Skip to content

Rollup of 13 pull requests #142313

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 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b2bfa10
Add discriminant_for_variant to AdtDef
NotLebedev May 27, 2025
a2d5942
Add discriminant_for_variant to CoroutineDef
NotLebedev May 27, 2025
7d13f8d
Implement Stable for Discr
NotLebedev Mar 27, 2025
becdd21
Add test for `AdtDef::discriminant_for_variant`
NotLebedev Jun 4, 2025
a39e98f
Add test for `AdtDef::discriminant_for_variant` polymorphic over para…
NotLebedev Jun 4, 2025
443e45c
Fix test description
NotLebedev Jun 6, 2025
3fce086
Make E0621 missing lifetime suggestion verbose
estebank Jun 4, 2025
643a9d2
tests: Change "fastcall" to "system" in some tests
workingjubilee Jun 6, 2025
518eb0d
rustdoc-json: Rearrange deck chairs in ABI testing
workingjubilee Jun 2, 2025
5906998
tests: Copy dont-shuffle-bswaps per tested opt level
workingjubilee Jun 7, 2025
cb3d074
Only run `citool` tests on the `auto` branch
Kobzol Jun 10, 2025
6b0deb2
tests: Revise dont-shuffle-bswaps-opt3 per tested arch
workingjubilee Jun 7, 2025
3a5187a
tests: Do not run afoul of asm.validity.non-exhaustive in input-stats
workingjubilee Jun 10, 2025
8f069e9
enable rustc debug assertions on -alt builds
lqd Sep 30, 2024
607a567
Use a faster runner for the x64 dist-alt job
Kobzol Jun 9, 2025
de8a91b
Add supported asm types for LoongArch32
heiher Jun 9, 2025
8ef8062
Extract target no-std hack to `build_helpers`
jieyouxu Jun 10, 2025
e10b2f6
Implement `//@ needs-target-std` directive in compiletest
jieyouxu Jun 10, 2025
c5b8123
Document `//@ needs-target-std` in rustc-dev-guide
jieyouxu Jun 10, 2025
97270ed
Make loongarch-none target maintainers more easily pingable
jieyouxu Jun 10, 2025
c558db3
Modify some run-make tests to use `//@ needs-target-std`
jieyouxu Jun 10, 2025
6f48758
Configure bootstrap backport nominations via triagebot
jieyouxu Jun 3, 2025
6227acc
Dont unwrap and re-wrap typing envs
compiler-errors Jun 10, 2025
d8f053b
Fix a missing fragment specifier in rustdoc tests
tgross35 Jul 31, 2024
1dc388b
Make `missing_fragment_specifier` an unconditional error
tgross35 Jul 31, 2024
f0cca10
Rollup merge of #128425 - tgross35:missing-fragment-specifier-uncondi…
fmease Jun 10, 2025
9692aec
Rollup merge of #141639 - NotLebedev:stable-mir-93, r=oli-obk
fmease Jun 10, 2025
33081bf
Rollup merge of #141967 - jieyouxu:bootstrap-backports, r=Kobzol
fmease Jun 10, 2025
032c01d
Rollup merge of #142042 - estebank:explicit-lifetime-verbose-suggesti…
fmease Jun 10, 2025
177af3d
Rollup merge of #142176 - workingjubilee:dont-shuffle-bswaps-per-arch…
fmease Jun 10, 2025
26b4071
Rollup merge of #142235 - Kobzol:rustc-dist-alt-assertions, r=marcoieni
fmease Jun 10, 2025
89a1c7a
Rollup merge of #142248 - heiher:loong32-asm-types, r=Amanieu
fmease Jun 10, 2025
cc1490c
Rollup merge of #142272 - workingjubilee:change-some-abi-tests, r=aDo…
fmease Jun 10, 2025
f2b8919
Rollup merge of #142282 - Kobzol:citool-skip-tests, r=marcoieni
fmease Jun 10, 2025
92e0cb7
Rollup merge of #142285 - workingjubilee:dont-use-bad-assembly, r=nne…
fmease Jun 10, 2025
6a0843d
Rollup merge of #142297 - jieyouxu:needs-target-std, r=Kobzol
fmease Jun 10, 2025
8fe7b32
Rollup merge of #142298 - jieyouxu:loongarch-maintainer-list, r=fee1-…
fmease Jun 10, 2025
f92aa1c
Rollup merge of #142306 - compiler-errors:nit-reveal-param-env-query,…
fmease Jun 10, 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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,18 @@ jobs:
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
workspaces: src/ci/citool
- name: Test citool
# Only test citool on the auto branch, to reduce latency of the calculate matrix job
# on PR/try builds.
if: ${{ github.ref == 'refs/heads/auto' }}
run: |
cd src/ci/citool
CARGO_INCREMENTAL=0 cargo test
- name: Calculate the CI job matrix
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
cd src/ci/citool
CARGO_INCREMENTAL=0 cargo test
CARGO_INCREMENTAL=0 cargo run calculate-job-matrix >> $GITHUB_OUTPUT
id: jobs
job:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ expand_meta_var_expr_unrecognized_var =
variable `{$key}` is not recognized in meta-variable expression
expand_missing_fragment_specifier = missing fragment specifier
.note = fragment specifiers must be specified in the 2024 edition
.note = fragment specifiers must be provided
.suggestion_add_fragspec = try adding a specifier here
.valid = {$valid}
Expand Down
25 changes: 6 additions & 19 deletions compiler/rustc_expand/src/mbe/macro_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ use rustc_ast::{DUMMY_NODE_ID, NodeId};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::MultiSpan;
use rustc_lint_defs::BuiltinLintDiag;
use rustc_session::lint::builtin::{META_VARIABLE_MISUSE, MISSING_FRAGMENT_SPECIFIER};
use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
use rustc_session::parse::ParseSess;
use rustc_span::edition::Edition;
use rustc_span::{ErrorGuaranteed, MacroRulesNormalizedIdent, Span, kw};
use smallvec::SmallVec;

