-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Revert revert of constness in #86003 #86295
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 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5fbb135
Revert "Revert effects of PRs 81167 and 83091."
usbalbin 6c890bb
Revert "Revert tests added by PR 81167."
usbalbin 38e9538
Revert "Remove tests that were also added in PR 79684."
usbalbin 7de63be
Revert "With the revert of PR 83091, `swap` is not a `const fn` anymo…
usbalbin 1aa032f
Add reference to issue for const_intrinsic_copy in ptr::write
usbalbin 22fe76d
Add reference to tracking issue #86302 for const_ptr_write
usbalbin 4b64baf
Bless out_of_bounds_read test
usbalbin 3a894e3
Bring back tests removed in 'Revert PRs 81238 and 82967 (which made c…
usbalbin 56c78b2
Fix the test copy-intrinsic
usbalbin c012553
Update and bless tests for copy intrinsic
usbalbin 4aa1267
Update and bless tests for const read out of bounds
usbalbin 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,70 @@ | ||
error: any use of this value will cause an error | ||
error[E0080]: evaluation of constant value failed | ||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| | ||
LL | unsafe { copy_nonoverlapping(src, dst, count) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 | ||
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| inside `_READ` at $DIR/out_of_bounds_read.rs:13:33 | ||
| | ||
::: $DIR/out_of_bounds_read.rs:13:5 | ||
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; | ||
| ------------------------------------------------------ | ||
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | ||
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
::: $DIR/out_of_bounds_read.rs:13:33 | ||
| | ||
= note: `#[deny(const_err)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; | ||
| ----------------------- inside `_READ` at $DIR/out_of_bounds_read.rs:13:33 | ||
|
||
error: any use of this value will cause an error | ||
error[E0080]: evaluation of constant value failed | ||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| | ||
LL | unsafe { copy_nonoverlapping(src, dst, count) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 | ||
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ||
| inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39 | ||
| | ||
::: $DIR/out_of_bounds_read.rs:14:5 | ||
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; | ||
| -------------------------------------------------------- | ||
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | ||
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ||
| | ||
LL | unsafe { read(self) } | ||
| ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ||
| | ||
::: $DIR/out_of_bounds_read.rs:14:39 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; | ||
| ------------------- inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39 | ||
|
||
error: any use of this value will cause an error | ||
error[E0080]: evaluation of constant value failed | ||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| | ||
LL | unsafe { copy_nonoverlapping(src, dst, count) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 | ||
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL | ||
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL | ||
| inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37 | ||
| | ||
::: $DIR/out_of_bounds_read.rs:15:5 | ||
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; | ||
| -------------------------------------------------------------------- | ||
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | ||
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | ||
| | ||
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
LL | unsafe { read(self) } | ||
| ---------- inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL | ||
| | ||
::: $DIR/out_of_bounds_read.rs:15:37 | ||
| | ||
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; | ||
| --------------------------------- inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37 | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
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.