From 96d10aa3255a8446b059666a4dd89dd111a773f6 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 23 Mar 2024 12:08:40 -0700 Subject: [PATCH 1/3] Crater 2024 edition test --- .gitmodules | 3 ++- src/tools/cargo | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 802d61eea293b..0a367243d0215 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,8 @@ shallow = true [submodule "src/tools/cargo"] path = src/tools/cargo - url = https://github.com/rust-lang/cargo.git + url = https://github.com/ehuss/cargo.git + branch = "edition-2024-crater" shallow = true [submodule "src/doc/reference"] path = src/doc/reference diff --git a/src/tools/cargo b/src/tools/cargo index 499a61ce7a0fc..ce2d5de7996af 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 499a61ce7a0fc6a72040084862a68b2603e770e8 +Subproject commit ce2d5de7996afb70ec0054f06b73caed559f7257 From 9a66ad4540e0a0af7d6d90a2ab1e51bfe1a7b0c4 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 25 Mar 2024 14:18:21 -0700 Subject: [PATCH 2/3] Remove `gen` keyword. This is blocking testing. --- compiler/rustc_parse/src/parser/expr.rs | 18 +++++++++--------- compiler/rustc_parse/src/parser/mod.rs | 16 ++++++++-------- compiler/rustc_span/src/symbol.rs | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 18fb858c84cf6..2212e74cb8988 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1521,15 +1521,15 @@ impl<'a> Parser<'a> { Ok(this.mk_expr(this.prev_token.span, ExprKind::Underscore)) } else if this.token.uninterpolated_span().at_least_rust_2018() { // `Span::at_least_rust_2018()` is somewhat expensive; don't get it repeatedly. - if this.token.uninterpolated_span().at_least_rust_2024() - // check for `gen {}` and `gen move {}` - // or `async gen {}` and `async gen move {}` - && (this.is_gen_block(kw::Gen, 0) - || (this.check_keyword(kw::Async) && this.is_gen_block(kw::Gen, 1))) - { - // FIXME: (async) gen closures aren't yet parsed. - this.parse_gen_block() - } else if this.check_keyword(kw::Async) { + // if this.token.uninterpolated_span().at_least_rust_2024() + // // check for `gen {}` and `gen move {}` + // // or `async gen {}` and `async gen move {}` + // && (this.is_gen_block(kw::Gen, 0) + // || (this.check_keyword(kw::Async) && this.is_gen_block(kw::Gen, 1))) + // { + // // FIXME: (async) gen closures aren't yet parsed. + // this.parse_gen_block() + if this.check_keyword(kw::Async) { // FIXME(gen_blocks): Parse `gen async` and suggest swap if this.is_gen_block(kw::Async, 0) { // Check for `async {` and `async move {`, diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 1971591364d34..478f553010e9b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1201,14 +1201,14 @@ impl<'a> Parser<'a> { return_impl_trait_id: DUMMY_NODE_ID, }) } - } else if self.token.uninterpolated_span().at_least_rust_2024() - && self.eat_keyword_case(kw::Gen, case) - { - Some(CoroutineKind::Gen { - span, - closure_id: DUMMY_NODE_ID, - return_impl_trait_id: DUMMY_NODE_ID, - }) + // } else if self.token.uninterpolated_span().at_least_rust_2024() + // && self.eat_keyword_case(kw::Gen, case) + // { + // Some(CoroutineKind::Gen { + // span, + // closure_id: DUMMY_NODE_ID, + // return_impl_trait_id: DUMMY_NODE_ID, + // }) } else { None } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 998b1a5c7eaa9..91f10f7a6919d 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2407,7 +2407,7 @@ impl Symbol { fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool { self == kw::Try && edition().at_least_rust_2018() - || self == kw::Gen && edition().at_least_rust_2024() + // || self == kw::Gen && edition().at_least_rust_2024() } pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool { From 561eebd607b554095cef5414bb93c3dd7fb7be3a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 29 Mar 2024 13:55:45 -0700 Subject: [PATCH 3/3] Disable rpit lifetime capture and static_mut_refs --- compiler/rustc_ast_lowering/src/lib.rs | 4 +- compiler/rustc_hir_analysis/src/check/errs.rs | 40 +++++++------- compiler/rustc_hir_analysis/src/errors.rs | 54 +++++++++---------- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 833b0e9b5679e..f032a4258be3d 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1540,8 +1540,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { if matches!( fn_kind.expect("expected RPITs to be lowered with a FnKind"), FnDeclKind::Impl | FnDeclKind::Trait - ) || self.tcx.features().lifetime_capture_rules_2024 - || span.at_least_rust_2024() + ) || (self.tcx.features().lifetime_capture_rules_2024 + && span.at_least_rust_2024()) { // return-position impl trait in trait was decided to capture all // in-scope lifetimes, which we collect for all opaques during resolution. diff --git a/compiler/rustc_hir_analysis/src/check/errs.rs b/compiler/rustc_hir_analysis/src/check/errs.rs index 548f9b0810fa3..0aca4db3181d4 100644 --- a/compiler/rustc_hir_analysis/src/check/errs.rs +++ b/compiler/rustc_hir_analysis/src/check/errs.rs @@ -52,28 +52,28 @@ fn handle_static_mut_ref( tcx: TyCtxt<'_>, span: Span, var: String, - e2024: bool, + _e2024: bool, mutable: Mutability, hir_id: hir::HirId, ) { - if e2024 { - let (sugg, shared) = if mutable == Mutability::Mut { - (errors::StaticMutRefSugg::Mut { span, var }, "mutable") - } else { - (errors::StaticMutRefSugg::Shared { span, var }, "shared") - }; - tcx.sess.psess.dcx.emit_err(errors::StaticMutRef { span, sugg, shared }); + // if e2024 { + // let (sugg, shared) = if mutable == Mutability::Mut { + // (errors::StaticMutRefSugg::Mut { span, var }, "mutable") + // } else { + // (errors::StaticMutRefSugg::Shared { span, var }, "shared") + // }; + // tcx.sess.psess.dcx.emit_err(errors::StaticMutRef { span, sugg, shared }); + // } else { + let (sugg, shared) = if mutable == Mutability::Mut { + (errors::RefOfMutStaticSugg::Mut { span, var }, "mutable") } else { - let (sugg, shared) = if mutable == Mutability::Mut { - (errors::RefOfMutStaticSugg::Mut { span, var }, "mutable") - } else { - (errors::RefOfMutStaticSugg::Shared { span, var }, "shared") - }; - tcx.emit_node_span_lint( - STATIC_MUT_REFS, - hir_id, - span, - errors::RefOfMutStatic { span, sugg, shared }, - ); - } + (errors::RefOfMutStaticSugg::Shared { span, var }, "shared") + }; + tcx.emit_node_span_lint( + STATIC_MUT_REFS, + hir_id, + span, + errors::RefOfMutStatic { span, sugg, shared }, + ); + // } } diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index fb919714afd38..2b3d4378ae144 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1498,36 +1498,36 @@ pub struct StaticMutRef<'a> { #[primary_span] #[label] pub span: Span, - #[subdiagnostic] - pub sugg: StaticMutRefSugg, + // #[subdiagnostic] + // pub sugg: StaticMutRefSugg, pub shared: &'a str, } -#[derive(Subdiagnostic)] -pub enum StaticMutRefSugg { - #[suggestion( - hir_analysis_suggestion, - style = "verbose", - code = "addr_of!({var})", - applicability = "maybe-incorrect" - )] - Shared { - #[primary_span] - span: Span, - var: String, - }, - #[suggestion( - hir_analysis_suggestion_mut, - style = "verbose", - code = "addr_of_mut!({var})", - applicability = "maybe-incorrect" - )] - Mut { - #[primary_span] - span: Span, - var: String, - }, -} +// #[derive(Subdiagnostic)] +// pub enum StaticMutRefSugg { +// #[suggestion( +// hir_analysis_suggestion, +// style = "verbose", +// code = "addr_of!({var})", +// applicability = "maybe-incorrect" +// )] +// Shared { +// #[primary_span] +// span: Span, +// var: String, +// }, +// #[suggestion( +// hir_analysis_suggestion_mut, +// style = "verbose", +// code = "addr_of_mut!({var})", +// applicability = "maybe-incorrect" +// )] +// Mut { +// #[primary_span] +// span: Span, +// var: String, +// }, +// } // STATIC_MUT_REF lint #[derive(LintDiagnostic)]