Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
430d353
Drop armebv7r-none-eabi* to Tier 3
thejpster Sep 7, 2025
7eea65f
Stop linking rs{begin,end} on x86_64-*-windows-gnu
mati865 Sep 19, 2025
e99e226
Switch `dummy_bang` from `LegacyBang` to `Bang`
joshtriplett Sep 21, 2025
a1646bf
mbe: Switch dummy extension used for errors from `LegacyBang` to `Bang`
joshtriplett Sep 21, 2025
9acc63a
port `#[debugger_visualizer]` to the new attribute system
jdonszelmann Sep 18, 2025
d226e7a
Use standard attribute logic for allocator shim
nikic Sep 19, 2025
9e3f748
mbe: Simplify check_redundant_vis_repetition
joshtriplett Sep 25, 2025
f89660e
resolve: Do not finalize shadowed bindings
petrochenkov Aug 1, 2025
0374fc5
Rename `rust.use-lld` to `rust.bootstrap-override-lld`
Kobzol Sep 25, 2025
fc703ec
fix doc comments to be more standard
hkBst Sep 25, 2025
7a2c173
Add new `tyalias` intra-doc link disambiguator
GuillaumeGomez Sep 25, 2025
dba45cd
Add tests for new `tyalias` intra-doc link disambiguator
GuillaumeGomez Sep 25, 2025
62c457b
Mention `tyalias` in intra-doc link rustdoc book chapter
GuillaumeGomez Sep 25, 2025
a535c7b
Ignore more failing ui tests for GCC backend
GuillaumeGomez Sep 26, 2025
ae70e6b
Rollup merge of #145113 - petrochenkov:lessfinalize, r=lcnr
matthiaskrgr Sep 26, 2025
10b98d6
Rollup merge of #146523 - thejpster:demote-armebv7r-targets, r=jackh726
matthiaskrgr Sep 26, 2025
48884f0
Rollup merge of #146704 - jdonszelmann:port-debug-visualizer, r=petro…
matthiaskrgr Sep 26, 2025
bfd21c1
Rollup merge of #146758 - mati865:amd64_mingw_no_rs_objects, r=petroc…
matthiaskrgr Sep 26, 2025
178f50b
Rollup merge of #146778 - nikic:allocator-shim-attributes, r=jackh726
matthiaskrgr Sep 26, 2025
e497ed3
Rollup merge of #146849 - joshtriplett:macro-reduce-legacy-bang, r=pe…
matthiaskrgr Sep 26, 2025
c1ee12c
Rollup merge of #147016 - hkBst:whitespace-1, r=nnethercote
matthiaskrgr Sep 26, 2025
c0502cf
Rollup merge of #147027 - GuillaumeGomez:tyalias-disambiguator, r=lol…
matthiaskrgr Sep 26, 2025
66cfbfe
Rollup merge of #147031 - joshtriplett:mbe-opt-collect, r=lcnr
matthiaskrgr Sep 26, 2025
9d33ef3
Rollup merge of #147046 - Kobzol:bootstrap-ll, r=jieyouxu
matthiaskrgr Sep 26, 2025
69a3cac
Rollup merge of #147058 - GuillaumeGomez:ignore-more-ui-tests, r=Kobzol
matthiaskrgr Sep 26, 2025
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
7 changes: 3 additions & 4 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -768,16 +768,15 @@
# make this default to false.
#rust.lld = false in all cases, except on `x86_64-unknown-linux-gnu` as described above, where it is true

# Indicates whether LLD will be used to link Rust crates during bootstrap on
# supported platforms.
# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD.
# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH
# will be used.
# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used.
#
# On MSVC, LLD will not be used if we're cross linking.
#
# Explicitly setting the linker for a target will override this option when targeting MSVC.
#rust.use-lld = false
#rust.bootstrap-override-lld = false

# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
# sysroot.
Expand Down Expand Up @@ -950,7 +949,7 @@
# Linker to be used to bootstrap Rust code. Note that the
# default value is platform specific, and if not specified it may also depend on
# what platform is crossing to what platform.
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
# Setting this will override the `bootstrap-override-lld` option for Rust code when targeting MSVC.
#linker = "cc" (path)

# Should rustc and the standard library be built with split debuginfo? Default
Expand Down
60 changes: 60 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/debugger.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use rustc_hir::attrs::{DebugVisualizer, DebuggerVisualizerType};

use super::prelude::*;

pub(crate) struct DebuggerViualizerParser;

