Skip to content

Commit

Permalink
Auto merge of #122960 - ehuss:edition-2024-crater-test, r=<try>
Browse files Browse the repository at this point in the history
Crater 2024 edition test
  • Loading branch information
bors committed Mar 29, 2024
2 parents af4a5a1 + 561eebd commit 36dbcae
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 69 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 20 additions & 20 deletions compiler/rustc_hir_analysis/src/check/errs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
);
// }
}
54 changes: 27 additions & 27 deletions compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {`,
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 209 files

0 comments on commit 36dbcae

Please sign in to comment.