diff --git a/Cargo.lock b/Cargo.lock index f2513185..ccce5c0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,25 +226,15 @@ dependencies = [ "winapi", ] -[[package]] -name = "clippy_config" -version = "0.1.83" -source = "git+https://github.com/rust-lang/rust-clippy?rev=7d7b298#7d7b298a4e26ee9998bc7756f740d65557ec67e2" -dependencies = [ - "itertools 0.12.1", - "serde", - "toml", -] - [[package]] name = "clippy_utils" -version = "0.1.83" -source = "git+https://github.com/rust-lang/rust-clippy?rev=7d7b298#7d7b298a4e26ee9998bc7756f740d65557ec67e2" +version = "0.1.85" +source = "git+https://github.com/rust-lang/rust-clippy?rev=af1f78a#af1f78af05af5ff7dd2d8b31386f96ce9bfc7a8a" dependencies = [ "arrayvec", - "clippy_config", "itertools 0.12.1", "rustc_apfloat", + "serde", ] [[package]] @@ -1946,15 +1936,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2279,26 +2260,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] [[package]] name = "toml_edit" @@ -2307,8 +2273,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.2.5", - "serde", - "serde_spanned", "toml_datetime", "winnow", ] diff --git a/crates/dash_compiler/src/builder.rs b/crates/dash_compiler/src/builder.rs index d23d1222..8da9f911 100755 --- a/crates/dash_compiler/src/builder.rs +++ b/crates/dash_compiler/src/builder.rs @@ -119,14 +119,14 @@ impl<'cx, 'interner> InstructionBuilder<'cx, 'interner> { } } -impl<'cx, 'interner> Deref for InstructionBuilder<'cx, 'interner> { +impl<'interner> Deref for InstructionBuilder<'_, 'interner> { type Target = FunctionCompiler<'interner>; fn deref(&self) -> &Self::Target { self.inner } } -impl<'cx, 'interner> DerefMut for InstructionBuilder<'cx, 'interner> { +impl DerefMut for InstructionBuilder<'_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { self.inner } diff --git a/crates/dash_compiler/src/instruction.rs b/crates/dash_compiler/src/instruction.rs index 3569c886..b1cec565 100755 --- a/crates/dash_compiler/src/instruction.rs +++ b/crates/dash_compiler/src/instruction.rs @@ -24,7 +24,7 @@ macro_rules! simple_instruction { } } -impl<'cx, 'interner> InstructionBuilder<'cx, 'interner> { +impl InstructionBuilder<'_, '_> { pub fn build_jmp_header(&mut self, label: Label, is_local_label: bool) { self.write_all(&[0, 0]); match is_local_label { diff --git a/crates/dash_compiler/src/lib.rs b/crates/dash_compiler/src/lib.rs index c55275a2..ebd45a99 100644 --- a/crates/dash_compiler/src/lib.rs +++ b/crates/dash_compiler/src/lib.rs @@ -321,11 +321,11 @@ impl<'interner> FunctionCompiler<'interner> { let enclosing_function = self.scopes.enclosing_function_of(scope); if let Some(slot) = self.scopes[scope].find_local(ident) { - return Some(( + Some(( slot, self.scopes[enclosing_function].expect_function().locals[slot as usize].clone(), enclosing_function, - )); + )) } else { let parent = self.scopes[scope].parent?; let parent_enclosing_function = self.scopes.enclosing_function_of(parent); @@ -368,7 +368,7 @@ impl<'interner> FunctionCompiler<'interner> { } } -impl<'interner> Visitor> for FunctionCompiler<'interner> { +impl Visitor> for FunctionCompiler<'_> { fn accept(&mut self, Statement { kind, span }: Statement) -> Result<(), Error> { match kind { StatementKind::Expression(e) => self.visit_expression_statement(e), diff --git a/crates/dash_llvm_jit_backend/src/llvm_wrapper/context.rs b/crates/dash_llvm_jit_backend/src/llvm_wrapper/context.rs index 3bc1eca0..e6000138 100644 --- a/crates/dash_llvm_jit_backend/src/llvm_wrapper/context.rs +++ b/crates/dash_llvm_jit_backend/src/llvm_wrapper/context.rs @@ -41,7 +41,7 @@ impl Context { } pub fn create_module(&mut self) -> Module { - self.create_module_with_name(CStr::from_bytes_with_nul(b"anon\0").unwrap()) + self.create_module_with_name(c"anon") } pub fn i1_ty(&self) -> Ty { diff --git a/crates/dash_llvm_jit_backend/src/llvm_wrapper/module.rs b/crates/dash_llvm_jit_backend/src/llvm_wrapper/module.rs index 94f14fb1..9d2ad49a 100644 --- a/crates/dash_llvm_jit_backend/src/llvm_wrapper/module.rs +++ b/crates/dash_llvm_jit_backend/src/llvm_wrapper/module.rs @@ -33,7 +33,7 @@ impl Module { } pub fn create_c_function(&self, ty: &Ty) -> Function { - self.create_c_function_with_name(CStr::from_bytes_with_nul(b"anon\0").unwrap(), ty) + self.create_c_function_with_name(c"anon", ty) } pub fn run_pass_manager(&self, pm: &PassManager) { diff --git a/crates/dash_middle/src/lexer/token.rs b/crates/dash_middle/src/lexer/token.rs index 72fc28df..5aa58593 100644 --- a/crates/dash_middle/src/lexer/token.rs +++ b/crates/dash_middle/src/lexer/token.rs @@ -474,7 +474,7 @@ impl TokenType { pub fn fmt_for_expected_tys(&self) -> impl fmt::Display + '_ { struct DisplayExpectedTys<'a>(&'a TokenType); - impl<'a> fmt::Display for DisplayExpectedTys<'a> { + impl fmt::Display for DisplayExpectedTys<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self.0 { TokenType::DUMMY_IDENTIFIER => write!(f, ""), diff --git a/crates/dash_middle/src/parser/error.rs b/crates/dash_middle/src/parser/error.rs index 8c9e5240..b858ab00 100644 --- a/crates/dash_middle/src/parser/error.rs +++ b/crates/dash_middle/src/parser/error.rs @@ -146,7 +146,7 @@ impl<'f, 'a, 'buf> DiagnosticBuilder<'f, 'a, 'buf> { } } -impl<'f, 'a, 'buf> fmt::Display for DiagnosticBuilder<'f, 'a, 'buf> { +impl fmt::Display for DiagnosticBuilder<'_, '_, '_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { macro_rules! write_style { ($sink:expr, $($style:ident) *, $s:expr) => { @@ -256,7 +256,7 @@ fn line_data(source: &str, span: Span) -> LineData<'_> { } } -impl<'a, 'buf> fmt::Display for FormattableError<'a, 'buf> { +impl fmt::Display for FormattableError<'_, '_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut diag = DiagnosticBuilder::error(self); match *self.error { @@ -422,7 +422,7 @@ pub struct FormattableErrors<'a, 'buf> { colors: bool, } -impl<'a, 'buf> fmt::Display for FormattableErrors<'a, 'buf> { +impl fmt::Display for FormattableErrors<'_, '_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for error in self.errors { FormattableError { diff --git a/crates/dash_parser/src/expr.rs b/crates/dash_parser/src/expr.rs index 5a0059e8..e988502f 100644 --- a/crates/dash_parser/src/expr.rs +++ b/crates/dash_parser/src/expr.rs @@ -12,7 +12,7 @@ use dash_regex::Flags; use crate::{any, Parser}; -impl<'a, 'interner> Parser<'a, 'interner> { +impl Parser<'_, '_> { pub fn parse_expression(&mut self) -> Option { self.parse_sequence() } diff --git a/crates/dash_parser/src/stmt.rs b/crates/dash_parser/src/stmt.rs index 7f4c189f..393a68e2 100644 --- a/crates/dash_parser/src/stmt.rs +++ b/crates/dash_parser/src/stmt.rs @@ -16,7 +16,7 @@ use crate::{any, Parser}; type ParameterList = Option, Option)>>; -impl<'a, 'interner> Parser<'a, 'interner> { +impl Parser<'_, '_> { pub fn parse_statement(&mut self) -> Option { self.error_sync = false; let lo_span = self.current()?.span; diff --git a/crates/dash_parser/src/types.rs b/crates/dash_parser/src/types.rs index e3a75a4f..8670d86b 100644 --- a/crates/dash_parser/src/types.rs +++ b/crates/dash_parser/src/types.rs @@ -4,7 +4,7 @@ use dash_middle::parser::types::{LiteralType, TypeSegment}; use crate::Parser; -impl<'a, 'interner> Parser<'a, 'interner> { +impl Parser<'_, '_> { pub fn parse_type_segment(&mut self) -> Option { self.parse_union_type() } diff --git a/crates/dash_typed_cfg/src/passes/bb_generation.rs b/crates/dash_typed_cfg/src/passes/bb_generation.rs index fb639f10..72237254 100644 --- a/crates/dash_typed_cfg/src/passes/bb_generation.rs +++ b/crates/dash_typed_cfg/src/passes/bb_generation.rs @@ -106,7 +106,7 @@ pub struct BBGenerationCtxt<'a, 'q, Q> { pub query: &'q mut Q, } -impl<'a, 'q, Q: BBGenerationQuery> BBGenerationCtxt<'a, 'q, Q> { +impl BBGenerationCtxt<'_, '_, Q> { pub fn find_bbs(&mut self) { self.bbs.insert( 0, diff --git a/crates/dash_typed_cfg/src/passes/type_infer.rs b/crates/dash_typed_cfg/src/passes/type_infer.rs index d7401c54..5bd24783 100644 --- a/crates/dash_typed_cfg/src/passes/type_infer.rs +++ b/crates/dash_typed_cfg/src/passes/type_infer.rs @@ -52,7 +52,7 @@ pub struct TypeInferCtxt<'a, 'q, Q> { pub visited: HashSet, } -impl<'a, 'q, Q: TypeInferQuery> TypeInferCtxt<'a, 'q, Q> { +impl TypeInferCtxt<'_, '_, Q> { fn get_or_insert_local_ty(&mut self, index: u16) -> Type { match self.local_tys.get(&index) { Some(ty) => ty.clone(), diff --git a/crates/dash_vm/src/dispatch.rs b/crates/dash_vm/src/dispatch.rs index e96da2e8..3663caec 100755 --- a/crates/dash_vm/src/dispatch.rs +++ b/crates/dash_vm/src/dispatch.rs @@ -164,7 +164,7 @@ impl<'vm> Deref for DispatchContext<'vm> { } } -impl<'vm> DerefMut for DispatchContext<'vm> { +impl DerefMut for DispatchContext<'_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.scope } diff --git a/crates/dash_vm/src/localscope.rs b/crates/dash_vm/src/localscope.rs index daa7ed21..80b1893e 100755 --- a/crates/dash_vm/src/localscope.rs +++ b/crates/dash_vm/src/localscope.rs @@ -142,7 +142,7 @@ pub struct LocalScope<'vm> { _p: PhantomData<&'vm mut Vm>, } -impl<'vm> LocalScope<'vm> { +impl LocalScope<'_> { fn scope_data_mut(&mut self) -> &mut ScopeData { unsafe { self.scope_data.as_mut() } } @@ -235,7 +235,7 @@ impl<'vm> LocalScope<'vm> { // TODO: remove this Deref impl // It's too prone to bugs due to similar methods -impl<'a> Deref for LocalScope<'a> { +impl Deref for LocalScope<'_> { type Target = Vm; fn deref(&self) -> &Self::Target { @@ -243,13 +243,13 @@ impl<'a> Deref for LocalScope<'a> { } } -impl<'a> DerefMut for LocalScope<'a> { +impl DerefMut for LocalScope<'_> { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut *self.vm } } } -impl<'vm> Drop for LocalScope<'vm> { +impl Drop for LocalScope<'_> { fn drop(&mut self) { let head = self.scopes.head; let data = self.scope_data_mut(); diff --git a/crates/dash_vm/src/util.rs b/crates/dash_vm/src/util.rs index 5676ebb5..9f3e2d60 100644 --- a/crates/dash_vm/src/util.rs +++ b/crates/dash_vm/src/util.rs @@ -1,6 +1,6 @@ use std::num::FpCategory; -use dash_middle::interner::{sym, Symbol}; +use dash_middle::interner::{Symbol, sym}; use crate::localscope::LocalScope; @@ -16,13 +16,6 @@ pub fn unlikely(b: bool) -> bool { b } -/// https://doc.rust-lang.org/beta/nightly-rustc/rustc_data_structures/captures/trait.Captures.html -/// and -/// https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999 -pub trait Captures<'a> {} - -impl<'a, T: ?Sized> Captures<'a> for T {} - pub fn intern_f64(sc: &mut LocalScope, n: f64) -> Symbol { if n.trunc() == n && n >= 0.0 && n <= usize::MAX as f64 { // Happy path: no fractional part and fits in a usize diff --git a/lints/Cargo.toml b/lints/Cargo.toml index 947e9f06..437a27d8 100644 --- a/lints/Cargo.toml +++ b/lints/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7d7b298" } +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "af1f78a" } [dev-dependencies] prettydiff = "0.7.0" diff --git a/lints/src/missing_root.rs b/lints/src/missing_root.rs index f17c6586..2e24e81b 100644 --- a/lints/src/missing_root.rs +++ b/lints/src/missing_root.rs @@ -7,8 +7,8 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::FnKind; use rustc_hir::{self as hir}; -use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; +use rustc_index::bit_set::BitSet; use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits::{Obligation, ObligationCause}; use rustc_lint::{LateContext, LateLintPass}; @@ -18,8 +18,8 @@ use rustc_middle::mir::{self, BasicBlock, Body, Local}; use rustc_middle::ty::{ParamEnv, Ty, TyCtxt}; use rustc_middle::{bug, ty}; use rustc_session::{declare_lint, impl_lint_pass}; -use rustc_span::source_map::Spanned; use rustc_span::Span; +use rustc_span::source_map::Spanned; use rustc_target::abi::VariantIdx; use rustc_trait_selection::traits::ObligationCtxt; @@ -181,7 +181,7 @@ struct PlaceVisitor<'a, 'b, 'tcx> { state: &'a mut TraverseState, } -impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PlaceVisitor<'a, '_, 'tcx> { +impl<'tcx> mir::visit::Visitor<'tcx> for PlaceVisitor<'_, '_, 'tcx> { fn visit_place(&mut self, place: &mir::Place<'tcx>, context: mir::visit::PlaceContext, location: mir::Location) { let base_ty = self.mir.local_decls[place.local].ty; @@ -347,13 +347,10 @@ fn traverse<'tcx>( match terminator.edges() { mir::TerminatorEdges::None => state, mir::TerminatorEdges::Single(bb) => traverse(cx, mir, state, bb), - mir::TerminatorEdges::Double(bb1, bb2) => TraverseState::join( - state.clone(), - [ - traverse(cx, mir, state.clone(), bb1), - traverse(cx, mir, state.clone(), bb2), - ], - ), + mir::TerminatorEdges::Double(bb1, bb2) => TraverseState::join(state.clone(), [ + traverse(cx, mir, state.clone(), bb1), + traverse(cx, mir, state.clone(), bb2), + ]), mir::TerminatorEdges::AssignOnReturn { return_, cleanup, @@ -394,7 +391,7 @@ impl LateLintPass<'_> for MissingRoot { let mir = cx.tcx.optimized_mir(def_id); let locals = IndexVec::::from_elem_n(LocalState::LiveBeforeBorrow, mir.local_decls.len()); - let infcx = cx.tcx.infer_ctxt().build(); + let infcx = cx.tcx.infer_ctxt().build(cx.typing_mode()); let ocx = ObligationCtxt::new(&infcx); traverse( &mut TraverseCtxt { diff --git a/rust-toolchain b/rust-toolchain index f931b0e7..3f42abf4 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-09-05" +channel = "nightly-2024-11-28" components = ["clippy", "rust-src", "rustc-dev", "llvm-tools-preview"]