Expand Down Expand Up @@ -266,23 +265,11 @@ fn check_binders(
// Similarly, this can only happen when checking a toplevel macro.
TokenTree::MetaVarDecl(span, name, kind) => {
if kind.is_none() && node_id != DUMMY_NODE_ID {
// FIXME: Report this as a hard error eventually and remove equivalent errors from
// `parse_tt_inner` and `nameize`. Until then the error may be reported twice, once
// as a hard error and then once as a buffered lint.
if span.edition() >= Edition::Edition2024 {
psess.dcx().emit_err(errors::MissingFragmentSpecifier {
span,
add_span: span.shrink_to_hi(),
valid: VALID_FRAGMENT_NAMES_MSG,
});
} else {
psess.buffer_lint(
MISSING_FRAGMENT_SPECIFIER,
span,
node_id,
BuiltinLintDiag::MissingFragmentSpecifier,
);
}
psess.dcx().emit_err(errors::MissingFragmentSpecifier {
span,
add_span: span.shrink_to_hi(),
valid: VALID_FRAGMENT_NAMES_MSG,
});
}
if !macros.is_empty() {
psess.dcx().span_bug(span, "unexpected MetaVarDecl in nested lhs");
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,6 @@ lint_mismatched_lifetime_syntaxes_suggestion_implicit =
lint_mismatched_lifetime_syntaxes_suggestion_mixed =
one option is to remove the lifetime for references and use the anonymous lifetime for paths
lint_missing_fragment_specifier = missing fragment specifier
lint_missing_unsafe_on_extern = extern blocks should be unsafe
.suggestion = needs `unsafe` before the extern keyword
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_lint/src/early/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,6 @@ pub fn decorate_builtin_lint(
BuiltinLintDiag::CfgAttrNoAttributes => {
lints::CfgAttrNoAttributes.decorate_lint(diag);
}
BuiltinLintDiag::MissingFragmentSpecifier => {
lints::MissingFragmentSpecifier.decorate_lint(diag);
}
BuiltinLintDiag::MetaVariableStillRepeating(name) => {
lints::MetaVariableStillRepeating { name }.decorate_lint(diag);
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,11 @@ fn register_builtins(store: &mut LintStore) {
"converted into hard error, \
see <https://github.com/rust-lang/rust/issues/116558> for more information",
);
store.register_removed(
"missing_fragment_specifier",
"converted into hard error, \
see <https://github.com/rust-lang/rust/issues/40107> for more information",
);
}

fn register_internals(store: &mut LintStore) {
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2616,10 +2616,6 @@ pub(crate) struct DuplicateMacroAttribute;
#[diag(lint_cfg_attr_no_attributes)]
pub(crate) struct CfgAttrNoAttributes;

#[derive(LintDiagnostic)]
#[diag(lint_missing_fragment_specifier)]
pub(crate) struct MissingFragmentSpecifier;

#[derive(LintDiagnostic)]
#[diag(lint_metavariable_still_repeating)]
pub(crate) struct MetaVariableStillRepeating {
Expand Down
46 changes: 0 additions & 46 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ declare_lint_pass! {
MACRO_USE_EXTERN_CRATE,
META_VARIABLE_MISUSE,
MISSING_ABI,
MISSING_FRAGMENT_SPECIFIER,
MISSING_UNSAFE_ON_EXTERN,
MUST_NOT_SUSPEND,
NAMED_ARGUMENTS_USED_POSITIONALLY,
Expand Down Expand Up @@ -1417,51 +1416,6 @@ declare_lint! {
};
}

declare_lint! {
/// The `missing_fragment_specifier` lint is issued when an unused pattern in a
/// `macro_rules!` macro definition has a meta-variable (e.g. `$e`) that is not
/// followed by a fragment specifier (e.g. `:expr`).
///
/// This warning can always be fixed by removing the unused pattern in the
/// `macro_rules!` macro definition.
///
/// ### Example
///
/// ```rust,compile_fail,edition2021
/// macro_rules! foo {
/// () => {};
/// ($name) => { };
/// }
///
/// fn main() {
/// foo!();
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// To fix this, remove the unused pattern from the `macro_rules!` macro definition:
///
/// ```rust
/// macro_rules! foo {
/// () => {};
/// }
/// fn main() {
/// foo!();
/// }
/// ```
pub MISSING_FRAGMENT_SPECIFIER,
Deny,
"detects missing fragment specifiers in unused `macro_rules!` patterns",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseError,
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
report_in_deps: true,
};
}

declare_lint! {
/// The `late_bound_lifetime_arguments` lint detects generic lifetime
/// arguments in path segments with late bound lifetime parameters.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ pub enum BuiltinLintDiag {
UnnameableTestItems,
DuplicateMacroAttribute,
CfgAttrNoAttributes,
MissingFragmentSpecifier,
MetaVariableStillRepeating(MacroRulesNormalizedIdent),
MetaVariableWrongOperator,
DuplicateMatcherBinding,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/query/erase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ tcx_lifetime! {
rustc_middle::ty::layout::FnAbiError,
rustc_middle::ty::layout::LayoutError,
rustc_middle::ty::ParamEnv,
rustc_middle::ty::TypingEnv,
rustc_middle::ty::Predicate,
rustc_middle::ty::SymbolName,
rustc_middle::ty::TraitRef,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ rustc_queries! {
/// Like `param_env`, but returns the `ParamEnv` after all opaque types have been
/// replaced with their hidden type. This is used in the old trait solver
/// when in `PostAnalysis` mode and should not be called directly.
query param_env_normalized_for_post_analysis(def_id: DefId) -> ty::ParamEnv<'tcx> {
query typing_env_normalized_for_post_analysis(def_id: DefId) -> ty::TypingEnv<'tcx> {
desc { |tcx| "computing revealed normalized predicates of `{}`", tcx.def_path_str(def_id) }
}

Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,10 +1116,7 @@ impl<'tcx> TypingEnv<'tcx> {
}

pub fn post_analysis(tcx: TyCtxt<'tcx>, def_id: impl IntoQueryParam<DefId>) -> TypingEnv<'tcx> {
TypingEnv {
typing_mode: TypingMode::PostAnalysis,
param_env: tcx.param_env_normalized_for_post_analysis(def_id),
}
tcx.typing_env_normalized_for_post_analysis(def_id)
}

/// Modify the `typing_mode` to `PostAnalysis` and eagerly reveal all
Expand All @@ -1133,7 +1130,7 @@ impl<'tcx> TypingEnv<'tcx> {
// No need to reveal opaques with the new solver enabled,
// since we have lazy norm.
let param_env = if tcx.next_trait_solver_globally() {
ParamEnv::new(param_env.caller_bounds())
param_env
} else {
ParamEnv::new(tcx.reveal_opaque_types_in_bounds(param_env.caller_bounds()))
};
Expand Down
33 changes: 29 additions & 4 deletions compiler/rustc_smir/src/rustc_smir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use rustc_middle::ty::layout::{
};
use rustc_middle::ty::print::{with_forced_trimmed_paths, with_no_trimmed_paths};
use rustc_middle::ty::{
GenericPredicates, Instance, List, ScalarInt, TyCtxt, TypeVisitableExt, ValTree,
CoroutineArgsExt, GenericPredicates, Instance, List, ScalarInt, TyCtxt, TypeVisitableExt,
ValTree,
};
use rustc_middle::{mir, ty};
use rustc_span::def_id::LOCAL_CRATE;
Expand All @@ -22,9 +23,9 @@ use stable_mir::mir::mono::{InstanceDef, StaticDef};
use stable_mir::mir::{BinOp, Body, Place, UnOp};
use stable_mir::target::{MachineInfo, MachineSize};
use stable_mir::ty::{
AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, FieldDef, FnDef, ForeignDef,
ForeignItemKind, GenericArgs, IntrinsicDef, LineInfo, MirConst, PolyFnSig, RigidTy, Span, Ty,
TyConst, TyKind, UintTy, VariantDef,
AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, CoroutineDef, Discr, FieldDef, FnDef,
ForeignDef, ForeignItemKind, GenericArgs, IntrinsicDef, LineInfo, MirConst, PolyFnSig, RigidTy,
Span, Ty, TyConst, TyKind, UintTy, VariantDef, VariantIdx,
};
use stable_mir::{Crate, CrateDef, CrateItem, CrateNum, DefId, Error, Filename, ItemKind, Symbol};

Expand Down Expand Up @@ -440,6 +441,30 @@ impl<'tcx> SmirCtxt<'tcx> {
def.internal(&mut *tables, tcx).variants().len()
}

/// Discriminant for a given variant index of AdtDef
pub fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr {
let mut tables = self.0.borrow_mut();
let tcx = tables.tcx;
let adt = adt.internal(&mut *tables, tcx);
let variant = variant.internal(&mut *tables, tcx);
adt.discriminant_for_variant(tcx, variant).stable(&mut *tables)
}

/// Discriminant for a given variand index and args of a coroutine
pub fn coroutine_discr_for_variant(
&self,
coroutine: CoroutineDef,
args: &GenericArgs,
variant: VariantIdx,
) -> Discr {
let mut tables = self.0.borrow_mut();
let tcx = tables.tcx;
let coroutine = coroutine.def_id().internal(&mut *tables, tcx);
let args = args.internal(&mut *tables, tcx);
let variant = variant.internal(&mut *tables, tcx);
args.as_coroutine().discriminant_for_variant(coroutine, tcx, variant).stable(&mut *tables)
}

/// The name of a variant.
pub fn variant_name(&self, def: VariantDef) -> Symbol {
let mut tables = self.0.borrow_mut();
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_smir/src/rustc_smir/convert/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,3 +959,11 @@ impl<'tcx> Stable<'tcx> for ty::ImplTraitInTraitData {
}
}
}

impl<'tcx> Stable<'tcx> for rustc_middle::ty::util::Discr<'tcx> {
type T = stable_mir::ty::Discr;

fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
stable_mir::ty::Discr { val: self.val, ty: self.ty.stable(tables) }
}
}
23 changes: 19 additions & 4 deletions compiler/rustc_smir/src/stable_mir/compiler_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use stable_mir::mir::mono::{Instance, InstanceDef, StaticDef};
use stable_mir::mir::{BinOp, Body, Place, UnOp};
use stable_mir::target::MachineInfo;
use stable_mir::ty::{
AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, FieldDef, FnDef, ForeignDef,
ForeignItemKind, ForeignModule, ForeignModuleDef, GenericArgs, GenericPredicates, Generics,
ImplDef, ImplTrait, IntrinsicDef, LineInfo, MirConst, PolyFnSig, RigidTy, Span, TraitDecl,
TraitDef, Ty, TyConst, TyConstId, TyKind, UintTy, VariantDef,
AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, CoroutineDef, Discr, FieldDef, FnDef,
ForeignDef, ForeignItemKind, ForeignModule, ForeignModuleDef, GenericArgs, GenericPredicates,
Generics, ImplDef, ImplTrait, IntrinsicDef, LineInfo, MirConst, PolyFnSig, RigidTy, Span,
TraitDecl, TraitDef, Ty, TyConst, TyConstId, TyKind, UintTy, VariantDef, VariantIdx,
};
use stable_mir::{
AssocItems, Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls,
Expand Down Expand Up @@ -225,6 +225,21 @@ impl<'tcx> SmirInterface<'tcx> {
self.cx.adt_variants_len(def)
}

/// Discriminant for a given variant index of AdtDef
pub(crate) fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr {
self.cx.adt_discr_for_variant(adt, variant)
}

/// Discriminant for a given variand index and args of a coroutine
pub(crate) fn coroutine_discr_for_variant(
&self,
coroutine: CoroutineDef,
args: &GenericArgs,
variant: VariantIdx,
) -> Discr {
self.cx.coroutine_discr_for_variant(coroutine, args, variant)
}

/// The name of a variant.
pub(crate) fn variant_name(&self, def: VariantDef) -> Symbol {
self.cx.variant_name(def)
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_smir/src/stable_mir/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,12 @@ crate_def! {
pub CoroutineDef;
}

impl CoroutineDef {
pub fn discriminant_for_variant(&self, args: &GenericArgs, idx: VariantIdx) -> Discr {
with(|cx| cx.coroutine_discr_for_variant(*self, args, idx))
}
}

crate_def! {
#[derive(Serialize)]
pub CoroutineClosureDef;
Expand Down Expand Up @@ -818,6 +824,15 @@ impl AdtDef {
pub fn variant(&self, idx: VariantIdx) -> Option<VariantDef> {
(idx.to_index() < self.num_variants()).then_some(VariantDef { idx, adt_def: *self })
}

pub fn discriminant_for_variant(&self, idx: VariantIdx) -> Discr {
with(|cx| cx.adt_discr_for_variant(*self, idx))
}
}

pub struct Discr {
pub val: u128,
pub ty: Ty,
}

/// Definition of a variant, which can be either a struct / union field or an enum variant.
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_target/src/asm/loongarch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ impl LoongArchInlineAsmRegClass {

pub fn supported_types(
self,
_arch: InlineAsmArch,
arch: InlineAsmArch,
) -> &'static [(InlineAsmType, Option<Symbol>)] {
match self {
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
Self::freg => types! { f: F32; d: F64; },
match (self, arch) {
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
(Self::reg, InlineAsmArch::LoongArch32) => types! { _: I8, I16, I32, F32; },
(Self::freg, _) => types! { f: F32; d: F64; },
_ => unreachable!("unsupported register class"),
}
}
}
Expand Down
Loading
Loading