Skip to content

Commit 9311767

Browse files
committed
Auto merge of #146685 - jdonszelmann:rollup-kwuih4z, r=jdonszelmann
Rollup of 7 pull requests Successful merges: - #146458 (Add parallel-frontend-threads to bootstrap.toml and enable multi-threaded parallel compilation) - #146485 (Remove unsized arg handling in `ArgAbiBuilderMethods::store_fn_arg` implementations) - #146536 (clean up several trait related UI tests) - #146598 (Make llvm_enzyme a regular cargo feature) - #146647 (Move `#[rustc_coherence_is_core]` to the `crate_level` file) - #146654 (Do not use `git -C dir`) - #146681 (Add space after brace in `Box<[T]>::new_uninit_slice` example) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4645a79 + c6ed4c0 commit 9311767

File tree

36 files changed

+143
-89
lines changed

36 files changed

+143
-89
lines changed

bootstrap.example.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,14 @@
859859
# Trigger a `DebugBreak` after an internal compiler error during bootstrap on Windows
860860
#rust.break-on-ice = true
861861

862+
# Set the number of threads for the compiler frontend used during compilation of Rust code (passed to `-Zthreads`).
863+
# The valid options are:
864+
# 0 - Set the number of threads according to the detected number of threads of the host system
865+
# 1 - Use a single thread for compilation of Rust code (the default)
866+
# N - Number of threads used for compilation of Rust code
867+
#
868+
#rust.parallel-frontend-threads = 1
869+
862870
# =============================================================================
863871
# Distribution options
864872
#

compiler/rustc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ features = ['unprefixed_malloc_on_supported_platforms']
3030
check_only = ['rustc_driver_impl/check_only']
3131
jemalloc = ['dep:tikv-jemalloc-sys']
3232
llvm = ['rustc_driver_impl/llvm']
33+
llvm_enzyme = ['rustc_driver_impl/llvm_enzyme']
3334
max_level_info = ['rustc_driver_impl/max_level_info']
3435
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
3536
# tidy-alphabetical-end

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,12 @@ impl<S: Stage> NoArgsAttributeParser<S> for NoStdParser {
174174
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::CrateLevel;
175175
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoStd;
176176
}
177+
178+
pub(crate) struct RustcCoherenceIsCoreParser;
179+
180+
impl<S: Stage> NoArgsAttributeParser<S> for RustcCoherenceIsCoreParser {
181+
const PATH: &[Symbol] = &[sym::rustc_coherence_is_core];
182+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
183+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::CrateLevel;
184+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcCoherenceIsCore;
185+
}

compiler/rustc_attr_parsing/src/attributes/traits.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for AllowIncoherentImplParser {
149149
const CREATE: fn(Span) -> AttributeKind = AttributeKind::AllowIncoherentImpl;
150150
}
151151

