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]
|
[package]
|
||||||
name = "rustc-main"
|
name = "rustc-main"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -65,7 +65,7 @@ fn main() {
|
||||||
// linking, so we need to explicitly depend on the function.
|
// linking, so we need to explicitly depend on the function.
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn _rjem_je_zone_register();
|
fn _rjem_je_zone_register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_abi"
|
name = "rustc_abi"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -329,19 +329,19 @@ impl TargetDataLayout {
|
||||||
[p] if p.starts_with('P') => {
|
[p] if p.starts_with('P') => {
|
||||||
dl.instruction_address_space = parse_address_space(&p[1..], "P")?
|
dl.instruction_address_space = parse_address_space(&p[1..], "P")?
|
||||||
}
|
}
|
||||||
["a", ref a @ ..] => dl.aggregate_align = parse_align(a, "a")?,
|
["a", a @ ..] => dl.aggregate_align = parse_align(a, "a")?,
|
||||||
["f16", ref a @ ..] => dl.f16_align = parse_align(a, "f16")?,
|
["f16", a @ ..] => dl.f16_align = parse_align(a, "f16")?,
|
||||||
["f32", ref a @ ..] => dl.f32_align = parse_align(a, "f32")?,
|
["f32", a @ ..] => dl.f32_align = parse_align(a, "f32")?,
|
||||||
["f64", ref a @ ..] => dl.f64_align = parse_align(a, "f64")?,
|
["f64", a @ ..] => dl.f64_align = parse_align(a, "f64")?,
|
||||||
["f128", ref a @ ..] => dl.f128_align = parse_align(a, "f128")?,
|
["f128", a @ ..] => dl.f128_align = parse_align(a, "f128")?,
|
||||||
// FIXME(erikdesjardins): we should be parsing nonzero address spaces
|
// FIXME(erikdesjardins): we should be parsing nonzero address spaces
|
||||||
// this will require replacing TargetDataLayout::{pointer_size,pointer_align}
|
// this will require replacing TargetDataLayout::{pointer_size,pointer_align}
|
||||||
// with e.g. `fn pointer_size_in(AddressSpace)`
|
// with e.g. `fn pointer_size_in(AddressSpace)`
|
||||||
[p @ "p", s, ref a @ ..] | [p @ "p0", s, ref a @ ..] => {
|
[p @ "p", s, a @ ..] | [p @ "p0", s, a @ ..] => {
|
||||||
dl.pointer_size = parse_size(s, p)?;
|
dl.pointer_size = parse_size(s, p)?;
|
||||||
dl.pointer_align = parse_align(a, p)?;
|
dl.pointer_align = parse_align(a, p)?;
|
||||||
}
|
}
|
||||||
[s, ref a @ ..] if s.starts_with('i') => {
|
[s, a @ ..] if s.starts_with('i') => {
|
||||||
let Ok(bits) = s[1..].parse::<u64>() else {
|
let Ok(bits) = s[1..].parse::<u64>() else {
|
||||||
parse_size(&s[1..], "i")?; // For the user error.
|
parse_size(&s[1..], "i")?; // For the user error.
|
||||||
continue;
|
continue;
|
||||||
|
@ -362,7 +362,7 @@ impl TargetDataLayout {
|
||||||
dl.i128_align = a;
|
dl.i128_align = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[s, ref a @ ..] if s.starts_with('v') => {
|
[s, a @ ..] if s.starts_with('v') => {
|
||||||
let v_size = parse_size(&s[1..], "v")?;
|
let v_size = parse_size(&s[1..], "v")?;
|
||||||
let a = parse_align(a, s)?;
|
let a = parse_align(a, s)?;
|
||||||
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
|
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
|
||||||
|
@ -1802,7 +1802,7 @@ where
|
||||||
variants,
|
variants,
|
||||||
max_repr_align,
|
max_repr_align,
|
||||||
unadjusted_abi_align,
|
unadjusted_abi_align,
|
||||||
ref randomization_seed,
|
randomization_seed,
|
||||||
} = self;
|
} = self;
|
||||||
f.debug_struct("Layout")
|
f.debug_struct("Layout")
|
||||||
.field("size", size)
|
.field("size", size)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_arena"
|
name = "rustc_arena"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_ast"
|
name = "rustc_ast"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -597,7 +597,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(
|
||||||
visit_opt!(visitor, visit_ident, rename);
|
visit_opt!(visitor, visit_ident, rename);
|
||||||
}
|
}
|
||||||
UseTreeKind::Glob => {}
|
UseTreeKind::Glob => {}
|
||||||
UseTreeKind::Nested { ref items, span: _ } => {
|
UseTreeKind::Nested { items, span: _ } => {
|
||||||
for &(ref nested_tree, nested_id) in items {
|
for &(ref nested_tree, nested_id) in items {
|
||||||
try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
|
try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_ast_ir"
|
name = "rustc_ast_ir"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_ast_lowering"
|
name = "rustc_ast_lowering"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_ast_passes"
|
name = "rustc_ast_passes"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_ast_pretty"
|
name = "rustc_ast_pretty"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_attr_data_structures"
|
name = "rustc_attr_data_structures"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_attr_parsing"
|
name = "rustc_attr_parsing"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_baked_icu_data"
|
name = "rustc_baked_icu_data"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_borrowck"
|
name = "rustc_borrowck"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -2617,7 +2617,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||||
if let hir::Pat { kind: hir::PatKind::Binding(_, hir_id, _ident, _), .. } =
|
if let hir::Pat { kind: hir::PatKind::Binding(_, hir_id, _ident, _), .. } =
|
||||||
local.pat
|
local.pat
|
||||||
&& let Some(init) = local.init
|
&& let Some(init) = local.init
|
||||||
&& let hir::Expr {
|
&& let &hir::Expr {
|
||||||
kind:
|
kind:
|
||||||
hir::ExprKind::Closure(&hir::Closure {
|
hir::ExprKind::Closure(&hir::Closure {
|
||||||
kind: hir::ClosureKind::Closure,
|
kind: hir::ClosureKind::Closure,
|
||||||
|
|
|
@ -262,7 +262,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
|
||||||
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
|
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
|
||||||
if let hir::ExprKind::If(cond, _conseq, _alt)
|
if let hir::ExprKind::If(cond, _conseq, _alt)
|
||||||
| hir::ExprKind::Loop(
|
| hir::ExprKind::Loop(
|
||||||
hir::Block {
|
&hir::Block {
|
||||||
expr:
|
expr:
|
||||||
Some(&hir::Expr {
|
Some(&hir::Expr {
|
||||||
kind: hir::ExprKind::If(cond, _conseq, _alt),
|
kind: hir::ExprKind::If(cond, _conseq, _alt),
|
||||||
|
|
|
@ -1126,7 +1126,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||||
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
|
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
|
||||||
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
|
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
|
||||||
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
|
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
|
||||||
if let hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
|
if let &hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
|
||||||
for (captured_place, place) in
|
for (captured_place, place) in
|
||||||
self.infcx.tcx.closure_captures(def_id).iter().zip(places)
|
self.infcx.tcx.closure_captures(def_id).iter().zip(places)
|
||||||
{
|
{
|
||||||
|
|
|
@ -681,7 +681,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
|
||||||
let mir_hir_id = self.mir_hir_id();
|
let mir_hir_id = self.mir_hir_id();
|
||||||
|
|
||||||
let (return_span, mir_description, hir_ty) = match tcx.hir_node(mir_hir_id) {
|
let (return_span, mir_description, hir_ty) = match tcx.hir_node(mir_hir_id) {
|
||||||
hir::Node::Expr(hir::Expr {
|
hir::Node::Expr(&hir::Expr {
|
||||||
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl, kind, fn_decl_span, .. }),
|
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl, kind, fn_decl_span, .. }),
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -873,7 +873,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
|
||||||
.name;
|
.name;
|
||||||
|
|
||||||
let yield_span = match tcx.hir_node(self.mir_hir_id()) {
|
let yield_span = match tcx.hir_node(self.mir_hir_id()) {
|
||||||
hir::Node::Expr(hir::Expr {
|
hir::Node::Expr(&hir::Expr {
|
||||||
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
||||||
..
|
..
|
||||||
}) => tcx.sess.source_map().end_point(fn_decl_span),
|
}) => tcx.sess.source_map().end_point(fn_decl_span),
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||||
|
|
||||||
/// Returns an iterator over all the RegionVids corresponding to
|
/// Returns an iterator over all the RegionVids corresponding to
|
||||||
/// universally quantified free regions.
|
/// universally quantified free regions.
|
||||||
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> {
|
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> + use<> {
|
||||||
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
|
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_builtin_macros"
|
name = "rustc_builtin_macros"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_codegen_llvm"
|
name = "rustc_codegen_llvm"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
test = false
|
test = false
|
||||||
|
|
|
@ -7,7 +7,7 @@ use super::ffi::{BasicBlock, Metadata, Module, Type, Value};
|
||||||
use crate::llvm::Bool;
|
use crate::llvm::Bool;
|
||||||
|
|
||||||
#[link(name = "llvm-wrapper", kind = "static")]
|
#[link(name = "llvm-wrapper", kind = "static")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
// Enzyme
|
// Enzyme
|
||||||
pub(crate) fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
|
pub(crate) fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
|
||||||
pub(crate) fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
|
pub(crate) fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
|
||||||
|
@ -18,7 +18,7 @@ extern "C" {
|
||||||
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
|
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
// Enzyme
|
// Enzyme
|
||||||
pub(crate) fn LLVMDumpModule(M: &Module);
|
pub(crate) fn LLVMDumpModule(M: &Module);
|
||||||
pub(crate) fn LLVMDumpValue(V: &Value);
|
pub(crate) fn LLVMDumpValue(V: &Value);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_codegen_ssa"
|
name = "rustc_codegen_ssa"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -183,11 +183,11 @@ fn exported_symbols_provider_local(
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut symbols: Vec<_> =
|
let mut symbols: Vec<_> =
|
||||||
sorted.iter().map(|(&def_id, &info)| (ExportedSymbol::NonGeneric(def_id), info)).collect();
|
sorted.iter().map(|&(&def_id, &info)| (ExportedSymbol::NonGeneric(def_id), info)).collect();
|
||||||
|
|
||||||
// Export TLS shims
|
// Export TLS shims
|
||||||
if !tcx.sess.target.dll_tls_export {
|
if !tcx.sess.target.dll_tls_export {
|
||||||
symbols.extend(sorted.iter().filter_map(|(&def_id, &info)| {
|
symbols.extend(sorted.iter().filter_map(|&(&def_id, &info)| {
|
||||||
tcx.needs_thread_local_shim(def_id).then(|| {
|
tcx.needs_thread_local_shim(def_id).then(|| {
|
||||||
(
|
(
|
||||||
ExportedSymbol::ThreadLocalShim(def_id),
|
ExportedSymbol::ThreadLocalShim(def_id),
|
||||||
|
|
|
@ -894,7 +894,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
|
||||||
let [mode, input_activities @ .., ret_activity] = &list[..] else {
|
let [mode, input_activities @ .., ret_activity] = &list[..] else {
|
||||||
span_bug!(attr.span, "rustc_autodiff attribute must contain mode and activities");
|
span_bug!(attr.span, "rustc_autodiff attribute must contain mode and activities");
|
||||||
};
|
};
|
||||||
let mode = if let MetaItemInner::MetaItem(MetaItem { path: ref p1, .. }) = mode {
|
let mode = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = mode {
|
||||||
p1.segments.first().unwrap().ident
|
p1.segments.first().unwrap().ident
|
||||||
} else {
|
} else {
|
||||||
span_bug!(attr.span, "rustc_autodiff attribute must contain mode");
|
span_bug!(attr.span, "rustc_autodiff attribute must contain mode");
|
||||||
|
@ -910,7 +910,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// First read the ret symbol from the attribute
|
// First read the ret symbol from the attribute
|
||||||
let ret_symbol = if let MetaItemInner::MetaItem(MetaItem { path: ref p1, .. }) = ret_activity {
|
let ret_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = ret_activity {
|
||||||
p1.segments.first().unwrap().ident
|
p1.segments.first().unwrap().ident
|
||||||
} else {
|
} else {
|
||||||
span_bug!(attr.span, "rustc_autodiff attribute must contain the return activity");
|
span_bug!(attr.span, "rustc_autodiff attribute must contain the return activity");
|
||||||
|
@ -924,7 +924,7 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
|
||||||
// Now parse all the intermediate (input) activities
|
// Now parse all the intermediate (input) activities
|
||||||
let mut arg_activities: Vec<DiffActivity> = vec![];
|
let mut arg_activities: Vec<DiffActivity> = vec![];
|
||||||
for arg in input_activities {
|
for arg in input_activities {
|
||||||
let arg_symbol = if let MetaItemInner::MetaItem(MetaItem { path: ref p2, .. }) = arg {
|
let arg_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p2, .. }) = arg {
|
||||||
match p2.segments.first() {
|
match p2.segments.first() {
|
||||||
Some(x) => x.ident,
|
Some(x) => x.ident,
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -720,14 +720,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
|
|
||||||
// Put together the arguments to the panic entry point.
|
// Put together the arguments to the panic entry point.
|
||||||
let (lang_item, args) = match msg {
|
let (lang_item, args) = match msg {
|
||||||
AssertKind::BoundsCheck { ref len, ref index } => {
|
AssertKind::BoundsCheck { len, index } => {
|
||||||
let len = self.codegen_operand(bx, len).immediate();
|
let len = self.codegen_operand(bx, len).immediate();
|
||||||
let index = self.codegen_operand(bx, index).immediate();
|
let index = self.codegen_operand(bx, index).immediate();
|
||||||
// It's `fn panic_bounds_check(index: usize, len: usize)`,
|
// It's `fn panic_bounds_check(index: usize, len: usize)`,
|
||||||
// and `#[track_caller]` adds an implicit third argument.
|
// and `#[track_caller]` adds an implicit third argument.
|
||||||
(LangItem::PanicBoundsCheck, vec![index, len, location])
|
(LangItem::PanicBoundsCheck, vec![index, len, location])
|
||||||
}
|
}
|
||||||
AssertKind::MisalignedPointerDereference { ref required, ref found } => {
|
AssertKind::MisalignedPointerDereference { required, found } => {
|
||||||
let required = self.codegen_operand(bx, required).immediate();
|
let required = self.codegen_operand(bx, required).immediate();
|
||||||
let found = self.codegen_operand(bx, found).immediate();
|
let found = self.codegen_operand(bx, found).immediate();
|
||||||
// It's `fn panic_misaligned_pointer_dereference(required: usize, found: usize)`,
|
// It's `fn panic_misaligned_pointer_dereference(required: usize, found: usize)`,
|
||||||
|
|
|
@ -584,7 +584,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
// Moves out of scalar and scalar pair fields are trivial.
|
// Moves out of scalar and scalar pair fields are trivial.
|
||||||
for elem in place_ref.projection.iter() {
|
for elem in place_ref.projection.iter() {
|
||||||
match elem {
|
match elem {
|
||||||
mir::ProjectionElem::Field(ref f, _) => {
|
mir::ProjectionElem::Field(f, _) => {
|
||||||
assert!(
|
assert!(
|
||||||
!o.layout.ty.is_any_ptr(),
|
!o.layout.ty.is_any_ptr(),
|
||||||
"Bad PlaceRef: destructing pointers should use cast/PtrMetadata, \
|
"Bad PlaceRef: destructing pointers should use cast/PtrMetadata, \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_const_eval"
|
name = "rustc_const_eval"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -502,12 +502,10 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
|
||||||
RemainderByZero(op) => RemainderByZero(eval_to_int(op)?),
|
RemainderByZero(op) => RemainderByZero(eval_to_int(op)?),
|
||||||
ResumedAfterReturn(coroutine_kind) => ResumedAfterReturn(*coroutine_kind),
|
ResumedAfterReturn(coroutine_kind) => ResumedAfterReturn(*coroutine_kind),
|
||||||
ResumedAfterPanic(coroutine_kind) => ResumedAfterPanic(*coroutine_kind),
|
ResumedAfterPanic(coroutine_kind) => ResumedAfterPanic(*coroutine_kind),
|
||||||
MisalignedPointerDereference { ref required, ref found } => {
|
MisalignedPointerDereference { required, found } => MisalignedPointerDereference {
|
||||||
MisalignedPointerDereference {
|
required: eval_to_int(required)?,
|
||||||
required: eval_to_int(required)?,
|
found: eval_to_int(found)?,
|
||||||
found: eval_to_int(found)?,
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
NullPointerDereference => NullPointerDereference,
|
NullPointerDereference => NullPointerDereference,
|
||||||
};
|
};
|
||||||
Err(ConstEvalErrKind::AssertFailure(err)).into()
|
Err(ConstEvalErrKind::AssertFailure(err)).into()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_data_structures"
|
name = "rustc_data_structures"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -133,7 +133,7 @@ impl<N: Idx, S: Idx + Ord, A: Annotation> Sccs<N, S, A> {
|
||||||
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
|
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
|
||||||
/// This is convenient when the edges represent dependencies: when you visit
|
/// This is convenient when the edges represent dependencies: when you visit
|
||||||
/// `S1`, the value for `S2` will already have been computed.
|
/// `S1`, the value for `S2` will already have been computed.
|
||||||
pub fn all_sccs(&self) -> impl Iterator<Item = S> {
|
pub fn all_sccs(&self) -> impl Iterator<Item = S> + use<N, S, A> {
|
||||||
(0..self.scc_data.len()).map(S::new)
|
(0..self.scc_data.len()).map(S::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn test_sorted_index_multi_map() {
|
||||||
// `get_by_key` returns items in insertion order.
|
// `get_by_key` returns items in insertion order.
|
||||||
let twos: Vec<_> = set.get_by_key_enumerated(2).collect();
|
let twos: Vec<_> = set.get_by_key_enumerated(2).collect();
|
||||||
let idxs: Vec<usize> = twos.iter().map(|(i, _)| *i).collect();
|
let idxs: Vec<usize> = twos.iter().map(|(i, _)| *i).collect();
|
||||||
let values: Vec<usize> = twos.iter().map(|(_, &v)| v).collect();
|
let values: Vec<usize> = twos.iter().map(|&(_, &v)| v).collect();
|
||||||
|
|
||||||
assert_eq!(idxs, vec![0, 2, 4]);
|
assert_eq!(idxs, vec![0, 2, 4]);
|
||||||
assert_eq!(values, vec![0, 1, 2]);
|
assert_eq!(values, vec![0, 1, 2]);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_driver"
|
name = "rustc_driver"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_driver_impl"
|
name = "rustc_driver_impl"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_error_codes"
|
name = "rustc_error_codes"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_error_messages"
|
name = "rustc_error_messages"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_errors"
|
name = "rustc_errors"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_expand"
|
name = "rustc_expand"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
build = false
|
build = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -258,7 +258,7 @@ pub(super) fn transcribe<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the meta-var with the matched token tree from the invocation.
|
// Replace the meta-var with the matched token tree from the invocation.
|
||||||
mbe::TokenTree::MetaVar(mut sp, mut original_ident) => {
|
&mbe::TokenTree::MetaVar(mut sp, mut original_ident) => {
|
||||||
// Find the matched nonterminal from the macro invocation, and use it to replace
|
// Find the matched nonterminal from the macro invocation, and use it to replace
|
||||||
// the meta-var.
|
// the meta-var.
|
||||||
//
|
//
|
||||||
|
@ -376,7 +376,7 @@ pub(super) fn transcribe<'a>(
|
||||||
// We will produce all of the results of the inside of the `Delimited` and then we will
|
// We will produce all of the results of the inside of the `Delimited` and then we will
|
||||||
// jump back out of the Delimited, pop the result_stack and add the new results back to
|
// jump back out of the Delimited, pop the result_stack and add the new results back to
|
||||||
// the previous results (from outside the Delimited).
|
// the previous results (from outside the Delimited).
|
||||||
mbe::TokenTree::Delimited(mut span, spacing, delimited) => {
|
&mbe::TokenTree::Delimited(mut span, ref spacing, ref delimited) => {
|
||||||
mut_visit::visit_delim_span(&mut marker, &mut span);
|
mut_visit::visit_delim_span(&mut marker, &mut span);
|
||||||
stack.push(Frame::new_delimited(delimited, span, *spacing));
|
stack.push(Frame::new_delimited(delimited, span, *spacing));
|
||||||
result_stack.push(mem::take(&mut result));
|
result_stack.push(mem::take(&mut result));
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl<T> pm::bridge::server::MessagePipe<T> for MessagePipe<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy {
|
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy + use<> {
|
||||||
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
|
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
|
||||||
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
|
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
|
||||||
== ProcMacroExecutionStrategy::CrossThread,
|
== ProcMacroExecutionStrategy::CrossThread,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_feature"
|
name = "rustc_feature"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_fluent_macro"
|
name = "rustc_fluent_macro"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_fs_util"
|
name = "rustc_fs_util"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_graphviz"
|
name = "rustc_graphviz"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_hashes"
|
name = "rustc_hashes"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_hir"
|
name = "rustc_hir"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -9,11 +9,11 @@ macro_rules! define_tests {
|
||||||
let unambig = $kind::$variant::<'_, ()> { $($init)* };
|
let unambig = $kind::$variant::<'_, ()> { $($init)* };
|
||||||
let unambig_to_ambig = unsafe { std::mem::transmute::<_, $kind<'_, AmbigArg>>(unambig) };
|
let unambig_to_ambig = unsafe { std::mem::transmute::<_, $kind<'_, AmbigArg>>(unambig) };
|
||||||
|
|
||||||
assert!(matches!(&unambig_to_ambig, $kind::$variant { $($init)* }));
|
assert!(matches!(&unambig_to_ambig, &$kind::$variant { $($init)* }));
|
||||||
|
|
||||||
let ambig_to_unambig = unsafe { std::mem::transmute::<_, $kind<'_, ()>>(unambig_to_ambig) };
|
let ambig_to_unambig = unsafe { std::mem::transmute::<_, $kind<'_, ()>>(unambig_to_ambig) };
|
||||||
|
|
||||||
assert!(matches!(&ambig_to_unambig, $kind::$variant { $($init)* }));
|
assert!(matches!(&ambig_to_unambig, &$kind::$variant { $($init)* }));
|
||||||
}
|
}
|
||||||
)*};
|
)*};
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,9 +593,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
|
||||||
defaultness: _,
|
defaultness: _,
|
||||||
polarity: _,
|
polarity: _,
|
||||||
defaultness_span: _,
|
defaultness_span: _,
|
||||||
ref generics,
|
generics,
|
||||||
ref of_trait,
|
of_trait,
|
||||||
ref self_ty,
|
self_ty,
|
||||||
items,
|
items,
|
||||||
}) => {
|
}) => {
|
||||||
try_visit!(visitor.visit_id(item.hir_id()));
|
try_visit!(visitor.visit_id(item.hir_id()));
|
||||||
|
@ -1045,7 +1045,7 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(
|
||||||
}
|
}
|
||||||
GenericParamKind::Const { ref ty, ref default, synthetic: _ } => {
|
GenericParamKind::Const { ref ty, ref default, synthetic: _ } => {
|
||||||
try_visit!(visitor.visit_ty_unambig(ty));
|
try_visit!(visitor.visit_ty_unambig(ty));
|
||||||
if let Some(ref default) = default {
|
if let Some(default) = default {
|
||||||
try_visit!(visitor.visit_const_param_default(param.hir_id, default));
|
try_visit!(visitor.visit_const_param_default(param.hir_id, default));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1401,8 +1401,8 @@ pub fn walk_assoc_item_constraint<'v, V: Visitor<'v>>(
|
||||||
try_visit!(visitor.visit_generic_args(constraint.gen_args));
|
try_visit!(visitor.visit_generic_args(constraint.gen_args));
|
||||||
match constraint.kind {
|
match constraint.kind {
|
||||||
AssocItemConstraintKind::Equality { ref term } => match term {
|
AssocItemConstraintKind::Equality { ref term } => match term {
|
||||||
Term::Ty(ref ty) => try_visit!(visitor.visit_ty_unambig(ty)),
|
Term::Ty(ty) => try_visit!(visitor.visit_ty_unambig(ty)),
|
||||||
Term::Const(ref c) => try_visit!(visitor.visit_const_arg_unambig(c)),
|
Term::Const(c) => try_visit!(visitor.visit_const_arg_unambig(c)),
|
||||||
},
|
},
|
||||||
AssocItemConstraintKind::Bound { bounds } => {
|
AssocItemConstraintKind::Bound { bounds } => {
|
||||||
walk_list!(visitor, visit_param_bound, bounds)
|
walk_list!(visitor, visit_param_bound, bounds)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_hir_analysis"
|
name = "rustc_hir_analysis"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
test = false
|
test = false
|
||||||
|
|
|
@ -106,7 +106,7 @@ fn anon_const_type_of<'tcx>(icx: &ItemCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node::Variant(Variant { disr_expr: Some(ref e), .. }) if e.hir_id == hir_id => {
|
Node::Variant(Variant { disr_expr: Some(e), .. }) if e.hir_id == hir_id => {
|
||||||
tcx.adt_def(tcx.hir_get_parent_item(hir_id)).repr().discr_type().to_ty(tcx)
|
tcx.adt_def(tcx.hir_get_parent_item(hir_id)).repr().discr_type().to_ty(tcx)
|
||||||
}
|
}
|
||||||
// Sort of affects the type system, but only for the purpose of diagnostics
|
// Sort of affects the type system, but only for the purpose of diagnostics
|
||||||
|
|
|
@ -1226,11 +1226,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
adt_def.variants().iter().find(|s| s.name == variant_name)
|
adt_def.variants().iter().find(|s| s.name == variant_name)
|
||||||
{
|
{
|
||||||
let mut suggestion = vec![(assoc_ident.span, variant_name.to_string())];
|
let mut suggestion = vec![(assoc_ident.span, variant_name.to_string())];
|
||||||
if let hir::Node::Stmt(hir::Stmt {
|
if let hir::Node::Stmt(&hir::Stmt {
|
||||||
kind: hir::StmtKind::Semi(ref expr),
|
kind: hir::StmtKind::Semi(expr), ..
|
||||||
..
|
|
||||||
})
|
})
|
||||||
| hir::Node::Expr(ref expr) = tcx.parent_hir_node(hir_ref_id)
|
| hir::Node::Expr(expr) = tcx.parent_hir_node(hir_ref_id)
|
||||||
&& let hir::ExprKind::Struct(..) = expr.kind
|
&& let hir::ExprKind::Struct(..) = expr.kind
|
||||||
{
|
{
|
||||||
match variant.ctor {
|
match variant.ctor {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_hir_pretty"
|
name = "rustc_hir_pretty"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1856,7 +1856,7 @@ impl<'a> State<'a> {
|
||||||
self.word_space("=");
|
self.word_space("=");
|
||||||
match term {
|
match term {
|
||||||
Term::Ty(ty) => self.print_type(ty),
|
Term::Ty(ty) => self.print_type(ty),
|
||||||
Term::Const(ref c) => self.print_const_arg(c),
|
Term::Const(c) => self.print_const_arg(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::AssocItemConstraintKind::Bound { bounds } => {
|
hir::AssocItemConstraintKind::Bound { bounds } => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_hir_typeck"
|
name = "rustc_hir_typeck"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -346,7 +346,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let fn_decl_span = if let hir::Node::Expr(hir::Expr {
|
let fn_decl_span = if let hir::Node::Expr(&hir::Expr {
|
||||||
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
||||||
..
|
..
|
||||||
}) = self.tcx.parent_hir_node(hir_id)
|
}) = self.tcx.parent_hir_node(hir_id)
|
||||||
|
@ -371,7 +371,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
{
|
{
|
||||||
// Actually need to unwrap one more layer of HIR to get to
|
// Actually need to unwrap one more layer of HIR to get to
|
||||||
// the _real_ closure...
|
// the _real_ closure...
|
||||||
if let hir::Node::Expr(hir::Expr {
|
if let hir::Node::Expr(&hir::Expr {
|
||||||
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
kind: hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }),
|
||||||
..
|
..
|
||||||
}) = self.tcx.parent_hir_node(parent_hir_id)
|
}) = self.tcx.parent_hir_node(parent_hir_id)
|
||||||
|
|
|
@ -1887,7 +1887,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
|
||||||
let parent_id = fcx.tcx.parent_hir_id(block_or_return_id);
|
let parent_id = fcx.tcx.parent_hir_id(block_or_return_id);
|
||||||
let parent = fcx.tcx.hir_node(parent_id);
|
let parent = fcx.tcx.hir_node(parent_id);
|
||||||
if let Some(expr) = expression
|
if let Some(expr) = expression
|
||||||
&& let hir::Node::Expr(hir::Expr {
|
&& let hir::Node::Expr(&hir::Expr {
|
||||||
kind: hir::ExprKind::Closure(&hir::Closure { body, .. }),
|
kind: hir::ExprKind::Closure(&hir::Closure { body, .. }),
|
||||||
..
|
..
|
||||||
}) = parent
|
}) = parent
|
||||||
|
|
|
@ -577,9 +577,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let mut parent;
|
let mut parent;
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
// Climb the HIR tree to see if the current `Expr` is part of a `break;` statement.
|
// Climb the HIR tree to see if the current `Expr` is part of a `break;` statement.
|
||||||
let (hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Semi(&ref p), .. })
|
let (hir::Node::Stmt(&hir::Stmt { kind: hir::StmtKind::Semi(p), .. })
|
||||||
| hir::Node::Block(hir::Block { expr: Some(&ref p), .. })
|
| hir::Node::Block(&hir::Block { expr: Some(p), .. })
|
||||||
| hir::Node::Expr(&ref p)) = self.tcx.hir_node(parent_id)
|
| hir::Node::Expr(p)) = self.tcx.hir_node(parent_id)
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
@ -593,13 +593,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
loop {
|
loop {
|
||||||
// Climb the HIR tree to find the (desugared) `loop` this `break` corresponds to.
|
// Climb the HIR tree to find the (desugared) `loop` this `break` corresponds to.
|
||||||
let parent = match self.tcx.hir_node(parent_id) {
|
let parent = match self.tcx.hir_node(parent_id) {
|
||||||
hir::Node::Expr(&ref parent) => {
|
hir::Node::Expr(parent) => {
|
||||||
parent_id = self.tcx.parent_hir_id(parent.hir_id);
|
parent_id = self.tcx.parent_hir_id(parent.hir_id);
|
||||||
parent
|
parent
|
||||||
}
|
}
|
||||||
hir::Node::Stmt(hir::Stmt {
|
hir::Node::Stmt(hir::Stmt {
|
||||||
hir_id,
|
hir_id,
|
||||||
kind: hir::StmtKind::Semi(&ref parent) | hir::StmtKind::Expr(&ref parent),
|
kind: hir::StmtKind::Semi(parent) | hir::StmtKind::Expr(parent),
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
parent_id = self.tcx.parent_hir_id(*hir_id);
|
parent_id = self.tcx.parent_hir_id(*hir_id);
|
||||||
|
|
|
@ -503,7 +503,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
||||||
let unit_errors = remaining_errors_if_fallback_to(self.tcx.types.unit);
|
let unit_errors = remaining_errors_if_fallback_to(self.tcx.types.unit);
|
||||||
if unit_errors.is_empty()
|
if unit_errors.is_empty()
|
||||||
&& let mut never_errors = remaining_errors_if_fallback_to(self.tcx.types.never)
|
&& let mut never_errors = remaining_errors_if_fallback_to(self.tcx.types.never)
|
||||||
&& let [ref mut never_error, ..] = never_errors.as_mut_slice()
|
&& let [never_error, ..] = never_errors.as_mut_slice()
|
||||||
{
|
{
|
||||||
self.adjust_fulfillment_error_for_expr_obligation(never_error);
|
self.adjust_fulfillment_error_for_expr_obligation(never_error);
|
||||||
let sugg = self.try_to_suggest_annotations(diverging_vids, coercions);
|
let sugg = self.try_to_suggest_annotations(diverging_vids, coercions);
|
||||||
|
|
|
@ -873,7 +873,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
fn assemble_inherent_candidates_from_object(&mut self, self_ty: Ty<'tcx>) {
|
fn assemble_inherent_candidates_from_object(&mut self, self_ty: Ty<'tcx>) {
|
||||||
let principal = match self_ty.kind() {
|
let principal = match self_ty.kind() {
|
||||||
ty::Dynamic(ref data, ..) => Some(data),
|
ty::Dynamic(data, ..) => Some(data),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
.and_then(|data| data.principal())
|
.and_then(|data| data.principal())
|
||||||
|
|
|
@ -1586,10 +1586,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if let SelfSource::QPath(ty) = source
|
if let SelfSource::QPath(ty) = source
|
||||||
&& let hir::Node::Expr(ref path_expr) = self.tcx.parent_hir_node(ty.hir_id)
|
&& let hir::Node::Expr(ref path_expr) = self.tcx.parent_hir_node(ty.hir_id)
|
||||||
&& let hir::ExprKind::Path(_) = path_expr.kind
|
&& let hir::ExprKind::Path(_) = path_expr.kind
|
||||||
&& let hir::Node::Stmt(hir::Stmt {
|
&& let hir::Node::Stmt(&hir::Stmt { kind: hir::StmtKind::Semi(parent), .. })
|
||||||
kind: hir::StmtKind::Semi(ref parent), ..
|
| hir::Node::Expr(parent) = self.tcx.parent_hir_node(path_expr.hir_id)
|
||||||
})
|
|
||||||
| hir::Node::Expr(ref parent) = self.tcx.parent_hir_node(path_expr.hir_id)
|
|
||||||
{
|
{
|
||||||
let replacement_span =
|
let replacement_span =
|
||||||
if let hir::ExprKind::Call(..) | hir::ExprKind::Struct(..) = parent.kind {
|
if let hir::ExprKind::Call(..) | hir::ExprKind::Struct(..) = parent.kind {
|
||||||
|
@ -3149,8 +3147,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let mut derives_grouped = Vec::<(String, Span, String)>::new();
|
let mut derives_grouped = Vec::<(String, Span, String)>::new();
|
||||||
for (self_name, self_span, trait_name) in derives.into_iter() {
|
for (self_name, self_span, trait_name) in derives.into_iter() {
|
||||||
if let Some((last_self_name, _, ref mut last_trait_names)) = derives_grouped.last_mut()
|
if let Some((last_self_name, _, last_trait_names)) = derives_grouped.last_mut() {
|
||||||
{
|
|
||||||
if last_self_name == &self_name {
|
if last_self_name == &self_name {
|
||||||
last_trait_names.push_str(format!(", {trait_name}").as_str());
|
last_trait_names.push_str(format!(", {trait_name}").as_str());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -324,7 +324,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let PatInfo { binding_mode, max_ref_mutbl, top_info: ti, current_depth, .. } = pat_info;
|
let PatInfo { binding_mode, max_ref_mutbl, top_info: ti, current_depth, .. } = pat_info;
|
||||||
|
|
||||||
let path_res = match pat.kind {
|
let path_res = match pat.kind {
|
||||||
PatKind::Expr(PatExpr { kind: PatExprKind::Path(ref qpath), hir_id, span }) => {
|
PatKind::Expr(PatExpr { kind: PatExprKind::Path(qpath), hir_id, span }) => {
|
||||||
Some(self.resolve_ty_and_res_fully_qualified_call(qpath, *hir_id, *span))
|
Some(self.resolve_ty_and_res_fully_qualified_call(qpath, *hir_id, *span))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -344,7 +344,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
PatKind::Wild | PatKind::Err(_) => expected,
|
PatKind::Wild | PatKind::Err(_) => expected,
|
||||||
// We allow any type here; we ensure that the type is uninhabited during match checking.
|
// We allow any type here; we ensure that the type is uninhabited during match checking.
|
||||||
PatKind::Never => expected,
|
PatKind::Never => expected,
|
||||||
PatKind::Expr(PatExpr { kind: PatExprKind::Path(ref qpath), hir_id, span }) => {
|
PatKind::Expr(PatExpr { kind: PatExprKind::Path(qpath), hir_id, span }) => {
|
||||||
let ty = self.check_pat_path(
|
let ty = self.check_pat_path(
|
||||||
*hir_id,
|
*hir_id,
|
||||||
pat.hir_id,
|
pat.hir_id,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_incremental"
|
name = "rustc_incremental"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_index"
|
name = "rustc_index"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -723,7 +723,7 @@ impl<T: Idx> ChunkedBitSet<T> {
|
||||||
match self.chunks.get(chunk_index) {
|
match self.chunks.get(chunk_index) {
|
||||||
Some(Zeros(_chunk_domain_size)) => ChunkIter::Zeros,
|
Some(Zeros(_chunk_domain_size)) => ChunkIter::Zeros,
|
||||||
Some(Ones(chunk_domain_size)) => ChunkIter::Ones(0..*chunk_domain_size as usize),
|
Some(Ones(chunk_domain_size)) => ChunkIter::Ones(0..*chunk_domain_size as usize),
|
||||||
Some(Mixed(chunk_domain_size, _, ref words)) => {
|
Some(Mixed(chunk_domain_size, _, words)) => {
|
||||||
let num_words = num_words(*chunk_domain_size as usize);
|
let num_words = num_words(*chunk_domain_size as usize);
|
||||||
ChunkIter::Mixed(BitIter::new(&words[0..num_words]))
|
ChunkIter::Mixed(BitIter::new(&words[0..num_words]))
|
||||||
}
|
}
|
||||||
|
@ -752,11 +752,7 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
Mixed(
|
Mixed(self_chunk_domain_size, self_chunk_count, self_chunk_words),
|
||||||
self_chunk_domain_size,
|
|
||||||
ref mut self_chunk_count,
|
|
||||||
ref mut self_chunk_words,
|
|
||||||
),
|
|
||||||
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
||||||
) => {
|
) => {
|
||||||
// First check if the operation would change
|
// First check if the operation would change
|
||||||
|
@ -836,11 +832,7 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
|
||||||
Mixed(*self_chunk_domain_size, self_chunk_count, Rc::new(self_chunk_words));
|
Mixed(*self_chunk_domain_size, self_chunk_count, Rc::new(self_chunk_words));
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
Mixed(
|
Mixed(self_chunk_domain_size, self_chunk_count, self_chunk_words),
|
||||||
self_chunk_domain_size,
|
|
||||||
ref mut self_chunk_count,
|
|
||||||
ref mut self_chunk_words,
|
|
||||||
),
|
|
||||||
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
||||||
) => {
|
) => {
|
||||||
// See [`<Self as BitRelations<ChunkedBitSet<T>>>::union`] for the explanation
|
// See [`<Self as BitRelations<ChunkedBitSet<T>>>::union`] for the explanation
|
||||||
|
@ -891,11 +883,7 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
|
||||||
*self_chunk = other_chunk.clone();
|
*self_chunk = other_chunk.clone();
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
Mixed(
|
Mixed(self_chunk_domain_size, self_chunk_count, self_chunk_words),
|
||||||
self_chunk_domain_size,
|
|
||||||
ref mut self_chunk_count,
|
|
||||||
ref mut self_chunk_words,
|
|
||||||
),
|
|
||||||
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
Mixed(_other_chunk_domain_size, _other_chunk_count, other_chunk_words),
|
||||||
) => {
|
) => {
|
||||||
// See [`<Self as BitRelations<ChunkedBitSet<T>>>::union`] for the explanation
|
// See [`<Self as BitRelations<ChunkedBitSet<T>>>::union`] for the explanation
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_index_macros"
|
name = "rustc_index_macros"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_infer"
|
name = "rustc_infer"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_interface"
|
name = "rustc_interface"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -171,13 +171,15 @@ fn configure_and_expand(
|
||||||
new_path.push(path);
|
new_path.push(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
env::set_var(
|
unsafe {
|
||||||
"PATH",
|
env::set_var(
|
||||||
&env::join_paths(
|
"PATH",
|
||||||
new_path.iter().filter(|p| env::join_paths(iter::once(p)).is_ok()),
|
&env::join_paths(
|
||||||
)
|
new_path.iter().filter(|p| env::join_paths(iter::once(p)).is_ok()),
|
||||||
.unwrap(),
|
)
|
||||||
);
|
.unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the config for macro expansion
|
// Create the config for macro expansion
|
||||||
|
@ -216,7 +218,9 @@ fn configure_and_expand(
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
env::set_var("PATH", &old_path);
|
unsafe {
|
||||||
|
env::set_var("PATH", &old_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
krate
|
krate
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "rustc_lexer"
|
name = "rustc_lexer"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
repository = "https://github.com/rust-lang/rust/"
|
repository = "https://github.com/rust-lang/rust/"
|
||||||
description = """
|
description = """
|
||||||
Rust lexer used by rustc. No stability guarantees are provided.
|
Rust lexer used by rustc. No stability guarantees are provided.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_lint"
|
name = "rustc_lint"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -975,10 +975,8 @@ declare_lint! {
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #[no_mangle]
|
/// #[unsafe(no_mangle)]
|
||||||
/// fn foo<T>(t: T) {
|
/// fn foo<T>(t: T) {}
|
||||||
///
|
|
||||||
/// }
|
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// {{produces}}
|
/// {{produces}}
|
||||||
|
|
|
@ -35,12 +35,12 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// mod m {
|
/// mod m {
|
||||||
/// extern "C" {
|
/// unsafe extern "C" {
|
||||||
/// fn foo();
|
/// fn foo();
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// extern "C" {
|
/// unsafe extern "C" {
|
||||||
/// fn foo(_: u32);
|
/// fn foo(_: u32);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl EarlyLintPass for NonAsciiIdents {
|
||||||
#[allow(rustc::potential_query_instability)]
|
#[allow(rustc::potential_query_instability)]
|
||||||
let mut symbols: Vec<_> = symbols.iter().collect();
|
let mut symbols: Vec<_> = symbols.iter().collect();
|
||||||
symbols.sort_by_key(|k| k.1);
|
symbols.sort_by_key(|k| k.1);
|
||||||
for (symbol, &sp) in symbols.iter() {
|
for &(ref symbol, &sp) in symbols.iter() {
|
||||||
let symbol_str = symbol.as_str();
|
let symbol_str = symbol.as_str();
|
||||||
if symbol_str.is_ascii() {
|
if symbol_str.is_ascii() {
|
||||||
continue;
|
continue;
|
||||||
|
@ -242,7 +242,7 @@ impl EarlyLintPass for NonAsciiIdents {
|
||||||
UnordMap::with_capacity(symbols.len());
|
UnordMap::with_capacity(symbols.len());
|
||||||
let mut skeleton_buf = String::new();
|
let mut skeleton_buf = String::new();
|
||||||
|
|
||||||
for (&symbol, &sp) in symbols.iter() {
|
for &(&symbol, &sp) in symbols.iter() {
|
||||||
use unicode_security::confusable_detection::skeleton;
|
use unicode_security::confusable_detection::skeleton;
|
||||||
|
|
||||||
let symbol_str = symbol.as_str();
|
let symbol_str = symbol.as_str();
|
||||||
|
@ -298,7 +298,7 @@ impl EarlyLintPass for NonAsciiIdents {
|
||||||
script_states.insert(latin_augmented_script_set, ScriptSetUsage::Verified);
|
script_states.insert(latin_augmented_script_set, ScriptSetUsage::Verified);
|
||||||
|
|
||||||
let mut has_suspicious = false;
|
let mut has_suspicious = false;
|
||||||
for (symbol, &sp) in symbols.iter() {
|
for &(ref symbol, &sp) in symbols.iter() {
|
||||||
let symbol_str = symbol.as_str();
|
let symbol_str = symbol.as_str();
|
||||||
for ch in symbol_str.chars() {
|
for ch in symbol_str.chars() {
|
||||||
if ch.is_ascii() {
|
if ch.is_ascii() {
|
||||||
|
|
|
@ -344,7 +344,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
||||||
ast::attr::find_by_name(cx.tcx.hir().attrs(hir::CRATE_HIR_ID), sym::crate_name)
|
ast::attr::find_by_name(cx.tcx.hir().attrs(hir::CRATE_HIR_ID), sym::crate_name)
|
||||||
.and_then(|attr| {
|
.and_then(|attr| {
|
||||||
if let AttrKind::Normal(n) = &attr.kind
|
if let AttrKind::Normal(n) = &attr.kind
|
||||||
&& let AttrItem { args: AttrArgs::Eq { eq_span: _, expr: ref lit }, .. } =
|
&& let AttrItem { args: AttrArgs::Eq { eq_span: _, expr: lit }, .. } =
|
||||||
n.as_ref()
|
n.as_ref()
|
||||||
&& let ast::LitKind::Str(name, ..) = lit.kind
|
&& let ast::LitKind::Str(name, ..) = lit.kind
|
||||||
{
|
{
|
||||||
|
|
|
@ -696,7 +696,7 @@ declare_lint! {
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// extern "C" {
|
/// unsafe extern "C" {
|
||||||
/// static STATIC: String;
|
/// static STATIC: String;
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -1791,7 +1791,7 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences {
|
||||||
let t = cx.tcx.type_of(it.owner_id).instantiate_identity();
|
let t = cx.tcx.type_of(it.owner_id).instantiate_identity();
|
||||||
let ty = cx.tcx.erase_regions(t);
|
let ty = cx.tcx.erase_regions(t);
|
||||||
let Ok(layout) = cx.layout_of(ty) else { return };
|
let Ok(layout) = cx.layout_of(ty) else { return };
|
||||||
let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, ref variants, .. } =
|
let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, variants, .. } =
|
||||||
&layout.variants
|
&layout.variants
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_lint_defs"
|
name = "rustc_lint_defs"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -2780,7 +2780,7 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// enum Void {}
|
/// enum Void {}
|
||||||
/// extern {
|
/// unsafe extern {
|
||||||
/// static EXTERN: Void;
|
/// static EXTERN: Void;
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -4011,7 +4011,7 @@ declare_lint! {
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![warn(ffi_unwind_calls)]
|
/// #![warn(ffi_unwind_calls)]
|
||||||
///
|
///
|
||||||
/// extern "C-unwind" {
|
/// unsafe extern "C-unwind" {
|
||||||
/// fn foo();
|
/// fn foo();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
@ -4755,7 +4755,7 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust,edition2021
|
||||||
/// #![warn(missing_unsafe_on_extern)]
|
/// #![warn(missing_unsafe_on_extern)]
|
||||||
/// #![allow(dead_code)]
|
/// #![allow(dead_code)]
|
||||||
///
|
///
|
||||||
|
@ -4792,7 +4792,7 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust,edition2021
|
||||||
/// #![warn(unsafe_attr_outside_unsafe)]
|
/// #![warn(unsafe_attr_outside_unsafe)]
|
||||||
///
|
///
|
||||||
/// #[no_mangle]
|
/// #[no_mangle]
|
||||||
|
|
|
@ -134,8 +134,8 @@ impl LintExpectationId {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_lint_index(&mut self, new_lint_index: Option<u16>) {
|
pub fn set_lint_index(&mut self, new_lint_index: Option<u16>) {
|
||||||
let (LintExpectationId::Unstable { ref mut lint_index, .. }
|
let (LintExpectationId::Unstable { lint_index, .. }
|
||||||
| LintExpectationId::Stable { ref mut lint_index, .. }) = self;
|
| LintExpectationId::Stable { lint_index, .. }) = self;
|
||||||
|
|
||||||
*lint_index = new_lint_index
|
*lint_index = new_lint_index
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_llvm"
|
name = "rustc_llvm"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -51,9 +51,13 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
|
||||||
fn restore_library_path() {
|
fn restore_library_path() {
|
||||||
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
||||||
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
||||||
env::set_var(&key, env);
|
unsafe {
|
||||||
|
env::set_var(&key, env);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
env::remove_var(&key);
|
unsafe {
|
||||||
|
env::remove_var(&key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_log"
|
name = "rustc_log"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_macros"
|
name = "rustc_macros"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -760,8 +760,8 @@ impl SubdiagnosticVariant {
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
"applicability",
|
"applicability",
|
||||||
SubdiagnosticKind::Suggestion { ref mut applicability, .. }
|
SubdiagnosticKind::Suggestion { applicability, .. }
|
||||||
| SubdiagnosticKind::MultipartSuggestion { ref mut applicability, .. },
|
| SubdiagnosticKind::MultipartSuggestion { applicability, .. },
|
||||||
) => {
|
) => {
|
||||||
let value = get_string!();
|
let value = get_string!();
|
||||||
let value = Applicability::from_str(&value.value()).unwrap_or_else(|()| {
|
let value = Applicability::from_str(&value.value()).unwrap_or_else(|()| {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_metadata"
|
name = "rustc_metadata"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_middle"
|
name = "rustc_middle"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub mod lib_features {
|
||||||
self.stability
|
self.stability
|
||||||
.to_sorted_stable_ord()
|
.to_sorted_stable_ord()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(&sym, &(stab, _))| (sym, stab))
|
.map(|&(&sym, &(stab, _))| (sym, stab))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||||
/// Returns the item's `CrateNum`
|
/// Returns the item's `CrateNum`
|
||||||
pub fn krate(&self) -> CrateNum {
|
pub fn krate(&self) -> CrateNum {
|
||||||
match self {
|
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::Static(def_id) => def_id.krate,
|
||||||
MonoItem::GlobalAsm(..) => LOCAL_CRATE,
|
MonoItem::GlobalAsm(..) => LOCAL_CRATE,
|
||||||
}
|
}
|
||||||
|
|
|
@ -970,7 +970,7 @@ impl<'tcx> TerminatorKind<'tcx> {
|
||||||
}
|
}
|
||||||
FalseEdge { .. } => write!(fmt, "falseEdge"),
|
FalseEdge { .. } => write!(fmt, "falseEdge"),
|
||||||
FalseUnwind { .. } => write!(fmt, "falseUnwind"),
|
FalseUnwind { .. } => write!(fmt, "falseUnwind"),
|
||||||
InlineAsm { template, ref operands, options, .. } => {
|
InlineAsm { template, operands, options, .. } => {
|
||||||
write!(fmt, "asm!(\"{}\"", InlineAsmTemplatePiece::to_string(template))?;
|
write!(fmt, "asm!(\"{}\"", InlineAsmTemplatePiece::to_string(template))?;
|
||||||
for op in operands {
|
for op in operands {
|
||||||
write!(fmt, ", ")?;
|
write!(fmt, ", ")?;
|
||||||
|
|
|
@ -226,7 +226,7 @@ impl<O> AssertKind<O> {
|
||||||
{
|
{
|
||||||
use AssertKind::*;
|
use AssertKind::*;
|
||||||
match self {
|
match self {
|
||||||
BoundsCheck { ref len, ref index } => write!(
|
BoundsCheck { len, index } => write!(
|
||||||
f,
|
f,
|
||||||
"\"index out of bounds: the length is {{}} but the index is {{}}\", {len:?}, {index:?}"
|
"\"index out of bounds: the length is {{}} but the index is {{}}\", {len:?}, {index:?}"
|
||||||
),
|
),
|
||||||
|
|
|
@ -443,7 +443,7 @@ macro_rules! make_mir_visitor {
|
||||||
location
|
location
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
StatementKind::Intrinsic(box ref $($mutability)? intrinsic) => {
|
StatementKind::Intrinsic(box intrinsic) => {
|
||||||
match intrinsic {
|
match intrinsic {
|
||||||
NonDivergingIntrinsic::Assume(op) => self.visit_operand(op, location),
|
NonDivergingIntrinsic::Assume(op) => self.visit_operand(op, location),
|
||||||
NonDivergingIntrinsic::CopyNonOverlapping(CopyNonOverlapping {
|
NonDivergingIntrinsic::CopyNonOverlapping(CopyNonOverlapping {
|
||||||
|
@ -886,8 +886,8 @@ macro_rules! make_mir_visitor {
|
||||||
self.visit_source_info(source_info);
|
self.visit_source_info(source_info);
|
||||||
let location = Location::START;
|
let location = Location::START;
|
||||||
if let Some(box VarDebugInfoFragment {
|
if let Some(box VarDebugInfoFragment {
|
||||||
ref $($mutability)? ty,
|
ty,
|
||||||
ref $($mutability)? projection
|
projection
|
||||||
}) = composite {
|
}) = composite {
|
||||||
self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
|
self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
|
||||||
for elem in projection {
|
for elem in projection {
|
||||||
|
|
|
@ -678,8 +678,7 @@ impl<'tcx> Pat<'tcx> {
|
||||||
subpatterns.iter().for_each(|field| field.pattern.walk_(it))
|
subpatterns.iter().for_each(|field| field.pattern.walk_(it))
|
||||||
}
|
}
|
||||||
Or { pats } => pats.iter().for_each(|p| p.walk_(it)),
|
Or { pats } => pats.iter().for_each(|p| p.walk_(it)),
|
||||||
Array { box ref prefix, ref slice, box ref suffix }
|
Array { box prefix, slice, box suffix } | Slice { box prefix, slice, box suffix } => {
|
||||||
| Slice { box ref prefix, ref slice, box ref suffix } => {
|
|
||||||
prefix.iter().chain(slice.as_deref()).chain(suffix.iter()).for_each(|p| p.walk_(it))
|
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,
|
initializer,
|
||||||
remainder_scope: _,
|
remainder_scope: _,
|
||||||
init_scope: _,
|
init_scope: _,
|
||||||
ref pattern,
|
pattern,
|
||||||
lint_level: _,
|
lint_level: _,
|
||||||
else_block,
|
else_block,
|
||||||
span: _,
|
span: _,
|
||||||
|
|
|
@ -776,7 +776,7 @@ impl DynCompatibilityViolation {
|
||||||
pub fn error_msg(&self) -> Cow<'static, str> {
|
pub fn error_msg(&self) -> Cow<'static, str> {
|
||||||
match self {
|
match self {
|
||||||
DynCompatibilityViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
|
DynCompatibilityViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
|
||||||
DynCompatibilityViolation::SupertraitSelf(ref spans) => {
|
DynCompatibilityViolation::SupertraitSelf(spans) => {
|
||||||
if spans.iter().any(|sp| *sp != DUMMY_SP) {
|
if spans.iter().any(|sp| *sp != DUMMY_SP) {
|
||||||
"it uses `Self` as a type parameter".into()
|
"it uses `Self` as a type parameter".into()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -447,23 +447,23 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for Ty<'tcx> {
|
||||||
}
|
}
|
||||||
ty::Slice(typ) => typ.visit_with(visitor),
|
ty::Slice(typ) => typ.visit_with(visitor),
|
||||||
ty::Adt(_, args) => args.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));
|
try_visit!(trait_ty.visit_with(visitor));
|
||||||
reg.visit_with(visitor)
|
reg.visit_with(visitor)
|
||||||
}
|
}
|
||||||
ty::Tuple(ts) => ts.visit_with(visitor),
|
ty::Tuple(ts) => ts.visit_with(visitor),
|
||||||
ty::FnDef(_, args) => args.visit_with(visitor),
|
ty::FnDef(_, args) => args.visit_with(visitor),
|
||||||
ty::FnPtr(ref sig_tys, _) => sig_tys.visit_with(visitor),
|
ty::FnPtr(sig_tys, _) => sig_tys.visit_with(visitor),
|
||||||
ty::UnsafeBinder(ref f) => f.visit_with(visitor),
|
ty::UnsafeBinder(f) => f.visit_with(visitor),
|
||||||
ty::Ref(r, ty, _) => {
|
ty::Ref(r, ty, _) => {
|
||||||
try_visit!(r.visit_with(visitor));
|
try_visit!(r.visit_with(visitor));
|
||||||
ty.visit_with(visitor)
|
ty.visit_with(visitor)
|
||||||
}
|
}
|
||||||
ty::Coroutine(_did, ref args) => args.visit_with(visitor),
|
ty::Coroutine(_did, args) => args.visit_with(visitor),
|
||||||
ty::CoroutineWitness(_did, ref args) => args.visit_with(visitor),
|
ty::CoroutineWitness(_did, args) => args.visit_with(visitor),
|
||||||
ty::Closure(_did, ref args) => args.visit_with(visitor),
|
ty::Closure(_did, args) => args.visit_with(visitor),
|
||||||
ty::CoroutineClosure(_did, ref args) => args.visit_with(visitor),
|
ty::CoroutineClosure(_did, args) => args.visit_with(visitor),
|
||||||
ty::Alias(_, ref data) => data.visit_with(visitor),
|
ty::Alias(_, data) => data.visit_with(visitor),
|
||||||
|
|
||||||
ty::Pat(ty, pat) => {
|
ty::Pat(ty, pat) => {
|
||||||
try_visit!(ty.visit_with(visitor));
|
try_visit!(ty.visit_with(visitor));
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ impl<'tcx> Ty<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_param(self, index: u32) -> bool {
|
pub fn is_param(self, index: u32) -> bool {
|
||||||
match self.kind() {
|
match self.kind() {
|
||||||
ty::Param(ref data) => data.index == index,
|
ty::Param(data) => data.index == index,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustc_mir_build"
|
name = "rustc_mir_build"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
|
|
@ -244,7 +244,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
StmtKind::Let {
|
StmtKind::Let {
|
||||||
remainder_scope,
|
remainder_scope,
|
||||||
init_scope,
|
init_scope,
|
||||||
ref pattern,
|
pattern,
|
||||||
initializer,
|
initializer,
|
||||||
lint_level,
|
lint_level,
|
||||||
else_block: None,
|
else_block: None,
|
||||||
|
|
|
@ -429,9 +429,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
|
||||||
let user_provided_types = self.typeck_results.user_provided_types();
|
let user_provided_types = self.typeck_results.user_provided_types();
|
||||||
let user_ty =
|
let user_ty =
|
||||||
user_provided_types.get(fun.hir_id).copied().map(|mut u_ty| {
|
user_provided_types.get(fun.hir_id).copied().map(|mut u_ty| {
|
||||||
if let ty::UserTypeKind::TypeOf(ref mut did, _) =
|
if let ty::UserTypeKind::TypeOf(did, _) = &mut u_ty.value.kind {
|
||||||
&mut u_ty.value.kind
|
|
||||||
{
|
|
||||||
*did = adt_def.did();
|
*did = adt_def.did();
|
||||||
}
|
}
|
||||||
Box::new(u_ty)
|
Box::new(u_ty)
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ fn find_fallback_pattern_typo<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some((i, &const_name)) =
|
if let Some((i, &const_name)) =
|
||||||
accessible.iter().enumerate().find(|(_, &const_name)| const_name == name)
|
accessible.iter().enumerate().find(|&(_, &const_name)| const_name == name)
|
||||||
{
|
{
|
||||||
// The pattern name is an exact match, so the pattern needed to be imported.
|
// The pattern name is an exact match, so the pattern needed to be imported.
|
||||||
lint.wanted_constant = Some(WantedConstant {
|
lint.wanted_constant = Some(WantedConstant {
|
||||||
|
@ -1115,7 +1115,7 @@ fn find_fallback_pattern_typo<'tcx>(
|
||||||
const_path: name.to_string(),
|
const_path: name.to_string(),
|
||||||
});
|
});
|
||||||
} else if let Some(i) =
|
} else if let Some(i) =
|
||||||
imported.iter().enumerate().find(|(_, &const_name)| const_name == name).map(|(i, _)| i)
|
imported.iter().enumerate().find(|&(_, &const_name)| const_name == name).map(|(i, _)| i)
|
||||||
{
|
{
|
||||||
// The const with the exact name wasn't re-exported from an import in this
|
// The const with the exact name wasn't re-exported from an import in this
|
||||||
// crate, we point at the import.
|
// crate, we point at the import.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue