Rollup merge of #137333 - compiler-errors:edition-2024-fresh, r=Nadrieril

Use `edition = "2024"` in the compiler (redux)

Most of this is binding mode changes, which I fixed by running `x.py fix`.

Also adds some miscellaneous `unsafe` blocks for new unsafe standard library functions (the setenv ones), and a missing `unsafe extern` block in some enzyme codegen code, and fixes some precise capturing lifetime changes (but only when they led to errors).

cc ``@ehuss`` ``@traviscross``
This commit is contained in:
Matthias Krüger 2025-02-22 11:36:43 +01:00 committed by GitHub
commit 37e0d138cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
149 changed files with 259 additions and 280 deletions

View file

@ -237,7 +237,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
Some(ConsiderAddingAwait::FutureSugg { span: then_span.shrink_to_hi() })
}
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
ref prior_non_diverging_arms,
prior_non_diverging_arms,
..
}) => Some({
ConsiderAddingAwait::FutureSuggMultiple {

View file

@ -2437,7 +2437,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
obligated_types: &mut Vec<Ty<'tcx>>,
cause_code: &ObligationCauseCode<'tcx>,
) -> bool {
if let ObligationCauseCode::BuiltinDerived(ref data) = cause_code {
if let ObligationCauseCode::BuiltinDerived(data) = cause_code {
let parent_trait_ref = self.resolve_vars_if_possible(data.parent_trait_pred);
let self_ty = parent_trait_ref.skip_binder().self_ty();
if obligated_types.iter().any(|ot| ot == &self_ty) {

View file

@ -974,7 +974,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
hir::ExprKind::MethodCall(
hir::PathSegment { ident, .. },
_receiver,
&[],
[],
call_span,
),
hir_id,

View file

@ -509,21 +509,18 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
let node = self.tcx.hir_node_by_def_id(anon_reg.scope);
let is_impl = matches!(&node, hir::Node::ImplItem(_));
let (generics, parent_generics) = match node {
hir::Node::Item(&hir::Item {
kind: hir::ItemKind::Fn { ref generics, .. },
..
})
| hir::Node::TraitItem(&hir::TraitItem { ref generics, .. })
| hir::Node::ImplItem(&hir::ImplItem { ref generics, .. }) => (
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. })
| hir::Node::TraitItem(hir::TraitItem { generics, .. })
| hir::Node::ImplItem(hir::ImplItem { generics, .. }) => (
generics,
match self.tcx.parent_hir_node(self.tcx.local_def_id_to_hir_id(anon_reg.scope))
{
hir::Node::Item(hir::Item {
kind: hir::ItemKind::Trait(_, _, ref generics, ..),
kind: hir::ItemKind::Trait(_, _, generics, ..),
..
})
| hir::Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { ref generics, .. }),
kind: hir::ItemKind::Impl(hir::Impl { generics, .. }),
..
}) => Some(generics),
_ => None,

View file

@ -67,7 +67,9 @@ impl<'tcx> ObligationStorage<'tcx> {
obligations
}
fn unstalled_for_select(&mut self) -> impl Iterator<Item = PredicateObligation<'tcx>> {
fn unstalled_for_select(
&mut self,
) -> impl Iterator<Item = PredicateObligation<'tcx>> + use<'tcx> {
mem::take(&mut self.pending).into_iter()
}

View file

@ -698,11 +698,11 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IllegalSelfTypeVisitor<'tcx> {
ControlFlow::Continue(())
}
}
ty::Alias(ty::Projection, ref data) if self.tcx.is_impl_trait_in_trait(data.def_id) => {
ty::Alias(ty::Projection, data) if self.tcx.is_impl_trait_in_trait(data.def_id) => {
// We'll deny these later in their own pass
ControlFlow::Continue(())
}
ty::Alias(ty::Projection, ref data) => {
ty::Alias(ty::Projection, data) => {
match self.allow_self_projections {
AllowSelfProjections::Yes => {
// This is a projected type `<Foo as SomeTrait>::X`.