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:
commit
37e0d138cf
149 changed files with 259 additions and 280 deletions
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "rustc_middle"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
|
|
|
@ -25,7 +25,7 @@ pub mod lib_features {
|
|||
self.stability
|
||||
.to_sorted_stable_ord()
|
||||
.iter()
|
||||
.map(|(&sym, &(stab, _))| (sym, stab))
|
||||
.map(|&(&sym, &(stab, _))| (sym, stab))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ impl<'tcx> MonoItem<'tcx> {
|
|||
/// Returns the item's `CrateNum`
|
||||
pub fn krate(&self) -> CrateNum {
|
||||
match self {
|
||||
MonoItem::Fn(ref instance) => instance.def_id().krate,
|
||||
MonoItem::Fn(instance) => instance.def_id().krate,
|
||||
MonoItem::Static(def_id) => def_id.krate,
|
||||
MonoItem::GlobalAsm(..) => LOCAL_CRATE,
|
||||
}
|
||||
|
|
|
@ -970,7 +970,7 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
}
|
||||
FalseEdge { .. } => write!(fmt, "falseEdge"),
|
||||
FalseUnwind { .. } => write!(fmt, "falseUnwind"),
|
||||
InlineAsm { template, ref operands, options, .. } => {
|
||||
InlineAsm { template, operands, options, .. } => {
|
||||
write!(fmt, "asm!(\"{}\"", InlineAsmTemplatePiece::to_string(template))?;
|
||||
for op in operands {
|
||||
write!(fmt, ", ")?;
|
||||
|
|
|
@ -226,7 +226,7 @@ impl<O> AssertKind<O> {
|
|||
{
|
||||
use AssertKind::*;
|
||||
match self {
|
||||
BoundsCheck { ref len, ref index } => write!(
|
||||
BoundsCheck { len, index } => write!(
|
||||
f,
|
||||
"\"index out of bounds: the length is {{}} but the index is {{}}\", {len:?}, {index:?}"
|
||||
),
|
||||
|
|
|
@ -443,7 +443,7 @@ macro_rules! make_mir_visitor {
|
|||
location
|
||||
)
|
||||
}
|
||||
StatementKind::Intrinsic(box ref $($mutability)? intrinsic) => {
|
||||
StatementKind::Intrinsic(box intrinsic) => {
|
||||
match intrinsic {
|
||||
NonDivergingIntrinsic::Assume(op) => self.visit_operand(op, location),
|
||||
NonDivergingIntrinsic::CopyNonOverlapping(CopyNonOverlapping {
|
||||
|
@ -886,8 +886,8 @@ macro_rules! make_mir_visitor {
|
|||
self.visit_source_info(source_info);
|
||||
let location = Location::START;
|
||||
if let Some(box VarDebugInfoFragment {
|
||||
ref $($mutability)? ty,
|
||||
ref $($mutability)? projection
|
||||
ty,
|
||||
projection
|
||||
}) = composite {
|
||||
self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
|
||||
for elem in projection {
|
||||
|
|
|
@ -678,8 +678,7 @@ impl<'tcx> Pat<'tcx> {
|
|||
subpatterns.iter().for_each(|field| field.pattern.walk_(it))
|
||||
}
|
||||
Or { pats } => pats.iter().for_each(|p| p.walk_(it)),
|
||||
Array { box ref prefix, ref slice, box ref suffix }
|
||||
| Slice { box ref prefix, ref slice, box ref suffix } => {
|
||||
Array { box prefix, slice, box suffix } | Slice { box prefix, slice, box suffix } => {
|
||||
prefix.iter().chain(slice.as_deref()).chain(suffix.iter()).for_each(|p| p.walk_(it))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ pub fn walk_stmt<'thir, 'tcx: 'thir, V: Visitor<'thir, 'tcx>>(
|
|||
initializer,
|
||||
remainder_scope: _,
|
||||
init_scope: _,
|
||||
ref pattern,
|
||||
pattern,
|
||||
lint_level: _,
|
||||
else_block,
|
||||
span: _,
|
||||
|
|
|
@ -776,7 +776,7 @@ impl DynCompatibilityViolation {
|
|||
pub fn error_msg(&self) -> Cow<'static, str> {
|
||||
match self {
|
||||
DynCompatibilityViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
|
||||
DynCompatibilityViolation::SupertraitSelf(ref spans) => {
|
||||
DynCompatibilityViolation::SupertraitSelf(spans) => {
|
||||
if spans.iter().any(|sp| *sp != DUMMY_SP) {
|
||||
"it uses `Self` as a type parameter".into()
|
||||
} else {
|
||||
|
|
|
@ -447,23 +447,23 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for Ty<'tcx> {
|
|||
}
|
||||
ty::Slice(typ) => typ.visit_with(visitor),
|
||||
ty::Adt(_, args) => args.visit_with(visitor),
|
||||
ty::Dynamic(ref trait_ty, ref reg, _) => {
|
||||
ty::Dynamic(trait_ty, reg, _) => {
|
||||
try_visit!(trait_ty.visit_with(visitor));
|
||||
reg.visit_with(visitor)
|
||||
}
|
||||
ty::Tuple(ts) => ts.visit_with(visitor),
|
||||
ty::FnDef(_, args) => args.visit_with(visitor),
|
||||
ty::FnPtr(ref sig_tys, _) => sig_tys.visit_with(visitor),
|
||||
ty::UnsafeBinder(ref f) => f.visit_with(visitor),
|
||||
ty::FnPtr(sig_tys, _) => sig_tys.visit_with(visitor),
|
||||
ty::UnsafeBinder(f) => f.visit_with(visitor),
|
||||
ty::Ref(r, ty, _) => {
|
||||
try_visit!(r.visit_with(visitor));
|
||||
ty.visit_with(visitor)
|
||||
}
|
||||
ty::Coroutine(_did, ref args) => args.visit_with(visitor),
|
||||
ty::CoroutineWitness(_did, ref args) => args.visit_with(visitor),
|
||||
ty::Closure(_did, ref args) => args.visit_with(visitor),
|
||||
ty::CoroutineClosure(_did, ref args) => args.visit_with(visitor),
|
||||
ty::Alias(_, ref data) => data.visit_with(visitor),
|
||||
ty::Coroutine(_did, args) => args.visit_with(visitor),
|
||||
ty::CoroutineWitness(_did, args) => args.visit_with(visitor),
|
||||
ty::Closure(_did, args) => args.visit_with(visitor),
|
||||
ty::CoroutineClosure(_did, args) => args.visit_with(visitor),
|
||||
ty::Alias(_, data) => data.visit_with(visitor),
|
||||
|
||||
ty::Pat(ty, pat) => {
|
||||
try_visit!(ty.visit_with(visitor));
|
||||
|
|
|
@ -1149,7 +1149,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
#[inline]
|
||||
pub fn is_param(self, index: u32) -> bool {
|
||||
match self.kind() {
|
||||
ty::Param(ref data) => data.index == index,
|
||||
ty::Param(data) => data.index == index,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue