Skip to content

Commit 290d792

Browse files
committed
Auto merge of rust-lang#124250 - matthiaskrgr:rollup-b8tqsup, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - rust-lang#124240 (add a couple tests for fixed ICEs.) - rust-lang#124245 (bootstrap: Promote some build_steps comments to docs) - rust-lang#124246 (Add comma at one place in `abs()` documentation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b3e1170 + c597ccf commit 290d792

15 files changed

+153
-29
lines changed

library/core/src/num/int_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,7 @@ macro_rules! int_impl {
31993199
/// that code in debug mode will trigger a panic on this case and
32003200
/// optimized code will return
32013201
#[doc = concat!("`", stringify!($SelfT), "::MIN`")]
3202-
/// without a panic. If you do not want this behavior consider
3202+
/// without a panic. If you do not want this behavior, consider
32033203
/// using [`unsigned_abs`](Self::unsigned_abs) instead.
32043204
///
32053205
/// # Examples

src/bootstrap/src/core/build_steps/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ macro_rules! tool_check_step {
394394
impl Step for $name {
395395
type Output = ();
396396
const ONLY_HOSTS: bool = true;
397-
// don't ever check out-of-tree tools by default, they'll fail when toolstate is broken
397+
/// don't ever check out-of-tree tools by default, they'll fail when toolstate is broken
398398
const DEFAULT: bool = matches!($source_type, SourceType::InTree) $( && $default )?;
399399

400400
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

src/bootstrap/src/core/build_steps/clippy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use super::compile::std_cargo;
2424
use super::tool::prepare_tool_cargo;
2525
use super::tool::SourceType;
2626

27-
// Disable the most spammy clippy lints
27+
/// Disable the most spammy clippy lints
2828
const IGNORED_RULES_FOR_STD_AND_RUSTC: &[&str] = &[
2929
"many_single_char_names", // there are a lot in stdarch
3030
"collapsible_if",

src/bootstrap/src/core/build_steps/compile.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,13 @@ impl Rustc {
835835
}
836836

837837
impl Step for Rustc {
838-
// We return the stage of the "actual" compiler (not the uplifted one).
839-
//
840-
// By "actual" we refer to the uplifting logic where we may not compile the requested stage;
841-
// instead, we uplift it from the previous stages. Which can lead to bootstrap failures in
842-
// specific situations where we request stage X from other steps. However we may end up
843-
// uplifting it from stage Y, causing the other stage to fail when attempting to link with
844-
// stage X which was never actually built.
838+
/// We return the stage of the "actual" compiler (not the uplifted one).
839+
///
840+
/// By "actual" we refer to the uplifting logic where we may not compile the requested stage;
841+
/// instead, we uplift it from the previous stages. Which can lead to bootstrap failures in
842+
/// specific situations where we request stage X from other steps. However we may end up
843+
/// uplifting it from stage Y, causing the other stage to fail when attempting to link with
844+
/// stage X which was never actually built.
845845
type Output = u32;
846846
const ONLY_HOSTS: bool = true;
847847
const DEFAULT: bool = false;
@@ -1302,7 +1302,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
13021302
impl Step for CodegenBackend {
13031303
type Output = ();
13041304
const ONLY_HOSTS: bool = true;
1305-
// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
1305+
/// Only the backends specified in the `codegen-backends` entry of `config.toml` are built.
13061306
const DEFAULT: bool = true;
13071307

13081308
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

src/bootstrap/src/core/build_steps/dist.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2272,9 +2272,9 @@ impl Step for LlvmBitcodeLinker {
22722272
}
22732273
}
22742274

2275-
// Tarball intended for internal consumption to ease rustc/std development.
2276-
//
2277-
// Should not be considered stable by end users.
2275+
/// Tarball intended for internal consumption to ease rustc/std development.
2276+
///
2277+
/// Should not be considered stable by end users.
22782278
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
22792279
pub struct RustDev {
22802280
pub target: TargetSelection,
@@ -2356,9 +2356,9 @@ impl Step for RustDev {
23562356
}
23572357
}
23582358

2359-
// Tarball intended for internal consumption to ease rustc/std development.
2360-
//
2361-
// Should not be considered stable by end users.
2359+
/// Tarball intended for internal consumption to ease rustc/std development.
2360+
///
2361+
/// Should not be considered stable by end users.
23622362
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
23632363
pub struct Bootstrap {
23642364
pub target: TargetSelection,

src/bootstrap/src/core/build_steps/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl Step for SharedAssets {
506506
run.never()
507507
}
508508

509-
// Generate shared resources used by other pieces of documentation.
509+
/// Generate shared resources used by other pieces of documentation.
510510
fn run(self, builder: &Builder<'_>) -> Self::Output {
511511
let out = builder.doc_out(self.target);
512512

src/bootstrap/src/core/build_steps/install.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const SHELL: &str = "bash";
2020
#[cfg(not(target_os = "illumos"))]
2121
const SHELL: &str = "sh";
2222

23-
// We have to run a few shell scripts, which choke quite a bit on both `\`
24-
// characters and on `C:\` paths, so normalize both of them away.
23+
/// We have to run a few shell scripts, which choke quite a bit on both `\`
24+
/// characters and on `C:\` paths, so normalize both of them away.
2525
fn sanitize_sh(path: &Path) -> String {
2626
let path = path.to_str().unwrap().replace('\\', "/");
2727
return change_drive(unc_to_lfs(&path)).unwrap_or(path);

src/bootstrap/src/core/build_steps/llvm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ impl LlvmBuildStatus {
5656
}
5757
}
5858

59-
// Linker flags to pass to LLVM's CMake invocation.
59+
/// Linker flags to pass to LLVM's CMake invocation.
6060
#[derive(Debug, Clone, Default)]
6161
struct LdFlags {
62-
// CMAKE_EXE_LINKER_FLAGS
62+
/// CMAKE_EXE_LINKER_FLAGS
6363
exe: OsString,
64-
// CMAKE_SHARED_LINKER_FLAGS
64+
/// CMAKE_SHARED_LINKER_FLAGS
6565
shared: OsString,
66-
// CMAKE_MODULE_LINKER_FLAGS
66+
/// CMAKE_MODULE_LINKER_FLAGS
6767
module: OsString,
6868
}
6969

src/bootstrap/src/core/build_steps/test.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1433,8 +1433,8 @@ host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite
14331433

14341434
host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });
14351435

1436-
// Special-handling is needed for `run-make`, so don't use `default_test` for defining `RunMake`
1437-
// tests.
1436+
/// Special-handling is needed for `run-make`, so don't use `default_test` for defining `RunMake`
1437+
/// tests.
14381438
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
14391439
pub struct RunMake {
14401440
pub compiler: Compiler,
@@ -1527,10 +1527,10 @@ impl Coverage {
15271527

15281528
impl Step for Coverage {
15291529
type Output = ();
1530-
// We rely on the individual CoverageMap/CoverageRun steps to run themselves.
1530+
/// We rely on the individual CoverageMap/CoverageRun steps to run themselves.
15311531
const DEFAULT: bool = false;
1532-
// When manually invoked, try to run as much as possible.
1533-
// Compiletest will automatically skip the "coverage-run" tests if necessary.
1532+
/// When manually invoked, try to run as much as possible.
1533+
/// Compiletest will automatically skip the "coverage-run" tests if necessary.
15341534
const ONLY_HOSTS: bool = false;
15351535

15361536
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// issue rust-lang/rust#121463
2+
// ICE non-ADT in struct pattern
3+
#![feature(box_patterns)]
4+
5+
fn main() {
6+
let mut a = E::StructVar { boxed: Box::new(5_i32) };
7+
//~^ ERROR failed to resolve: use of undeclared type `E`
8+
match a {
9+
E::StructVar { box boxed } => { }
10+
//~^ ERROR failed to resolve: use of undeclared type `E`
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0433]: failed to resolve: use of undeclared type `E`
2+
--> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17
3+
|
4+
LL | let mut a = E::StructVar { boxed: Box::new(5_i32) };
5+
| ^
6+
| |
7+
| use of undeclared type `E`
8+
| help: a trait with a similar name exists: `Eq`
9+
10+
error[E0433]: failed to resolve: use of undeclared type `E`
11+
--> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9
12+
|
13+
LL | E::StructVar { box boxed } => { }
14+
| ^
15+
| |
16+
| use of undeclared type `E`
17+
| help: a trait with a similar name exists: `Eq`
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0433`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// issue: rust-lang/rust#114463
2+
// ICE cannot convert `ReFree ..` to a region vid
3+
#![feature(generic_const_exprs)]
4+
//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
5+
fn bug<'a>() {
6+
[(); (|_: &'a u8| (), 0).1];
7+
//~^ ERROR cannot capture late-bound lifetime in constant
8+
}
9+
10+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/cannot-convert-refree-ice-114463.rs:3:12
3+
|
4+
LL | #![feature(generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
error: cannot capture late-bound lifetime in constant
11+
--> $DIR/cannot-convert-refree-ice-114463.rs:6:16
12+
|
13+
LL | fn bug<'a>() {
14+
| -- lifetime defined here
15+
LL | [(); (|_: &'a u8| (), 0).1];
16+
| ^^
17+
18+
error: aborting due to 1 previous error; 1 warning emitted
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ICE: ImmTy { imm: Scalar(alloc1), ty: *const dyn Sync } input to a fat-to-thin cast (*const dyn Sync -> *const usize
2+
// or with -Zextra-const-ub-checks: expected wide pointer extra data (e.g. slice length or trait object vtable)
3+
// issue: rust-lang/rust#121413
4+
//@ compile-flags: -Zextra-const-ub-checks
5+
// ignore-tidy-linelength
6+
#![feature(const_refs_to_static)]
7+
const REF_INTERIOR_MUT: &usize = {
8+
static FOO: Sync = AtomicUsize::new(0);
9+
//~^ ERROR failed to resolve: use of undeclared type `AtomicUsize`
10+
//~| WARN trait objects without an explicit `dyn` are deprecated
11+
//~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
12+
//~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
13+
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
14+
unsafe { &*(&FOO as *const _ as *const usize) }
15+
};
16+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error[E0433]: failed to resolve: use of undeclared type `AtomicUsize`
2+
--> $DIR/const_refs_to_static-ice-121413.rs:8:24
3+
|
4+
LL | static FOO: Sync = AtomicUsize::new(0);
5+
| ^^^^^^^^^^^ use of undeclared type `AtomicUsize`
6+
|
7+
help: consider importing this struct
8+
|
9+
LL + use std::sync::atomic::AtomicUsize;
10+
|
11+
12+
warning: trait objects without an explicit `dyn` are deprecated
13+
--> $DIR/const_refs_to_static-ice-121413.rs:8:17
14+
|
15+
LL | static FOO: Sync = AtomicUsize::new(0);
16+
| ^^^^
17+
|
18+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
19+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
20+
= note: `#[warn(bare_trait_objects)]` on by default
21+
help: if this is an object-safe trait, use `dyn`
22+
|
23+
LL | static FOO: dyn Sync = AtomicUsize::new(0);
24+
| +++
25+
26+
error[E0277]: the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
27+
--> $DIR/const_refs_to_static-ice-121413.rs:8:17
28+
|
29+
LL | static FOO: Sync = AtomicUsize::new(0);
30+
| ^^^^ doesn't have a size known at compile-time
31+
|
32+
= help: the trait `Sized` is not implemented for `(dyn Sync + 'static)`
33+
34+
error[E0277]: the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
35+
--> $DIR/const_refs_to_static-ice-121413.rs:8:24
36+
|
37+
LL | static FOO: Sync = AtomicUsize::new(0);
38+
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
39+
|
40+
= help: the trait `Sized` is not implemented for `(dyn Sync + 'static)`
41+
= note: constant expressions must have a statically known size
42+
43+
error: aborting due to 3 previous errors; 1 warning emitted
44+
45+
Some errors have detailed explanations: E0277, E0433.
46+
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)