Skip to content

Commit 561eebd

Browse files
committed
Disable rpit lifetime capture and static_mut_refs
1 parent 9a66ad4 commit 561eebd

File tree

3 files changed

+49
-49
lines changed

3 files changed

+49
-49
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15401540
if matches!(
15411541
fn_kind.expect("expected RPITs to be lowered with a FnKind"),
15421542
FnDeclKind::Impl | FnDeclKind::Trait
1543-
) || self.tcx.features().lifetime_capture_rules_2024
1544-
|| span.at_least_rust_2024()
1543+
) || (self.tcx.features().lifetime_capture_rules_2024
1544+
&& span.at_least_rust_2024())
15451545
{
15461546
// return-position impl trait in trait was decided to capture all
15471547
// in-scope lifetimes, which we collect for all opaques during resolution.

compiler/rustc_hir_analysis/src/check/errs.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,28 @@ fn handle_static_mut_ref(
5252
tcx: TyCtxt<'_>,
5353
span: Span,
5454
var: String,
55-
e2024: bool,
55+
_e2024: bool,
5656
mutable: Mutability,
5757
hir_id: hir::HirId,
5858
) {
59-
if e2024 {
60-
let (sugg, shared) = if mutable == Mutability::Mut {
61-
(errors::StaticMutRefSugg::Mut { span, var }, "mutable")
62-
} else {
63-
(errors::StaticMutRefSugg::Shared { span, var }, "shared")
64-
};
65-
tcx.sess.psess.dcx.emit_err(errors::StaticMutRef { span, sugg, shared });
59+
// if e2024 {
60+
// let (sugg, shared) = if mutable == Mutability::Mut {
61+
// (errors::StaticMutRefSugg::Mut { span, var }, "mutable")
62+
// } else {
63+
// (errors::StaticMutRefSugg::Shared { span, var }, "shared")
64+
// };
65+
// tcx.sess.psess.dcx.emit_err(errors::StaticMutRef { span, sugg, shared });
66+
// } else {
67+
let (sugg, shared) = if mutable == Mutability::Mut {
68+
(errors::RefOfMutStaticSugg::Mut { span, var }, "mutable")
6669
} else {
67-
let (sugg, shared) = if mutable == Mutability::Mut {
68-
(errors::RefOfMutStaticSugg::Mut { span, var }, "mutable")
69-
} else {
70-
(errors::RefOfMutStaticSugg::Shared { span, var }, "shared")
71-
};
72-
tcx.emit_node_span_lint(
73-
STATIC_MUT_REFS,
74-
hir_id,
75-
span,
76-
errors::RefOfMutStatic { span, sugg, shared },
77-
);
78-
}
70+
(errors::RefOfMutStaticSugg::Shared { span, var }, "shared")
71+
};
72+
tcx.emit_node_span_lint(
73+
STATIC_MUT_REFS,
74+
hir_id,
75+
span,
76+
errors::RefOfMutStatic { span, sugg, shared },
77+
);
78+
// }
7979
}

compiler/rustc_hir_analysis/src/errors.rs

+27-27
Original file line numberDiff line numberDiff line change
@@ -1498,36 +1498,36 @@ pub struct StaticMutRef<'a> {
14981498
#[primary_span]
14991499
#[label]
15001500
pub span: Span,
1501-
#[subdiagnostic]
1502-
pub sugg: StaticMutRefSugg,
1501+
// #[subdiagnostic]
1502+
// pub sugg: StaticMutRefSugg,
15031503
pub shared: &'a str,
15041504
}
15051505

1506-
#[derive(Subdiagnostic)]
1507-
pub enum StaticMutRefSugg {
1508-
#[suggestion(
1509-
hir_analysis_suggestion,
1510-
style = "verbose",
1511-
code = "addr_of!({var})",
1512-
applicability = "maybe-incorrect"
1513-
)]
1514-
Shared {
1515-
#[primary_span]
1516-
span: Span,
1517-
var: String,
1518-
},
1519-
#[suggestion(
1520-
hir_analysis_suggestion_mut,
1521-
style = "verbose",
1522-
code = "addr_of_mut!({var})",
1523-
applicability = "maybe-incorrect"
1524-
)]
1525-
Mut {
1526-
#[primary_span]
1527-
span: Span,
1528-
var: String,
1529-
},
1530-
}
1506+
// #[derive(Subdiagnostic)]
1507+
// pub enum StaticMutRefSugg {
1508+
// #[suggestion(
1509+
// hir_analysis_suggestion,
1510+
// style = "verbose",
1511+
// code = "addr_of!({var})",
1512+
// applicability = "maybe-incorrect"
1513+
// )]
1514+
// Shared {
1515+
// #[primary_span]
1516+
// span: Span,
1517+
// var: String,
1518+
// },
1519+
// #[suggestion(
1520+
// hir_analysis_suggestion_mut,
1521+
// style = "verbose",
1522+
// code = "addr_of_mut!({var})",
1523+
// applicability = "maybe-incorrect"
1524+
// )]
1525+
// Mut {
1526+
// #[primary_span]
1527+
// span: Span,
1528+
// var: String,
1529+
// },
1530+
// }
15311531

15321532
// STATIC_MUT_REF lint
15331533
#[derive(LintDiagnostic)]

0 commit comments

Comments
 (0)