Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
1040ec5
docs: Fix typo in `__get_cpuid_max` description
tyilo Sep 28, 2026
0983196
assert_instr: add support for explicit exclusion of bad instructions
RalfJung Aug 19, 2026
6a28c46
make assert_instr total instruction limit configurable per-test
RalfJung Aug 19, 2026
06cdd56
make x86-64 asm more consistent
RalfJung Aug 20, 2026
0f2d45d
add the new tests to more intrinsics
RalfJung Aug 20, 2026
0c7dd1e
Add `$` to bash string interpolation
Jamesbarford Oct 14, 2026
a15341d
bfloat16 types
Jamesbarford Oct 20, 2026
fdaa683
Update Arm intrinsic generator
Jamesbarford Oct 20, 2026
b5bf510
Update test harness
Jamesbarford Oct 20, 2026
ac43d47
Add bf16 intrinsics to YAML, JSON & re-generate
Jamesbarford Oct 20, 2026
bf098d9
add tracking issue number
Jamesbarford Oct 26, 2026
15f0d64
Merge pull request #2257 from Jamesbarford/fix/correct-string-interpo…
folkertdev Oct 27, 2026
3a22eb8
amdgpu: document that ds_permute/ds_bpermute take a byte address
bernardogv Oct 17, 2026
6973b86
Merge pull request #2258 from bernardogv/amdgpu-permute-byte-address
adamgemmell Oct 27, 2026
4543923
refactor: move RISC-V bit manipulation intrinsics into zb.rs
TechnoPorg Oct 20, 2026
558c0ac
refactor: make RISC-V bit manip intrinsics match C API
TechnoPorg Oct 20, 2026
cac7fb7
refactor: make LLVM RISC-V intrinsics use unsigned types
TechnoPorg Oct 26, 2026
1b99c25
Merge pull request #2247 from TechnoPorg/push-oltzmvxwsyno
tgross35 Oct 27, 2026
dae3a88
cleanup: remove rustc_legacy_const_generics from unstable intrinsics
TechnoPorg Oct 12, 2026
9c05e66
Merge pull request #2254 from TechnoPorg/push-mwwoxvvolwwx
tgross35 Oct 28, 2026
1d32319
simd-test: Update old import style, remove outdated lint
tgross35 Oct 29, 2026
70ea346
simd-test: Update proc macros to syn 3
tgross35 Oct 29, 2026
b510ea1
simd-test: Handle target-specific behavior within generated code
tgross35 Oct 29, 2026
2a0437e
Merge pull request #2261 from tgross35/test-updates
folkertdev Oct 29, 2026
e855210
Merge pull request #2256 from Jamesbarford/feature/aarch64-neon-bf16-…
folkertdev Oct 29, 2026
ca9e290
Correct llvm intrinsic type parameters in AArch64
sayantn Nov 1, 2026
5b4c933
Merge pull request #2212 from RalfJung/assert_instr_not
sayantn Nov 1, 2026
ad0911f
fix shift immediate widths
folkertdev Oct 28, 2026
b0c9d3f
use better test inputs
folkertdev Oct 28, 2026
fa502db
use better inputs that don't get folded away
folkertdev Oct 28, 2026
65b8447
use better inputs that don't get folded away
folkertdev Oct 28, 2026
441deff
fixup docker files
folkertdev Oct 28, 2026
2d06ea8
loads and stores now always use the `.d` variant
folkertdev Oct 28, 2026
caf6684
`copy_u_d` uses the signed instruction; there is no sign/zero extensi…
folkertdev Oct 28, 2026
4e05dff
clang ends up using the negated variant; fine
folkertdev Oct 28, 2026
6762899
clang uses just an `andi.b` for `bclri_b`
folkertdev Oct 28, 2026
fc31e66
correct FMA test results
folkertdev Oct 28, 2026
8ef038b
run qemu with a CPU that has +msa
folkertdev Oct 28, 2026
bf502cf
work around LLVM emitting a different instruction than the intrinsic …
folkertdev Oct 28, 2026
b3ad729
loongarch: Use `intrinsics::simd` for vclo
heiher Nov 10, 2026
bf8350a
Prepare for merging from rust-lang/rust
invalid-email-address Nov 12, 2026
77775ec
Fold `UnusedDuplicate` and `UnusedMultiple` diagnostics into `Duplica…
petrak-at-canonical Nov 12, 2026
befd06d
Fix SingleAttributeParser printing duplicate paths with .. instead of…
petrak-at-canonical Nov 13, 2026
ac9d75c
ref: replace debug_tuple helpers with debug struct ones
panstromek Oct 29, 2026
a8f1df2
add `core::arch::{x86, x86_64}::x87_f80`
folkertdev Sep 23, 2026
ef186ec
disable `assert_instr` on some amx tests
folkertdev Nov 15, 2026
be665a3
avx512ifma: fix docs for masked intrinsics
RalfJung Nov 15, 2026
b4e6163
Merge pull request #2264 from rust-lang/rustc-pull
folkertdev Nov 15, 2026
8c52e82
Merge pull request #2262 from sayantn/correct-overloaded-intrinsics
folkertdev Nov 15, 2026
e91673a
Merge pull request #2233 from tyilo/patch-1
folkertdev Nov 15, 2026
d2a12fd
Merge pull request #2260 from folkertdev/mips-fixes
folkertdev Nov 15, 2026
4c22f63
Merge pull request #2265 from heiher/loong-vclo
folkertdev Nov 15, 2026
1098785
powerpc: Implement vclzlsbb and vctzlsbb
Gelbpunkt Nov 11, 2026
b167284
Add some test cases
Gelbpunkt Nov 15, 2026
8e99d87
Skip power9-vector feature on 32-bit powerpc
Gelbpunkt Nov 15, 2026
5e12b34
Merge pull request #2267 from RalfJung/avx512ifma-mask
folkertdev Nov 15, 2026
a5cf8dd
Merge pull request #2266 from Gelbpunkt/powerpc-vclzlsbb-vctzlsbb
folkertdev Nov 15, 2026
598a018
Correctly filter deref impls on type aliases
GuillaumeGomez Nov 16, 2026
780712f
Prepare for merging from rust-lang/rust
folkertdev Nov 16, 2026
f57b2a3
Merge ref '4de190d26178' from rust-lang/rust
folkertdev Nov 16, 2026
3151c0f
Merge pull request #2270 from folkertdev/main
folkertdev Nov 16, 2026
c97f50d
attribute #[optimize]: keep low opt levels unoptimized
RalfJung Nov 15, 2026
1cfe456
rustc_target: Require altivec feature for ELFv2 powerpc64 targets
Gelbpunkt Nov 16, 2026
a292cb1
alloctests: use thread-local in `c_str_alloc_error`
Jules-Bertholet Nov 16, 2026
e4ae358
add `feature(cfg_target_has_reliable_f16b)` to `core`
folkertdev Nov 16, 2026
eb82c1f
Update TPDE submodule
TechnoPorg Nov 15, 2026
e27cc7a
Parallelize AST -> HIR lowering
aerooneqq Nov 16, 2026
6de3ba1
Collapse warn_unused_duplicate and warn_unused_duplicate_future_error
petrak-at-canonical Nov 16, 2026
cabdeec
Fix bad hyperlink
maxdexh Nov 16, 2026
e48bfa8
Update books
rustbot Nov 16, 2026
eb5a029
Rollup merge of #166054 - folkertdev:stdarch-sync-2026-11-16, r=folke…
JonathanBrouwer Nov 16, 2026
798263c
Rollup merge of #163495 - aerooneqq:parallel-ast-hir-lowering, r=petr…
JonathanBrouwer Nov 16, 2026
50585d8
Rollup merge of #165960 - Jules-Bertholet:unflake, r=RalfJung
JonathanBrouwer Nov 16, 2026
19a68f8
Rollup merge of #166002 - RalfJung:mir-opt-attr, r=hanna-kruppe
JonathanBrouwer Nov 16, 2026
58ee9ea
Rollup merge of #166049 - Gelbpunkt:elfv2-require-altivec, r=RalfJung
JonathanBrouwer Nov 16, 2026
aad3fd1
Rollup merge of #165935 - petrak-at-canonical:duplicate-attr-diagnost…
JonathanBrouwer Nov 16, 2026
d9f46c0
Rollup merge of #165999 - TechnoPorg:push-osuqssntxnxp, r=ZuseZ4
JonathanBrouwer Nov 16, 2026
d22eec8
Rollup merge of #166045 - GuillaumeGomez:correctly-filter-deref-impls…
JonathanBrouwer Nov 16, 2026
188dfdc
Rollup merge of #166063 - maxdexh:silence-rustdoc-this-isnt-my-code, …
JonathanBrouwer Nov 16, 2026
6fcd335
Rollup merge of #166066 - rustbot:docs-update, r=traviscross
JonathanBrouwer Nov 16, 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
8 changes: 4 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl AttributeParser for NakedParser {

if let Some(earlier) = this.span {
let span = cx.attr_span;
cx.warn_unused_duplicate(earlier, span);
cx.warn_unused_duplicate(earlier, span, sym::naked, false);
} else {
this.span = Some(cx.attr_span);
}
Expand Down Expand Up @@ -505,22 +505,22 @@ impl AttributeParser for UsedParser {
UsedBy::Compiler => &mut group.first_compiler,
UsedBy::Linker => {
if let Some(prev) = group.first_default {
cx.warn_unused_duplicate(prev, attr_span);
cx.warn_unused_duplicate(prev, attr_span, sym::used, false);
return;
}
&mut group.first_linker
}
UsedBy::Default => {
if let Some(prev) = group.first_linker {
cx.warn_unused_duplicate(prev, attr_span);
cx.warn_unused_duplicate(prev, attr_span, sym::used, false);
return;
}
&mut group.first_default
}
};

if let Some(prev) = *target {
cx.warn_unused_duplicate(prev, attr_span);
cx.warn_unused_duplicate(prev, attr_span, sym::used, false);
} else {
*target = Some(attr_span);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc_attr_ir::AttributeKind;
use rustc_attr_ir::target::Target;
use rustc_feature::AttributeStability;
use rustc_lint_defs::builtin::MALFORMED_DIAGNOSTIC_ATTRIBUTES;
use rustc_span::{Span, sym};
use rustc_span::{Span, Symbol, sym};

use crate::attributes::diagnostic::gate_diagnostic_attr;
use crate::attributes::{AcceptMapping, AttributeParser};
Expand Down Expand Up @@ -52,7 +52,8 @@ impl OpaqueParser {
fn parse<'sess>(&mut self, cx: &mut AcceptContext<'_, 'sess>, args: &ArgParser) {
let attr_span = cx.attr_span;
if let Some(earlier_span) = self.attr_span {
cx.warn_unused_duplicate(earlier_span, attr_span);
let attr_path_interned = Symbol::intern(&cx.attr_path.to_string());
cx.warn_unused_duplicate(earlier_span, attr_span, attr_path_interned, false);
}
self.attr_span = Some(attr_span);

Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use rustc_span::{Span, Symbol, edition, kw, sym};

use super::prelude::{ALL_TARGETS, AllowedTargets};
use super::{AcceptMapping, AttributeParser, template};
use crate::DuplicateAttribute;
use crate::context::{AcceptContext, FinalizeContext};
use crate::diagnostics::{
DocAliasBadChar, DocAliasDuplicated, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd,
Expand All @@ -23,7 +24,7 @@ use crate::diagnostics::{
DocKeywordNotKeyword, DocTestLiteral, DocTestTakesList, DocTestUnknown, DocUnknownAny,
DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins, DocUnknownSpotlight,
DuplicateNotableTraitColor, ExpectedNameValue, ExpectedNoArgs, IllFormedAttributeInput,
InvalidNotableTraitAttr, InvalidNotableTraitColor, MalformedDoc, UnusedDuplicate,
InvalidNotableTraitAttr, InvalidNotableTraitColor, MalformedDoc,
};
use crate::parser::{
ArgParser, MetaItemListParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser,
Expand Down Expand Up @@ -278,7 +279,12 @@ impl DocParser {
let unused_span = path.span();
cx.emit_lint(
INVALID_DOC_ATTRIBUTES,
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
DuplicateAttribute {
this: unused_span,
other: used_span,
name: sym::no_crate_inject,
warning: true,
},
unused_span,
);
return;
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_feature::AttributeStability;
use rustc_lint_defs::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNUSED_ATTRIBUTES};

use super::prelude::*;
use crate::diagnostics::{InlineForceInlineConflict, InlineIgnoredForExported, UnusedMultiple};
use crate::diagnostics::{DuplicateAttribute, InlineForceInlineConflict, InlineIgnoredForExported};

#[derive(Default)]
pub(crate) struct InlineParser(Option<(InlineAttr, Span)>);
Expand Down Expand Up @@ -70,7 +70,7 @@ impl AttributeParser for InlineParser {
cx.emit_err(InlineForceInlineConflict { inline_span, force_inline_span });
}
Some((_, first_inline_span)) => {
cx.warn_unused_duplicate_future_error(first_inline_span, inline_span);
cx.warn_unused_duplicate(first_inline_span, inline_span, sym::inline, true);
}
}
},
Expand Down Expand Up @@ -108,10 +108,11 @@ impl AttributeParser for InlineParser {
match this.0 {
None => this.0 = Some((attr, force_inline_span)),
Some((InlineAttr::Force { .. }, first_force_inline_span)) => {
cx.emit_err(UnusedMultiple {
cx.emit_err(DuplicateAttribute {
this: force_inline_span,
other: first_force_inline_span,
name: sym::rustc_force_inline,
warning: false,
});
}
Some((_, inline_span)) => {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ impl AttributeParser for MacroUseParser {
"State is UseAll is some so this is not the first attribute",
);
// Since there is a `#[macro_use]` import already, give a warning
cx.warn_unused_duplicate(first_span, span);
cx.warn_unused_duplicate(first_span, span, sym::macro_use, false);
}
MacroUseArgs::UseSpecific(_) => {
group.state = MacroUseArgs::UseAll;
group.first_span = Some(span);
// If there is a `#[macro_use]` attribute, warn on all `#[macro_use(...)]` attributes since everything is already imported
for specific_use in group.uses_attr_spans.drain(..) {
cx.warn_unused_duplicate(span, specific_use);
cx.warn_unused_duplicate(span, specific_use, sym::macro_use, false);
}
}
}
Expand All @@ -81,7 +81,7 @@ impl AttributeParser for MacroUseParser {
let first_span = group.first_span.expect(
"State is UseAll is some so this is not the first attribute",
);
cx.warn_unused_duplicate(first_span, span);
cx.warn_unused_duplicate(first_span, span, sym::macro_use, false);
}
MacroUseArgs::UseSpecific(arguments) => {
// Store here so if we encounter a `UseAll` later we can still lint this attribute
Expand Down
18 changes: 7 additions & 11 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use rustc_span::{Span, Symbol};
use thin_vec::ThinVec;

use crate::context::{AcceptContext, FinalizeCheckContext, FinalizeCheckFn, FinalizeContext};
use crate::diagnostics::UnusedMultiple;
use crate::diagnostics::DuplicateAttribute;
use crate::parser::ArgParser;
use crate::target_checking::AllowedTargets;
use crate::{AttributeTemplate, template};
Expand Down Expand Up @@ -233,19 +233,15 @@ impl OnDuplicate {
used: Span,
unused: Span,
) {
let name =
Symbol::intern(&P::PATH.iter().map(|i| i.to_string()).collect::<Vec<_>>().join("::"));
match self {
OnDuplicate::Warn => cx.warn_unused_duplicate(used, unused),
OnDuplicate::WarnButFutureError => cx.warn_unused_duplicate_future_error(used, unused),
OnDuplicate::Ignore => {}
OnDuplicate::Warn => cx.warn_unused_duplicate(used, unused, name, false),
OnDuplicate::WarnButFutureError => cx.warn_unused_duplicate(used, unused, name, true),
OnDuplicate::Error => {
cx.emit_err(UnusedMultiple {
this: unused,
other: used,
name: Symbol::intern(
&P::PATH.iter().map(|i| i.to_string()).collect::<Vec<_>>().join(".."),
),
});
cx.emit_err(DuplicateAttribute { this: unused, other: used, name, warning: false });
}
OnDuplicate::Ignore => {}
}
}
}
Expand Down
18 changes: 6 additions & 12 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ use crate::attributes::unroll::*;
use crate::attributes::{AttributeParser as _, AttributeSafety, Combine, Single, WithoutArgs};
use crate::diagnostics::{
AttributeParseError, AttributeParseErrorReason, AttributeParseErrorSuggestions,
ParsedDescription, UnusedDuplicate,
ParsedDescription,
};
use crate::parser::{
ArgParser, MetaItemListParser, MetaItemOrLitParser, MetaItemParser, NameValueParser,
RefPathParser,
};
use crate::target_checking::AllowedTargets;
use crate::{AttributeParser, AttributeTemplate, EmitAttribute};
use crate::{AttributeParser, AttributeTemplate, DuplicateAttribute, EmitAttribute};

