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

Merge Promoted and Static in mir::Place #59232

Merged
merged 8 commits into from
Mar 26, 2019

Conversation

saleemjaffer
Copy link
Contributor

@saleemjaffer saleemjaffer commented Mar 16, 2019

fixes #53848

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 16, 2019
@saleemjaffer
Copy link
Contributor Author

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned davidtwco Mar 16, 2019
@saleemjaffer saleemjaffer changed the title promoted is still left in 2 places Merge Promoted and Static in mir::Place Mar 16, 2019
src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
src/librustc_mir/borrow_check/mod.rs Outdated Show resolved Hide resolved
src/librustc_mir/borrow_check/nll/type_check/mod.rs Outdated Show resolved Hide resolved
src/librustc_mir/borrow_check/place_ext.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/qualify_consts.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor

oli-obk commented Mar 17, 2019

note that you need to rebase over the master branch, since there are merge conflicts

@saleemjaffer
Copy link
Contributor Author

@oli-obk #53848 (comment)

Not sure how to get the DefId of the current function. Any tips?

@oli-obk
Copy link
Contributor

oli-obk commented Mar 17, 2019

You can add a new DefId field to the Promoter type. Whereever Promoted objects are created, you can fill in the field with the current function's DefId

@saleemjaffer
Copy link
Contributor Author

you can fill in the field with the current function's DefId

I am stuck with figuring out how to obtain the current function's DefId :(

@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:2f7af79f:start=1553352610681796655,finish=1553352685026031560,duration=74344234905
$ 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
Setting environment variables from .travis.yml
---
[00:28:04]    Compiling rustc_asan v0.0.0 (/checkout/src/librustc_asan)
[00:28:04]    Compiling rustc_msan v0.0.0 (/checkout/src/librustc_msan)
[00:28:05]    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
[00:28:05]    Compiling rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[00:28:24] error: internal compiler error: src/librustc_mir/borrow_check/nll/mod.rs:354: region is not an ReVar: ReStatic
[00:28:24] thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:634:9
[00:28:24] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[00:28:24] error: aborting due to previous error
[00:28:24] 
[00:28:24] 
[00:28:24] 
[00:28:24] note: the compiler unexpectedly panicked. this is a bug.
[00:28:24] 
[00:28:24] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:28:24] 
[00:28:24] note: rustc 1.35.0-dev running on x86_64-unknown-linux-gnu
[00:28:24] 
[00:28:24] note: compiler flags: -Z external-macro-backtrace -Z force-unstable-if-unmarked -C opt-level=2 -C prefer-dynamic -C debug-assertions=y -C codegen-units=1 -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type lib
[00:28:24] note: some of the compiler flags provided by cargo are hidden
[00:28:24] 
[00:28:25] error: Could not compile `core`.
[00:28:25] 
---
travis_time:end:274e8e4a:start=1553354400212355337,finish=1553354400219776250,duration=7420913
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:106db90c
$ 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:0b51f4bc
travis_time:start:0b51f4bc
$ 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

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)

src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
@saleemjaffer
Copy link
Contributor Author

Fixed everything.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 25, 2019

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Mar 25, 2019

📌 Commit fb93f10 has been approved by oli-obk

@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 Mar 25, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2019
…oli-obk

Merge `Promoted` and `Static` in `mir::Place`

fixes rust-lang#53848
Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2019
…oli-obk

Merge `Promoted` and `Static` in `mir::Place`

fixes rust-lang#53848
Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2019
…oli-obk

Merge `Promoted` and `Static` in `mir::Place`

fixes rust-lang#53848
assert!(!static_.ty.needs_subst());
let layout = self.layout_of(static_.ty)?;
let instance = ty::Instance::mono(*self.tcx, static_.def_id);
Base(PlaceBase::Static(box Static { kind: StaticKind::Static(def_id), ty })) => {
Copy link
Member

Choose a reason for hiding this comment

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

Why do these cases need to be handled so differently here? I somewhat hoped they'd get more uniform though this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

To get this resolved we'll need to either teach intern_static about promoteds (which opens up a whole can of worms since we'd need to put a GlobalId in there (which has 'tcx lifetimes) or we'd need to still treat it differently in the end, which would end up with the code we have now.

bors added a commit that referenced this pull request Mar 26, 2019
Rollup of 10 pull requests

Successful merges:

 - #59150 (Expand suggestions for type ascription parse errors)
 - #59232 (Merge `Promoted` and `Static` in `mir::Place`)
 - #59267 (Provide suggestion when using field access instead of path)
 - #59315 (Add no_hash to query macro and move some queries over)
 - #59334 (Update build instructions in README.md)
 - #59362 (Demo `FromIterator` short-circuiting)
 - #59374 (Simplify checked_duration_since)
 - #59389 (replace redundant note in deprecation warning)
 - #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
 - #59419 (Utilize `?` instead of `return None`.)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Mar 26, 2019
Rollup of 10 pull requests

Successful merges:

 - #59150 (Expand suggestions for type ascription parse errors)
 - #59232 (Merge `Promoted` and `Static` in `mir::Place`)
 - #59267 (Provide suggestion when using field access instead of path)
 - #59315 (Add no_hash to query macro and move some queries over)
 - #59334 (Update build instructions in README.md)
 - #59362 (Demo `FromIterator` short-circuiting)
 - #59374 (Simplify checked_duration_since)
 - #59389 (replace redundant note in deprecation warning)
 - #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
 - #59419 (Utilize `?` instead of `return None`.)

Failed merges:

r? @ghost
@bors bors merged commit fb93f10 into rust-lang:master Mar 26, 2019
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
pub struct Static<'tcx> {
pub def_id: DefId,
pub ty: Ty<'tcx>,
Copy link
Member

Choose a reason for hiding this comment

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

cc @arielb1 @nikomatsakis Are pre-normalized types in MIR still needed?

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.

Merge Promoted and Static variants of mir::Place
8 participants