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

Don't use lift to detect local types #61871

Merged
merged 2 commits into from
Jul 2, 2019
Merged

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Jun 15, 2019

This overlaps with #61392.

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 15, 2019
@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:05217f82:start=1560626469432056280,finish=1560626564629490044,duration=95197433764
$ 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:03:49] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:49] tidy error: /checkout/src/librustc/ty/context.rs: too many lines (3068) (add `// ignore-tidy-filelength` to the file to suppress this error)
[00:03:54] some tidy checks failed
[00:03:54] 
[00:03:54] 
[00:03:54] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:54] 
[00:03:54] 
[00:03:54] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:54] Build completed unsuccessfully in 0:01:11
---
travis_time:end:150ef786:start=1560626809115496126,finish=1560626809120038297,duration=4542171
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:18c8ef24
$ 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:0e9e7588
travis_time:start:0e9e7588
$ 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:000f04a8
$ 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)

@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:047c93c4:start=1560627424950581360,finish=1560627514195892917,duration=89245311557
$ 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:14:37]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:14:52] error: unused variable: `gcx`
[00:14:52]    --> src/librustc_mir/borrow_check/nll/region_infer/mod.rs:812:13
[00:14:52]     |
[00:14:52] 812 |         let gcx = tcx.global_tcx();
[00:14:52]     |             ^^^ help: consider prefixing with an underscore: `_gcx`
[00:14:52]     = note: `-D unused-variables` implied by `-D warnings`
[00:14:52] 
[00:15:01]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:15:02] error: aborting due to previous error
---
travis_time:end:2f83a7c6:start=1560628597803657351,finish=1560628597809069415,duration=5412064
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:12cc995e
$ 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:049b5600
travis_time:start:049b5600
$ 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:3241ba93
$ 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)

@Zoxc
Copy link
Contributor Author

Zoxc commented Jun 15, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jun 15, 2019

⌛ Trying commit 90fbfd7095ad0b022adb968bbc72ce51b55e2467 with merge 3e509e149d6644da28c5e2b642d164845e724047...

