Skip to content

Commit 1562e83

Browse files
committed
tests: move crashes/79409.rs to ui suite
This test no longer crashes the compiler as `Box` no longer accepts `PointeeSized`-types. It eventually could, but not because of `Deref::Target` currently, so this doesn't fail anymore and there wasn't an obvious to add new types to make it continue to fail because `Deref` is special.
1 parent b178a28 commit 1562e83

File tree

3 files changed

+81
-16
lines changed

3 files changed

+81
-16
lines changed

tests/crashes/79409.rs

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![feature(extern_types)]
2+
#![feature(unsized_locals)]
3+
//~^ WARN the feature `unsized_locals` is incomplete
4+
5+
// Regression test for #79409
6+
7+
extern "C" {
8+
type Device;
9+
}
10+
11+
unsafe fn make_device() -> Box<Device> {
12+
//~^ ERROR the size for values of type `Device` cannot be known
13+
Box::from_raw(0 as *mut _)
14+
//~^ ERROR the size for values of type `Device` cannot be known
15+
//~| ERROR the size for values of type `Device` cannot be known
16+
}
17+
18+
fn main() {
19+
let d: Device = unsafe { *make_device() };
20+
//~^ ERROR the size for values of type `Device` cannot be known
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/extern-types-unsizing-79409.rs:2:12
3+
|
4+
LL | #![feature(unsized_locals)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
error[E0277]: the size for values of type `Device` cannot be known
11+
--> $DIR/extern-types-unsizing-79409.rs:11:28
12+
|
13+
LL | unsafe fn make_device() -> Box<Device> {
14+
| ^^^^^^^^^^^ doesn't have a known size
15+
|
16+
= help: the trait `MetaSized` is not implemented for `Device`
17+
note: required by a bound in `Box`
18+
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
19+
20+
error[E0277]: the size for values of type `Device` cannot be known
21+
--> $DIR/extern-types-unsizing-79409.rs:13:19
22+
|
23+
LL | Box::from_raw(0 as *mut _)
24+
| ------------- ^^^^^^^^^^^ the trait `MetaSized` is not implemented for `Device`
25+
| |
26+
| required by a bound introduced by this call
27+
|
28+
= note: the trait bound `Device: MetaSized` is not satisfied
29+
note: required by a bound in `Box::<T>::from_raw`
30+
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
31+
help: consider borrowing here
32+
|
33+
LL | Box::from_raw(&0 as *mut _)
34+
| +
35+
LL | Box::from_raw(&mut 0 as *mut _)
36+
| ++++
37+
38+
error[E0277]: the size for values of type `Device` cannot be known
39+
--> $DIR/extern-types-unsizing-79409.rs:13:5
40+
|
41+
LL | Box::from_raw(0 as *mut _)
42+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a known size
43+
|
44+
= help: the trait `MetaSized` is not implemented for `Device`
45+
note: required by a bound in `Box`
46+
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
47+
48+
error[E0277]: the size for values of type `Device` cannot be known
49+
--> $DIR/extern-types-unsizing-79409.rs:19:31
50+
|
51+
LL | let d: Device = unsafe { *make_device() };
52+
| ^^^^^^^^^^^^^ doesn't have a known size
53+
|
54+
= help: the trait `MetaSized` is not implemented for `Device`
55+
note: required by a bound in `Box`
56+
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
57+
58+
error: aborting due to 4 previous errors; 1 warning emitted
59+
60+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)