-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #75136 - JohnTitor:unsizing-casts-non-null, r=oli-obk
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Regression test for #75118. | ||
|
||
use std::ptr::NonNull; | ||
|
||
pub const fn dangling_slice<T>() -> NonNull<[T]> { | ||
NonNull::<[T; 0]>::dangling() | ||
//~^ ERROR: unsizing casts are only allowed for references right now | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0723]: unsizing casts are only allowed for references right now | ||
--> $DIR/unsizing-cast-non-null.rs:6:5 | ||
| | ||
LL | NonNull::<[T; 0]>::dangling() | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0723`. |