@@ -1455,7 +1455,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// Even if the type may have no inference variables, during
// type-checking closure types are in local tables only.
if !self.in_progress_tables.is_some() || !ty.has_closure_types() {
if let Some((param_env, ty)) = self.tcx.lift_to_global(&(param_env, ty)) {
if !(param_env, ty).has_local_value() {
Copy link
Member

Choose a reason for hiding this comment

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

cc @rust-lang/compiler I think it might be better if we stop referring to these as "local values" and instead use something more like .has_infer_vars()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

has_infer_types already exist and is a different property.

ty.is_copy_modulo_regions(self.tcx.global_tcx(), param_env, span)
})
if (param_env, ty).has_local_value() {
None
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, if self.infcx is None, this case should be impossible - it's plausible this code is unnecessarily defensive and lift_to_global's result could've been unwrap'd all along.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree.

promoted: None,
};
match self.selcx.tcx().at(obligation.cause.span)
.const_eval(obligation.param_env.and(cid)) {
Copy link
Member

Choose a reason for hiding this comment

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

I can't wait for this to use erasure and canonicalization instead (@oli-obk and @nikomatsakis are working on that, I think?).

}
if predicates.has_local_value() {
// FIXME: shouldn't we, you know, actually report an error here? or an ICE?
Err(ErrorReported)
Copy link
Member

Choose a reason for hiding this comment

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

@rust-lang/wg-traits This is scary, can we do a crater run with a delay_span_bug in here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@eddyb What happened to this?

if let Some(lifted) = self.tcx().lift_to_global(&x) {
lifted
} else {
if cfg!(debug_assertions) && x.has_local_value() {
Copy link
Member

Choose a reason for hiding this comment

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

Is it really that expensive? Anyway it should be impossible, given a correct Resolver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how expensive these are. They're not free though, so I'd prefer to not have them for release builds.

And yes, it should be impossible, that's why it's an assertion =P

let c_sig = if let Some(c_sig) = self.tcx().lift_to_global(c_sig) {
c_sig
} else {
if cfg!(debug_assertions) && c_sig.has_local_value() {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, can we do a crater run with all of these assertions turned on by default, to confirm they're very likely never triggered, and then remove them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're effectively turned on now, and they have caught at least one bug #46184.

I do think we should have these assertions somewhere though, to ensure that no infer types leaks out from typeck. I could just use debug_assert here instead of span_bug to make them more slim.

@@ -808,26 +825,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

ty::Predicate::ConstEvaluatable(def_id, substs) => {
let tcx = self.tcx();
match tcx.lift_to_global(&(obligation.param_env, substs)) {
Some((param_env, substs)) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer if one of two things happened here (and in other places match-ing over lift_to_global results):

  • land a PR on master replacing the matches with if lets (you can just r=me that if you want)
  • keep the match and either use Option::filter or just match on the bool predicate

That is, I would prefer if indentation didn't change (and it only does because of the match -> if change).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you not want indention to change? I like less rightward drift, and I definitely don't like matching on bools.

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to change, I just want to be able to read the diff without mentally pretending nothing changed without checking, where indentation is involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the indentation to reduce the diffs in 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.

@eddyb you can append ?w=1 to the diff url to have whitespace insensitive diffs https://github.com/rust-lang/rust/pull/61871/files?w=1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. I also reordered some branches which that can't deal with though =P

@@ -461,40 +461,34 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
}

ty::Predicate::ConstEvaluatable(def_id, substs) => {
match self.selcx.tcx().lift_to_global(&obligation.param_env) {
None => {
if obligation.param_env.has_local_value() {
Copy link
Member

Choose a reason for hiding this comment

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

Same as the other match -> if change.

@Zoxc Zoxc force-pushed the no-lift-branch branch 3 times, most recently from a35c705 to fabe708 Compare June 16, 2019 13:32
@bors
Copy link
Contributor

bors commented Jun 19, 2019

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

@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:1df9c270:start=1560968986542163132,finish=1560968987405713224,duration=863550092
$ 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:04:52] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:52] tidy error: /checkout/src/librustc/traits/fulfill.rs:480: line longer than 100 chars
[00:04:57] some tidy checks failed
[00:04:57] 
[00:04:57] 
[00:04:57] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:57] 
[00:04:57] 
[00:04:57] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:57] Build completed unsuccessfully in 0:01:15
---
travis_time:end:24c77cd0:start=1560969296547077810,finish=1560969296551855472,duration=4777662
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0e6f8794
$ 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:07441038
travis_time:start:07441038
$ 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:1d1a7b9f
$ 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)

@eddyb
Copy link
Member

eddyb commented Jul 1, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 1, 2019

📌 Commit 8465daf 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 Jul 1, 2019
@bors
Copy link
Contributor

bors commented Jul 1, 2019

⌛ Testing commit 8465daf with merge ebe126b40db5acb422774453b0d9a2d821bb3755...

@pietroalbini
Copy link
Member

@bors retry

Yielding priority to the Azure migration.

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 2, 2019
Don't use lift to detect local types

This overlaps with rust-lang#61392.

r? @eddyb
@bors
Copy link
Contributor

bors commented Jul 2, 2019

⌛ Testing commit 8465daf with merge ef064d2...

bors added a commit that referenced this pull request Jul 2, 2019
Don't use lift to detect local types

This overlaps with #61392.

r? @eddyb
@bors
Copy link
Contributor

bors commented Jul 2, 2019

☀️ Test successful - checks-azure, checks-travis, status-appveyor
Approved by: eddyb
Pushing ef064d2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 2, 2019
@bors bors merged commit 8465daf into rust-lang:master Jul 2, 2019
@Zoxc Zoxc deleted the no-lift-branch branch July 2, 2019 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

None yet

7 participants