Skip to content

Rollup of 11 pull requests #144109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 63 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
fba4177
Simplify assignments.
cjgillot Jun 23, 2025
ac70dc8
Introduce Value::RawPtr as it behaves differently from other aggregates.
cjgillot Jun 30, 2025
be41333
Store a full Ty with each Value.
cjgillot Jun 30, 2025
4750dff
Remove extraneous types.
cjgillot Jun 30, 2025
cbc3cf7
Avoid computing layouts inside coroutines.
cjgillot Jul 1, 2025
4a95b16
Move crashes tests.
cjgillot Jul 2, 2025
92144e1
Remove `josh-sync` tooling and update README
Kobzol Jul 4, 2025
13dca5e
Update CI workflow to use rustc-josh-sync
Kobzol Jul 4, 2025
9d83749
Document `rustc-josh-sync`
Kobzol Jul 4, 2025
dbad976
Merge pull request #2491 from Kobzol/switch-to-rustc-josh-sync
jieyouxu Jul 4, 2025
f167f9b
external-repos.md: small fixes
tshepang Jul 4, 2025
33c70d9
Merge pull request #2492 from rust-lang/tshepang-patch-1
tshepang Jul 4, 2025
922ee88
Mention that stdarch is managed by josh-sync
Kobzol Jul 8, 2025
342d78d
Merge pull request #2495 from Kobzol/josh-sync-stdarch
jieyouxu Jul 8, 2025
24a25db
Revert `tests/run-make/mte-ffi` changes
jieyouxu Jun 10, 2025
37136dd
Disable `tests/run-make/mte-ffi`
jieyouxu Jul 8, 2025
6b8bc68
use a consistent (and recommended) invocation
tshepang Jul 9, 2025
120a361
Merge pull request #2496 from rust-lang/tshepang-a-convenience
tshepang Jul 9, 2025
7b394d2
tweak some git clone commands
tshepang Jul 9, 2025
42472f2
add missing word
tshepang Jul 9, 2025
d99af0b
distcheck had only one possible invocation
tshepang Jul 9, 2025
99fc05b
do not invent a name
tshepang Jul 9, 2025
1a6e543
Merge pull request #2498 from rust-lang/tshepang-patch-1
Noratrieb Jul 10, 2025
7c76abc
Merge pull request #2500 from rust-lang/tshepang-patch-3
Noratrieb Jul 10, 2025
1ef0072
Merge pull request #2499 from rust-lang/tshepang-patch-2
Noratrieb Jul 10, 2025
f1ae43f
Mention that compiler-builtins is now using `rustc-josh-sync`
Kobzol Jul 10, 2025
c6bedc1
Migrate rustc-pull to CI workflow from `josh-sync`
Kobzol Jul 10, 2025
c7cdd14
Merge pull request #2501 from Kobzol/compiler-builtins-josh
jieyouxu Jul 10, 2025
c46e385
Merge pull request #2502 from Kobzol/rustc-josh-sync-ci
jieyouxu Jul 11, 2025
7803c25
directives.md: build-aux-docs does not work with aux-crate
lolbinarycat Jul 11, 2025
f58accb
pass --gc-sections if -Zexport-executable-symbols is enabled and impr…
usamoi Jul 12, 2025
39f269c
Merge pull request #2497 from rust-lang/tshepang-git-clone
ZuseZ4 Jul 14, 2025
8ec7e6f
Merge pull request #2504 from lolbinarycat/lolbinarycat-patch-2
jieyouxu Jul 15, 2025
0e423f4
Boostrap: add warning on `optimize = false`
xdoardo Jul 16, 2025
4e054fc
Port `#[coverage]` to the new attribute system
scrabsha Jul 13, 2025
af39c0c
Emit warning when there is no space between `-o` and confusing arg
xizheyin Jul 10, 2025
9ef3be2
go over invariants again :3
lcnr Jul 16, 2025
6237eaf
Merge pull request #2506 from lcnr/type-system-invariants
lcnr Jul 16, 2025
f100767
fix `-Zsanitizer=kcfi` on `#[naked]` functions
folkertdev Jul 1, 2025
ec0ff72
add `codegen_instance_attrs` query
folkertdev Jul 2, 2025
9c8ab89
use `codegen_instance_attrs` where an instance is (easily) available
folkertdev Jul 2, 2025
fad8dec
fix: false positive double_negations when it jumps macro boundary
anatawa12 Jul 16, 2025
8df6a1d
some improvements to "Invariants of the type system"
tshepang Jul 17, 2025
c113a60
Merge pull request #2507 from rust-lang/tshepang-misc
tshepang Jul 17, 2025
2faf5ed
Prepare for merging from rust-lang/rust
invalid-email-address Jul 17, 2025
ce0de76
Merge ref 'fd2eb391d032' from rust-lang/rust
invalid-email-address Jul 17, 2025
b2474c8
Merge pull request #2508 from rust-lang/rustc-pull
tshepang Jul 17, 2025
dd364bd
copy-paste convenience
tshepang Jul 17, 2025
41c0c5b
Merge pull request #2510 from rust-lang/tshepang-patch-1
tshepang Jul 17, 2025
5bb6b9d
remove no_gc_sections
usamoi Jul 14, 2025
6645bf5
Copy GCC sources into the build directory even outside CI
Kobzol Jul 17, 2025
853333d
constify `Option` methods
oli-obk Jul 15, 2025
e943b3b
Rollup merge of #142300 - jieyouxu:exp-partial-revert-141576, r=Waffl…
matthiaskrgr Jul 18, 2025
b252014
Rollup merge of #143271 - cjgillot:gvn-types, r=oli-obk
matthiaskrgr Jul 18, 2025
accf61d
Rollup merge of #143293 - folkertdev:naked-function-kcfi, r=compiler-…
matthiaskrgr Jul 18, 2025
26f5936
Rollup merge of #143719 - xizheyin:142812-1, r=jieyouxu
matthiaskrgr Jul 18, 2025
79c8f90
Rollup merge of #143846 - usamoi:gc, r=bjorn3
matthiaskrgr Jul 18, 2025
03734ae
Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmann
matthiaskrgr Jul 18, 2025
a7009e9
Rollup merge of #143967 - oli-obk:const-option-methods, r=fee1-dead
matthiaskrgr Jul 18, 2025
19ed2f1
Rollup merge of #144008 - anatawa12:fix-double-negations, r=compiler-…
matthiaskrgr Jul 18, 2025
3023a28
Rollup merge of #144010 - xdoardo:bootstrap-warning-optimize-false, r…
matthiaskrgr Jul 18, 2025
37e7bc1
Rollup merge of #144049 - tshepang:rust-push, r=jieyouxu
matthiaskrgr Jul 18, 2025
c22e2ea
Rollup merge of #144056 - Kobzol:gcc-build-src, r=nikic
matthiaskrgr Jul 18, 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
19 changes: 19 additions & 0 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ pub enum DeprecatedSince {
Err,
}

