Skip to content

Commit 502d6aa

Browse files
committed
Auto merge of #93854 - matthiaskrgr:rollup-bh2a85j, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #92670 (add kernel target for RustyHermit) - #93756 (Support custom options for LLVM build) - #93802 (fix oversight in the `min_const_generics` checks) - #93808 (Remove first headings indent) - #93824 (Stabilize cfg_target_has_atomic) - #93830 (Refactor sidebar printing code) - #93843 (kmc-solid: Fix wait queue manipulation errors in the `Condvar` implementation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 56cd04a + 8c60f44 commit 502d6aa

34 files changed

+445
-599
lines changed

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ declare_features! (
7272
(accepted, cfg_doctest, "1.40.0", Some(62210), None),
7373
/// Allows `cfg(target_feature = "...")`.
7474
(accepted, cfg_target_feature, "1.27.0", Some(29717), None),
75+
/// Allows `cfg(target_has_atomic = "...")`.
76+
(accepted, cfg_target_has_atomic, "1.60.0", Some(32976), None),
7577
/// Allows `cfg(target_vendor = "...")`.
7678
(accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
7779
/// Allows implementing `Clone` for closures where possible (RFC 2132).

compiler/rustc_feature/src/active.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ declare_features! (
309309
(active, cfg_sanitize, "1.41.0", Some(39699), None),
310310
/// Allows `cfg(target_abi = "...")`.
311311
(active, cfg_target_abi, "1.55.0", Some(80970), None),
312-
/// Allows `cfg(target_has_atomic = "...")`.
313-
(active, cfg_target_has_atomic, "1.9.0", Some(32976), None),
312+
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
313+
(active, cfg_target_has_atomic_equal_alignment, "1.60.0", Some(93822), None),
314314
/// Allows `cfg(target_thread_local)`.
315315
(active, cfg_target_thread_local, "1.7.0", Some(29594), None),
316316
/// Allow conditional compilation depending on rust version

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ const GATED_CFGS: &[GatedCfg] = &[
2626
// (name in cfg, feature, function to check if the feature is enabled)
2727
(sym::target_abi, sym::cfg_target_abi, cfg_fn!(cfg_target_abi)),
2828
(sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)),
29-
(sym::target_has_atomic, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)),
30-
(sym::target_has_atomic_load_store, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)),
3129
(
3230
sym::target_has_atomic_equal_alignment,
33-
sym::cfg_target_has_atomic,
34-
cfg_fn!(cfg_target_has_atomic),
31+
sym::cfg_target_has_atomic_equal_alignment,
32+
cfg_fn!(cfg_target_has_atomic_equal_alignment),
3533
),
3634
(sym::sanitize, sym::cfg_sanitize, cfg_fn!(cfg_sanitize)),
3735
(sym::version, sym::cfg_version, cfg_fn!(cfg_version)),

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ symbols! {
421421
cfg_target_abi,
422422
cfg_target_feature,
423423
cfg_target_has_atomic,
424+
cfg_target_has_atomic_equal_alignment,
424425
cfg_target_thread_local,
425426
cfg_target_vendor,
426427
cfg_version,

compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::spec::Target;
33
pub fn target() -> Target {
44
let mut base = super::hermit_base::opts();
55
base.max_atomic_width = Some(128);
6+
base.features = "+strict-align,+neon,+fp-armv8".to_string();
67

78
Target {
89
llvm_target: "aarch64-unknown-hermit".to_string(),
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use crate::spec::Target;
2+
3+
pub fn target() -> Target {
4+
let mut base = super::hermit_kernel_base::opts();
5+
base.max_atomic_width = Some(128);
6+
base.abi = "softfloat".to_string();
7+
base.features = "+strict-align,-neon,-fp-armv8".to_string();
8+
9+
Target {
10+
llvm_target: "aarch64-unknown-hermit".to_string(),
11+
pointer_width: 64,
12+
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
13+
arch: "aarch64".to_string(),
14+
options: base,
15+
}
16+
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ supported_targets! {
964964
("aarch64-unknown-hermit", aarch64_unknown_hermit),
965965
("x86_64-unknown-hermit", x86_64_unknown_hermit),
966966

967+
("aarch64-unknown-none-hermitkernel", aarch64_unknown_none_hermitkernel),
967968
("x86_64-unknown-none-hermitkernel", x86_64_unknown_none_hermitkernel),
968969

969970
("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,8 +2281,27 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
22812281
assert_eq!(opt_self_ty, None);
22822282
self.prohibit_generics(path.segments);
22832283
// Try to evaluate any array length constants.
2284-
let normalized_ty = self.normalize_ty(span, tcx.at(span).type_of(def_id));
2285-
if forbid_generic && normalized_ty.needs_subst() {
2284+
let ty = tcx.at(span).type_of(def_id);
2285+
// HACK(min_const_generics): Forbid generic `Self` types
2286+
// here as we can't easily do that during nameres.
2287+
//
2288+
// We do this before normalization as we otherwise allow
2289+
// ```rust
2290+
// trait AlwaysApplicable { type Assoc; }
2291+
// impl<T: ?Sized> AlwaysApplicable for T { type Assoc = usize; }
2292+
//
2293+
// trait BindsParam<T> {
2294+
// type ArrayTy;
2295+
// }
2296+
// impl<T> BindsParam<T> for <T as AlwaysApplicable>::Assoc {
2297+
// type ArrayTy = [u8; Self::MAX];
2298+
// }
2299+
// ```
2300+
// Note that the normalization happens in the param env of
2301+
// the anon const, which is empty. This is why the
2302+
// `AlwaysApplicable` impl needs a `T: ?Sized` bound for
2303+
// this to compile if we were to normalize here.
2304+
if forbid_generic && ty.needs_subst() {
22862305
let mut err = tcx.sess.struct_span_err(
22872306
path.span,
22882307
"generic `Self` types are currently not permitted in anonymous constants",
@@ -2297,7 +2316,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
22972316
err.emit();
22982317
tcx.ty_error()
22992318
} else {
2300-
normalized_ty
2319+
self.normalize_ty(span, ty)
23012320
}
23022321
}
23032322
Res::Def(DefKind::AssocTy, def_id) => {

config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ changelog-seen = 2
157157
# Whether to build the clang compiler.
158158
#clang = false
159159

160+
# Custom CMake defines to set when building LLVM.
161+
#build-config = {}
162+
160163
# =============================================================================
161164
# General build configuration options
162165
# =============================================================================

library/alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
#![feature(associated_type_bounds)]
141141
#![feature(box_syntax)]
142142
#![feature(cfg_sanitize)]
143-
#![feature(cfg_target_has_atomic)]
143+
#![cfg_attr(bootstrap, feature(cfg_target_has_atomic))]
144144
#![feature(const_deref)]
145145
#![feature(const_fn_trait_bound)]
146146
#![feature(const_mut_refs)]

0 commit comments

Comments
 (0)