152-
pub(crate) struct CoherenceIsCoreParser;
153-
impl<S: Stage> NoArgsAttributeParser<S> for CoherenceIsCoreParser {
154-
const PATH: &[Symbol] = &[sym::rustc_coherence_is_core];
155-
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
156-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::CrateLevel;
157-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::CoherenceIsCore;
158-
}
159-
160152
pub(crate) struct FundamentalParser;
161153
impl<S: Stage> NoArgsAttributeParser<S> for FundamentalParser {
162154
const PATH: &[Symbol] = &[sym::fundamental];

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::attributes::codegen_attrs::{
2626
use crate::attributes::confusables::ConfusablesParser;
2727
use crate::attributes::crate_level::{
2828
CrateNameParser, MoveSizeLimitParser, NoCoreParser, NoStdParser, PatternComplexityLimitParser,
29-
RecursionLimitParser, TypeLengthLimitParser,
29+
RecursionLimitParser, RustcCoherenceIsCoreParser, TypeLengthLimitParser,
3030
};
3131
use crate::attributes::deprecation::DeprecationParser;
3232
use crate::attributes::dummy::DummyParser;
@@ -61,10 +61,10 @@ use crate::attributes::stability::{
6161
};
6262
use crate::attributes::test_attrs::{IgnoreParser, ShouldPanicParser};
6363
use crate::attributes::traits::{
64-
AllowIncoherentImplParser, CoherenceIsCoreParser, CoinductiveParser, ConstTraitParser,
65-
DenyExplicitImplParser, DoNotImplementViaObjectParser, FundamentalParser, MarkerParser,
66-
ParenSugarParser, PointeeParser, SkipDuringMethodDispatchParser, SpecializationTraitParser,
67-
TypeConstParser, UnsafeSpecializationMarkerParser,
64+
AllowIncoherentImplParser, CoinductiveParser, ConstTraitParser, DenyExplicitImplParser,
65+
DoNotImplementViaObjectParser, FundamentalParser, MarkerParser, ParenSugarParser,
66+
PointeeParser, SkipDuringMethodDispatchParser, SpecializationTraitParser, TypeConstParser,
67+
UnsafeSpecializationMarkerParser,
6868
};
6969
use crate::attributes::transparency::TransparencyParser;
7070
use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs};
@@ -206,7 +206,6 @@ attribute_parsers!(
206206
Single<WithoutArgs<AllowInternalUnsafeParser>>,
207207
Single<WithoutArgs<AsPtrParser>>,
208208
Single<WithoutArgs<AutomaticallyDerivedParser>>,
209-
Single<WithoutArgs<CoherenceIsCoreParser>>,
210209
Single<WithoutArgs<CoinductiveParser>>,
211210
Single<WithoutArgs<ColdParser>>,
212211
Single<WithoutArgs<ConstContinueParser>>,
@@ -234,6 +233,7 @@ attribute_parsers!(
234233
Single<WithoutArgs<ProcMacroAttributeParser>>,
235234
Single<WithoutArgs<ProcMacroParser>>,
236235
Single<WithoutArgs<PubTransparentParser>>,
236+
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
237237
Single<WithoutArgs<SpecializationTraitParser>>,
238238
Single<WithoutArgs<StdInternalSymbolParser>>,
239239
Single<WithoutArgs<TrackCallerParser>>,

compiler/rustc_builtin_macros/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
3333
thin-vec = "0.2.12"
3434
tracing = "0.1"
3535
# tidy-alphabetical-end
36+
37+
[features]
38+
# tidy-alphabetical-start
39+
llvm_enzyme = []
40+
# tidy-alphabetical-end

compiler/rustc_builtin_macros/src/autodiff.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ mod llvm_enzyme {
209209
mut item: Annotatable,
210210
mode: DiffMode,
211211
) -> Vec<Annotatable> {
212-
if cfg!(not(llvm_enzyme)) {
212+
// FIXME(bjorn3) maybe have the backend directly tell if autodiff is supported?
213+
if cfg!(not(feature = "llvm_enzyme")) {
213214
ecx.sess.dcx().emit_err(errors::AutoDiffSupportNotBuild { span: meta_item.span });
214215
return vec![item];
215216
}

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
730730
if self.is_sized_indirect() {
731731
OperandValue::Ref(PlaceValue::new_sized(val, self.layout.align.abi)).store(bx, dst)
732732
} else if self.is_unsized_indirect() {
733-
bug!("unsized `ArgAbi` must be handled through `store_fn_arg`");
733+
bug!("unsized `ArgAbi` cannot be stored");
734734
} else if let PassMode::Cast { ref cast, .. } = self.mode {
735735
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
736736
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
@@ -797,12 +797,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
797797
OperandValue::Pair(next(), next()).store(bx, dst);
798798
}
799799
PassMode::Indirect { meta_attrs: Some(_), .. } => {
800-
let place_val = PlaceValue {
801-
llval: next(),
802-
llextra: Some(next()),
803-
align: self.layout.align.abi,
804-
};
805-
OperandValue::Ref(place_val).store(bx, dst);
800+
bug!("unsized `ArgAbi` cannot be stored");
806801
}
807802
PassMode::Direct(_)
808803
| PassMode::Indirect { meta_attrs: None, .. }

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ tracing = "0.1"
4646
[features]
4747
# tidy-alphabetical-start
4848
check_only = ["rustc_llvm/check_only"]
49+
llvm_enzyme = []
4950
# tidy-alphabetical-end
5051

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
215215
let align = attrs.pointee_align.unwrap_or(self.layout.align.abi);
216216
OperandValue::Ref(PlaceValue::new_sized(val, align)).store(bx, dst);
217217
}
218-
// Unsized indirect qrguments
218+
// Unsized indirect arguments cannot be stored
219219
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
220-
bug!("unsized `ArgAbi` must be handled through `store_fn_arg`");
220+
bug!("unsized `ArgAbi` cannot be stored");
221221
}
222222
PassMode::Cast { cast, pad_i32: _ } => {
223223
// The ABI mandates that the value is passed as a different struct representation.
@@ -272,12 +272,7 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
272272
OperandValue::Pair(next(), next()).store(bx, dst);
273273
}
274274
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
275-
let place_val = PlaceValue {
276-
llval: next(),
277-
llextra: Some(next()),
278-
align: self.layout.align.abi,
279-
};
280-
OperandValue::Ref(place_val).store(bx, dst);
275+
bug!("unsized `ArgAbi` cannot be stored");
281276
}
282277
PassMode::Direct(_)
283278
| PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ }

0 commit comments

Comments
 (0)