#[derive(
Copy,
Debug,
Eq,
PartialEq,
Encodable,
Decodable,
Clone,
HashStable_Generic,
PrintAttribute
)]
pub enum CoverageStatus {
On,
Off,
}

impl Deprecation {
/// Whether an item marked with #[deprecated(since = "X")] is currently
/// deprecated (i.e., whether X is not greater than the current rustc
Expand Down Expand Up @@ -274,6 +290,9 @@ pub enum AttributeKind {
/// Represents `#[const_trait]`.
ConstTrait(Span),

/// Represents `#[coverage]`.
Coverage(Span, CoverageStatus),

///Represents `#[rustc_deny_explicit_impl]`.
DenyExplicitImpl(Span),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl AttributeKind {
ConstStability { .. } => Yes,
ConstStabilityIndirect => No,
ConstTrait(..) => No,
Coverage(..) => No,
DenyExplicitImpl(..) => No,
Deprecation { .. } => Yes,
DoNotImplementViaObject(..) => No,
Expand Down
41 changes: 40 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_attr_data_structures::{AttributeKind, OptimizeAttr, UsedBy};
use rustc_attr_data_structures::{AttributeKind, CoverageStatus, OptimizeAttr, UsedBy};
use rustc_feature::{AttributeTemplate, template};
use rustc_session::parse::feature_err;
use rustc_span::{Span, Symbol, sym};
Expand Down Expand Up @@ -52,6 +52,45 @@ impl<S: Stage> NoArgsAttributeParser<S> for ColdParser {
const CREATE: fn(Span) -> AttributeKind = AttributeKind::Cold;
}

pub(crate) struct CoverageParser;

impl<S: Stage> SingleAttributeParser<S> for CoverageParser {
const PATH: &[Symbol] = &[sym::coverage];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const TEMPLATE: AttributeTemplate = template!(OneOf: &[sym::off, sym::on]);

fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
let Some(args) = args.list() else {
cx.expected_specific_argument_and_list(cx.attr_span, vec!["on", "off"]);
return None;
};

let Some(arg) = args.single() else {
cx.expected_single_argument(args.span);
return None;
};

let fail_incorrect_argument = |span| cx.expected_specific_argument(span, vec!["on", "off"]);

let Some(arg) = arg.meta_item() else {
fail_incorrect_argument(args.span);
return None;
};

let status = match arg.path().word_sym() {
Some(sym::off) => CoverageStatus::Off,
Some(sym::on) => CoverageStatus::On,
None | Some(_) => {
fail_incorrect_argument(arg.span());
return None;
}
};

Some(AttributeKind::Coverage(cx.attr_span, status))
}
}

pub(crate) struct ExportNameParser;

impl<S: Stage> SingleAttributeParser<S> for ExportNameParser {
Expand Down
26 changes: 24 additions & 2 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ use crate::attributes::allow_unstable::{
AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser,
};
use crate::attributes::codegen_attrs::{
ColdParser, ExportNameParser, NakedParser, NoMangleParser, OmitGdbPrettyPrinterSectionParser,
OptimizeParser, TargetFeatureParser, TrackCallerParser, UsedParser,
ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser,
OmitGdbPrettyPrinterSectionParser, OptimizeParser, TargetFeatureParser, TrackCallerParser,
UsedParser,
};
use crate::attributes::confusables::ConfusablesParser;
use crate::attributes::deprecation::DeprecationParser;
Expand Down Expand Up @@ -139,6 +140,7 @@ attribute_parsers!(
// tidy-alphabetical-end

// tidy-alphabetical-start
Single<CoverageParser>,
Single<DeprecationParser>,
Single<DummyParser>,
Single<ExportNameParser>,
Expand Down Expand Up @@ -452,6 +454,25 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
reason: AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings: false,
list: false,
},
})
}