type GroupType = LazyLock<GroupTypeInner>;

Expand Down Expand Up @@ -475,22 +475,16 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
(self.emit_lint)(LintId::of(lint), span.into(), kind);
}

pub(crate) fn warn_unused_duplicate(&mut self, used_span: Span, unused_span: Span) {
self.emit_lint(
UNUSED_ATTRIBUTES,
UnusedDuplicate { this: unused_span, other: used_span, warning: false },
unused_span,
)
}

pub(crate) fn warn_unused_duplicate_future_error(
pub(crate) fn warn_unused_duplicate(
&mut self,
used_span: Span,
unused_span: Span,
name: Symbol,
future_error: bool,
) {
self.emit_lint(
UNUSED_ATTRIBUTES,
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
DuplicateAttribute { this: unused_span, other: used_span, name, warning: future_error },
unused_span,
)
}
Expand Down
21 changes: 6 additions & 15 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1339,14 +1339,18 @@ pub(crate) struct UnknownVersionLiteral {
}

#[derive(Diagnostic)]
#[diag("multiple `{$name}` attributes")]
pub struct UnusedMultiple {
#[diag("duplicate `{$name}` attributes")]
pub struct DuplicateAttribute {
#[primary_span]
#[suggestion("remove this attribute", code = "", applicability = "unspecified")]
pub this: Span,
#[note("attribute also specified here")]
pub other: Span,
pub name: Symbol,
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub warning: bool,
}

#[derive(Diagnostic)]
Expand Down Expand Up @@ -2180,19 +2184,6 @@ pub(crate) struct AdditionalCommaSuggestion {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("unused attribute")]
pub(crate) struct UnusedDuplicate {
#[suggestion("remove this attribute", code = "", applicability = "unspecified")]
pub this: Span,
#[note("attribute also specified here")]
pub other: Span,
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub warning: bool,
}

#[derive(Diagnostic)]
#[diag("`#[macro_export]` is not allowed on declarative macro definitions")]
#[note("declarative macros follow the same exporting rules as regular items")]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub use attributes::cfg::{
pub use attributes::cfg_select::*;
pub use attributes::util::{is_builtin_attr, parse_version};
pub use context::ShouldEmit;
pub use diagnostics::{ParsedDescription, UnusedMultiple};
pub use diagnostics::{DuplicateAttribute, ParsedDescription};
pub use interface::{AttributeParser, EmitAttribute};
pub use rustc_parse::parser::Recovery;
pub use template::AttributeTemplate;
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::{self as ast, AttrStyle, Attribute, MetaItem, attr, token};
use rustc_attr_parsing::{AttributeTemplate, UnusedMultiple, validate_attr};
use rustc_attr_parsing::{AttributeTemplate, DuplicateAttribute, validate_attr};
use rustc_errors::{Applicability, Diag, ErrorGuaranteed};
use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt};
use rustc_expand::expand::AstFragment;
Expand Down Expand Up @@ -51,7 +51,7 @@ pub(crate) fn warn_on_duplicate_attribute(
DUPLICATE_MACRO_ATTRIBUTES,
attr.span,
ecx.current_expansion.lint_node_id,
UnusedMultiple { this: attr.span, other: span, name },
DuplicateAttribute { this: attr.span, other: span, name, warning: false },
);
}
}
Expand Down
36 changes: 33 additions & 3 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ use rustc_crate_store::Untracked;
use rustc_data_structures::indexmap::IndexMap;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{
AppendOnlyIndexVec, DynSend, DynSync, FreezeLock, WorkerLocal, par_fns,
AppendOnlyIndexVec, DynSend, DynSync, FreezeLock, WorkerLocal, is_dyn_thread_safe, par_fns,
par_range,
};
use rustc_data_structures::thousands;
use rustc_errors::timings::TimingSection;
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level};
use rustc_expand::base::{ExtCtxt, LintStoreExpand};
use rustc_feature::Features;
use rustc_fs_util::try_canonicalize;
use rustc_hir::def_id::{LOCAL_CRATE, StableCrateId, StableCrateIdMap};
use rustc_hir::OwnerId;
use rustc_hir::def_id::{DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap};
use rustc_hir::definitions::Definitions;
use rustc_incremental::setup_dep_graph;
use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore, unerased_lint_store};
Expand Down Expand Up @@ -1110,9 +1112,35 @@ pub fn emit_delayed_lints(tcx: TyCtxt<'_>) {
/// Runs all analyses that we guarantee to run, even if errors were reported in earlier analyses.
/// This function never fails.
fn run_required_analyses(tcx: TyCtxt<'_>) {
let is_parallel = is_dyn_thread_safe();

// There is no point in prefetching hir owners when parallel compiler is
// disabled, `print_hir_stats`, `check_crate` or `hir_crate_items` below will do it.
if is_parallel {
// Prefetch this as it is invoked in each `lower_to_hir`.
tcx.ensure_done().resolve_type_relative_delegations(());

let index = tcx.index_ast(());

// Invoke right before the parallel loop starts.
tcx.untracked().definitions.write().commit_end_of_determinism();
par_range(0..index.len(), |idx| {
let id = LocalDefId { local_def_index: DefIndex::from_usize(idx) };

// FIXME: one can try to eliminate this filter in future,
// but it didn't lead to significant improvements at the moment
// of writing.
if index[id].is_some() {
tcx.ensure_done().hir_owner(id);
tcx.ensure_done().hir_attr_map(OwnerId { def_id: id });
}
});
}

if tcx.sess.opts.unstable_opts.input_stats {
rustc_passes::input_stats::print_hir_stats(tcx);
}

// When using rustdoc's "jump to def" feature, it enters this code and `check_crate`
// is not defined. So we need to cfg it out.
#[cfg(all(not(doc), debug_assertions))]
Expand All @@ -1123,7 +1151,9 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
// to use `hir_crate_items`.
tcx.ensure_done().hir_crate_items(());

tcx.untracked().definitions.write().commit_end_of_determinism();
if !is_parallel {
tcx.untracked().definitions.write().commit_end_of_determinism();
}

rustc_passes::delegation::check_glob_and_list_delegations_target_expr(tcx);

Expand Down
19 changes: 11 additions & 8 deletions compiler/rustc_mir_transform/src/pass_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,19 @@ impl<'sess> PassCtx<'sess> {
let body_mir_opt_level = if !tcx.def_kind(def_id).has_codegen_attrs() {
tcx.sess.mir_opt_level()
} else {
match tcx.codegen_fn_attrs(def_id).optimize {
let attr_opt_level = match tcx.codegen_fn_attrs(def_id).optimize {
OptimizeAttr::Default => tcx.sess.mir_opt_level(),
OptimizeAttr::Speed => OptLevel::Aggressive.mir_opt_level(),
// `optimize(none)`/`optimize(size)` should not increase the MIR opt level.
// (This can be relevant when `-Zmir-opt-level=0` was manually set.)
OptimizeAttr::DoNotOptimize => {
OptLevel::No.mir_opt_level().min(tcx.sess.mir_opt_level())
}
OptimizeAttr::Size => OptLevel::Size.mir_opt_level().min(tcx.sess.mir_opt_level()),
}
OptimizeAttr::Size => OptLevel::SizeMin.mir_opt_level(),
OptimizeAttr::DoNotOptimize => OptLevel::No.mir_opt_level(),
};
// The LLVM backend only makes the `optimize` attribute really do anything in optimized
// builds: at opt-levels 1-3, we can choose some functions to optimize for size instead;
// at opt-level s or z, we can choose some functions to optimize for speed. For
// consistency, we do something similar for MIR-opts, by letting the attribute only
// decrease the opt-level, not increase it. (MIR does not distinguish between size and
// speed optimizations.)
attr_opt_level.min(tcx.sess.mir_opt_level())
};
Self { session: tcx.sess, body_mir_opt_level }
}
Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,15 @@ impl Target {
// There's no SPE for PowerPC64, and we currently don't support any soft-float
// targets. (If we ever add one, we need to match on `RustcAbi::Softfloat` similar
// to other targets above.)
FeatureConstraints { required: &["hard-float"], incompatible: &["spe"] }
match self.llvm_abiname {
// The ELFv2 ABI requires vector registers for passing f128 and any future
// 16-byte aligned types.
LlvmAbi::ElfV2 => FeatureConstraints {
required: &["hard-float", "altivec"],
incompatible: &["spe"],
},
_ => FeatureConstraints { required: &["hard-float"], incompatible: &["spe"] },
}
}
Arch::Sparc => {
// We currently don't have a soft-float target for SPARC.
Expand Down
Loading
Loading