diff options
| author | bors <bors@rust-lang.org> | 2022-08-10 18:05:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-10 18:05:34 +0000 |
| commit | 7bc32faebcfacb96be73650e624dc94e330298ab (patch) | |
| tree | 96eb6c6ef5d76613c4a499759280f06b03c2b838 /src | |
| parent | c7ff1e8b0090b4ca3d62edef3dc2421861d57c48 (diff) | |
| parent | eff71b9927a98900ace67494fb9b1cb45a3b80a5 (diff) | |
| download | rust-7bc32faebcfacb96be73650e624dc94e330298ab.tar.gz rust-7bc32faebcfacb96be73650e624dc94e330298ab.zip | |
Auto merge of #100378 - compiler-errors:rollup-8vzsd92, r=compiler-errors
Rollup of 8 pull requests Successful merges: - #100286 (Add support for link-flavor rust-lld for macOS) - #100317 (Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target) - #100339 (Fixes bootstrap panic when running x fmt --check ) - #100348 (Add regression test for #93205) - #100349 (Refactor: remove a type string comparison) - #100353 (Fix doc links in core::time::Duration::as_secs) - #100359 (Special-case references to leafs in valtree pretty-printing) - #100371 (Inline CStr::from_bytes_with_nul_unchecked::rt_impl) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/lib.rs | 10 | ||||
| -rw-r--r-- | src/test/rustdoc/intra-doc/assoc-reexport-super.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-100313.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-100313.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/suggestions/as-ref.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/suggestions/as-ref.stderr | 62 |
6 files changed, 128 insertions, 7 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index f84de73297a..a242243aaaf 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1631,14 +1631,12 @@ fn chmod(_path: &Path, _perms: u32) {} /// If code is not 0 (successful exit status), exit status is 101 (rust's default error code.) /// If the test is running and code is an error code, it will cause a panic. fn detail_exit(code: i32) -> ! { - // Successful exit - if code == 0 { - std::process::exit(0); - } - if cfg!(test) { + // if in test and code is an error code, panic with staus code provided + if cfg!(test) && code != 0 { panic!("status code: {}", code); } else { - std::panic::resume_unwind(Box::new(code)); + //otherwise,exit with provided status code + std::process::exit(code); } } diff --git a/src/test/rustdoc/intra-doc/assoc-reexport-super.rs b/src/test/rustdoc/intra-doc/assoc-reexport-super.rs new file mode 100644 index 00000000000..a7bc1c6a29f --- /dev/null +++ b/src/test/rustdoc/intra-doc/assoc-reexport-super.rs @@ -0,0 +1,20 @@ +// Regression test for #93205 + +#![crate_name = "foo"] + +mod generated { + pub struct MyNewType; + impl MyNewType { + pub const FOO: Self = Self; + } +} + +pub use generated::MyNewType; + +mod prelude { + impl super::MyNewType { + /// An alias for [`Self::FOO`]. + // @has 'foo/struct.MyNewType.html' '//a[@href="struct.MyNewType.html#associatedconstant.FOO"]' 'Self::FOO' + pub const FOO2: Self = Self::FOO; + } +} diff --git a/src/test/ui/const-generics/issues/issue-100313.rs b/src/test/ui/const-generics/issues/issue-100313.rs new file mode 100644 index 00000000000..4e9d3626aa8 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-100313.rs @@ -0,0 +1,21 @@ +#![allow(incomplete_features)] +#![feature(const_mut_refs)] +#![feature(adt_const_params)] + +struct T<const B: &'static bool>; + +impl <const B: &'static bool> T<B> { + const fn set_false(&self) { + unsafe { + *(B as *const bool as *mut bool) = false; + //~^ ERROR evaluation of constant value failed [E0080] + } + } +} + +const _: () = { + let x = T::<{&true}>; + x.set_false(); +}; + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-100313.stderr b/src/test/ui/const-generics/issues/issue-100313.stderr new file mode 100644 index 00000000000..f3ce357c2bb --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-100313.stderr @@ -0,0 +1,15 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/issue-100313.rs:10:13 + | +LL | *(B as *const bool as *mut bool) = false; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | writing to alloc7 which is read-only + | inside `T::<&true>::set_false` at $DIR/issue-100313.rs:10:13 +... +LL | x.set_false(); + | ------------- inside `_` at $DIR/issue-100313.rs:18:5 + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/suggestions/as-ref.rs b/src/test/ui/suggestions/as-ref.rs index 46d9461538c..a0535344185 100644 --- a/src/test/ui/suggestions/as-ref.rs +++ b/src/test/ui/suggestions/as-ref.rs @@ -17,4 +17,11 @@ fn main() { // note: do not suggest because of `E: usize` let x: &Result<usize, usize> = &Ok(3); let y: Result<&usize, usize> = x; //~ ERROR mismatched types [E0308] + + let multiple_ref_opt = &&Some(Foo); + multiple_ref_opt.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] + multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); //~ ERROR mismatched types [E0308] + let multiple_ref_result = &&Ok(Foo); + multiple_ref_result.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] + multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 1efd1b317b7..deafa9f48d4 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -97,6 +97,66 @@ LL | let y: Result<&usize, usize> = x; = note: expected enum `Result<&usize, usize>` found reference `&Result<usize, usize>` -error: aborting due to 7 previous errors +error[E0308]: mismatched types + --> $DIR/as-ref.rs:22:42 + | +LL | multiple_ref_opt.map(|arg| takes_ref(arg)); + | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().map` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:23:52 + | +LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); + | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().and_then` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:25:45 + | +LL | multiple_ref_result.map(|arg| takes_ref(arg)); + | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().map` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:26:53 + | +LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); + | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().and_then` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0308`. |
