diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index bd3e676daa4c7..8d6b0ef7e71ce 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1391,7 +1391,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { /// When encountering an equality constraint in a `where` clause, emit an error. If the code seems /// like it's setting an associated type, provide an appropriate suggestion. fn deny_equality_constraints( - this: &mut AstValidator<'_>, + this: &AstValidator<'_>, predicate: &WhereEqPredicate, generics: &Generics, ) { diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index fe4a45b38989a..fb595275e7b96 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -3203,7 +3203,7 @@ enum AnnotatedBorrowFnSignature<'tcx> { impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { /// Annotate the provided diagnostic with information about borrow from the fn signature that /// helps explain. - pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diagnostic) -> String { + pub(crate) fn emit(&self, cx: &MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diagnostic) -> String { match self { &AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => { diag.span_label( diff --git a/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs b/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs index c621df37106b2..8cebab4a36ca6 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs @@ -87,7 +87,7 @@ pub(super) fn populate_access_facts<'a, 'tcx>( body: &Body<'tcx>, location_table: &LocationTable, move_data: &MoveData<'tcx>, - dropped_at: &mut Vec<(Local, Location)>, + dropped_at: &Vec<(Local, Location)>, ) { debug!("populate_access_facts()"); diff --git a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs index 5702d39db32d6..adb806bc1e993 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs @@ -567,10 +567,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> { }); } - fn compute_drop_data( - typeck: &mut TypeChecker<'_, 'tcx>, - dropped_ty: Ty<'tcx>, - ) -> DropData<'tcx> { + fn compute_drop_data(typeck: &TypeChecker<'_, 'tcx>, dropped_ty: Ty<'tcx>) -> DropData<'tcx> { debug!("compute_drop_data(dropped_ty={:?})", dropped_ty,); match typeck diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 9e66eaf73b3ba..51c6200b52f15 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -29,7 +29,7 @@ pub struct AsmArgs { } fn parse_args<'a>( - ecx: &mut ExtCtxt<'a>, + ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream, is_global_asm: bool, @@ -295,7 +295,7 @@ pub fn parse_asm_args<'a>( /// /// This function must be called immediately after the option token is parsed. /// Otherwise, the suggestion will be incorrect. -fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) { +fn err_duplicate_option(p: &Parser<'_>, symbol: Symbol, span: Span) { // Tool-only output let full_span = if p.token.kind == token::Comma { span.to(p.token.span) } else { span }; p.sess.span_diagnostic.emit_err(errors::AsmOptAlreadyprovided { span, symbol, full_span }); @@ -307,7 +307,7 @@ fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) { /// This function must be called immediately after the option token is parsed. /// Otherwise, the error will not point to the correct spot. fn try_set_option<'a>( - p: &mut Parser<'a>, + p: &Parser<'a>, args: &mut AsmArgs, symbol: Symbol, option: ast::InlineAsmOptions, diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs index 9302db104b681..57e38e85751a7 100644 --- a/compiler/rustc_builtin_macros/src/assert.rs +++ b/compiler/rustc_builtin_macros/src/assert.rs @@ -111,7 +111,7 @@ fn expr_if_not( cx.expr_if(span, cx.expr(span, ExprKind::Unary(UnOp::Not, cond)), then, els) } -fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> { +fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> { let mut parser = cx.new_parser_from_tts(stream); if parser.token == token::Eof { diff --git a/compiler/rustc_builtin_macros/src/cfg.rs b/compiler/rustc_builtin_macros/src/cfg.rs index 31cac51845faa..9ab3b1731f43c 100644 --- a/compiler/rustc_builtin_macros/src/cfg.rs +++ b/compiler/rustc_builtin_macros/src/cfg.rs @@ -35,7 +35,7 @@ pub fn expand_cfg( } } -fn parse_cfg<'a>(cx: &mut ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> { +fn parse_cfg<'a>(cx: &ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> { let mut p = cx.new_parser_from_tts(tts); if p.token == token::Eof { diff --git a/compiler/rustc_builtin_macros/src/cfg_accessible.rs b/compiler/rustc_builtin_macros/src/cfg_accessible.rs index 37ac09ccdff4d..0a623f1ba9551 100644 --- a/compiler/rustc_builtin_macros/src/cfg_accessible.rs +++ b/compiler/rustc_builtin_macros/src/cfg_accessible.rs @@ -10,7 +10,7 @@ use rustc_span::Span; pub(crate) struct Expander; -fn validate_input<'a>(ecx: &mut ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> { +fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> { use errors::CfgAccessibleInvalid::*; match mi.meta_item_list() { None => {} diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs index 6a1586f071c45..be68595e0f53a 100644 --- a/compiler/rustc_builtin_macros/src/concat_bytes.rs +++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs @@ -8,7 +8,7 @@ use crate::errors; /// Emits errors for literal expressions that are invalid inside and outside of an array. fn invalid_type_err( - cx: &mut base::ExtCtxt<'_>, + cx: &base::ExtCtxt<'_>, token_lit: ast::token::Lit, span: Span, is_nested: bool, @@ -67,7 +67,7 @@ fn invalid_type_err( } fn handle_array_element( - cx: &mut base::ExtCtxt<'_>, + cx: &base::ExtCtxt<'_>, has_errors: &mut bool, missing_literals: &mut Vec, expr: &P, diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index b468abe3249af..55b9f1cbdef3c 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -94,7 +94,7 @@ pub fn expand_deriving_clone( fn cs_clone_simple( name: &str, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, is_union: bool, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs index c78a0eb04a074..aaec5fede20cc 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs @@ -51,7 +51,7 @@ pub fn expand_deriving_eq( } fn cs_total_eq_assert( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, ) -> BlockOrExpr { diff --git a/compiler/rustc_builtin_macros/src/deriving/debug.rs b/compiler/rustc_builtin_macros/src/deriving/debug.rs index 809f9838d20be..5b8ec6a01183b 100644 --- a/compiler/rustc_builtin_macros/src/deriving/debug.rs +++ b/compiler/rustc_builtin_macros/src/deriving/debug.rs @@ -46,7 +46,7 @@ pub fn expand_deriving_debug( trait_def.expand(cx, mitem, item, push) } -fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { +fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { // We want to make sure we have the ctxt set so that we can use unstable methods let span = cx.with_def_site_ctxt(span); @@ -210,7 +210,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_> /// } /// ``` fn show_fieldless_enum( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, def: &EnumDef, substr: &Substructure<'_>, diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs index 07b172bc757b2..352044339ef9b 100644 --- a/compiler/rustc_builtin_macros/src/deriving/default.rs +++ b/compiler/rustc_builtin_macros/src/deriving/default.rs @@ -52,7 +52,7 @@ pub fn expand_deriving_default( } fn default_struct_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, summary: &StaticFields, @@ -79,7 +79,7 @@ fn default_struct_substructure( } fn default_enum_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, enum_def: &EnumDef, ) -> BlockOrExpr { @@ -98,7 +98,7 @@ fn default_enum_substructure( } fn extract_default_variant<'a>( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, enum_def: &'a EnumDef, trait_span: Span, ) -> Result<&'a rustc_ast::Variant, ()> { @@ -169,7 +169,7 @@ fn extract_default_variant<'a>( } fn validate_default_attribute( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, default_variant: &rustc_ast::Variant, ) -> Result<(), ()> { let attrs: SmallVec<[_; 1]> = diff --git a/compiler/rustc_builtin_macros/src/deriving/encodable.rs b/compiler/rustc_builtin_macros/src/deriving/encodable.rs index 2dc20c324972b..9e13ea5e28c4a 100644 --- a/compiler/rustc_builtin_macros/src/deriving/encodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/encodable.rs @@ -147,7 +147,7 @@ pub fn expand_deriving_rustc_encodable( } fn encodable_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, krate: Symbol, diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 6597ee3cf1b6c..66316d0c43683 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -552,7 +552,7 @@ impl<'a> TraitDef<'a> { /// therefore does not get bound by the derived trait. fn create_derived_impl( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, type_ident: Ident, generics: &Generics, field_tys: Vec>, @@ -910,7 +910,7 @@ impl<'a> MethodDef<'a> { fn get_ret_ty( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, generics: &Generics, type_ident: Ident, @@ -931,7 +931,7 @@ impl<'a> MethodDef<'a> { // `&self`. fn extract_arg_details( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics, @@ -967,7 +967,7 @@ impl<'a> MethodDef<'a> { fn create_method( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics, @@ -1406,7 +1406,7 @@ impl<'a> MethodDef<'a> { // general helper methods. impl<'a> TraitDef<'a> { - fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields { + fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields { let mut named_idents = Vec::new(); let mut just_spans = Vec::new(); for field in struct_def.fields() { @@ -1433,7 +1433,7 @@ impl<'a> TraitDef<'a> { fn create_struct_patterns( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, struct_path: ast::Path, struct_def: &'a VariantData, prefixes: &[String], @@ -1526,7 +1526,7 @@ impl<'a> TraitDef<'a> { fn create_struct_pattern_fields( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, struct_def: &'a VariantData, prefixes: &[String], ) -> Vec { @@ -1543,7 +1543,7 @@ impl<'a> TraitDef<'a> { fn create_struct_field_access_fields( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, selflike_args: &[P], struct_def: &'a VariantData, is_packed: bool, diff --git a/compiler/rustc_builtin_macros/src/deriving/hash.rs b/compiler/rustc_builtin_macros/src/deriving/hash.rs index 101401f9c85b7..4315409ea96fc 100644 --- a/compiler/rustc_builtin_macros/src/deriving/hash.rs +++ b/compiler/rustc_builtin_macros/src/deriving/hash.rs @@ -46,11 +46,7 @@ pub fn expand_deriving_hash( hash_trait_def.expand(cx, mitem, item, push); } -fn hash_substructure( - cx: &mut ExtCtxt<'_>, - trait_span: Span, - substr: &Substructure<'_>, -) -> BlockOrExpr { +fn hash_substructure(cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>) -> BlockOrExpr { let [state_expr] = substr.nonselflike_args else { cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`"); }; diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs index d34336e7679c0..7da4f035afc2a 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -120,7 +120,7 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P { // does *not* add `where T: Structural` for parameters `T` in `...`. // (That's the main reason we cannot use TraitDef here.) fn inject_impl_of_structural_trait( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, item: &Annotatable, structural_path: generic::ty::Path, @@ -211,7 +211,7 @@ fn inject_impl_of_structural_trait( } fn assert_ty_bounds( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, stmts: &mut ThinVec, ty: P, span: Span, diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs index 1e1dadab48067..7e3cb5c8c74e7 100644 --- a/compiler/rustc_builtin_macros/src/edition_panic.rs +++ b/compiler/rustc_builtin_macros/src/edition_panic.rs @@ -40,7 +40,7 @@ pub fn expand_unreachable<'cx>( fn expand<'cx>( mac: rustc_span::Symbol, - cx: &'cx mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, sp: Span, tts: TokenStream, ) -> Box { diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index ede95dbf897e7..9d94edc8d4c85 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -62,7 +62,7 @@ struct MacroInput { /// ```text /// Ok((fmtstr, parsed arguments)) /// ``` -fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> { +fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> { let mut args = FormatArguments::new(); let mut p = ecx.new_parser_from_tts(tts); @@ -562,7 +562,7 @@ fn invalid_placeholder_type_error( } fn report_missing_placeholders( - ecx: &mut ExtCtxt<'_>, + ecx: &ExtCtxt<'_>, unused: Vec<(Span, bool)>, detect_foreign_fmt: bool, str_style: Option, @@ -674,7 +674,7 @@ fn report_missing_placeholders( /// there are named arguments or numbered positional arguments in the /// format string. fn report_invalid_references( - ecx: &mut ExtCtxt<'_>, + ecx: &ExtCtxt<'_>, invalid_refs: &[(usize, Option, PositionUsedAs, FormatArgPositionKind)], template: &[FormatArgsPiece], fmt_span: Span, diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 1580a6f6dd3ca..d584dd71ccf05 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -93,7 +93,7 @@ pub fn expand_bench( } pub fn expand_test_or_bench( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, attr_sp: Span, item: Annotatable, is_bench: bool, diff --git a/compiler/rustc_builtin_macros/src/type_ascribe.rs b/compiler/rustc_builtin_macros/src/type_ascribe.rs index 72b85af148638..0bf593e734474 100644 --- a/compiler/rustc_builtin_macros/src/type_ascribe.rs +++ b/compiler/rustc_builtin_macros/src/type_ascribe.rs @@ -23,7 +23,7 @@ pub fn expand_type_ascribe( return MacEager::expr(asc_expr); } -fn parse_ascribe<'a>(cx: &mut ExtCtxt<'a>, stream: TokenStream) -> PResult<'a, (P, P)> { +fn parse_ascribe<'a>(cx: &ExtCtxt<'a>, stream: TokenStream) -> PResult<'a, (P, P)> { let mut parser = cx.new_parser_from_tts(stream); let expr = parser.parse_expr()?; diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs index db5c1388ef846..8c5eadf4f0486 100644 --- a/compiler/rustc_codegen_llvm/src/allocator.rs +++ b/compiler/rustc_codegen_llvm/src/allocator.rs @@ -14,7 +14,7 @@ use crate::ModuleLlvm; pub(crate) unsafe fn codegen( tcx: TyCtxt<'_>, - module_llvm: &mut ModuleLlvm, + module_llvm: &ModuleLlvm, module_name: &str, kind: AllocatorKind, alloc_error_handler_kind: AllocatorKind, diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index b2d28cef89976..890778f8ef0f3 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -580,7 +580,7 @@ fn thin_lto( pub(crate) fn run_pass_manager( cgcx: &CodegenContext, diag_handler: &Handler, - module: &mut ModuleCodegen, + module: &ModuleCodegen, thin: bool, ) -> Result<(), FatalError> { let _timer = cgcx.prof.verbose_generic_activity_with_arg("LLVM_lto_optimize", &*module.name); diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index ebf04e7a399bc..8e02ea0c971e2 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -13,7 +13,7 @@ pub struct RPathConfig<'a> { pub linker_is_gnu: bool, } -pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec { +pub fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec { // No rpath on windows if !config.has_rpath { return Vec::new(); @@ -53,7 +53,7 @@ fn rpaths_to_flags(rpaths: Vec) -> Vec { ret } -fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec { +fn get_rpaths(config: &RPathConfig<'_>) -> Vec { debug!("output: {:?}", config.out_filename.display()); debug!("libs:"); for libpath in config.libs { @@ -74,11 +74,11 @@ fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec { minimize_rpaths(&rpaths) } -fn get_rpaths_relative_to_output(config: &mut RPathConfig<'_>) -> Vec { +fn get_rpaths_relative_to_output(config: &RPathConfig<'_>) -> Vec { config.libs.iter().map(|a| get_rpath_relative_to_output(config, a)).collect() } -fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsString { +fn get_rpath_relative_to_output(config: &RPathConfig<'_>, lib: &Path) -> OsString { // Mac doesn't appear to support $ORIGIN let prefix = if config.is_like_osx { "@loader_path" } else { "$ORIGIN" }; diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 4f26383ed05f0..0364c6f6f0889 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> { fn llbb_characteristics>( &self, - fx: &mut FunctionCx<'a, 'tcx, Bx>, + fx: &FunctionCx<'a, 'tcx, Bx>, target: mir::BasicBlock, ) -> (bool, bool) { if let Some(ref cleanup_kinds) = fx.cleanup_kinds { diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index f90d1a0fc9cda..a5968cf80653c 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -347,7 +347,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue { /// /// Supports sized types only. pub fn poison>( - bx: &mut Bx, + bx: &Bx, layout: TyAndLayout<'tcx>, ) -> OperandValue { assert!(layout.is_sized()); diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index e7c3906d977df..2fefc4feefcd1 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -399,7 +399,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { pub fn project_downcast>( &self, - bx: &mut Bx, + bx: &Bx, variant_index: VariantIdx, ) -> Self { let mut downcast = *self; @@ -409,7 +409,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { pub fn project_type>( &self, - bx: &mut Bx, + bx: &Bx, ty: Ty<'tcx>, ) -> Self { let mut downcast = *self; diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 34d16bf00cd67..969e3c9231677 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -937,7 +937,7 @@ pub fn parse_ast_fragment<'a>( } pub fn ensure_complete_parse<'a>( - parser: &mut Parser<'a>, + parser: &Parser<'a>, macro_path: &ast::Path, kind_name: &str, span: Span, diff --git a/compiler/rustc_infer/src/infer/fudge.rs b/compiler/rustc_infer/src/infer/fudge.rs index 86c2c2be4a805..68a8a5e82606f 100644 --- a/compiler/rustc_infer/src/infer/fudge.rs +++ b/compiler/rustc_infer/src/infer/fudge.rs @@ -12,7 +12,7 @@ use ut::UnifyKey; use std::ops::Range; fn vars_since_snapshot<'tcx, T>( - table: &mut UnificationTable<'_, 'tcx, T>, + table: &UnificationTable<'_, 'tcx, T>, snapshot_var_len: usize, ) -> Range where diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 47512d350e546..df644675856ea 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -861,7 +861,7 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionPredicate<'tcx> { /////////////////////////////////////////////////////////////////////////// // Error handling -pub fn expected_found<'tcx, R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound +pub fn expected_found<'tcx, R, T>(relation: &R, a: T, b: T) -> ExpectedFound where R: TypeRelation<'tcx>, { diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 383e80851f0d7..254c307e42665 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -209,7 +209,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { fn lower_pattern( &self, - cx: &mut MatchCheckCtxt<'p, 'tcx>, + cx: &MatchCheckCtxt<'p, 'tcx>, pattern: &Pat<'tcx>, ) -> &'p DeconstructedPat<'p, 'tcx> { cx.pattern_arena.alloc(DeconstructedPat::from_pat(cx, &pattern)) @@ -303,7 +303,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { fn check_let_reachability( &mut self, - cx: &mut MatchCheckCtxt<'p, 'tcx>, + cx: &MatchCheckCtxt<'p, 'tcx>, pat_id: HirId, source: LetSource, pat: &'p DeconstructedPat<'p, 'tcx>, @@ -616,7 +616,7 @@ fn irrefutable_let_patterns( } fn is_let_irrefutable<'p, 'tcx>( - cx: &mut MatchCheckCtxt<'p, 'tcx>, + cx: &MatchCheckCtxt<'p, 'tcx>, pat_id: HirId, pat: &'p DeconstructedPat<'p, 'tcx>, ) -> bool { diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index d1f2f0c76c839..a41f464d1dc7a 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -282,7 +282,7 @@ impl<'a> MakeBcbCounters<'a> { fn make_branch_counters( &mut self, - traversal: &mut TraverseCoverageGraphWithLoops, + traversal: &TraverseCoverageGraphWithLoops, branching_bcb: BasicCoverageBlock, branching_counter_operand: Operand, ) -> Result<(), Error> { diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index e08b6d6f6e8d8..c09391f55ab4d 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -538,7 +538,7 @@ fn fn_sig_and_body( fn get_body_span<'tcx>( tcx: TyCtxt<'tcx>, hir_body: &rustc_hir::Body<'tcx>, - mir_body: &mut mir::Body<'tcx>, + mir_body: &mir::Body<'tcx>, ) -> Span { let mut body_span = hir_body.value.span; let def_id = mir_body.source.def_id(); diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index 797a1a86846f6..788542e1bc45a 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -1108,7 +1108,7 @@ fn create_generator_drop_shim<'tcx>( tcx: TyCtxt<'tcx>, transform: &TransformVisitor<'tcx>, gen_ty: Ty<'tcx>, - body: &mut Body<'tcx>, + body: &Body<'tcx>, drop_clean: BasicBlock, ) -> Body<'tcx> { let mut body = body.clone(); diff --git a/compiler/rustc_mir_transform/src/nrvo.rs b/compiler/rustc_mir_transform/src/nrvo.rs index e1298b0654f2c..81ff0545d81d6 100644 --- a/compiler/rustc_mir_transform/src/nrvo.rs +++ b/compiler/rustc_mir_transform/src/nrvo.rs @@ -84,7 +84,7 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace { /// /// If the MIR fulfills both these conditions, this function returns the `Local` that is assigned /// to the return place along all possible paths through the control-flow graph. -fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option { +fn local_eligible_for_nrvo(body: &mir::Body<'_>) -> Option { if IsReturnPlaceRead::run(body) { return None; } @@ -118,10 +118,7 @@ fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option { copied_to_return_place } -fn find_local_assigned_to_return_place( - start: BasicBlock, - body: &mut mir::Body<'_>, -) -> Option { +fn find_local_assigned_to_return_place(start: BasicBlock, body: &mir::Body<'_>) -> Option { let mut block = start; let mut seen = HybridBitSet::new_empty(body.basic_blocks.len()); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 28ae88424ab10..e7c70f378d077 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2106,7 +2106,7 @@ fn check_thread_count(handler: &EarlyErrorHandler, unstable_opts: &UnstableOptio fn collect_print_requests( handler: &EarlyErrorHandler, cg: &mut CodegenOptions, - unstable_opts: &mut UnstableOptions, + unstable_opts: &UnstableOptions, matches: &getopts::Matches, ) -> Vec { let mut prints = Vec::::new(); diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs index b4c7b0f120f91..79e65767d911c 100644 --- a/compiler/rustc_target/src/abi/call/aarch64.rs +++ b/compiler/rustc_target/src/abi/call/aarch64.rs @@ -12,7 +12,7 @@ pub enum AbiKind { Win64, } -fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option +fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &ArgAbi<'a, Ty>) -> Option where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/arm.rs b/compiler/rustc_target/src/abi/call/arm.rs index 1923ea58838ba..75d49980c46b0 100644 --- a/compiler/rustc_target/src/abi/call/arm.rs +++ b/compiler/rustc_target/src/abi/call/arm.rs @@ -2,7 +2,7 @@ use crate::abi::call::{ArgAbi, Conv, FnAbi, Reg, RegKind, Uniform}; use crate::abi::{HasDataLayout, TyAbiInterface}; use crate::spec::HasTargetSpec; -fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option +fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &ArgAbi<'a, Ty>) -> Option where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs index 359bb8fc09a87..1a2346260494a 100644 --- a/compiler/rustc_target/src/abi/call/powerpc64.rs +++ b/compiler/rustc_target/src/abi/call/powerpc64.rs @@ -13,11 +13,7 @@ enum ABI { } use ABI::*; -fn is_homogeneous_aggregate<'a, Ty, C>( - cx: &C, - arg: &mut ArgAbi<'a, Ty>, - abi: ABI, -) -> Option +fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &ArgAbi<'a, Ty>, abi: ABI) -> Option where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 5746781ae35d7..6af6e741ca4e0 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -137,7 +137,7 @@ pub fn overlapping_impls( } fn with_fresh_ty_vars<'cx, 'tcx>( - selcx: &mut SelectionContext<'cx, 'tcx>, + selcx: &SelectionContext<'cx, 'tcx>, param_env: ty::ParamEnv<'tcx>, impl_def_id: DefId, ) -> ty::ImplHeader<'tcx> { diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 06a1027e5dfdb..23df36504a0ab 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1290,7 +1290,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>( /// because it contains `[type error]`. Yuck! (See issue #29857 for /// one case where this arose.) fn normalize_to_error<'a, 'tcx>( - selcx: &mut SelectionContext<'a, 'tcx>, + selcx: &SelectionContext<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, projection_ty: ty::AliasTy<'tcx>, cause: ObligationCause<'tcx>, diff --git a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs index e9a592bdee799..ac7683fa86dd7 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs @@ -209,7 +209,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children { } } -fn iter_children(children: &mut Children) -> impl Iterator + '_ { +fn iter_children(children: &Children) -> impl Iterator + '_ { let nonblanket = children.non_blanket_impls.iter().flat_map(|(_, v)| v.iter()); children.blanket_impls.iter().chain(nonblanket).cloned() } diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index a76272e9d092d..d066cc464eda7 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -202,7 +202,7 @@ impl Iterator for SupertraitDefIds<'_> { /// returning the resulting subject and all obligations that arise. /// The obligations are closed under normalization. pub fn impl_subject_and_oblig<'a, 'tcx>( - selcx: &mut SelectionContext<'a, 'tcx>, + selcx: &SelectionContext<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, impl_def_id: DefId, impl_args: GenericArgsRef<'tcx>,