impl<S: Stage> CombineAttributeParser<S> for DebuggerViualizerParser {
const PATH: &[Symbol] = &[sym::debugger_visualizer];
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Mod), Allow(Target::Crate)]);
const TEMPLATE: AttributeTemplate = template!(
List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
"https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
);

type Item = DebugVisualizer;
const CONVERT: ConvertFn<Self::Item> = |v, _| AttributeKind::DebuggerVisualizer(v);

fn extend<'c>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c {
let Some(l) = args.list() else {
cx.expected_list(args.span().unwrap_or(cx.attr_span));
return None;
};
let Some(single) = l.single() else {
cx.expected_single_argument(l.span);
return None;
};
let Some(mi) = single.meta_item() else {
cx.expected_name_value(single.span(), None);
return None;
};
let path = mi.path().word_sym();
let visualizer_type = match path {
Some(sym::natvis_file) => DebuggerVisualizerType::Natvis,
Some(sym::gdb_script_file) => DebuggerVisualizerType::GdbPrettyPrinter,
_ => {
cx.expected_specific_argument(
mi.path().span(),
&[sym::natvis_file, sym::gdb_script_file],
);
return None;
}
};

let Some(path) = mi.args().name_value() else {
cx.expected_name_value(single.span(), path);
return None;
};

let Some(path) = path.value_as_str() else {
cx.expected_string_literal(path.value_span, Some(path.value_as_lit()));
return None;
};

Some(DebugVisualizer { span: mi.span(), visualizer_type, path })
}
}
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub(crate) mod cfg_old;
pub(crate) mod codegen_attrs;
pub(crate) mod confusables;
pub(crate) mod crate_level;
pub(crate) mod debugger;
pub(crate) mod deprecation;
pub(crate) mod dummy;
pub(crate) mod inline;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::attributes::crate_level::{
CrateNameParser, MoveSizeLimitParser, NoCoreParser, NoStdParser, PatternComplexityLimitParser,
RecursionLimitParser, RustcCoherenceIsCoreParser, TypeLengthLimitParser,
};
use crate::attributes::debugger::DebuggerViualizerParser;
use crate::attributes::deprecation::DeprecationParser;
use crate::attributes::dummy::DummyParser;
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
Expand Down Expand Up @@ -163,6 +164,7 @@ attribute_parsers!(
// tidy-alphabetical-start
Combine<AllowConstFnUnstableParser>,
Combine<AllowInternalUnstableParser>,
Combine<DebuggerViualizerParser>,
Combine<ForceTargetFeatureParser>,
Combine<LinkParser>,
Combine<ReprParser>,
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,13 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {

// If the declaration has an associated instance, compute extra attributes based on that.
if let Some(instance) = instance {
llfn_attrs_from_instance(cx, llfn, instance);
llfn_attrs_from_instance(
cx,
cx.tcx,
llfn,
&cx.tcx.codegen_instance_attrs(instance.def),
Some(instance),
);
}
}

Expand Down
25 changes: 5 additions & 20 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ use rustc_ast::expand::allocator::{
};
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{DebugInfo, OomStrategy};
use rustc_symbol_mangling::mangle_internal_symbol;
use smallvec::SmallVec;

use crate::attributes::llfn_attrs_from_instance;
use crate::builder::SBuilder;
use crate::declare::declare_simple_fn;
use crate::llvm::{self, FALSE, TRUE, Type, Value};
use crate::{SimpleCx, attributes, debuginfo, llvm_util};
use crate::{SimpleCx, attributes, debuginfo};

pub(crate) unsafe fn codegen(
tcx: TyCtxt<'_>,
Expand Down Expand Up @@ -149,18 +150,8 @@ fn create_wrapper_function(
ty,
);

let mut attrs = SmallVec::<[_; 2]>::new();

let target_cpu = llvm_util::target_cpu(tcx.sess);
let target_cpu_attr = llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu);

let tune_cpu_attr = llvm_util::tune_cpu(tcx.sess)
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu));

attrs.push(target_cpu_attr);
attrs.extend(tune_cpu_attr);

attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
let attrs = CodegenFnAttrs::new();
llfn_attrs_from_instance(cx, tcx, llfn, &attrs, None);

let no_return = if no_return {
// -> ! DIFlagNoReturn
Expand All @@ -171,12 +162,6 @@ fn create_wrapper_function(
None
};

if tcx.sess.must_emit_unwind_tables() {
let uwtable =
attributes::uwtable_attr(cx.llcx, tcx.sess.opts.unstable_opts.use_sync_unwind);
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
}

let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
let mut bx = SBuilder::build(&cx, llbb);

Expand Down
Loading
Loading