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 upReplace all const evaluation with miri #46882
Conversation
rust-highfive
assigned
eddyb
Dec 20, 2017
kennytm
added
the
S-waiting-on-author
label
Dec 20, 2017
oli-obk
changed the title
WIP: add more boosters to miri...
WIP: add more boosters 🚀 to miri...
Dec 21, 2017
oli-obk
force-pushed the
oli-obk:miri3
branch
2 times, most recently
from
7de6a56
to
ef9043b
Dec 21, 2017
oli-obk
reviewed
Dec 22, 2017
| value: cx.tcx().mk_const(ty::Const { | ||
| val: if cx.tcx().sess.opts.debugging_opts.miri { | ||
| let inst = ty::Instance::new(def_id, substs); | ||
| let ptr = cx.tcx() |
This comment has been minimized.
This comment has been minimized.
oli-obk
Dec 22, 2017
Author
Contributor
@eddyb help! I'm not sure where to start touching the hair in order to get these 'gcx and 'tcx lifetimes satisfied:
error[E0623]: lifetime mismatch
--> src/librustc_mir/hair/cx/expr.rs:603:38
|
584 | fn method_callee<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
| ------------------ this parameter and the return type are declared with different lifetimes...
...
587 | -> Expr<'tcx> {
| ----------
...
603 | let ptr = cx.tcx()
| ^^^ ...but data from `cx` is returned here
error: aborting due to previous error
error: Could not compile `rustc_mir`.
oli-obk
force-pushed the
oli-obk:miri3
branch
from
f3fe013
to
d7928a1
Dec 28, 2017
This comment has been minimized.
This comment has been minimized.
|
|
oli-obk
force-pushed the
oli-obk:miri3
branch
from
9cb239a
to
625820f
Dec 28, 2017
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Great work on this, @oli-obk! I was just playing around with it myself, and was wondering on the state of it. Specifically, I seem to still be getting errors indicating that if expressions and loops are still not supported. Is this the case? |
This comment has been minimized.
This comment has been minimized.
|
This PR does not enable much new stuff. That's not the point of it. We can enable more things after this PR. All I'm trying to do is to make it work on all code that worked before, without adding anything that we want to talk about in RFCs. That said, a few things will work after this PR.
Also I haven't pushed everything yet. |
This comment has been minimized.
This comment has been minimized.
|
@oli-obk Oh, I see. Thanks for the clarification. |
This comment has been minimized.
This comment has been minimized.
|
@oli-obk this is currently tagged as waiting-on-author, but did you want to start getting an early review? |
This comment has been minimized.
This comment has been minimized.
|
FWIW, @eddyb and I have been expanding on this significantly over the last few days. He's encouraging me to submit a PR, though I don't know if it's going to be against oli-obk's branch, or rust-lang:master. |
oli-obk
force-pushed the
oli-obk:miri3
branch
from
d07e8e6
to
3fac474
Jan 8, 2018
This comment has been minimized.
This comment has been minimized.
|
|
oli-obk
force-pushed the
oli-obk:miri3
branch
from
a199c77
to
d10b896
Jan 9, 2018
eddyb
reviewed
Jan 9, 2018
| .expect("miri alloc not found"); | ||
| Ok(global_initializer(ccx, alloc)) | ||
| } | ||
|
|
||
| impl<'a, 'tcx> MirContext<'a, 'tcx> { | ||
| // Old version of trans_constant now used just for SIMD shuffle | ||
| pub fn remove_me__shuffle_indices(&mut self, | ||
| pub fn remove_me_shuffle_indices(&mut self, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexreg
Jan 9, 2018
Contributor
My bad. I got an error for non-snake-case names, and fixed it by removing the _ instead of adding a deny attribute. :-P
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
oli-obk
force-pushed the
oli-obk:miri3
branch
from
5fd4cb8
to
38023e4
Jan 14, 2018
This comment has been minimized.
This comment has been minimized.
|
Just wanted to note that 1. the PR description should include all changes 2. this will need a crater run. |
oli-obk
changed the title
WIP: add more boosters 🚀 to miri...
WIP: Replace all const evaluation with miri
Jan 15, 2018
This comment has been minimized.
This comment has been minimized.
|
I am now getting
Which very likely results from the fact that Any clues how to solve this? |
This comment has been minimized.
This comment has been minimized.
|
You removed the I'm going to need access to the miri allocation interner to be able to hash AllocIds in a stable manner |
This comment has been minimized.
This comment has been minimized.
|
@oli-obk, yes, we are creating rust/src/librustc_driver/driver.rs Line 189 in 8ff449d This could be solved by some refactoring, I think. @eddyb wanted to move HIR lowering to after the There might also be another way of hashing |
This comment has been minimized.
This comment has been minimized.
|
We could have an |
This comment has been minimized.
This comment has been minimized.
|
During lowering we won't have any Won't just hashing the ID be problematic if recompiling changes the value of a static? |
This comment has been minimized.
This comment has been minimized.
That depends. Can you access the contents of an allocation via an Is there a write up somewhere what these |
This comment has been minimized.
This comment has been minimized.
|
Nope no writeup. I'll add one though In short : AllocIds are used to identify interned Allocations. Serialization serializes the allocation instead of the allocid and deserialization generates a new allocid on the fly to keep them unique |
This comment has been minimized.
This comment has been minimized.
|
Is there one graph of allocations per |
oli-obk
deleted the
oli-obk:miri3
branch
Mar 8, 2018
This was referenced Mar 8, 2018
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
Mar 8, 2018
|
|
SimonSapin
added a commit
to SimonSapin/rust
that referenced
this pull request
Mar 8, 2018
bdrewery
referenced this pull request
Mar 9, 2018
Closed
Crash building libstd on FreeBSD after miri const eval changes. #48888
This comment has been minimized.
This comment has been minimized.
|
Getting a weird build crash on FreeBSD after this merge #48888 |
This was referenced Mar 10, 2018
alexcrichton
referenced this pull request
Mar 15, 2018
Closed
ICE during cross-compilation and const eval #49033
EpicatSupercell
referenced this pull request
Mar 15, 2018
Closed
clippy_lints-0.0.187 error breaks +nightly clippy install #2532
SimonSapin
added a commit
to SimonSapin/rust
that referenced
this pull request
Mar 17, 2018
Vurich
referenced this pull request
Mar 20, 2018
Closed
All fixed-size array impls show up as `<unevaluated[]>` #49208
pnkfelix
referenced this pull request
Mar 21, 2018
Closed
Compiler panic: unexpected unsized tail: TyProjection(ProjectionTy { substs: Slice([chrono::Utc]), ... #48336
bors
added a commit
that referenced
this pull request
Apr 9, 2018
This comment has been minimized.
This comment has been minimized.
ur0
commented
Apr 16, 2018
|
I'm sorry if this isn't the right place, but are tuple struct constructors available in the latest stable build (2018-03-25)? |
This comment has been minimized.
This comment has been minimized.
|
This is as good a place as any other ;) No they're not in the current stable. they'll be in the next stable (so they are in the current beta) |
oli-obk commentedDec 20, 2017
•
edited
aand read from fieldbconst X: &u32 = &22)1i8 >> [8][0]does not lint about exceeding bitshifts anymore.foo[I]produces a const eval lint iffoo: [T; N]andN < Iunions to implementtransmuteforCopytypes in constants without a feature gate. With all the greatness and nasal demons that come with this.&'static Tin constants (useful for embedded)fixes #34997 (stack overflow with many constants)
fixes #25574 (deref byte strings in patterns)
fixes #27918 (broken mir ICE)
fixes #46114 (ICE on struct constructors in patterns)
fixes #37448 (
SomeStruct { foo } as SomeStruct)fixes #43754 (
returnin const fn)fixes #41898 (tuple struct constructors)
fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit)
closes #29947 (const indexing stabilization)
fixes #45044 (pattern matching repeat expressions)
fixes #47971 (ICE on const fn + references)
fixes #48081 (ICE on cyclic assoc const error)
fixes #48746 (nonhelpful error message with unions)
r? @eddyb
even though 1k loc are added in tests, this PR reduces the loc in this repository by 700