Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crater 2024 edition test #122960

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading