Skip to content

Commit cb7a1bf

Browse files
authored
Unrolled build for rust-lang#124240
Rollup merge of rust-lang#124240 - matthiaskrgr:tests_sunday, r=compiler-errors add a couple tests for fixed ICEs. Fixes rust-lang#121413 Fixes rust-lang#121463 Fixes rust-lang#114463
2 parents b3e1170 + a42adf2 commit cb7a1bf

6 files changed

+124
-0
lines changed
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)