Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
acd02b8
document that `!` does bitwise and logical negation
evan-dickinson Sep 9, 2026
39a66e7
Remove unused method
bjorn3 Sep 24, 2026
dc513a5
Move some LLVM specific options from Linker::link to cg_llvm
bjorn3 Sep 25, 2026
2b7a3ab
Apply suggestion
bjorn3 Sep 30, 2026
e243b6d
Move incr comp session dirs out of CodegenContext
bjorn3 Sep 24, 2026
8240628
Add `RUSTC_BOOTSTRAP=-2` as a way of simulating a stable rustc in UI …
Kobzol Oct 2, 2026
94a6b12
Implement `act-as-stable` compiletest directive
Kobzol Oct 2, 2026
522200b
Use `act-as-stable` in the `feature-gate-autodiff-use` test
Kobzol Oct 2, 2026
aa97b1b
Migrate `const-destruct-stable-toolchain` from a run-make test to a U…
Kobzol Oct 2, 2026
0c3b3be
Migrate `print-request-help-stable-unstable` from a run-make test to …
Kobzol Oct 2, 2026
6fc1dc1
lint: suggest fXX::is_nan for unsuffixed NaN comparisons
caelyreth Oct 13, 2026
4f9916a
lint: use UFCS for NaN comparison suggestions
caelyreth Oct 13, 2026
ed4718f
lint: preserve qualified paths in NaN suggestions
caelyreth Oct 13, 2026
62cf356
lint: fix NaN suggestions for nested operands and macros
caelyreth Oct 14, 2026
f6c3d62
Replace `RUSTC_BOOTSTRAP=-2` with `RUSTC_BOOTSTRAP=-allow-unstable-co…
Kobzol Oct 14, 2026
adbf2a5
Use `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` in compiletest
Kobzol Oct 14, 2026
142d509
Don't try to skip anything in `Skip::advance_by(0)`
cuviper Oct 17, 2026
20a7d95
layout invariant: turn delayed bug back into proper assertion
RalfJung Oct 18, 2026
f5705f8
Add test for issue 142887
estebank Oct 18, 2026
0a5b761
Avoid incorrect lifetime suggestion involving `sym::anon`
estebank Nov 11, 2025
0b7a2d9
Remove `MatcherLoc::Delimited`
Oct 18, 2026
b012329
Strip doc-comment tokens in `compute_locs()`
Oct 18, 2026
5fc2428
Remove redundant return value in `try_match_*()`
Oct 18, 2026
2c2a5e9
test: re-organize ui test case
caelyreth Oct 19, 2026
d201932
test: cover shadowing in qualified NaN suggestions
caelyreth Oct 19, 2026
3b9350a
lint: skip NaN diagnostics for custom comparisons
caelyreth Oct 19, 2026
8aa94f1
Rename the unstable compiler flag mode to `AllowUnstableCompilerFlags…
Kobzol Oct 19, 2026
61ab2cd
Update Cranelift test script
Kobzol Oct 19, 2026
e39618c
Correctly handle inner `deprecated` attribute on modules
GuillaumeGomez Oct 19, 2026
8735b14
Improve bit permutation codegen
ywxt Oct 20, 2026
37bc46f
add ReadDir::dir to get the directory handle of the underlying directory
RalfJung Oct 3, 2026
730a53d
miri: use and test new ReadDir::dir support
RalfJung Oct 5, 2026
cccc5be
Also allow `-Zunstable-options` in `act-as-stable`
Kobzol Oct 19, 2026
0370417
emit usize and isize as typedefs
Walnut356 Oct 20, 2026
1f4a761
std: Make the PPC portion of `std_detect` easier to follow
tgross35 Oct 18, 2026
17c9245
std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature…
tgross35 Oct 20, 2026
85108f2
Remap syntax contexts and expansion ids for det. metadata encoding
aerooneqq Oct 20, 2026
8ec19d9
Attributes in function trait parameters
Tess4552 Sep 30, 2026
1d19690
Add test for incr comp fat LTO and fix assert_module_sources testing
bjorn3 Sep 25, 2026
51e5451
Stop useless caching of post-LTO artifact caching for fat LTO
bjorn3 Jun 3, 2026
c207b3a
unix impls of AsRef<File>&Co.
the8472 Aug 2, 2026
2de7d9c
windows impls of AsRef<File>&Co.
the8472 Aug 3, 2026
7490ed1
Stabilize `slice_split_once`
maxdexh Oct 20, 2026
baa3a66
Encode HashMap and HashSet in deterministic order when an encoder req…
susitsm Oct 20, 2026
d3a392d
docs: suggest to not use `--allow-noop` for now
jieyouxu Oct 20, 2026
e58e0f5
Rollup merge of #163664 - Kobzol:bootstrap-but-this-time-for-real-2, …
JonathanBrouwer Oct 20, 2026
993f4b2
Rollup merge of #163668 - aerooneqq:syntax-contexts-and-expansions-id…
JonathanBrouwer Oct 20, 2026
f645e0e
Rollup merge of #160404 - the8472:fd-views, r=jhpratt
JonathanBrouwer Oct 20, 2026
e017219
Rollup merge of #163104 - Walnut356:i_usize_typedef, r=mati865
JonathanBrouwer Oct 20, 2026
71247d9
Rollup merge of #163317 - bjorn3:lto_refactors22, r=nnethercote
JonathanBrouwer Oct 20, 2026
7e4a07e
Rollup merge of #163701 - RalfJung:read-dir-dir, r=the8472
JonathanBrouwer Oct 20, 2026
56d3fef
Rollup merge of #164488 - cuviper:skip0, r=JohnTitor
JonathanBrouwer Oct 20, 2026
2021413
Rollup merge of #164507 - susitsm:deterministic-hashmap-encode, r=pet…
JonathanBrouwer Oct 20, 2026
4e9c7c6
Rollup merge of #164611 - ywxt:int_bits, r=Amanieu
JonathanBrouwer Oct 20, 2026
079d9d3
Rollup merge of #164612 - tgross35:ppc-feature-detect-combine, r=prog…
JonathanBrouwer Oct 20, 2026
48e7d26
Rollup merge of #148842 - estebank:issue-142887, r=nnethercote
JonathanBrouwer Oct 20, 2026
8eb3680
Rollup merge of #162668 - evan-dickinson:bitwise-not, r=JohnTitor
JonathanBrouwer Oct 20, 2026
20c2948
Rollup merge of #164264 - caelyreth:fix-invalid-nan-float, r=jieyouxu
JonathanBrouwer Oct 20, 2026
4410388
Rollup merge of #164509 - RalfJung:assert-discriminant-layout, r=oli-obk
JonathanBrouwer Oct 20, 2026
e0a93a8
Rollup merge of #164540 - bal-e:mini-macro-opts, r=nnethercote
JonathanBrouwer Oct 20, 2026
f69a8e4
Rollup merge of #164594 - GuillaumeGomez:intra-doc-deprecated, r=Urgau
JonathanBrouwer Oct 20, 2026
d3a350c
Rollup merge of #164595 - Tess4552:attr-fn-trait-params, r=JonathanBr…
JonathanBrouwer Oct 20, 2026
6169ded
Rollup merge of #164641 - maxdexh:explode-or-smth-idk-i-use-php, r=jh…
JonathanBrouwer Oct 20, 2026
9aed346
Rollup merge of #164646 - jieyouxu:jieyouxu/force-rustfmt-subtree-cha…
JonathanBrouwer Oct 20, 2026
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
19 changes: 15 additions & 4 deletions compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::sync::Arc;

