-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Merge miri into librustc_mir #43340
Merge miri into librustc_mir #43340
Conversation
Update to rustc 1.19.0-nightly (777ee20 2017-05-01)
Rustup to rustc 1.19.0-nightly (2d4ed8e 2017-05-03)
Update Cargo.toml, fix for build error (see rust-lang#164)
update for latest rustc
implement __rust_allocate_zeroed C ABI function
update for upstream changes with ty::ParamEnv
fix 'cargo run' in README
update for latest nightly rustc
miri complains about a memory leak when the program terminates. This may be related to thread-local dtors not running.
…t C ABI calls if MIR is missing
I am worried about moving miri here before having a plan for how to continue running its test suite automatically whenever it gets changed. |
Maybe we should revisit #38350 (including MIR for the entire standard library, which introduces a 10% increase in lib size) The new motivation is that miri needs to keep getting tested, because the features we will want to have in the future (after RFCs) are working already, but without tests they will very likely break. Assuming that const fns become more common with more features becoming legal in const eval, this 10% increase might come anyway (or nearly at least). |
Also, miri has other uses, like my "Types as Contracts" work and your priroda. |
priroda will still work with the xargo method. As will |
Yes, but it relies on the non-CTFE parts of miri continuing to work -- which you argued in the text I quoted will break if we stop testing it. |
I haven't looked yet, but are the non-CTFE parts here, not abstracted away? What I had in mind (which we could do later) is have the interpreter parametrized by a "machine" trait which could choose how abstract to be and would handle all the C function emulation and whatnot. |
no
While this is trivial for c functions and friends, weaving this through miri for every relevant location will get very messy. There's all kinds of locations where the decision between CTFE and interpretation mode is done. I've already marked most with an |
It's fine to have some primitive restrictions for the more internal details, but the "machine" could have different flags for different categories. The one thing I'm not sure is readily doable this way is integer pointers but the "machine" could have a way to attempt memory accesses on integer addresses (which would always fail for CTFE). |
Ok, I can get behind that. But that still leaves the issue of code that is in miri, will most likely be part of CTFE in the future, but isn't right now. Should these also get moved back to the miri repository? Where do we draw the line, and how do we test those paths properly? |
@oli-obk I think they should be separated, if nothing else to avoid the risk of accidentally turning them on and exposing people to e.g. dynamic allocation at compile-time (before we're sure how it will actually work). cc @alexcrichton about cargotest(?), for running external miri tests on bors. |
Er sorry, I have very little context and this is a massive change. At first glance there's licensing to worry about, source structure with a new Is there perhaps a comprehensive summary of what's happening here so I might be able to help? |
So the high level goal is to get miri into the compiler in order to scrap the two const evaluators that are currently in the compiler and just use miri. Miri is much more extensible than the existing const evaluators, so new RFCs can then be opened in order to activate or implement miri features in const eval. The goal of this PR is to discuss which parts of miri go into the compiler now. The 13k lines of code will be reduced significantly before merging, since rustc doesn't need everything. The issue with testing is that currently miri is way overpowered compared to const eval. So if we just test miri by testing whether constant evaluation works the same with miri as with the builtin const eval, we'll be ignoring an enormous part of miri code. This ignored part will probably break very quickly due to the lack of testing and the high rate of change that MIR and other internals code has. Much of the "untested" code would be required some day in the future by some RFC, so we don't want it to break. Thus the idea was to run miri's test suite along with the compiler's test suite, but keep the non-CTFE parts outside the rustc repository. Miri's test suite custom builds a libstd with |
Miri has been intentionally licensed the same as rustc from the beginning. |
@oli-obk thanks for the explanation! I think it's totally fine to have miri tests be "special" and only works sometimes or perhaps not others. It sounds like what we may want is a subdirectory for all miri tests (probably under the miri directory), new rules in @solson yeah that's great! To me "licensing worry" is equivalent to "something about licensing changed" and this PR, for example, currently adds new license files, which to me just raises red flags. (if we can agree those should be removed that sounds fine) |
There's also the option of adding an attribute The same would go for compile-fail or ui tests.
So failing miri tests wouldn't block PRs from passing? |
@alexcrichton What I was interested in, was whether non-CTFE miri tests could live in the out-of-tree miri and get tested like several crates are tested (e.g. regex and cargo, AFAIK) by bors. |
@oli-obk oh if that's the case then we could have a new @eddyb certainly that can always be done! It's just a matter of changing this array |
@alexcrichton Ah, perfectly understandable. :) Yeah, I assume we can just ditch the new license files - the new code falls under the same top-level license declarations in this repo. |
@eddyb that sounds like a nice plan. It's still not straight-forward though, with miri's test suite currently depending on rustup to fetch rust-src and then xargo to compile it. That wouldn't work with cargotest and things are not in rustup yet, right? |
We don't need xargo at all I think. As long as we start generating fullmir libstd on the Basically I'd add a |
Closing this to keep the queue clean. The changes are in progress inside the miri repository. I'll open a new PR when they are done. |
Run the miri test suite on the aux builder and travis Reopen of #38350 see #43340 (comment) for earlier discussion Rationale for running miri's test suite in rustc's CI is that miri currently contains many features that we want in const eval in the future, and these features would break if the test suite is not run. fixes #44077 r? @nikomatsakis cc @eddyb
r? @eddyb
cc @solson @RalfJung @dwrensha @rust-lang/compiler
My plan is:
wrt the new git initial commit: rust-lang/miri#105 (comment)