From bf476417265d23e9a3371cb0901039b3b1335312 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 10:50:09 +0300 Subject: [PATCH 01/14] compiler: fix unused_peekable clippy lint warning: `peek` never called on `Peekable` iterator --> compiler\rustc_session\src\utils.rs:130:13 | 130 | let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()).peekable(); | ^^^^ | = help: consider removing the call to `peekable` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable warning: `peek` never called on `Peekable` iterator --> compiler\rustc_trait_selection\src\traits\error_reporting\suggestions.rs:4934:17 | 4934 | let mut bounds = pred.bounds.iter().peekable(); | ^^^^^^ | = help: consider removing the call to `peekable` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable --- compiler/rustc_session/src/utils.rs | 2 +- .../src/traits/error_reporting/suggestions.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/utils.rs b/compiler/rustc_session/src/utils.rs index 50ebbdccf6722..58de5cb31a513 100644 --- a/compiler/rustc_session/src/utils.rs +++ b/compiler/rustc_session/src/utils.rs @@ -127,7 +127,7 @@ pub fn extra_compiler_flags() -> Option<(Vec, bool)> { const ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE: &[&str] = &["incremental"]; - let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()).peekable(); + let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()); let mut result = Vec::new(); let mut excluded_cargo_defaults = false; diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 28f4f81e7d869..fe2691e9d4db9 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -4931,7 +4931,7 @@ fn point_at_assoc_type_restriction( let hir::WherePredicate::BoundPredicate(pred) = pred else { continue; }; - let mut bounds = pred.bounds.iter().peekable(); + let mut bounds = pred.bounds.iter(); while let Some(bound) = bounds.next() { let Some(trait_ref) = bound.trait_ref() else { continue; From b6cfe71f3891db6b7883fc31a8acc37c4f13c8ec Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 11:03:48 +0300 Subject: [PATCH 02/14] compiler: fix some clippy needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_session\src\config.rs:2111:20 | 2111 | unstable_opts: &mut UnstableOptions, | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&UnstableOptions` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_session/src/config.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index f612e8b5b1a55..ff8165c4f7b7b 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2108,7 +2108,7 @@ fn should_override_cgus_and_disable_thinlto( fn collect_print_requests( early_dcx: &EarlyDiagCtxt, cg: &mut CodegenOptions, - unstable_opts: &mut UnstableOptions, + unstable_opts: &UnstableOptions, matches: &getopts::Matches, ) -> Vec { let mut prints = Vec::::new(); @@ -2732,6 +2732,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M } if let Ok(graphviz_font) = std::env::var("RUSTC_GRAPHVIZ_FONT") { + // FIXME: this is only mutation of UnstableOptions here, move into + // UnstableOptions::build? unstable_opts.graphviz_font = graphviz_font; } @@ -2781,7 +2783,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M )); } - let prints = collect_print_requests(early_dcx, &mut cg, &mut unstable_opts, matches); + let prints = collect_print_requests(early_dcx, &mut cg, &unstable_opts, matches); let cg = cg; From aa355303195d9d6fecb016afb0d52f4cd7a52d09 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 11:30:49 +0300 Subject: [PATCH 03/14] compiler: fix few needless_pass_by_ref_mut clippy lints warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_session\src\config.rs:2013:16 | 2013 | early_dcx: &mut EarlyDiagCtxt, | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&EarlyDiagCtxt` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_ast_passes\src\ast_validation.rs:1555:11 | 1555 | this: &mut AstValidator<'_>, | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&AstValidator<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_infer\src\infer\snapshot\fudge.rs:16:12 | 16 | table: &mut UnificationTable<'_, 'tcx, T>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&UnificationTable<'_, 'tcx, T>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_expand\src\expand.rs:961:13 | 961 | parser: &mut Parser<'a>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'a>` | = warning: changing this function will impact semver compatibility = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_ast_passes/src/ast_validation.rs | 2 +- compiler/rustc_expand/src/expand.rs | 4 ++-- compiler/rustc_infer/src/infer/snapshot/fudge.rs | 6 +++--- compiler/rustc_session/src/config.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 3edb832b9a09b..80c62d3fecf49 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1552,7 +1552,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_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index cac1e8f80e323..6029caa965c0b 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -871,7 +871,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let mut parser = self.cx.new_parser_from_tts(toks); match parse_ast_fragment(&mut parser, kind) { Ok(fragment) => { - ensure_complete_parse(&mut parser, path, kind.name(), span); + ensure_complete_parse(&parser, path, kind.name(), span); fragment } Err(mut err) => { @@ -958,7 +958,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/snapshot/fudge.rs b/compiler/rustc_infer/src/infer/snapshot/fudge.rs index 14de461cd17eb..f8f1c1b4c45c1 100644 --- a/compiler/rustc_infer/src/infer/snapshot/fudge.rs +++ b/compiler/rustc_infer/src/infer/snapshot/fudge.rs @@ -13,7 +13,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 @@ -124,11 +124,11 @@ impl<'tcx> InferCtxt<'tcx> { let type_vars = inner.type_variables().vars_since_snapshot(variable_lengths.type_var_len); let int_vars = vars_since_snapshot( - &mut inner.int_unification_table(), + &inner.int_unification_table(), variable_lengths.int_var_len, ); let float_vars = vars_since_snapshot( - &mut inner.float_unification_table(), + &inner.float_unification_table(), variable_lengths.float_var_len, ); let region_vars = inner diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index ff8165c4f7b7b..4bf0e51905ffd 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2010,7 +2010,7 @@ pub fn parse_crate_edition(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches } fn check_error_format_stability( - early_dcx: &mut EarlyDiagCtxt, + early_dcx: &EarlyDiagCtxt, unstable_opts: &UnstableOptions, error_format: ErrorOutputType, ) { @@ -2574,7 +2574,7 @@ fn parse_remap_path_prefix( } fn parse_logical_env( - early_dcx: &mut EarlyDiagCtxt, + early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, ) -> FxIndexMap { let mut vars = FxIndexMap::default(); From 316bc1c67cf72700a5e3c411fc044278eb1ef9ef Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 12:04:00 +0300 Subject: [PATCH 04/14] compiler: fix few needless_pass_by_ref_mut clippy lints warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:306:28 | 306 | fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) { | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:318:8 | 318 | p: &mut Parser<'a>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\assert.rs:114:25 | 114 | fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:32:10 | 32 | ecx: &mut ExtCtxt<'a>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\test.rs:99:9 | 99 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\source_util.rs:237:9 | 237 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:809:10 | 809 | ecx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:737:10 | 737 | ecx: &mut ExtCtxt<'a>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:68:24 | 68 | fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:607:10 | 607 | ecx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\edition_panic.rs:43:9 | 43 | cx: &'cx mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\concat_bytes.rs:11:9 | 11 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\cfg.rs:38:22 | 38 | fn parse_cfg<'a>(cx: &mut ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\cfg_accessible.rs:13:28 | 13 | fn validate_input<'a>(ecx: &mut ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_builtin_macros/src/asm.rs | 6 +++--- compiler/rustc_builtin_macros/src/assert.rs | 2 +- compiler/rustc_builtin_macros/src/cfg.rs | 2 +- compiler/rustc_builtin_macros/src/cfg_accessible.rs | 2 +- compiler/rustc_builtin_macros/src/concat_bytes.rs | 4 ++-- compiler/rustc_builtin_macros/src/edition_panic.rs | 2 +- compiler/rustc_builtin_macros/src/format.rs | 8 ++++---- compiler/rustc_builtin_macros/src/source_util.rs | 2 +- compiler/rustc_builtin_macros/src/test.rs | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 76805617c933b..137ac44157924 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, @@ -303,7 +303,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.psess.dcx.emit_err(errors::AsmOptAlreadyprovided { span, symbol, full_span }); @@ -315,7 +315,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 5905bdd710849..d200179f3a0ae 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 9197b9ebdf9fc..5dc9bbacd0629 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 1933b2e1fb7fe..98c0ca3a526b8 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 a2f827c5567d8..45fec2945788b 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 ExtCtxt<'_>, + cx: &ExtCtxt<'_>, token_lit: token::Lit, span: Span, is_nested: bool, @@ -65,7 +65,7 @@ fn invalid_type_err( /// Otherwise, returns `None`, and either pushes the `expr`'s span to `missing_literals` or /// updates `guar` accordingly. fn handle_array_element( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, guar: &mut Option, missing_literals: &mut Vec, expr: &P, diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs index fa22e91164232..bb3c83e8c0e3f 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: &'cx ExtCtxt<'_>, sp: Span, tts: TokenStream, ) -> MacroExpanderResult<'cx> { diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 6f031f270cae5..51d6058a744fc 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -65,7 +65,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); @@ -604,7 +604,7 @@ fn invalid_placeholder_type_error( } fn report_missing_placeholders( - ecx: &mut ExtCtxt<'_>, + ecx: &ExtCtxt<'_>, unused: Vec<(Span, bool)>, used: &[bool], args: &FormatArguments, @@ -734,7 +734,7 @@ fn report_missing_placeholders( /// This function detects and reports unused format!() arguments that are /// redundant due to implicit captures (e.g. `format!("{x}", x)`). fn report_redundant_format_arguments<'a>( - ecx: &mut ExtCtxt<'a>, + ecx: &ExtCtxt<'a>, args: &FormatArguments, used: &[bool], placeholders: Vec<(Span, &str)>, @@ -806,7 +806,7 @@ fn report_redundant_format_arguments<'a>( /// 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/source_util.rs b/compiler/rustc_builtin_macros/src/source_util.rs index abcdfabcaedae..61a6361ae8dcf 100644 --- a/compiler/rustc_builtin_macros/src/source_util.rs +++ b/compiler/rustc_builtin_macros/src/source_util.rs @@ -234,7 +234,7 @@ pub fn expand_include_bytes( } fn load_binary_file( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, original_path: &Path, macro_span: Span, path_span: Span, diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 81ac78dd58fa6..c7568f1461c10 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -96,7 +96,7 @@ pub fn expand_bench( } pub fn expand_test_or_bench( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, attr_sp: Span, item: Annotatable, is_bench: bool, From ecb39926d86871ccec1e83d748452671a7202c38 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 12:16:08 +0300 Subject: [PATCH 05/14] compiler: fix few needless_pass_by_ref_mut clippy lints warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\mod.rs:120:9 | 120 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1573:13 | 1573 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1556:13 | 1556 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1463:13 | 1463 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1433:36 | 1433 | fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:953:13 | 953 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:932:13 | 932 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:580:13 | 580 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:989:13 | 989 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\clone.rs:97:9 | 97 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\cmp\eq.rs:52:9 | 52 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\hash.rs:50:9 | 50 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\encodable.rs:150:9 | 150 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\default.rs:176:9 | 176 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\default.rs:106:9 | 106 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\default.rs:57:9 | 57 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\default.rs:84:9 | 84 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\debug.rs:212:9 | 212 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\debug.rs:48:26 | 48 | fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- .../rustc_builtin_macros/src/deriving/clone.rs | 2 +- .../rustc_builtin_macros/src/deriving/cmp/eq.rs | 2 +- .../rustc_builtin_macros/src/deriving/debug.rs | 4 ++-- .../rustc_builtin_macros/src/deriving/default.rs | 8 ++++---- .../src/deriving/encodable.rs | 2 +- .../src/deriving/generic/mod.rs | 16 ++++++++-------- .../rustc_builtin_macros/src/deriving/hash.rs | 6 +----- .../rustc_builtin_macros/src/deriving/mod.rs | 2 +- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index 267405ac32e24..7205d14404e81 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 ce3fa1ab32c6a..d20e715d793f9 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs @@ -49,7 +49,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 03acd7f489f29..bfab4ec48c264 100644 --- a/compiler/rustc_builtin_macros/src/deriving/debug.rs +++ b/compiler/rustc_builtin_macros/src/deriving/debug.rs @@ -45,7 +45,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); @@ -209,7 +209,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 292a916e2a78b..c565ef2fcd089 100644 --- a/compiler/rustc_builtin_macros/src/deriving/default.rs +++ b/compiler/rustc_builtin_macros/src/deriving/default.rs @@ -54,7 +54,7 @@ pub fn expand_deriving_default( } fn default_struct_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, summary: &StaticFields, @@ -81,7 +81,7 @@ fn default_struct_substructure( } fn default_enum_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, enum_def: &EnumDef, ) -> BlockOrExpr { @@ -103,7 +103,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, ErrorGuaranteed> { @@ -173,7 +173,7 @@ fn extract_default_variant<'a>( } fn validate_default_attribute( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, default_variant: &rustc_ast::Variant, ) -> Result<(), ErrorGuaranteed> { 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 d939f8c7aeb1d..3286099b14c3d 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 afa73b672da13..18c0e3f4bee87 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -577,7 +577,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>, @@ -929,7 +929,7 @@ impl<'a> MethodDef<'a> { fn get_ret_ty( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, generics: &Generics, type_ident: Ident, @@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> { // `&self`. fn extract_arg_details( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics, @@ -986,7 +986,7 @@ impl<'a> MethodDef<'a> { fn create_method( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, type_ident: Ident, generics: &Generics, @@ -1430,7 +1430,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() { @@ -1460,7 +1460,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], @@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> { fn create_struct_pattern_fields( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, struct_def: &'a VariantData, prefixes: &[String], ) -> Vec { @@ -1570,7 +1570,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 dd6149cf61496..4af6fe395f716 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.dcx().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 8a3375cba9dc1..7d25493571c12 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -117,7 +117,7 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P { } fn assert_ty_bounds( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, stmts: &mut ThinVec, ty: P, span: Span, From 615bb53a8da597afb72a78b616cf0c747e81107e Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 12:36:45 +0300 Subject: [PATCH 06/14] compiler: fix few needless_pass_by_ref_mut clippy lints warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\clone.rs:160:9 | 160 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\cmp\partial_ord.rs:72:9 | 72 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\cmp\partial_eq.rs:19:18 | 19 | fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\cmp\ord.rs:42:19 | 42 | pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:917:13 | 917 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1406:13 | 1406 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1157:13 | 1157 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1103:13 | 1103 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1080:13 | 1080 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:859:13 | 859 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:805:13 | 805 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:467:13 | 467 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:457:13 | 457 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- .../src/deriving/clone.rs | 4 ++-- .../src/deriving/cmp/ord.rs | 2 +- .../src/deriving/cmp/partial_eq.rs | 2 +- .../src/deriving/cmp/partial_ord.rs | 2 +- .../src/deriving/decodable.rs | 6 ++--- .../src/deriving/generic/mod.rs | 24 +++++++++---------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index 7205d14404e81..4d8979c74830a 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -157,14 +157,14 @@ fn cs_clone_simple( fn cs_clone( name: &str, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, ) -> BlockOrExpr { let ctor_path; let all_fields; let fn_path = cx.std_path(&[sym::clone, sym::Clone, sym::clone]); - let subcall = |cx: &mut ExtCtxt<'_>, field: &FieldInfo| { + let subcall = |cx: &ExtCtxt<'_>, field: &FieldInfo| { let args = thin_vec![field.self_expr.clone()]; cx.expr_call_global(field.span, fn_path.clone(), args) }; diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs index 0923acfeeddb8..df7a5e6ccd35e 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs @@ -39,7 +39,7 @@ pub fn expand_deriving_ord( trait_def.expand(cx, mitem, item, push) } -pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { +pub fn cs_cmp(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { let test_id = Ident::new(sym::cmp, span); let equal_path = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal])); let cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]); diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs index 006110cd4b1f6..63744516ac6a3 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs @@ -16,7 +16,7 @@ pub fn expand_deriving_partial_eq( push: &mut dyn FnMut(Annotatable), is_const: bool, ) { - fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { + fn cs_eq(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr { let base = true; let expr = cs_fold( true, // use foldl diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs index 60dbdf8b54460..d4e98347b0772 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs @@ -69,7 +69,7 @@ pub fn expand_deriving_partial_ord( } fn cs_partial_cmp( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>, tag_then_data: bool, diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs index bf4693cd54198..57cbc8c66f2e3 100644 --- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs @@ -63,7 +63,7 @@ pub fn expand_deriving_rustc_decodable( } fn decodable_substructure( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>, krate: Symbol, @@ -186,14 +186,14 @@ fn decodable_substructure( /// - `outer_pat_path` is the path to this enum variant/struct /// - `getarg` should retrieve the `usize`-th field with name `@str`. fn decode_static_fields( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, outer_pat_path: ast::Path, fields: &StaticFields, mut getarg: F, ) -> P where - F: FnMut(&mut ExtCtxt<'_>, Span, Symbol, usize) -> P, + F: FnMut(&ExtCtxt<'_>, Span, Symbol, usize) -> P, { match fields { Unnamed(fields, is_tuple) => { diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 18c0e3f4bee87..e16d74eed4e07 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -330,7 +330,7 @@ pub enum SubstructureFields<'a> { /// Combine the values of all the fields together. The last argument is /// all the fields of all the structures. pub type CombineSubstructureFunc<'a> = - Box, Span, &Substructure<'_>) -> BlockOrExpr + 'a>; + Box, Span, &Substructure<'_>) -> BlockOrExpr + 'a>; pub fn combine_substructure( f: CombineSubstructureFunc<'_>, @@ -454,7 +454,7 @@ fn find_type_parameters( impl<'a> TraitDef<'a> { pub fn expand( self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, mitem: &ast::MetaItem, item: &'a Annotatable, push: &mut dyn FnMut(Annotatable), @@ -464,7 +464,7 @@ impl<'a> TraitDef<'a> { pub fn expand_ext( self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, mitem: &ast::MetaItem, item: &'a Annotatable, push: &mut dyn FnMut(Annotatable), @@ -802,7 +802,7 @@ impl<'a> TraitDef<'a> { fn expand_struct_def( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, struct_def: &'a VariantData, type_ident: Ident, generics: &Generics, @@ -856,7 +856,7 @@ impl<'a> TraitDef<'a> { fn expand_enum_def( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, enum_def: &'a EnumDef, type_ident: Ident, generics: &Generics, @@ -914,7 +914,7 @@ impl<'a> TraitDef<'a> { impl<'a> MethodDef<'a> { fn call_substructure_method( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, type_ident: Ident, nonselflike_args: &[P], @@ -1077,7 +1077,7 @@ impl<'a> MethodDef<'a> { /// ``` fn expand_struct_method_body<'b>( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'b>, struct_def: &'b VariantData, type_ident: Ident, @@ -1100,7 +1100,7 @@ impl<'a> MethodDef<'a> { fn expand_static_struct_method_body( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, struct_def: &VariantData, type_ident: Ident, @@ -1154,7 +1154,7 @@ impl<'a> MethodDef<'a> { /// `Unify`), and possibly a default arm. fn expand_enum_method_body<'b>( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'b>, enum_def: &'b EnumDef, type_ident: Ident, @@ -1403,7 +1403,7 @@ impl<'a> MethodDef<'a> { fn expand_static_enum_method_body( &self, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_: &TraitDef<'_>, enum_def: &EnumDef, type_ident: Ident, @@ -1668,13 +1668,13 @@ pub enum CsFold<'a> { /// Statics may not be folded over. pub fn cs_fold( use_foldl: bool, - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, trait_span: Span, substructure: &Substructure<'_>, mut f: F, ) -> P where - F: FnMut(&mut ExtCtxt<'_>, CsFold<'_>) -> P, + F: FnMut(&ExtCtxt<'_>, CsFold<'_>) -> P, { match substructure.fields { EnumMatching(.., all_fields) | Struct(_, all_fields) => { From afd0a8eb8f2d26f540dd39b2b05739a7ecc0869d Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 12:49:18 +0300 Subject: [PATCH 07/14] change BuiltinDeriveFn type to get ExtCtxt by immutable ref and fix signatures --- compiler/rustc_builtin_macros/src/deriving/bounds.rs | 4 ++-- compiler/rustc_builtin_macros/src/deriving/clone.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/debug.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/decodable.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/default.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/encodable.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/hash.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/mod.rs | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/bounds.rs b/compiler/rustc_builtin_macros/src/deriving/bounds.rs index 8027ca2e7bb47..26ef3da3a915c 100644 --- a/compiler/rustc_builtin_macros/src/deriving/bounds.rs +++ b/compiler/rustc_builtin_macros/src/deriving/bounds.rs @@ -6,7 +6,7 @@ use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::Span; pub fn expand_deriving_copy( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, @@ -29,7 +29,7 @@ pub fn expand_deriving_copy( } pub fn expand_deriving_const_param_ty( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index 4d8979c74830a..0a44bd42b9173 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -9,7 +9,7 @@ use rustc_span::Span; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_clone( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs index d20e715d793f9..45c4467a1097c 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs @@ -10,7 +10,7 @@ use rustc_span::Span; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_eq( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs index df7a5e6ccd35e..1d7a69540ab89 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs @@ -8,7 +8,7 @@ use rustc_span::Span; use thin_vec::thin_vec; pub fn expand_deriving_ord( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs index 63744516ac6a3..234918ae42961 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs @@ -9,7 +9,7 @@ use rustc_span::Span; use thin_vec::thin_vec; pub fn expand_deriving_partial_eq( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs index d4e98347b0772..49fe89b18b091 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs @@ -8,7 +8,7 @@ use rustc_span::Span; use thin_vec::thin_vec; pub fn expand_deriving_partial_ord( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/debug.rs b/compiler/rustc_builtin_macros/src/deriving/debug.rs index bfab4ec48c264..e442b3520b275 100644 --- a/compiler/rustc_builtin_macros/src/deriving/debug.rs +++ b/compiler/rustc_builtin_macros/src/deriving/debug.rs @@ -9,7 +9,7 @@ use rustc_span::Span; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_debug( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs index 57cbc8c66f2e3..34798ab0a17b0 100644 --- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs @@ -11,7 +11,7 @@ use rustc_span::Span; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_rustc_decodable( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs index c565ef2fcd089..328770ce10d2c 100644 --- a/compiler/rustc_builtin_macros/src/deriving/default.rs +++ b/compiler/rustc_builtin_macros/src/deriving/default.rs @@ -13,7 +13,7 @@ use smallvec::SmallVec; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_default( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &ast::MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/encodable.rs b/compiler/rustc_builtin_macros/src/deriving/encodable.rs index 3286099b14c3d..2e5f1173825a1 100644 --- a/compiler/rustc_builtin_macros/src/deriving/encodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/encodable.rs @@ -95,7 +95,7 @@ use rustc_span::Span; use thin_vec::{thin_vec, ThinVec}; pub fn expand_deriving_rustc_encodable( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/hash.rs b/compiler/rustc_builtin_macros/src/deriving/hash.rs index 4af6fe395f716..6bb61311bd281 100644 --- a/compiler/rustc_builtin_macros/src/deriving/hash.rs +++ b/compiler/rustc_builtin_macros/src/deriving/hash.rs @@ -8,7 +8,7 @@ use rustc_span::Span; use thin_vec::thin_vec; pub fn expand_deriving_hash( - cx: &mut ExtCtxt<'_>, + cx: &ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs index 7d25493571c12..9f786d22c932f 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -40,7 +40,7 @@ pub mod partial_ord; pub mod generic; pub(crate) type BuiltinDeriveFn = - fn(&mut ExtCtxt<'_>, Span, &MetaItem, &Annotatable, &mut dyn FnMut(Annotatable), bool); + fn(&ExtCtxt<'_>, Span, &MetaItem, &Annotatable, &mut dyn FnMut(Annotatable), bool); pub(crate) struct BuiltinDerive(pub(crate) BuiltinDeriveFn); From c64a4403123c43b88f9261a055bda4b9fbd6fc73 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 13:16:22 +0300 Subject: [PATCH 08/14] fix few more warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_trait_selection\src\traits\project.rs:511:12 | 511 | selcx: &mut SelectionContext<'a, 'tcx>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&SelectionContext<'a, 'tcx>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_trait_selection\src\traits\specialize\specialization_graph.rs:201:28 | 201 | fn iter_children(children: &mut Children) -> impl Iterator + '_ { | ^^^^^^^^^^^^^ help: consider changing to: `&Children` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_trait_selection/src/traits/project.rs | 2 +- compiler/rustc_trait_selection/src/traits/specialize/mod.rs | 4 ++-- .../src/traits/specialize/specialization_graph.rs | 2 +- compiler/rustc_trait_selection/src/traits/util.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 12371155303f9..c33e24b1094d4 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -508,7 +508,7 @@ pub(super) 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/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 27dd8f26489e7..43c750ebbb5b8 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -239,10 +239,10 @@ fn fulfill_implication<'tcx>( let source_trait = ImplSubject::Trait(source_trait_ref); - let selcx = &mut SelectionContext::new(infcx); + let selcx = SelectionContext::new(infcx); let target_args = infcx.fresh_args_for_item(DUMMY_SP, target_impl); let (target_trait, obligations) = - util::impl_subject_and_oblig(selcx, param_env, target_impl, target_args, error_cause); + util::impl_subject_and_oblig(&selcx, param_env, target_impl, target_args, error_cause); // do the impls unify? If not, no specialization. let Ok(InferOk { obligations: more_obligations, .. }) = infcx 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 1aa65b87f0b7b..dba014d58b00d 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs @@ -198,7 +198,7 @@ impl<'tcx> 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 3f433a9e919a3..f9e5dc169de20 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -205,7 +205,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>, From 5488e492af99e8a7b1b24cbccdfcd6635996220d Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 16:26:37 +0300 Subject: [PATCH 09/14] and few more warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_codegen_ssa\src\back\rpath.rs:80:41 | 80 | fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsString { | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_codegen_ssa\src\back\rpath.rs:76:42 | 76 | fn get_rpaths_relative_to_output(config: &mut RPathConfig<'_>) -> Vec { | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_codegen_ssa\src\back\rpath.rs:55:23 | 55 | fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec { | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_codegen_ssa\src\back\rpath.rs:15:32 | 15 | pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec { | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>` | = warning: changing this function will impact semver compatibility = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_codegen_ssa/src/back/link.rs | 4 ++-- compiler/rustc_codegen_ssa/src/back/rpath.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index c8b8594c0dd66..7c7f702b2c390 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2089,14 +2089,14 @@ fn add_rpath_args( .map(|(path, _)| &**path) }) .collect::>(); - let mut rpath_config = RPathConfig { + let rpath_config = RPathConfig { libs: &*libs, out_filename: out_filename.to_path_buf(), has_rpath: sess.target.has_rpath, is_like_osx: sess.target.is_like_osx, linker_is_gnu: sess.target.linker_flavor.is_gnu(), }; - cmd.args(&rpath::get_rpath_flags(&mut rpath_config)); + cmd.args(&rpath::get_rpath_flags(&rpath_config)); } } diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index 60346228625fa..ebbf49af18487 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -12,7 +12,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(); @@ -52,7 +52,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 { @@ -73,11 +73,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" }; From 9a6b3dfc0636ab8eaece281ecfeceb2b2f393b06 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 16:57:32 +0300 Subject: [PATCH 10/14] and few more maybe bug here? warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_borrowck\src\diagnostics\conflict_errors.rs:3857:35 | 3857 | pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&MirBorrowckCtxt<'_, 'tcx>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_borrowck\src\type_check\liveness\trace.rs:601:17 | 601 | typeck: &mut TypeChecker<'_, 'tcx>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&TypeChecker<'_, 'tcx>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- .../src/diagnostics/conflict_errors.rs | 20 +++++++++---------- .../src/type_check/liveness/polonius.rs | 2 ++ .../src/type_check/liveness/trace.rs | 9 +++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 578369de4d6e3..62e16d445c63f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -337,7 +337,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } fn suggest_ref_or_clone( - &mut self, + &self, mpi: MovePathIndex, move_span: Span, err: &mut Diag<'tcx>, @@ -1125,7 +1125,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } pub(crate) fn report_use_while_mutably_borrowed( - &mut self, + &self, location: Location, (place, _span): (Place<'tcx>, Span), borrow: &BorrowData<'tcx>, @@ -1174,7 +1174,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } pub(crate) fn report_conflicting_borrow( - &mut self, + &self, location: Location, (place, span): (Place<'tcx>, Span), gen_borrow_kind: BorrowKind, @@ -2463,7 +2463,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } fn report_local_value_does_not_live_long_enough( - &mut self, + &self, location: Location, name: &str, borrow: &BorrowData<'tcx>, @@ -2642,7 +2642,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } fn report_thread_local_value_does_not_live_long_enough( - &mut self, + &self, drop_span: Span, borrow_span: Span, ) -> Diag<'tcx> { @@ -2663,7 +2663,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { #[instrument(level = "debug", skip(self))] fn report_temporary_value_does_not_live_long_enough( - &mut self, + &self, location: Location, borrow: &BorrowData<'tcx>, drop_span: Span, @@ -2921,7 +2921,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { #[instrument(level = "debug", skip(self))] fn report_escaping_closure_capture( - &mut self, + &self, use_span: UseSpans<'tcx>, var_span: Span, fr_name: &RegionName, @@ -3031,7 +3031,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } fn report_escaping_data( - &mut self, + &self, borrow_span: Span, name: &Option, upvar_span: Span, @@ -3065,7 +3065,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } fn get_moved_indexes( - &mut self, + &self, location: Location, mpi: MovePathIndex, ) -> (Vec, Vec) { @@ -3854,7 +3854,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 Diag<'_>) -> String { + pub(crate) fn emit(&self, cx: &MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> 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 45f7b07fd5f93..7f5302270439c 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/polonius.rs @@ -87,6 +87,8 @@ pub(super) fn populate_access_facts<'a, 'tcx>( body: &Body<'tcx>, location_table: &LocationTable, move_data: &MoveData<'tcx>, + //FIXME: this is not mutated, but expected to be modified as + // out param, bug? dropped_at: &mut 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 18975a4e3b271..8bdefdfc0ac99 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs @@ -200,7 +200,7 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> { for local in boring_locals { let local_ty = self.cx.body.local_decls[local].ty; let drop_data = self.cx.drop_data.entry(local_ty).or_insert_with({ - let typeck = &mut self.cx.typeck; + let typeck = &self.cx.typeck; move || LivenessContext::compute_drop_data(typeck, local_ty) }); @@ -542,7 +542,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> { ); let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({ - let typeck = &mut self.typeck; + let typeck = &self.typeck; move || Self::compute_drop_data(typeck, dropped_ty) }); @@ -597,10 +597,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 From 8245718503f24a0a316c6603195b94be23f4fda4 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 28 Mar 2024 17:09:13 +0300 Subject: [PATCH 11/14] and more warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\coroutine.rs:1229:11 | 1229 | body: &mut Body<'tcx>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Body<'tcx>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\nrvo.rs:123:11 | 123 | body: &mut mir::Body<'_>, | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&mir::Body<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\nrvo.rs:87:34 | 87 | fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option { | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&mir::Body<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- compiler/rustc_mir_build/src/build/matches/mod.rs | 5 +---- compiler/rustc_mir_transform/src/coroutine.rs | 2 +- compiler/rustc_mir_transform/src/nrvo.rs | 7 ++----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 6d083e66a9b25..8705223508e8e 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -1595,10 +1595,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// [`Switch`]: TestKind::Switch /// [`SwitchInt`]: TestKind::SwitchInt /// [`Range`]: TestKind::Range - fn pick_test( - &mut self, - candidates: &mut [&mut Candidate<'_, 'tcx>], - ) -> (Place<'tcx>, Test<'tcx>) { + fn pick_test(&mut self, candidates: &[&mut Candidate<'_, 'tcx>]) -> (Place<'tcx>, Test<'tcx>) { // Extract the match-pair from the highest priority candidate let match_pair = &candidates.first().unwrap().match_pairs[0]; let test = self.test(match_pair); diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index f0a13f6655593..c3f175f150d21 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -1226,7 +1226,7 @@ fn create_coroutine_drop_shim<'tcx>( tcx: TyCtxt<'tcx>, transform: &TransformVisitor<'tcx>, coroutine_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 c3a92911bbf0f..232c290e0fb21 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 = BitSet::new_empty(body.basic_blocks.len()); From a325bce3cd162a20ecab9ff31def3e6701c8ebea Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Thu, 28 Mar 2024 13:19:50 -0700 Subject: [PATCH 12/14] Normalize the result of Fields::ty_with_args We were only instantiating before, which would leak an AliasTy. I added a test case that reproduce the issue seen here: https://github.com/model-checking/kani/issues/3113 --- compiler/rustc_smir/src/rustc_smir/context.rs | 5 +- compiler/stable_mir/src/ty.rs | 4 +- .../stable-mir/check_normalization.rs | 95 +++++++++++++++++++ 3 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 tests/ui-fulldeps/stable-mir/check_normalization.rs diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs index d39a3788d4cf7..7c12168b80951 100644 --- a/compiler/rustc_smir/src/rustc_smir/context.rs +++ b/compiler/rustc_smir/src/rustc_smir/context.rs @@ -420,7 +420,10 @@ impl<'tcx> Context for TablesWrapper<'tcx> { let tcx = tables.tcx; let args = args.internal(&mut *tables, tcx); let def_ty = tables.tcx.type_of(item.internal(&mut *tables, tcx)); - def_ty.instantiate(tables.tcx, args).stable(&mut *tables) + tables + .tcx + .instantiate_and_normalize_erasing_regions(args, ty::ParamEnv::reveal_all(), def_ty) + .stable(&mut *tables) } fn const_pretty(&self, cnst: &stable_mir::ty::Const) -> String { diff --git a/compiler/stable_mir/src/ty.rs b/compiler/stable_mir/src/ty.rs index 21db222095f45..3e8d186b97e20 100644 --- a/compiler/stable_mir/src/ty.rs +++ b/compiler/stable_mir/src/ty.rs @@ -654,7 +654,7 @@ impl AdtDef { with(|cx| cx.def_ty(self.0)) } - /// Retrieve the type of this Adt instantiating the type with the given arguments. + /// Retrieve the type of this Adt by instantiating and normalizing it with the given arguments. /// /// This will assume the type can be instantiated with these arguments. pub fn ty_with_args(&self, args: &GenericArgs) -> Ty { @@ -733,7 +733,7 @@ pub struct FieldDef { } impl FieldDef { - /// Retrieve the type of this field instantiating the type with the given arguments. + /// Retrieve the type of this field instantiating and normalizing it with the given arguments. /// /// This will assume the type can be instantiated with these arguments. pub fn ty_with_args(&self, args: &GenericArgs) -> Ty { diff --git a/tests/ui-fulldeps/stable-mir/check_normalization.rs b/tests/ui-fulldeps/stable-mir/check_normalization.rs new file mode 100644 index 0000000000000..72e410f80809b --- /dev/null +++ b/tests/ui-fulldeps/stable-mir/check_normalization.rs @@ -0,0 +1,95 @@ +//@ run-pass +//! Test that types are normalized in an instance body. + +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 +//@ edition: 2021 + +#![feature(rustc_private)] + +#[macro_use] +extern crate rustc_smir; +extern crate rustc_driver; +extern crate rustc_interface; +extern crate stable_mir; + +use mir::mono::Instance; +use ty::{Ty, TyKind, RigidTy}; +use rustc_smir::rustc_internal; +use stable_mir::*; +use std::io::Write; +use std::ops::ControlFlow; + +const CRATE_NAME: &str = "input"; + +/// This function uses the Stable MIR APIs to get information about the test crate. +fn test_stable_mir() -> ControlFlow<()> { + let items = stable_mir::all_local_items(); + + // Get all items and split generic vs monomorphic items. + let instances: Vec<_> = + items.into_iter().filter_map(|item| (!item.requires_monomorphization()).then(|| { + Instance::try_from(item).unwrap() + })).collect(); + assert_eq!(instances.len(), 1, "Expected one constant"); + + for instance in instances { + check_ty(instance.ty()); + } + ControlFlow::Continue(()) +} + +fn check_ty(ty: Ty) { + match ty.kind() { + TyKind::RigidTy(RigidTy::Adt(def, args)) if def.kind().is_struct() => { + // Ensure field type is also normalized + def.variants_iter().next().unwrap().fields().into_iter().for_each(|f| { + check_ty(f.ty_with_args(&args)) + }); + } + TyKind::RigidTy(RigidTy::Uint(..)) => {} + kind => unreachable!("Unexpected kind: {kind:?}") + } +} + + +/// This test will generate and analyze a dummy crate using the stable mir. +/// For that, it will first write the dummy crate into a file. +/// Then it will create a `StableMir` using custom arguments and then +/// it will run the compiler. +fn main() { + let path = "normalization_input.rs"; + generate_input(&path).unwrap(); + let args = vec![ + "rustc".to_string(), + "-Cpanic=abort".to_string(), + "--crate-type=lib".to_string(), + "--crate-name".to_string(), + CRATE_NAME.to_string(), + path.to_string(), + ]; + run!(args, test_stable_mir).unwrap(); +} + +fn generate_input(path: &str) -> std::io::Result<()> { + let mut file = std::fs::File::create(path)?; + write!( + file, + r#" + pub trait Primitive {{ + type Base; + }} + + impl Primitive for char {{ + type Base = u32; + }} + + pub struct Wrapper(T::Base); + pub type WrapperChar = Wrapper; + pub const NULL_CHAR: WrapperChar = Wrapper::(0); + "# + )?; + Ok(()) +} From 5fe364afdd590c8f928721820e490f82b90f65e0 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 29 Mar 2024 10:06:13 +0300 Subject: [PATCH 13/14] copy any file from stage0/lib to stage0-sysroot/lib With the LLVM 18 upgrade, the name of the LLVM library has been changed to something like `libLLVM.so.18.1-rust-1.78.0-beta`, which `is_dylib` function cannot determine as it only looks whether files are ending with ".so" or not. This change resolves this problem by no longer doing that ".so" check, as we need all files from the stage0/lib as they are all dependency of rustc anyway. Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/compile.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index d40a3ea4c884e..895c43d4dda60 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -643,13 +643,13 @@ impl Step for StdLink { t!(fs::create_dir_all(&sysroot_bin_dir)); builder.cp_link_r(&stage0_bin_dir, &sysroot_bin_dir); - // Copy all *.so files from stage0/lib to stage0-sysroot/lib + // Copy all files from stage0/lib to stage0-sysroot/lib let stage0_lib_dir = builder.out.join(host).join("stage0/lib"); if let Ok(files) = fs::read_dir(stage0_lib_dir) { for file in files { let file = t!(file); let path = file.path(); - if path.is_file() && is_dylib(&file.file_name().into_string().unwrap()) { + if path.is_file() { builder .copy_link(&path, &sysroot.join("lib").join(path.file_name().unwrap())); } From 5eb78c515c777c232c35b2e606bcec7cefe875af Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Fri, 29 Mar 2024 10:44:19 +0300 Subject: [PATCH 14/14] Forward port 1.77.1 release notes --- RELEASES.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 922afdd3e1852..f35dd27ec2475 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,13 @@ +Version 1.77.1 (2024-03-28) +=========================== + + + +- [Revert stripping debuginfo by default for Windows](https://github.com/rust-lang/cargo/pull/13654) + This fixes a regression in 1.77 by reverting to the previous default. + Platforms other than Windows are not affected. +- Internal: [Fix heading anchor rendering in doc pages](https://github.com/rust-lang/rust/pull/122693) + Version 1.77.0 (2024-03-21) ==========================