Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 502d6aa

Browse files
committedFeb 10, 2022
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

File tree

34 files changed

+445
-599
lines changed

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)]

‎library/core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@
155155
#![feature(allow_internal_unstable)]
156156
#![feature(associated_type_bounds)]
157157
#![feature(auto_traits)]
158-
#![feature(cfg_target_has_atomic)]
158+
#![cfg_attr(bootstrap, feature(cfg_target_has_atomic))]
159+
#![cfg_attr(not(bootstrap), feature(cfg_target_has_atomic_equal_alignment))]
159160
#![feature(const_fn_floating_point_arithmetic)]
160161
#![feature(const_fn_fn_ptr_basics)]
161162
#![feature(const_fn_trait_bound)]

‎library/core/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![feature(box_syntax)]
88
#![feature(cell_update)]
99
#![feature(cfg_panic)]
10-
#![feature(cfg_target_has_atomic)]
10+
#![cfg_attr(bootstrap, feature(cfg_target_has_atomic))]
1111
#![feature(const_assume)]
1212
#![feature(const_black_box)]
1313
#![feature(const_bool_to_option)]

‎library/std/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
#![feature(c_variadic)]
243243
#![feature(cfg_accessible)]
244244
#![feature(cfg_eval)]
245-
#![feature(cfg_target_has_atomic)]
245+
#![cfg_attr(bootstrap, feature(cfg_target_has_atomic))]
246246
#![feature(cfg_target_thread_local)]
247247
#![feature(char_error_internals)]
248248
#![feature(char_internals)]

‎library/std/src/sys/itron/condvar.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ unsafe impl Sync for Condvar {}
1515
pub type MovableCondvar = Condvar;
1616

