-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Stabilize min_const_unsafe_fn in 1.33 #57067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.