forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#57067 - Centril:stabilize-min_const_unsafe_…
…fn, r=oli-obk Stabilize min_const_unsafe_fn in 1.33 Fixes rust-lang#55607 r? @oli-obk
- Loading branch information
Showing
15 changed files
with
79 additions
and
184 deletions.
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
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
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
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
49 changes: 25 additions & 24 deletions
49
src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr
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 |
---|---|---|
@@ -1,43 +1,44 @@ | ||
error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) | ||
--> $DIR/min_const_fn_unsafe.rs:31:59 | ||
--> $DIR/min_const_fn_unsafe.rs:60:77 | ||
| | ||
LL | const unsafe fn deref_forbidden(x: *mut usize) -> usize { *x } | ||
| ^^ | ||
LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe | ||
| ^^^ | ||
| | ||
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable | ||
|
||
error[E0658]: unions in const fn are unstable (see issue #51909) | ||
--> $DIR/min_const_fn_unsafe.rs:38:5 | ||
error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) | ||
--> $DIR/min_const_fn_unsafe.rs:63:70 | ||
| | ||
LL | Foo { x: () }.y | ||
| ^^^^^^^^^^^^^^^ | ||
LL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } | ||
| ^^ | ||
| | ||
= help: add #![feature(const_fn_union)] to the crate attributes to enable | ||
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable | ||
|
||
error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) | ||
--> $DIR/min_const_fn_unsafe.rs:21:14 | ||
error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) | ||
--> $DIR/min_const_fn_unsafe.rs:66:83 | ||
| | ||
LL | unsafe { ret_i32_no_unsafe() } //~ ERROR calls to `const unsafe fn` in const fns are unstable | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } | ||
| ^^^ | ||
| | ||
= help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable | ||
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable | ||
|
||
error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) | ||
--> $DIR/min_const_fn_unsafe.rs:24:14 | ||
error[E0658]: unions in const fn are unstable (see issue #51909) | ||
--> $DIR/min_const_fn_unsafe.rs:73:5 | ||
| | ||
LL | unsafe { ret_null_ptr_no_unsafe::<String>() } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | Foo { x: () }.y | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable | ||
= help: add #![feature(const_fn_union)] to the crate attributes to enable | ||
|
||
error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) | ||
--> $DIR/min_const_fn_unsafe.rs:28:14 | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/min_const_fn_unsafe.rs:60:77 | ||
| | ||
LL | unsafe { ret_null_mut_ptr_no_unsafe::<Vec<std::cell::Cell<u32>>>() } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe | ||
| ^^^ dereference of raw pointer | ||
| | ||
= help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. | ||
Some errors occurred: E0133, E0658. | ||
For more information about an error, try `rustc --explain E0133`. |
61 changes: 0 additions & 61 deletions
61
src/test/ui/consts/min_const_fn/min_const_fn_unsafe_feature_gate.rs
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/test/ui/consts/min_const_fn/min_const_fn_unsafe_feature_gate.stderr
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.