Skip to content

Rollup of 15 pull requests #144071

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

Closed
wants to merge 82 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 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
c9bdba3
So many test updates x_x
scottmcm Jul 12, 2025
faa6ded
Update cranelift tests
scottmcm Jul 13, 2025
d53b104
Update Miri Tests
scottmcm Jul 13, 2025
fa7734a
Ban projecting into SIMD types [MCP838]
scottmcm Mar 7, 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
aa87845
`SmirCtxt` to `CompilerCtxt`, `SmirInterface` to `CompilerInterface`
makai410 Jul 15, 2025
ea3bb05
`SmirContainer` to `Container`
makai410 Jul 15, 2025
26eca4c
use "helper" as a more descriptive name
makai410 Jul 15, 2025
a5e450d
rename `ui-fulldeps/stable-mir`
makai410 Jul 15, 2025
7831a1f
rename `ui/stable-mir-print`
makai410 Jul 15, 2025
922b034
`SmirError` to `Error`
makai410 Jul 15, 2025
7bd295e
Update docs in `rustc_public_bridge`
makai410 Jul 15, 2025
6a87e95
Update docs in `rustc_public`
makai410 Jul 15, 2025
b7b8b75
use `RustcPublic` instead of `StableMir`
makai410 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
dd48e56
tests: Test line number in debuginfo for diverging function calls
Enselic Jul 16, 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
6932687
parse `const trait Trait`
fee1-dead Jul 13, 2025
106802b
Rollup merge of #142300 - jieyouxu:exp-partial-revert-141576, r=Waffl…
fmease Jul 17, 2025
6dbbc27
Rollup merge of #143271 - cjgillot:gvn-types, r=oli-obk
fmease Jul 17, 2025
d62da83
Rollup merge of #143293 - folkertdev:naked-function-kcfi, r=compiler-…
fmease Jul 17, 2025
db14157
Rollup merge of #143719 - xizheyin:142812-1, r=jieyouxu
fmease Jul 17, 2025
de1bb37
Rollup merge of #143833 - scottmcm:final-mcp-838, r=compiler-errors
fmease Jul 17, 2025
48bd693
Rollup merge of #143846 - usamoi:gc, r=bjorn3
fmease Jul 17, 2025
1b8b8af
Rollup merge of #143879 - fee1-dead-contrib:push-lrlpoouyqqry, r=fmease
fmease Jul 17, 2025
e472f24
Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmann
fmease Jul 17, 2025
ffb9a68
Rollup merge of #143967 - oli-obk:const-option-methods, r=fee1-dead
fmease Jul 17, 2025
9e5154c
Rollup merge of #143985 - makai410:rp-rename, r=oli-obk
fmease Jul 17, 2025
7e54dc9
Rollup merge of #144008 - anatawa12:fix-double-negations, r=compiler-…
fmease Jul 17, 2025
b835e0d
Rollup merge of #144010 - xdoardo:bootstrap-warning-optimize-false, r…
fmease Jul 17, 2025
20adadf
Rollup merge of #144034 - Enselic:diverging-function-call-debuginfo, …
fmease Jul 17, 2025
f746f62
Rollup merge of #144049 - tshepang:rust-push, r=jieyouxu
fmease Jul 17, 2025
ba0656f
Rollup merge of #144056 - Kobzol:gcc-build-src, r=nikic
fmease Jul 17, 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
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3690,6 +3690,7 @@ impl Default for FnHeader {

#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Trait {
pub constness: Const,
pub safety: Safety,
pub is_auto: IsAuto,
pub ident: Ident,
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ macro_rules! common_visitor_and_walkers {
try_visit!(vis.visit_ty(self_ty));
visit_assoc_items(vis, items, AssocCtxt::Impl { of_trait: of_trait.is_some() })
}
ItemKind::Trait(box Trait { safety, is_auto: _, ident, generics, bounds, items }) => {
ItemKind::Trait(box Trait { constness, safety, is_auto: _, ident, generics, bounds, items }) => {
try_visit!(visit_constness(vis, constness));
try_visit!(visit_safety(vis, safety));
try_visit!(vis.visit_ident(ident));
try_visit!(vis.visit_generics(generics));
Expand Down
13 changes: 11 additions & 2 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
items: new_impl_items,
}))
}
ItemKind::Trait(box Trait { is_auto, safety, ident, generics, bounds, items }) => {
ItemKind::Trait(box Trait {
constness,
is_auto,
safety,
ident,
generics,
bounds,
items,
}) => {
let constness = self.lower_constness(*constness);
let ident = self.lower_ident(*ident);
let (generics, (safety, items, bounds)) = self.lower_generics(
generics,
Expand All @@ -435,7 +444,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
(safety, items, bounds)
},
);
hir::ItemKind::Trait(*is_auto, safety, ident, generics, bounds, items)
hir::ItemKind::Trait(constness, *is_auto, safety, ident, generics, bounds, items)
}
ItemKind::TraitAlias(ident, generics, bounds) => {
let ident = self.lower_ident(*ident);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ ast_passes_static_without_body =
ast_passes_tilde_const_disallowed = `[const]` is not allowed here
.closure = closures cannot have `[const]` trait bounds
.function = this function is not `const`, so it cannot have `[const]` trait bounds
.trait = this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
.trait = this trait is not `const`, so it cannot have `[const]` trait bounds
.trait_impl = this impl is not `const`, so it cannot have `[const]` trait bounds
.impl = inherent impls cannot have `[const]` trait bounds
.trait_assoc_ty = associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds
.trait_assoc_ty = associated types in non-`const` traits cannot have `[const]` trait bounds
.trait_impl_assoc_ty = associated types in non-const impls cannot have `[const]` trait bounds
.inherent_assoc_ty = inherent associated types cannot have `[const]` trait bounds
.object = trait objects cannot have `[const]` trait bounds
Expand Down
38 changes: 23 additions & 15 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ enum SelfSemantic {
}

enum TraitOrTraitImpl {
Trait { span: Span, constness_span: Option<Span> },
Trait { span: Span, constness: Const },
TraitImpl { constness: Const, polarity: ImplPolarity, trait_ref_span: Span },
}

impl TraitOrTraitImpl {
fn constness(&self) -> Option<Span> {
match self {
Self::Trait { constness_span: Some(span), .. }
Self::Trait { constness: Const::Yes(span), .. }
| Self::TraitImpl { constness: Const::Yes(span), .. } => Some(*span),
_ => None,
}
Expand Down Expand Up @@ -110,15 +110,10 @@ impl<'a> AstValidator<'a> {
self.outer_trait_or_trait_impl = old;
}

fn with_in_trait(
&mut self,
span: Span,
constness_span: Option<Span>,
f: impl FnOnce(&mut Self),
) {
fn with_in_trait(&mut self, span: Span, constness: Const, f: impl FnOnce(&mut Self)) {
let old = mem::replace(
&mut self.outer_trait_or_trait_impl,
Some(TraitOrTraitImpl::Trait { span, constness_span }),
Some(TraitOrTraitImpl::Trait { span, constness }),
);
f(self);
self.outer_trait_or_trait_impl = old;
Expand Down Expand Up @@ -273,7 +268,7 @@ impl<'a> AstValidator<'a> {
};

let make_trait_const_sugg = if const_trait_impl
&& let TraitOrTraitImpl::Trait { span, constness_span: None } = parent
&& let TraitOrTraitImpl::Trait { span, constness: ast::Const::No } = parent
{
Some(span.shrink_to_lo())
} else {
Expand Down Expand Up @@ -1131,10 +1126,23 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
visit::walk_item(self, item)
}
ItemKind::Trait(box Trait { is_auto, generics, ident, bounds, items, .. }) => {
ItemKind::Trait(box Trait {
constness,
is_auto,
generics,
ident,
bounds,
items,
..
}) => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
let is_const_trait =
// FIXME(const_trait_impl) remove this
let alt_const_trait_span =
attr::find_by_name(&item.attrs, sym::const_trait).map(|attr| attr.span);
let constness = match (*constness, alt_const_trait_span) {
(Const::Yes(span), _) | (Const::No, Some(span)) => Const::Yes(span),
(Const::No, None) => Const::No,
};
if *is_auto == IsAuto::Yes {
// Auto traits cannot have generics, super traits nor contain items.
self.deny_generic_params(generics, ident.span);
Expand All @@ -1145,13 +1153,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {

// Equivalent of `visit::walk_item` for `ItemKind::Trait` that inserts a bound
// context for the supertraits.
let disallowed =
is_const_trait.is_none().then(|| TildeConstReason::Trait { span: item.span });
let disallowed = matches!(constness, ast::Const::No)
.then(|| TildeConstReason::Trait { span: item.span });
self.with_tilde_const(disallowed, |this| {
this.visit_generics(generics);
walk_list!(this, visit_param_bound, bounds, BoundKind::SuperTraits)
});
self.with_in_trait(item.span, is_const_trait, |this| {
self.with_in_trait(item.span, constness, |this| {
walk_list!(this, visit_assoc_item, items, AssocCtxt::Trait);
});
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ pub(crate) struct ConstBoundTraitObject {
}

// FIXME(const_trait_impl): Consider making the note/reason the message of the diagnostic.
// FIXME(const_trait_impl): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here).
// FIXME(const_trait_impl): Provide structured suggestions (e.g., add `const` here).
#[derive(Diagnostic)]
#[diag(ast_passes_tilde_const_disallowed)]
pub(crate) struct TildeConstDisallowed {
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ impl<'a> State<'a> {
self.bclose(item.span, empty, cb);
}
ast::ItemKind::Trait(box ast::Trait {
constness,
safety,
is_auto,
ident,
Expand All @@ -366,6 +367,7 @@ impl<'a> State<'a> {
}) => {
let (cb, ib) = self.head("");
self.print_visibility(&item.vis);
self.print_constness(*constness);
self.print_safety(*safety);
self.print_is_auto(*is_auto);
self.word_nbsp("trait");
Expand Down
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
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for DoNotImplementViaObjectParser {
const CREATE: fn(Span) -> AttributeKind = AttributeKind::DoNotImplementViaObject;
}

// FIXME(const_trait_impl): remove this
// Const traits

pub(crate) struct ConstTraitParser;
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
Loading
Loading