pub(crate) fn expected_specific_argument_and_list(
&self,
span: Span,
possibilities: Vec<&'static str>,
) -> ErrorGuaranteed {
self.emit_err(AttributeParseError {
span,
attr_span: self.attr_span,
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings: false,
list: true,
},
})
}
Expand All @@ -469,6 +490,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
reason: AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings: true,
list: false,
},
})
}
Expand Down
49 changes: 46 additions & 3 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,22 @@ pub(crate) struct LinkOrdinalOutOfRange {

pub(crate) enum AttributeParseErrorReason {
ExpectedNoArgs,
ExpectedStringLiteral { byte_string: Option<Span> },
ExpectedStringLiteral {
byte_string: Option<Span>,
},
ExpectedIntegerLiteral,
ExpectedAtLeastOneArgument,
ExpectedSingleArgument,
ExpectedList,
UnexpectedLiteral,
ExpectedNameValue(Option<Symbol>),
DuplicateKey(Symbol),
ExpectedSpecificArgument { possibilities: Vec<&'static str>, strings: bool },
ExpectedSpecificArgument {
possibilities: Vec<&'static str>,
strings: bool,
/// Should we tell the user to write a list when they didn't?
list: bool,
},
}

pub(crate) struct AttributeParseError {
Expand Down Expand Up @@ -615,7 +622,11 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
format!("expected this to be of the form `{name} = \"...\"`"),
);
}
AttributeParseErrorReason::ExpectedSpecificArgument { possibilities, strings } => {
AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings,
list: false,
} => {
let quote = if strings { '"' } else { '`' };
match possibilities.as_slice() {
&[] => {}
Expand All @@ -641,6 +652,38 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
}
}
}
AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings,
list: true,
} => {
let quote = if strings { '"' } else { '`' };
match possibilities.as_slice() {
&[] => {}
&[x] => {
diag.span_label(
self.span,
format!(
"this attribute is only valid with {quote}{x}{quote} as an argument"
),
);
}
[first, second] => {
diag.span_label(self.span, format!("this attribute is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
}
[first @ .., second_to_last, last] => {
let mut res = String::new();
for i in first {
res.push_str(&format!("{quote}{i}{quote}, "));
}
res.push_str(&format!(
"{quote}{second_to_last}{quote} or {quote}{last}{quote}"
));

diag.span_label(self.span, format!("this attribute is only valid with one of the following arguments: {res}"));
}
}
}
}

let suggestions = self.template.suggestions(false, &name);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ fn codegen_cgu_content(
for (mono_item, item_data) in mono_items {
match mono_item {
MonoItem::Fn(instance) => {
if tcx.codegen_fn_attrs(instance.def_id()).flags.contains(CodegenFnAttrFlags::NAKED)
{
let flags = tcx.codegen_instance_attrs(instance.def).flags;
if flags.contains(CodegenFnAttrFlags::NAKED) {
rustc_codegen_ssa::mir::naked_asm::codegen_naked_asm(
&mut GlobalAsmContext { tcx, global_asm: &mut cx.global_asm },
instance,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn codegen_and_compile_fn<'tcx>(
module: &mut dyn Module,
instance: Instance<'tcx>,
) {
if tcx.codegen_fn_attrs(instance.def_id()).flags.contains(CodegenFnAttrFlags::NAKED) {
if tcx.codegen_instance_attrs(instance.def).flags.contains(CodegenFnAttrFlags::NAKED) {
tcx.dcx()
.span_fatal(tcx.def_span(instance.def_id()), "Naked asm is not supported in JIT mode");
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn predefine_mono_items<'tcx>(
is_compiler_builtins,
);
let is_naked = tcx
.codegen_fn_attrs(instance.def_id())
.codegen_instance_attrs(instance.def)
.flags
.contains(CodegenFnAttrFlags::NAKED);
module
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
#[cfg_attr(not(feature = "master"), allow(unused_variables))] func: Function<'gcc>,
instance: ty::Instance<'tcx>,
) {
let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(instance.def_id());
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);

#[cfg(feature = "master")]
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
let is_hidden = if is_generic {
// This is a monomorphization of a generic function.
if !(cx.tcx.sess.opts.share_generics()
|| tcx.codegen_fn_attrs(instance_def_id).inline
|| tcx.codegen_instance_attrs(instance.def).inline
== rustc_attr_data_structures::InlineAttr::Never)
{
// When not sharing generics, all instances are in the same
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
self.linkage.set(base::linkage_to_gcc(linkage));
let decl = self.declare_fn(symbol_name, fn_abi);
//let attrs = self.tcx.codegen_fn_attrs(instance.def_id());
//let attrs = self.tcx.codegen_instance_attrs(instance.def);

attributes::from_fn_attrs(self, decl, instance);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
llfn: &'ll Value,
instance: ty::Instance<'tcx>,
) {
let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(instance.def_id());
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);

let mut to_add = SmallVec::<[_; 16]>::new();

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub(crate) fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'t
let is_hidden = if is_generic {
// This is a monomorphization of a generic function.
if !(cx.tcx.sess.opts.share_generics()
|| tcx.codegen_fn_attrs(instance_def_id).inline
|| tcx.codegen_instance_attrs(instance.def).inline
== rustc_attr_data_structures::InlineAttr::Never)
{
// When not sharing generics, all instances are in the same
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
let lldecl = self.declare_fn(symbol_name, fn_abi, Some(instance));
llvm::set_linkage(lldecl, base::linkage_to_llvm(linkage));
let attrs = self.tcx.codegen_fn_attrs(instance.def_id());
base::set_link_section(lldecl, attrs);
let attrs = self.tcx.codegen_instance_attrs(instance.def);
base::set_link_section(lldecl, &attrs);
if (linkage == Linkage::LinkOnceODR || linkage == Linkage::WeakODR)
&& self.tcx.sess.target.supports_comdat()
{
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2542,12 +2542,7 @@ fn add_order_independent_options(
// sections to ensure we have all the data for PGO.
let keep_metadata =
crate_type == CrateType::Dylib || sess.opts.cg.profile_generate.enabled();
if crate_type != CrateType::Executable || !sess.opts.unstable_opts.export_executable_symbols
{
cmd.gc_sections(keep_metadata);
} else {
cmd.no_gc_sections();
}
cmd.gc_sections(keep_metadata);
}

cmd.set_output_kind(link_output_kind, crate_type, out_filename);
Expand Down
Loading
Loading