Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upturn on MIR construction unconditionally #28748
Conversation
rust-highfive
assigned
pnkfelix
Sep 30, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Oh, I meant to remove the "reachable" flags for matches. I can do that easily enough. |
This comment has been minimized.
This comment has been minimized.
|
done. |
nikomatsakis
referenced this pull request
Sep 30, 2015
Closed
Tracking issue for MIR (RFC #1211) #27840
eefriedman
reviewed
Sep 30, 2015
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| fn eq(&self, other: &ConstVal) -> bool { | ||
| match (self, other) { | ||
| (&Float(v1), &Float(v2)) => (v1.is_nan() && v2.is_nan()) || (v1 == v2), |
This comment has been minimized.
This comment has been minimized.
eefriedman
Sep 30, 2015
Contributor
Is v1.is_nan() && v2.is_nan() really what you mean, as opposed to transmute<f64, u64>(v1) == transmute<f64, u64>(v2)?
This comment has been minimized.
This comment has been minimized.
Hmm, interesting question. It's probably better to be more conservative, I agree. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton huh, that confetti-ball renders looks more like an angry stormcloud to me. I was like "what did I do to make alex angry now?" |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Hmm, on a checkout from yesterday, the #[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[repr(usize)]
pub enum E { A = 0, B = 1 }
impl E {
pub fn foo(x: usize) -> Self {
use self::E::{A, B};
const E_A: usize = A as usize;
const E_B: usize = B as usize;
match x {
E_A => A,
E_B => B,
_ => panic!("no match"),
}
}
}results in ICE:
The crater run you did, I assume it wasn't including the |
This comment has been minimized.
This comment has been minimized.
|
(The reason that I point this out on this ticket is just to warn that we do not seem to have been testing this pattern internally, if Update: and in fact the commit messages for the commit series on this PR gives me some hope that this problem is in fact addressed somewhere here, since this PR does something with respect to the handling of patterns and const-evaluation. Update 2: @nikomatsakis I will actually build rust with this PR locally and check whether it indeed does fix the test case I listed above. |
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix that test case works on this branch. I did indeed revamp how constants are handled to just reuse more of the compiler's existing machinery. |
This comment has been minimized.
This comment has been minimized.
|
Note: -Z always build Mir is only used currently when bootstrapping, not
|
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
force-pushed the
nikomatsakis:universal-mir
branch
from
9adce8d
to
c84f284
Oct 1, 2015
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis okay I've finished reviewing. Looks fine, assuming you squash some of the later commits into the appropriate earlier commits (i.e. the removal of the So r=me once that's done. |
nikomatsakis
added some commits
Sep 10, 2015
nikomatsakis
force-pushed the
nikomatsakis:universal-mir
branch
from
c84f284
to
5261441
Oct 5, 2015
nikomatsakis
added some commits
Sep 29, 2015
nikomatsakis
force-pushed the
nikomatsakis:universal-mir
branch
from
5261441
to
7e1e830
Oct 5, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors r=pnkfelix |
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis commentedSep 30, 2015
I had to fix a few things. Notable changes:
ConstVal. I still think we ought to reform how we handle constants, but it's not clear to me that the approach I was taking is correct, and anyway I think we ought to do it separately.check_match, because it detects various broken cases. I'd like forcheck_matchto be subsumed by MIR construction, but we can do that as a separate PR (if indeed it makes sense).I did a crater run and found no regressions in the wild: https://gist.github.com/nikomatsakis/0038f90e10c8ad00f2f8