1717
impl Condvar {
18+
#[inline]
1819
pub const fn new() -> Condvar {
1920
Condvar { waiters: SpinMutex::new(waiter_queue::WaiterQueue::new()) }
2021
}
2122

23+
#[inline]
2224
pub unsafe fn init(&mut self) {}
2325

2426
pub unsafe fn notify_one(&self) {
@@ -190,7 +192,7 @@ mod waiter_queue {
190192
let insert_after = {
191193
let mut cursor = head.last;
192194
loop {
193-
if waiter.priority <= cursor.as_ref().priority {
195+
if waiter.priority >= cursor.as_ref().priority {
194196
// `cursor` and all previous waiters have the same or higher
195197
// priority than `current_task_priority`. Insert the new
196198
// waiter right after `cursor`.
@@ -206,14 +208,16 @@ mod waiter_queue {
206208

207209
if let Some(mut insert_after) = insert_after {
208210
// Insert `waiter` after `insert_after`
209-
let insert_before = insert_after.as_ref().prev;
211+
let insert_before = insert_after.as_ref().next;
210212

211213
waiter.prev = Some(insert_after);
212214
insert_after.as_mut().next = Some(waiter_ptr);
213215

214216
waiter.next = insert_before;
215217
if let Some(mut insert_before) = insert_before {
216218
insert_before.as_mut().prev = Some(waiter_ptr);
219+
} else {
220+
head.last = waiter_ptr;
217221
}
218222
} else {
219223
// Insert `waiter` to the front
@@ -240,11 +244,11 @@ mod waiter_queue {
240244
match (waiter.prev, waiter.next) {
241245
(Some(mut prev), Some(mut next)) => {
242246
prev.as_mut().next = Some(next);
243-
next.as_mut().next = Some(prev);
247+
next.as_mut().prev = Some(prev);
244248
}
245249
(None, Some(mut next)) => {
246250
head.first = next;
247-
next.as_mut().next = None;
251+
next.as_mut().prev = None;
248252
}
249253
(Some(mut prev), None) => {
250254
prev.as_mut().next = None;
@@ -271,6 +275,7 @@ mod waiter_queue {
271275
unsafe { waiter.as_ref().task != 0 }
272276
}
273277

278+
#[inline]
274279
pub fn pop_front(&mut self) -> Option<abi::ID> {
275280
unsafe {
276281
let head = self.head.as_mut()?;

‎src/bootstrap/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ pub struct Config {
108108
pub llvm_polly: bool,
109109
pub llvm_clang: bool,
110110
pub llvm_from_ci: bool,
111+
pub llvm_build_config: HashMap<String, String>,
111112

112113
pub use_lld: bool,
113114
pub lld_enabled: bool,
@@ -477,6 +478,7 @@ derive_merge! {
477478
polly: Option<bool>,
478479
clang: Option<bool>,
479480
download_ci_llvm: Option<StringOrBool>,
481+
build_config: Option<HashMap<String, String>>,
480482
}
481483
}
482484

@@ -807,6 +809,7 @@ impl Config {
807809
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
808810
config.llvm_polly = llvm.polly.unwrap_or(false);
809811
config.llvm_clang = llvm.clang.unwrap_or(false);
812+
config.llvm_build_config = llvm.build_config.clone().unwrap_or(Default::default());
810813
config.llvm_from_ci = match llvm.download_ci_llvm {
811814
Some(StringOrBool::String(s)) => {
812815
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
@@ -876,6 +879,7 @@ impl Config {
876879
check_ci_llvm!(llvm.allow_old_toolchain);
877880
check_ci_llvm!(llvm.polly);
878881
check_ci_llvm!(llvm.clang);
882+
check_ci_llvm!(llvm.build_config);
879883
check_ci_llvm!(llvm.plugins);
880884

881885
// CI-built LLVM can be either dynamic or static.

‎src/bootstrap/native.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ impl Step for Llvm {
353353

354354
configure_cmake(builder, target, &mut cfg, true);
355355

356+
for (key, val) in &builder.config.llvm_build_config {
357+
cfg.define(key, val);
358+
}
359+
356360
// FIXME: we don't actually need to build all LLVM tools and all LLVM
357361
// libraries here, e.g., we just want a few components and a few
358362
// tools. Figure out how to filter them down and only build the right

‎src/doc/rustc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md)
1818
- [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md)
1919
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)
20+
- [aarch64-unknown-none-hermitkernel](platform-support/aarch64-unknown-none-hermitkernel.md)
2021
- [\*-kmc-solid_\*](platform-support/kmc-solid.md)
2122
- [*-unknown-openbsd](platform-support/openbsd.md)
2223
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)

‎src/doc/rustc/src/platform-support.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ target | std | host | notes
204204
`aarch64-apple-tvos` | * | | ARM64 tvOS
205205
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
206206
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
207-
`aarch64-unknown-hermit` | ? | |
207+
`aarch64-unknown-hermit` | ✓ | | ARM64 HermitCore
208+
[`aarch64-unknown-none-hermitkernel`](platform-support/aarch64-unknown-none-hermitkernel.md) | * | | ARM64 HermitCore kernel
208209
`aarch64-unknown-uefi` | * | | ARM64 UEFI
209210
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
210211
`aarch64-unknown-netbsd` | ✓ | ✓ |
@@ -286,10 +287,10 @@ target | std | host | notes
286287
`x86_64-sun-solaris` | ? | | Deprecated target for 64-bit Solaris 10/11, illumos
287288
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
288289
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
289-
`x86_64-unknown-hermit` | ? | |
290+
`x86_64-unknown-hermit` | | | HermitCore
290291
`x86_64-unknown-l4re-uclibc` | ? | |
291292
[`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | | Freestanding/bare-metal x86_64, softfloat
292-
`x86_64-unknown-none-hermitkernel` | ? | | HermitCore kernel
293+
`x86_64-unknown-none-hermitkernel` | * | | HermitCore kernel
293294
`x86_64-unknown-none-linuxkernel` | * | | Linux kernel modules
294295
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
295296
`x86_64-unknown-uefi` | * | | 64-bit UEFI
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# `aarch64-unknown-none-hermitkernel`
2+
3+
**Tier: 3**
4+
5+
Required to build the kernel for [HermitCore](https://github.com/hermitcore/hermit-playground)
6+
or [RustyHermit](https://github.com/hermitcore/rusty-hermit).
7+
The result is a bare-metal aarch64 binary in ELF format.
8+
9+
## Target maintainers
10+
11+
- Stefan Lankes, https://github.com/stlankes
12+
13+
## Requirements
14+
15+
This target is cross-compiled. There is no support for `std`, but the
16+
library operating system provides a simple allocator to use `alloc`.
17+
18+
By default, Rust code generated for this target does not use any vector or
19+
floating-point registers. This allows the generated code to build the library
20+
operaring system, which may need to avoid the use of such
21+
registers or which may have special considerations about the use of such
22+
registers (e.g. saving and restoring them to avoid breaking userspace code
23+
using the same registers). In contrast to `aarch64-unknown-none-softfloat`,
24+
the target is completly relocatable, which is a required feature of RustyHermit.
25+
26+
By default, code generated with this target should run on any `aarch64`
27+
hardware; enabling additional target features may raise this baseline.
28+
On `aarch64-unknown-none-hermitkernel`, `extern "C"` uses the [standard System V calling
29+
convention](https://github.com/ARM-software/abi-aa/releases/download/2021Q3/sysvabi64.pdf),
30+
without red zones.
31+
32+
This target generated binaries in the ELF format.
33+
34+
## Building the target
35+
36+
Typical you should not use the target directly. The target `aarch64-unknown-hermit`
37+
builds the _user space_ of RustyHermit and supports red zones and floating-point
38+
operations.
39+
To build and link the kernel to the application, the crate
40+
[hermit-sys](https://github.com/hermitcore/rusty-hermit/tree/master/hermit-sys)
41+
should be used by adding the following lines to the `Cargo.toml` file of
42+
your application.
43+
44+
```toml
45+
[target.'cfg(target_os = "hermit")'.dependencies]
46+
hermit-sys = "0.1.*"
47+
```
48+
49+
The crate `hermit-sys` uses the target `aarch64-unknown-none-hermitkernel`
50+
to build the kernel.
51+
52+
## Building Rust programs
53+
54+
Rust does not yet ship pre-compiled artifacts for this target. To compile for
55+
this target, you need to build the crate `hermit-sys` (see
56+
"Building the target" above).
57+
58+
## Testing
59+
60+
As `aarch64-unknown-none-hermitkernel` does not support `std`
61+
and does not support running any Rust testsuite.
62+
63+
## Cross-compilation toolchains and C code
64+
65+
If you want to compile C code along with Rust you will need an
66+
appropriate `aarch64` toolchain.
67+
68+
Rust *may* be able to use an `aarch64-linux-gnu-` toolchain with appropriate
69+
standalone flags to build for this toolchain (depending on the assumptions of
70+
that toolchain, see below), or you may wish to use a separate
71+
`aarch64-unknown-none` (or `aarch64-elf-`) toolchain.
72+
73+
On some `aarch64` hosts that use ELF binaries, you *may* be able to use the host
74+
C toolchain, if it does not introduce assumptions about the host environment
75+
that don't match the expectations of a standalone environment. Otherwise, you
76+
may need a separate toolchain for standalone/freestanding development, just as
77+
when cross-compiling from a non-`aarch64` platform.

‎src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
565565
self.buf.push_back((Event::Html(format!("</a></h{}>", level).into()), 0..0));
566566

567567
let start_tags = format!(
568-
"<h{level} id=\"{id}\" class=\"section-header\">\
568+
"<h{level} id=\"{id}\">\
569569
<a href=\"#{id}\">",
570570
id = id,
571571
level = level

‎src/librustdoc/html/markdown/tests.rs

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,22 @@ fn test_header() {
159159
assert_eq!(output, expect, "original: {}", input);
160160
}
161161

162-
t(
163-
"# Foo bar",
164-
"<h2 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h2>",
165-
);
162+
t("# Foo bar", "<h2 id=\"foo-bar\"><a href=\"#foo-bar\">Foo bar</a></h2>");
166163
t(
167164
"## Foo-bar_baz qux",
168-
"<h3 id=\"foo-bar_baz-qux\" class=\"section-header\">\
165+
"<h3 id=\"foo-bar_baz-qux\">\
169166
<a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h3>",
170167
);
171168
t(
172169
"### **Foo** *bar* baz!?!& -_qux_-%",
173-
"<h4 id=\"foo-bar-baz--qux-\" class=\"section-header\">\
170+
"<h4 id=\"foo-bar-baz--qux-\">\
174171
<a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
175172
<em>bar</em> baz!?!&amp; -<em>qux</em>-%</a>\
176173
</h4>",
177174
);
178175
t(
179176
"#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
180-
"<h5 id=\"foo--bar--baz--qux\" class=\"section-header\">\
177+
"<h5 id=\"foo--bar--baz--qux\">\
181178
<a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \
182179
<em><code>baz</code></em> ❤ #qux</a>\
183180
</h5>",
@@ -201,36 +198,12 @@ fn test_header_ids_multiple_blocks() {
201198
assert_eq!(output, expect, "original: {}", input);
202199
}
203200

204-
t(
205-
&mut map,
206-
"# Example",
207-
"<h2 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h2>",
208-
);
209-
t(
210-
&mut map,
211-
"# Panics",
212-
"<h2 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h2>",
213-
);
214-
t(
215-
&mut map,
216-
"# Example",
217-
"<h2 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h2>",
218-
);
219-
t(
220-
&mut map,
221-
"# Search",
222-
"<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
223-
);
224-
t(
225-
&mut map,
226-
"# Example",
227-
"<h2 id=\"example-2\" class=\"section-header\"><a href=\"#example-2\">Example</a></h2>",
228-
);
229-
t(
230-
&mut map,
231-
"# Panics",
232-
"<h2 id=\"panics-1\" class=\"section-header\"><a href=\"#panics-1\">Panics</a></h2>",
233-
);
201+
t(&mut map, "# Example", "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>");
202+
t(&mut map, "# Panics", "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>");
203+
t(&mut map, "# Example", "<h2 id=\"example-1\"><a href=\"#example-1\">Example</a></h2>");
204+
t(&mut map, "# Search", "<h2 id=\"search-1\"><a href=\"#search-1\">Search</a></h2>");
205+
t(&mut map, "# Example", "<h2 id=\"example-2\"><a href=\"#example-2\">Example</a></h2>");
206+
t(&mut map, "# Panics", "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>");
234207
}
235208

236209
#[test]

‎src/librustdoc/html/render/mod.rs

Lines changed: 157 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,78 +2402,170 @@ fn sidebar_enum(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, e: &clean:
24022402
}
24032403
}
24042404

2405-
fn item_ty_to_strs(ty: ItemType) -> (&'static str, &'static str) {
2405+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2406+
enum ItemSection {
2407+
Reexports,
2408+
PrimitiveTypes,
2409+
Modules,
2410+
Macros,
2411+
Structs,
2412+
Enums,
2413+
Constants,
2414+
Statics,
2415+
Traits,
2416+
Functions,
2417+
TypeDefinitions,
2418+
Unions,
2419+
Implementations,
2420+
TypeMethods,
2421+
Methods,
2422+
StructFields,
2423+
Variants,
2424+
AssociatedTypes,
2425+
AssociatedConstants,
2426+
ForeignTypes,
2427+
Keywords,
2428+
OpaqueTypes,
2429+
AttributeMacros,
2430+
DeriveMacros,
2431+
TraitAliases,
2432+
}
2433+
2434+
impl ItemSection {
2435+
const ALL: &'static [Self] = {
2436+
use ItemSection::*;
2437+
// NOTE: The order here affects the order in the UI.
2438+
&[
2439+
Reexports,
2440+
PrimitiveTypes,
2441+
Modules,
2442+
Macros,
2443+
Structs,
2444+
Enums,
2445+
Constants,
2446+
Statics,
2447+
Traits,
2448+
Functions,
2449+
TypeDefinitions,
2450+
Unions,
2451+
Implementations,
2452+
TypeMethods,
2453+
Methods,
2454+
StructFields,
2455+
Variants,
2456+
AssociatedTypes,
2457+
AssociatedConstants,
2458+
ForeignTypes,
2459+
Keywords,
2460+
OpaqueTypes,
2461+
AttributeMacros,
2462+
DeriveMacros,
2463+
TraitAliases,
2464+
]
2465+
};
2466+
2467+
fn id(self) -> &'static str {
2468+
match self {
2469+
Self::Reexports => "reexports",
2470+
Self::Modules => "modules",
2471+
Self::Structs => "structs",
2472+
Self::Unions => "unions",
2473+
Self::Enums => "enums",
2474+
Self::Functions => "functions",
2475+
Self::TypeDefinitions => "types",
2476+
Self::Statics => "statics",
2477+
Self::Constants => "constants",
2478+
Self::Traits => "traits",
2479+
Self::Implementations => "impls",
2480+
Self::TypeMethods => "tymethods",
2481+
Self::Methods => "methods",
2482+
Self::StructFields => "fields",
2483+
Self::Variants => "variants",
2484+
Self::Macros => "macros",
2485+
Self::PrimitiveTypes => "primitives",
2486+
Self::AssociatedTypes => "associated-types",
2487+
Self::AssociatedConstants => "associated-consts",
2488+
Self::ForeignTypes => "foreign-types",
2489+
Self::Keywords => "keywords",
2490+
Self::OpaqueTypes => "opaque-types",
2491+
Self::AttributeMacros => "attributes",
2492+
Self::DeriveMacros => "derives",
2493+
Self::TraitAliases => "trait-aliases",
2494+
}
2495+
}
2496+
2497+
fn name(self) -> &'static str {
2498+
match self {
2499+
Self::Reexports => "Re-exports",
2500+
Self::Modules => "Modules",
2501+
Self::Structs => "Structs",
2502+
Self::Unions => "Unions",
2503+
Self::Enums => "Enums",
2504+
Self::Functions => "Functions",
2505+
Self::TypeDefinitions => "Type Definitions",
2506+
Self::Statics => "Statics",
2507+
Self::Constants => "Constants",
2508+
Self::Traits => "Traits",
2509+
Self::Implementations => "Implementations",
2510+
Self::TypeMethods => "Type Methods",
2511+
Self::Methods => "Methods",
2512+
Self::StructFields => "Struct Fields",
2513+
Self::Variants => "Variants",
2514+
Self::Macros => "Macros",
2515+
Self::PrimitiveTypes => "Primitive Types",
2516+
Self::AssociatedTypes => "Associated Types",
2517+
Self::AssociatedConstants => "Associated Constants",
2518+
Self::ForeignTypes => "Foreign Types",
2519+
Self::Keywords => "Keywords",
2520+
Self::OpaqueTypes => "Opaque Types",
2521+
Self::AttributeMacros => "Attribute Macros",
2522+
Self::DeriveMacros => "Derive Macros",
2523+
Self::TraitAliases => "Trait Aliases",
2524+
}
2525+
}
2526+
}
2527+
2528+
fn item_ty_to_section(ty: ItemType) -> ItemSection {
24062529
match ty {
2407-
ItemType::ExternCrate | ItemType::Import => ("reexports", "Re-exports"),
2408-
ItemType::Module => ("modules", "Modules"),
2409-
ItemType::Struct => ("structs", "Structs"),
2410-
ItemType::Union => ("unions", "Unions"),
2411-
ItemType::Enum => ("enums", "Enums"),
2412-
ItemType::Function => ("functions", "Functions"),
2413-
ItemType::Typedef => ("types", "Type Definitions"),
2414-
ItemType::Static => ("statics", "Statics"),
2415-
ItemType::Constant => ("constants", "Constants"),
2416-
ItemType::Trait => ("traits", "Traits"),
2417-
ItemType::Impl => ("impls", "Implementations"),
2418-
ItemType::TyMethod => ("tymethods", "Type Methods"),
2419-
ItemType::Method => ("methods", "Methods"),
2420-
ItemType::StructField => ("fields", "Struct Fields"),
2421-
ItemType::Variant => ("variants", "Variants"),
2422-
ItemType::Macro => ("macros", "Macros"),
2423-
ItemType::Primitive => ("primitives", "Primitive Types"),
2424-
ItemType::AssocType => ("associated-types", "Associated Types"),
2425-
ItemType::AssocConst => ("associated-consts", "Associated Constants"),
2426-
ItemType::ForeignType => ("foreign-types", "Foreign Types"),
2427-
ItemType::Keyword => ("keywords", "Keywords"),
2428-
ItemType::OpaqueTy => ("opaque-types", "Opaque Types"),
2429-
ItemType::ProcAttribute => ("attributes", "Attribute Macros"),
2430-
ItemType::ProcDerive => ("derives", "Derive Macros"),
2431-
ItemType::TraitAlias => ("trait-aliases", "Trait aliases"),
2530+
ItemType::ExternCrate | ItemType::Import => ItemSection::Reexports,
2531+
ItemType::Module => ItemSection::Modules,
2532+
ItemType::Struct => ItemSection::Structs,
2533+
ItemType::Union => ItemSection::Unions,
2534+
ItemType::Enum => ItemSection::Enums,
2535+
ItemType::Function => ItemSection::Functions,
2536+
ItemType::Typedef => ItemSection::TypeDefinitions,
2537+
ItemType::Static => ItemSection::Statics,
2538+
ItemType::Constant => ItemSection::Constants,
2539+
ItemType::Trait => ItemSection::Traits,
2540+
ItemType::Impl => ItemSection::Implementations,
2541+
ItemType::TyMethod => ItemSection::TypeMethods,
2542+
ItemType::Method => ItemSection::Methods,
2543+
ItemType::StructField => ItemSection::StructFields,
2544+
ItemType::Variant => ItemSection::Variants,
2545+
ItemType::Macro => ItemSection::Macros,
2546+
ItemType::Primitive => ItemSection::PrimitiveTypes,
2547+
ItemType::AssocType => ItemSection::AssociatedTypes,
2548+
ItemType::AssocConst => ItemSection::AssociatedConstants,
2549+
ItemType::ForeignType => ItemSection::ForeignTypes,
2550+
ItemType::Keyword => ItemSection::Keywords,
2551+
ItemType::OpaqueTy => ItemSection::OpaqueTypes,
2552+
ItemType::ProcAttribute => ItemSection::AttributeMacros,
2553+
ItemType::ProcDerive => ItemSection::DeriveMacros,
2554+
ItemType::TraitAlias => ItemSection::TraitAliases,
24322555
ItemType::Generic => unreachable!(),
24332556
}
24342557
}
24352558

24362559
fn sidebar_module(buf: &mut Buffer, items: &[clean::Item]) {
24372560
let mut sidebar = String::new();
24382561

2439-
// Re-exports are handled a bit differently because they can be extern crates or imports.
2440-
if items.iter().any(|it| {
2441-
it.name.is_some()
2442-
&& (it.type_() == ItemType::ExternCrate
2443-
|| (it.type_() == ItemType::Import && !it.is_stripped()))
2444-
}) {
2445-
let (id, name) = item_ty_to_strs(ItemType::Import);
2446-
sidebar.push_str(&format!("<li><a href=\"#{}\">{}</a></li>", id, name));
2447-
}
2448-
2449-
// ordering taken from item_module, reorder, where it prioritized elements in a certain order
2450-
// to print its headings
2451-
for &myty in &[
2452-
ItemType::Primitive,
2453-
ItemType::Module,
2454-
ItemType::Macro,
2455-
ItemType::Struct,
2456-
ItemType::Enum,
2457-
ItemType::Constant,
2458-
ItemType::Static,
2459-
ItemType::Trait,
2460-
ItemType::Function,
2461-
ItemType::Typedef,
2462-
ItemType::Union,
2463-
ItemType::Impl,
2464-
ItemType::TyMethod,
2465-
ItemType::Method,
2466-
ItemType::StructField,
2467-
ItemType::Variant,
2468-
ItemType::AssocType,
2469-
ItemType::AssocConst,
2470-
ItemType::ForeignType,
2471-
ItemType::Keyword,
2472-
] {
2473-
if items.iter().any(|it| !it.is_stripped() && it.type_() == myty && it.name.is_some()) {
2474-
let (id, name) = item_ty_to_strs(myty);
2475-
sidebar.push_str(&format!("<li><a href=\"#{}\">{}</a></li>", id, name));
2476-
}
2562+
let item_sections_in_use: FxHashSet<_> = items
2563+
.iter()
2564+
.filter(|it| !it.is_stripped() && it.name.is_some())
2565+
.map(|it| item_ty_to_section(it.type_()))
2566+
.collect();
2567+
for &sec in ItemSection::ALL.iter().filter(|sec| item_sections_in_use.contains(sec)) {
2568+
sidebar.push_str(&format!("<li><a href=\"#{}\">{}</a></li>", sec.id(), sec.name()));
24772569
}
24782570

24792571
if !sidebar.is_empty() {
@@ -2567,7 +2659,7 @@ fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item) {
25672659
w,
25682660
"<div class=\"docblock scraped-example-list\">\
25692661
<span></span>\
2570-
<h5 id=\"{id}\" class=\"section-header\">\
2662+
<h5 id=\"{id}\">\
25712663
<a href=\"#{id}\">Examples found in repository</a>\
25722664
</h5>",
25732665
id = id

‎src/librustdoc/html/render/print_item.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use rustc_span::symbol::{kw, sym, Symbol};
1616
use rustc_target::abi::{Layout, Primitive, TagEncoding, Variants};
1717

1818
use super::{
19-
collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_strs, notable_traits_decl,
20-
render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre,
21-
render_impl, render_stability_since_raw, write_srclink, AssocItemLink, Context,
22-
ImplRenderingParameters,
19+
collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_section,
20+
notable_traits_decl, render_assoc_item, render_assoc_items, render_attributes_in_code,
21+
render_attributes_in_pre, render_impl, render_stability_since_raw, write_srclink,
22+
AssocItemLink, Context, ImplRenderingParameters,
2323
};
2424
use crate::clean;
2525
use crate::formats::item_type::ItemType;
@@ -221,7 +221,9 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
221221
) -> Ordering {
222222
let ty1 = i1.type_();
223223
let ty2 = i2.type_();
224-
if ty1 != ty2 {
224+
if item_ty_to_section(ty1) != item_ty_to_section(ty2)
225+
|| (ty1 != ty2 && (ty1 == ItemType::ExternCrate || ty2 == ItemType::ExternCrate))
226+
{
225227
return (reorder(ty1), idx1).cmp(&(reorder(ty2), idx2));
226228
}
227229
let s1 = i1.stability(tcx).as_ref().map(|s| s.level);
@@ -270,32 +272,28 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
270272
});
271273

272274
debug!("{:?}", indices);
273-
let mut curty = None;
275+
let mut last_section = None;
274276

275277
for &idx in &indices {
276278
let myitem = &items[idx];
277279
if myitem.is_stripped() {
278280
continue;
279281
}
280282

281-
let myty = Some(myitem.type_());
282-
if curty == Some(ItemType::ExternCrate) && myty == Some(ItemType::Import) {
283-
// Put `extern crate` and `use` re-exports in the same section.
284-
curty = myty;
285-
} else if myty != curty {
286-
if curty.is_some() {
283+
let my_section = item_ty_to_section(myitem.type_());
284+
if Some(my_section) != last_section {
285+
if last_section.is_some() {
287286
w.write_str(ITEM_TABLE_CLOSE);
288287
}
289-
curty = myty;
290-
let (short, name) = item_ty_to_strs(myty.unwrap());
288+
last_section = Some(my_section);
291289
write!(
292290
w,
293291
"<h2 id=\"{id}\" class=\"small-section-header\">\
294292
<a href=\"#{id}\">{name}</a>\
295293
</h2>\n{}",
296294
ITEM_TABLE_OPEN,
297-
id = cx.derive_id(short.to_owned()),
298-
name = name
295+
id = cx.derive_id(my_section.id().to_owned()),
296+
name = my_section.name(),
299297
);
300298
}
301299

@@ -407,7 +405,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
407405
}
408406
}
409407

410-
if curty.is_some() {
408+
if last_section.is_some() {
411409
w.write_str(ITEM_TABLE_CLOSE);
412410
}
413411
}

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,16 +1141,6 @@ a.test-arrow {
11411141
a.test-arrow:hover{
11421142
text-decoration: none;
11431143
}
1144-
.section-header:hover a:before {
1145-
position: absolute;
1146-
left: -25px;
1147-
padding-right: 10px; /* avoid gap that causes hover to disappear */
1148-
content: '\2002\00a7\2002';
1149-
}
1150-
1151-
.section-header:hover a {
1152-
text-decoration: none;
1153-
}
11541144

11551145
.code-attribute {
11561146
font-weight: 300;
@@ -1196,17 +1186,6 @@ h3.variant {
11961186
margin-top: 3px;
11971187
}
11981188

1199-
.top-doc .docblock > .section-header:first-child {
1200-
margin-left: 15px;
1201-
}
1202-
.top-doc .docblock > .section-header:first-child:hover > a:before {
1203-
left: -10px;
1204-
}
1205-
1206-
.docblock > .section-header:first-child {
1207-
margin-top: 0;
1208-
}
1209-
12101189
:target > code, :target > .code-header {
12111190
opacity: 1;
12121191
}

‎src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items)]
1+
#![feature(no_core, intrinsics, lang_items)]
22
#![crate_type="rlib"]
33
#![no_core]
44

‎src/test/rustdoc-gui/anchors.goml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,4 @@ assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
3131
move-cursor-to: "#impl"
3232
assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
3333

34-
// Now we check the positions: only the first heading of the top doc comment should
35-
// have a different position.
36-
move-cursor-to: ".top-doc .docblock .section-header:first-child"
37-
assert-css: (
38-
".top-doc .docblock .section-header:first-child > a::before",
39-
{"left": "-10px", "padding-right": "10px"},
40-
)
41-
// We also check that the heading itself has a different indent.
42-
assert-css: (".top-doc .docblock .section-header:first-child", {"margin-left": "15px"})
43-
44-
move-cursor-to: ".top-doc .docblock .section-header:not(:first-child)"
45-
assert-css: (
46-
".top-doc .docblock .section-header:not(:first-child) > a::before",
47-
{"left": "-25px", "padding-right": "10px"},
48-
)
49-
assert-css: (".top-doc .docblock .section-header:not(:first-child)", {"margin-left": "0px"})
50-
51-
// Now let's check some other docblock headings...
52-
// First the impl block docs.
53-
move-cursor-to: "#title-for-struct-impl-doc"
54-
assert-css: (
55-
"#title-for-struct-impl-doc > a::before",
56-
{"left": "-25px", "padding-right": "10px"},
57-
)
58-
assert-css: ("#title-for-struct-impl-doc", {"margin-left": "0px"})
59-
// Now a method docs.
60-
move-cursor-to: "#title-for-struct-impl-item-doc"
61-
assert-css: (
62-
"#title-for-struct-impl-item-doc > a::before",
63-
{"left": "-25px", "padding-right": "10px"},
64-
)
6534
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
66-
67-
// Finally, we want to ensure that if the first element of the doc block isn't a heading,
68-
// if there is a heading afterwards, it won't have the indent.
69-
goto: file://|DOC_PATH|/test_docs/enum.WhoLetTheDogOut.html
70-
71-
move-cursor-to: ".top-doc .docblock .section-header"
72-
assert-css: (
73-
".top-doc .docblock .section-header > a::before",
74-
{"left": "-25px", "padding-right": "10px"},
75-
)
76-
assert-css: (".top-doc .docblock .section-header", {"margin-left": "0px"})

‎src/test/rustdoc-gui/headers-color.goml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
4040
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
4141

4242
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
43-
assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL)
43+
// We select headings (h2, h3, h...).
44+
assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL)
4445

4546
// Dark theme
4647
local-storage: {
@@ -78,7 +79,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
7879
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
7980

8081
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
81-
assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL)
82+
// We select headings (h2, h3, h...).
83+
assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
8284

8385
// Light theme
8486
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
@@ -111,4 +113,5 @@ goto: file://|DOC_PATH|/test_docs/index.html
111113
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
112114

113115
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
114-
assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL)
116+
// We select headings (h2, h3, h...).
117+
assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)

‎src/test/rustdoc/trait_alias.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::fmt::Debug;
88
// @has foo/all.html '//a[@href="traitalias.Alias2.html"]' 'Alias2'
99
// @has foo/all.html '//a[@href="traitalias.Foo.html"]' 'Foo'
1010

11-
// @has foo/index.html '//h2[@id="trait-aliases"]' 'Trait aliases'
11+
// @has foo/index.html '//h2[@id="trait-aliases"]' 'Trait Aliases'
1212
// @has foo/index.html '//a[@class="traitalias"]' 'CopyAlias'
1313
// @has foo/index.html '//a[@class="traitalias"]' 'Alias2'
1414
// @has foo/index.html '//a[@class="traitalias"]' 'Foo'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait AlwaysApplicable {
2+
type Assoc;
3+
}
4+
impl<T: ?Sized> AlwaysApplicable for T {
5+
type Assoc = usize;
6+
}
7+
8+
trait BindsParam<T> {
9+
type ArrayTy;
10+
}
11+
impl<T> BindsParam<T> for <T as AlwaysApplicable>::Assoc {
12+
type ArrayTy = [u8; Self::MAX]; //~ ERROR generic `Self` types
13+
}
14+
15+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: generic `Self` types are currently not permitted in anonymous constants
2+
--> $DIR/forbid-self-no-normalize.rs:12:25
3+
|
4+
LL | type ArrayTy = [u8; Self::MAX];
5+
| ^^^^
6+
|
7+
note: not a concrete type
8+
--> $DIR/forbid-self-no-normalize.rs:11:27
9+
|
10+
LL | impl<T> BindsParam<T> for <T as AlwaysApplicable>::Assoc {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn main() {
2+
cfg!(target_has_atomic_equal_alignment = "8");
3+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
4+
cfg!(target_has_atomic_equal_alignment = "16");
5+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
6+
cfg!(target_has_atomic_equal_alignment = "32");
7+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
8+
cfg!(target_has_atomic_equal_alignment = "64");
9+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
10+
cfg!(target_has_atomic_equal_alignment = "128");
11+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
12+
cfg!(target_has_atomic_equal_alignment = "ptr");
13+
//~^ ERROR `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
14+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
2+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:2:10
3+
|
4+
LL | cfg!(target_has_atomic_equal_alignment = "8");
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
8+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
9+
10+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
11+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:4:10
12+
|
13+
LL | cfg!(target_has_atomic_equal_alignment = "16");
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
17+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
18+
19+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
20+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:6:10
21+
|
22+
LL | cfg!(target_has_atomic_equal_alignment = "32");
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
|
25+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
26+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
27+
28+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
29+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:8:10
30+
|
31+
LL | cfg!(target_has_atomic_equal_alignment = "64");
32+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
|
34+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
35+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
36+
37+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
38+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:10:10
39+
|
40+
LL | cfg!(target_has_atomic_equal_alignment = "128");
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
|
43+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
44+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
45+
46+
error[E0658]: `cfg(target_has_atomic_equal_alignment)` is experimental and subject to change
47+
--> $DIR/feature-gate-cfg-target-has-atomic-equal-alignment.rs:12:10
48+
|
49+
LL | cfg!(target_has_atomic_equal_alignment = "ptr");
50+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51+
|
52+
= note: see issue #93822 <https://github.com/rust-lang/rust/issues/93822> for more information
53+
= help: add `#![feature(cfg_target_has_atomic_equal_alignment)]` to the crate attributes to enable
54+
55+
error: aborting due to 6 previous errors
56+
57+
For more information about this error, try `rustc --explain E0658`.

‎src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs

Lines changed: 0 additions & 118 deletions
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr

Lines changed: 0 additions & 273 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.