-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
const validation: point at where we found a pointer but expected an integer #114372
Conversation
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
180fdd3
to
3b87fa6
Compare
|
||
use std::mem; | ||
struct MyStr(str); | ||
const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted this test since this exact const is also tested in "raw-bytes", in a test case called MYSTR_NO_INIT_ISSUE83182
.
1u8, | ||
MaybeUninit { uninit: () }.init, | ||
//~^ ERROR evaluation of constant value failed | ||
//~| uninitialized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point these got changed to longer test what they were actually meant to test: reporting the right index in the error message. So I changed the test to fix that again.
☔ The latest upstream changes (presumably #114368) made this pull request unmergeable. Please resolve the merge conflicts. |
3b87fa6
to
7767cbb
Compare
@bors r+ rollup |
⌛ Testing commit 7767cbb with merge 5867b0dee32588e906201478181562b7dd81ebdb... |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry "Too Many Requests" fetching some docker image |
…li-obk const validation: point at where we found a pointer but expected an integer Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers". To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under `const_eval_validation` so that they are in a single group in the ftl file. r? `@oli-obk`
@bors r=oli-obk |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#113657 (Expand, rename and improve `incorrect_fn_null_checks` lint) - rust-lang#114237 (parser: more friendly hints for handling `async move` in the 2015 edition) - rust-lang#114300 (Suggests turbofish in patterns) - rust-lang#114372 (const validation: point at where we found a pointer but expected an integer) - rust-lang#114395 ([rustc_span][perf] Hoist lookup sorted by words out of the loop.) - rust-lang#114403 (fix the span in the suggestion of remove question mark) - rust-lang#114408 (Temporary remove myself from review rotation) - rust-lang#114415 (Skip checking of `rustc_codegen_gcc` with vendoring enabled) r? `@ghost` `@rustbot` modify labels: rollup
Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers".
To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under
const_eval_validation
so that they are in a single group in the ftl file.r? @oli-obk