use rustc_ast::{self as ast, *};
use rustc_attr_ir::target::Target;
use rustc_errors::StashKey;
use rustc_hir::def::{DefKind, PerNS, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, GenericArg};
use rustc_hir::{self as hir, GenericArg, HirId};
use rustc_middle::middle::resolve::PartialRes;
use rustc_middle::ty;
use rustc_session::diagnostics::add_feature_diagnostics;
Expand Down Expand Up @@ -263,6 +264,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
bound_modifier_allowed_features: Option<Arc<[Symbol]>>,
) -> hir::PathSegment<'hir> {
debug!("path_span: {:?}, lower_path_segment(segment: {:?})", path_span, segment);

let res = self.expect_full_res(segment.id);
let hir_id = self.lower_node_id(segment.id);

let (mut generic_args, infer_args) = if let Some(generic_args) = segment.args.as_deref() {
match generic_args {
GenericArgs::AngleBracketed(data) => {
Expand Down Expand Up @@ -315,6 +320,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
data,
itctx,
bound_modifier_allowed_features,
hir_id,
),
GenericArgsMode::Err => {
// Suggest replacing parentheses with angle brackets `Trait(params...)` to `Trait<params...>`
Expand Down Expand Up @@ -398,13 +404,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
);
}

let res = self.expect_full_res(segment.id);
let hir_id = self.lower_node_id(segment.id);
debug!(
"lower_path_segment: ident={:?} original-id={:?} new-id={:?}",
segment.ident, segment.id, hir_id,
);

hir::PathSegment {
ident: self.lower_ident(segment.ident),
hir_id,
Expand Down Expand Up @@ -508,13 +511,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
data: &ParenthesizedArgs,
itctx: ImplTraitContext,
bound_modifier_allowed_features: Option<Arc<[Symbol]>>,
segment_hir_id: HirId,
) -> (GenericArgsCtor<'hir>, bool) {
// Switch to `PassThrough` mode for anonymous lifetimes; this
// means that we permit things like `&Ref<T>`, where `Ref` has
// a hidden lifetime parameter. This is needed for backwards
// compatibility, even in contexts like an impl header where
// we generally don't permit such things (see #51008).
let ParenthesizedArgs { span, inputs, inputs_span, output } = data;

// FIXME uses the segments HIR id which is not correct, it should
// be the parameters HIR id instead. This is currently not lowered.
for input in inputs {
self.lower_attrs(segment_hir_id, &input.attrs, input.span, Target::Param);
}

let inputs = self.arena.alloc_from_iter(inputs.iter().map(|param| {
self.lower_ty(&param.ty, ImplTraitContext::Disallowed(ImplTraitPosition::FnTraitParam))
}));
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<'a> AstValidator<'a> {
self.check_decl_num_args(fn_decl);
let c_variadic_span = self.check_decl_cvariadic_pos(fn_decl);
self.check_decl_splatting(fn_decl, c_variadic_span, splat_semantic);
self.check_decl_attrs(fn_decl);
self.check_decl_attrs(&fn_decl.inputs);
self.check_decl_self_param(&fn_decl.inputs, self_semantic);
self.check_decl_const_param(&fn_decl.inputs);
}
Expand Down Expand Up @@ -518,10 +518,9 @@ impl<'a> AstValidator<'a> {
}
}

fn check_decl_attrs(&self, fn_decl: &FnDecl) {
fn check_decl_attrs(&self, fn_inputs: &[Param]) {
use SyntheticAttr::*;
fn_decl
.inputs
fn_inputs
.iter()
.flat_map(|i| i.attrs.as_ref())
.filter(|attr| match &attr.kind {
Expand Down Expand Up @@ -2230,6 +2229,7 @@ impl Visitor<'_> for AstValidator<'_> {
fn visit_path_segment(&mut self, seg: &PathSegment) -> Self::Result {
if let Some(Parenthesized(args)) = &seg.args {
self.check_decl_self_param(&args.inputs, SelfSemantic::No);
self.check_decl_attrs(&args.inputs);
Self::check_decl_no_pat(&args.inputs, |span, _, _| {
self.dcx().emit_err(diagnostics::PatternParenthesizedArgList { span });
});
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,8 @@ pub enum AttributeKind {
Deprecated {
deprecation: Deprecation,
span: Span,
/// `true` if this an inner attribute (ie `#![]`).
is_inner: bool,
},

/// Represents `#[diagnostic::do_not_recommend]`.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/deprecation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl SingleAttributeParser for DeprecatedParser {
Some(AttributeKind::Deprecated {
deprecation: Deprecation { since, note, suggestion },
span: cx.attr_span,
is_inner: matches!(cx.attr_style, rustc_ast::AttrStyle::Inner),
})
}
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ rm -r tests/run-make-cargo/panic-immediate-abort-codegen # same
rm -r tests/run-make-cargo/panic-strategies # same
rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features
rm -r tests/run-make/const-trait-stable-toolchain # same
rm -r tests/run-make/print-request-help-stable-unstable # same
rm -r tests/run-make/issue-149402-suggest-unresolve # same
rm -r tests/run-make/const-destruct-stable-toolchain # same
rm -r tests/run-make/unstable-target-feature # same
rm -r tests/run-make/incr-add-rust-src-component
rm tests/ui/errors/remap-path-prefix-sysroot.rs # different sysroot source path
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::WorkProduct;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::mono::{MonoItem, MonoItemData, Visibility};
use rustc_session::Session;
use rustc_session::config::{OptLevel, OutputFilenames, OutputType};
use rustc_session::{BorrowedIncrCompSession, Session};
use rustc_span::Symbol;

use crate::base::CodegenedFunction;
Expand Down Expand Up @@ -341,6 +341,7 @@ impl WriteBackendMethods for AotDriver {
fn run_thin_lto(
_cgcx: &CodegenContext,
_prof: &SelfProfilerRef,
_incr_comp_session: Option<&BorrowedIncrCompSession>,
_dcx: rustc_errors::DiagCtxtHandle<'_>,
_exported_symbols_for_lto: &[String],
_each_linked_rlib_for_lto: &[PathBuf],
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{OptLevel, OutputFilenames};
use rustc_session::{CodegenBackendInit, EarlySession, IncrCompSession, Session};
use rustc_session::{
BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session,
};
use rustc_span::{Symbol, sym};
use rustc_target::spec::{RelocModel, TargetTuple};
use tempfile::TempDir;
Expand Down Expand Up @@ -427,6 +429,7 @@ impl WriteBackendMethods for GccCodegenBackend {
fn run_thin_lto(
_cgcx: &CodegenContext,
_prof: &SelfProfilerRef,
_incr_comp_session: Option<&BorrowedIncrCompSession>,
_dcx: DiagCtxtHandle<'_>,
// FIXME(bjorn3): Limit LTO exports to these symbols
_exported_symbols_for_lto: &[String],
Expand Down
44 changes: 31 additions & 13 deletions compiler/rustc_codegen_llvm/src/back/llvm_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
use rustc_session::{CodegenBackendInit, EarlySession, IncrCompSession, Session};
use rustc_session::{
BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session,
};
use rustc_span::{Symbol, sym};
use rustc_target::spec::{RelocModel, TlsModel};

Expand Down Expand Up @@ -122,6 +124,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
fn run_thin_lto(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
exported_symbols_for_lto: &[String],
each_linked_rlib_for_lto: &[PathBuf],
Expand All @@ -130,6 +133,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
back::lto::run_thin(
cgcx,
prof,
incr_comp_session,
dcx,
exported_symbols_for_lto,
each_linked_rlib_for_lto,
Expand Down Expand Up @@ -381,21 +385,35 @@ impl CodegenBackend for LlvmCodegenBackend {
});
}

(compiled_modules, work_products)
}
if sess.codegen_units().as_usize() == 1 && sess.opts.unstable_opts.time_llvm_passes {
let timings =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
print!("{timings}");
}

fn print_pass_timings(&self) {
let timings = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
print!("{timings}");
}
if sess.print_llvm_stats() {
let stats =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
print!("{stats}");
}

fn print_statistics(&self) {
let stats = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
print!("{stats}");
}
if let Some(out_path) = sess.print_llvm_stats_json() {
let llvm_stats_json =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatisticsJSON(s) }).unwrap();

if !llvm_stats_json.is_empty() {
if let Err(e) = std::fs::write(&out_path, llvm_stats_json) {
sess.dcx().err(format!("failed to write stats to {out_path}: {e}"));
}
} else {
sess.dcx().warn(format!(
"requested to print LLVM statistics to JSON file {out_path}, but the codegen backend \
did not provide any statistics",
));
}
}

fn print_statistics_json(&self) -> String {
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatisticsJSON(s) }).unwrap()
(compiled_modules, work_products)
}

fn link(
Expand Down
23 changes: 11 additions & 12 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::WorkProduct;
use rustc_session::config;
use rustc_session::{BorrowedIncrCompSession, config};
use rustc_span::bug;
use rustc_structures::SanitizerSet;
use tracing::{debug, info};
Expand Down Expand Up @@ -186,6 +186,7 @@ pub(crate) fn run_fat(
pub(crate) fn run_thin(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
exported_symbols_for_lto: &[String],
each_linked_rlib_for_lto: &[PathBuf],
Expand All @@ -201,7 +202,7 @@ pub(crate) fn run_thin(
is deferred to the linker"
);
}
thin_lto(cgcx, prof, dcx, modules, upstream_modules, &symbols_below_threshold)
thin_lto(prof, incr_comp_session, dcx, modules, upstream_modules, &symbols_below_threshold)
}

fn fat_lto(
Expand Down Expand Up @@ -368,8 +369,8 @@ fn fat_lto(
/// all of the `LtoModuleCodegen` units returned below and destroyed once
/// they all go out of scope.
fn thin_lto(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
modules: Vec<ThinLtoInput<LlvmCodegenBackend>>,
serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
Expand Down Expand Up @@ -460,13 +461,12 @@ fn thin_lto(

info!("thin LTO data created");

let new_key_map_path = cgcx
.new_incr_comp_session_dir
.as_ref()
.map(|dir| dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME));
let new_key_map_path = incr_comp_session.as_ref().map(|incr_comp_session| {
incr_comp_session.new_session_directory.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME)
});

let prev_key_map = if let Some(ref old_incr_comp_session_dir) =
cgcx.old_incr_comp_session_dir
let prev_key_map = if let Some(ref old_incr_comp_session_dir) = incr_comp_session
.and_then(|incr_comp_session| incr_comp_session.old_session_directory.as_deref())
{
let old_path = old_incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);

Expand All @@ -478,7 +478,7 @@ fn thin_lto(
assert!(green_modules.is_empty());
None
};
let curr_key_map = if cgcx.new_incr_comp_session_dir.is_some() {
let curr_key_map = if incr_comp_session.is_some() {
ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names)
} else {
assert!(green_modules.is_empty());
Expand All @@ -503,8 +503,7 @@ fn thin_lto(
if let (Some(prev_key_map), true) =
(prev_key_map.as_ref(), green_modules.contains_key(module_name))
{
assert!(cgcx.old_incr_comp_session_dir.is_some());
assert!(cgcx.new_incr_comp_session_dir.is_some());
assert!(incr_comp_session.unwrap().old_session_directory.is_some());

// If a module exists in both the current and the previous session,
// and has the same LTO cache key in both sessions, then we can re-use it
Expand Down
46 changes: 44 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{assert_matches, iter, ptr};

use libc::{c_longlong, c_uint};
use rustc_abi::{Align, Endian, Layout, NumScalableVectors, Size};
use rustc_ast::{IntTy, UintTy};
use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo};
use rustc_codegen_ssa::traits::*;
use rustc_hir::def::{CtorKind, DefKind};
Expand Down Expand Up @@ -794,9 +795,50 @@ fn build_basic_type_di_node<'ll, 'tcx>(
_ => bug!("debuginfo::build_basic_type_di_node - `t` is invalid type"),
};

let ty_di_node = create_basic_type(cx, name, cx.size_of(t), encoding);
// Around LLDB 21 or 22, LLDB started using prebuilt Clang type nodes for primitives rather than
// reading the full DWARF data. These nodes are based on the size and signedness of the
// primitive, and ignore pretty much all other fields. This causes 2 issues:
// 1. type names get normalized to C-style names which isn't ideal. The normalization occurs
// even in generic args.
// 2. if you have a generic type `S<T>`, and 2 instantiations are `S<u64>`
// and `S<usize>` (on a 64-bit target), the use of prebuilt nodes causes a name collision.
// Whichever instantiation is interacted with first will work fine, all others will break a
// bunch of stuff in the LLDB pipeline. To avoid this, we explicitly treat `usize` and `isize`
// as typedefs of their equivalent types. For more info see: llvm/llvm-project#196812

let mut needs_typedef = cpp_like_debuginfo;

let ty_di_node = match t.kind() {
ty::Uint(UintTy::Usize) => {
needs_typedef = true;

let equivalent = match t.primitive_size(cx.tcx).bits() {
8 => cx.tcx.types.u8,
16 => cx.tcx.types.u16,
32 => cx.tcx.types.u32,
64 => cx.tcx.types.u64,
128 => cx.tcx.types.u128,
x => bug!("Unexpected signed int size {x}"),
};
type_di_node(cx, equivalent)
}
ty::Int(IntTy::Isize) => {
needs_typedef = true;

let equivalent = match t.primitive_size(cx.tcx).bits() {
8 => cx.tcx.types.i8,
16 => cx.tcx.types.i16,
32 => cx.tcx.types.i32,
64 => cx.tcx.types.i64,
128 => cx.tcx.types.i128,
x => bug!("Unexpected signed int size: {x}"),
};
type_di_node(cx, equivalent)
}
_ => create_basic_type(cx, name, cx.size_of(t), encoding),
};

if !cpp_like_debuginfo {
if !needs_typedef {
return DINodeCreationResult::new(ty_di_node, false);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<'tcx> AssertModuleSource<'tcx> {

if !self.check_config(cfg) {
debug!("check_attr: config does not match, ignoring attr");
return;
continue;
}

let user_path = module.as_str();
Expand Down
Loading
Loading