-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-miriArea: The miri toolArea: The miri toolC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
I tried this code on nightly with -Zunleash-the-miri-inside-of-you
:
#![allow(const_err)]
#![feature(const_raw_ptr_deref)]
use std::cell::UnsafeCell;
struct Meh {
x: UnsafeCell<i32>,
}
unsafe impl Sync for Meh {}
static MEH: Meh = Meh {
x: UnsafeCell::new(42),
};
const WRITE: () = unsafe {
*MEH.x.get() = 12;
};
fn main() {
}
I expected that that should try to mutate a global, and show an error along those lines. But instead, const-checking gets in the way, even though "unleash Miri" should disable that:
warning: skipping const checks
--> unleash.rs:18:6
|
18 | *MEH.x.get() = 12;
| ^^^
error[E0019]: constant contains unimplemented expression type
--> unleash.rs:18:5
|
18 | *MEH.x.get() = 12;
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0019`.
wesleywiser, estebank and jyn514
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-miriArea: The miri toolArea: The miri toolC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
RalfJung commentedon Apr 28, 2020
Cc @rust-lang/wg-const-eval
RalfJung commentedon Apr 28, 2020
Ah, I need to add the
const_mut_refs
feature gate. But that's basically impossible to figure out without reading the rustc sources.I think unleashing miri should ignore all those feature gates. IMO it makes little sense to let this unleash features that do not even have a feature gate yet, but not let it unleash features that do.
ecstatic-morse commentedon Apr 28, 2020
Cross posting from #71631:
RalfJung commentedon Apr 28, 2020
(I responded there, summary: I disagree.)
Auto merge of rust-lang#71631 - RalfJung:miri-unleash-the-gates, r=ol…