Skip to content
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

Changes the type mir::Mir into mir::Body #60928

Merged
merged 3 commits into from
May 29, 2019
Merged

Conversation

TheSirC
Copy link

@TheSirC TheSirC commented May 17, 2019

Fixes part 1 of #60229 (previously attempted in #60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 17, 2019
@@ -71,7 +71,7 @@ macro_rules! make_mir_visitor {
// Override these, and call `self.super_xxx` to revert back to the
// default behavior.

fn visit_mir(&mut self, mir: & $($mutability)? Mir<'tcx>) {
fn visit_mir(&mut self, mir: & $($mutability)? Body<'tcx>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and super_mir should be renamed to visit_body, and super_body, respectively.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rodger that. Done in the last force push.

Ref(&'mir String),
Owned(Rc<String>),
}

impl<'mir> CachedMir<'mir> {
impl<'mir> CachedBody<'mir> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change this test - alternatively, CachedMir can be renamed to Cached, if you want.
(Since this is a reduction, where Mir was replaced with String)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well received. Renamed to Cached then !

Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after a rebase and with nits fixed

@TheSirC
Copy link
Author

TheSirC commented May 22, 2019

@eddyb I rebased the branch with the modifications you asked to one commit.

@eddyb
Copy link
Member

eddyb commented May 23, 2019

@TheSirC You still need to rebase on latest master, before I can approve the PR.

@TheSirC
Copy link
Author

TheSirC commented May 24, 2019

Sorry for the back-and-forth, just rebased. I will try to be reactive in case another one is needed.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0e00a7aa:start=1558688467617550443,finish=1558688470662037256,duration=3044486813
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:15:47]    Compiling rustc_allocator v0.0.0 (/checkout/src/librustc_allocator)
[00:15:49] error[E0433]: failed to resolve: use of undeclared type or module `AggregateKind`
[00:15:49]    --> src/librustc_mir/transform/const_prop.rs:537:38
[00:15:49]     |
[00:15:49] 537 |                             Box::new(AggregateKind::Tuple),
[00:15:49]     |                                      ^^^^^^^^^^^^^ use of undeclared type or module `AggregateKind`
[00:16:03] error: aborting due to previous error
[00:16:03] 
[00:16:03] For more information about this error, try `rustc --explain E0433`.
[00:16:03] error: Could not compile `rustc_mir`.
---
travis_time:end:16f2f0fa:start=1558689610583775473,finish=1558689610589161448,duration=5385975
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2de6ab26
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:07b8df90
travis_time:start:07b8df90
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:12271400
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@TheSirC
Copy link
Author

TheSirC commented May 24, 2019

Obviously in the rebase I messed up an import; normally fixed now. Let's see what Travis has to say !

@eddyb
Copy link
Member

eddyb commented May 24, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 24, 2019

📌 Commit 6d14e73 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 24, 2019
Centril added a commit to Centril/rust that referenced this pull request May 25, 2019
Changes the type `mir::Mir` into `mir::Body`

Fixes part 1 of rust-lang#60229 (previously attempted in rust-lang#60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
Centril added a commit to Centril/rust that referenced this pull request May 25, 2019
Rollup of 5 pull requests

Successful merges:

 - rust-lang#60928 (Changes the type `mir::Mir` into `mir::Body`)
 - rust-lang#61035 (Avoid more symbol interning)
 - rust-lang#61036 (PGO - Add a smoketest for combining PGO with cross-language LTO.)
 - rust-lang#61077 (Don't arena-allocate static symbols.)
 - rust-lang#61080 (Ship profiler with windows-gnu)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented May 25, 2019

☔ The latest upstream changes (presumably #60441) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 25, 2019
@TheSirC
Copy link
Author

TheSirC commented May 25, 2019

Should I rebase again ?

@TheSirC
Copy link
Author

TheSirC commented May 25, 2019

Rebased to fix conflicts. Tests were passing locally.

@eddyb
Copy link
Member

eddyb commented May 25, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 25, 2019

📌 Commit d5f7181 has been approved by eddyb

@eddyb

This comment has been minimized.

@@ -1,4 +1,4 @@
use rustc::mir::{BasicBlock, Location, Mir};
use rustc::mir::{BasicBlock, Location, Body};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember if @oli-obk wanted to leave this for another PR (or maybe I never asked for this before), but IMO Body shouldn't be referred to as anything other than mir::Body outside of the module it's defined in.

src/librustc/ty/steal.rs Outdated Show resolved Hide resolved
@eddyb
Copy link
Member

eddyb commented May 28, 2019

Oh wow, the failure has nothing to do with this PR, it just accidentally got triggered:

let local_begin = self.lookup_byte_offset(sp.lo());
let local_end = self.lookup_byte_offset(sp.hi());
debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`",
local_begin, local_end);
let start_index = local_begin.pos.to_usize();
let end_index = local_end.pos.to_usize();

That code is missing a check that local_begin and local_end actually are in the same SourceFile, like this (from a different function):

let local_begin = self.lookup_byte_offset(sp.lo());
let local_end = self.lookup_byte_offset(sp.hi());
if local_begin.sf.start_pos != local_end.sf.start_pos {

Macros are involved, somehow causing a span to end up with its two endpoints in different files. That might otherwise result in ICEs, if not for them being at the exact same byte offset (within their respective files) which the algorithm doesn't account for.
cc @davidtwco @petrochenkov

@eddyb
Copy link
Member

eddyb commented May 28, 2019

@TheSirC I've pushed two commits - if you need to rebase, please pull first (and don't squash the syntax: ... commit away, since it's a separate bugfix).

@bors r+

@bors
Copy link
Contributor

bors commented May 28, 2019

📌 Commit 95013e6 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 28, 2019
Centril added a commit to Centril/rust that referenced this pull request May 28, 2019
Changes the type `mir::Mir` into `mir::Body`

Fixes part 1 of rust-lang#60229 (previously attempted in rust-lang#60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request May 28, 2019
bors added a commit that referenced this pull request May 28, 2019
Rollup of 9 pull requests

Successful merges:

 - #60742 (Allow const parameters in array sizes to be unified)
 - #60756 (Add better tests for hidden lifetimes in impl trait)
 - #60928 (Changes the type `mir::Mir` into `mir::Body`)
 - #61024 (tests: Centralize proc macros commonly used for testing)
 - #61157 (BufReader: In Seek impl, remove extra discard_buffer call)
 - #61195 (Special-case `.llvm` in mangler)
 - #61202 (Print PermissionExt::mode() in octal in Documentation Examples)
 - #61259 (Mailmap fixes)
 - #61273 (mention that MaybeUninit is a bit like Option)

Failed merges:

r? @ghost
@bors bors merged commit 95013e6 into rust-lang:master May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request May 29, 2019
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 30, 2019
Changes:
````
Rustup to rust-lang#61203
rustup rust-lang#60928
rustup rust-lang#61164 (which is included in rust-lang#61274)
````
bors added a commit that referenced this pull request May 31, 2019
submodules: update clippy from fb33fad to d2f5122

Changes:
````
Rustup to #61203
rustup #60928
rustup #61164 (which is included in #61274)
````

Fixes #61287

r? @oli-obk
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants