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

Universes #55517

Merged
merged 30 commits into from
Jan 3, 2019
Merged

Universes #55517

merged 30 commits into from
Jan 3, 2019

Conversation

nikomatsakis
Copy link
Contributor

This PR transitions the compiler to use universes instead of the leak-check. It is marked as [WIP] for a few reasons:

  • The diagnostics at present are terrible =)
  • This changes the behavior of coherence, regressing some things that used to compile

The goals of this PR at present are:

The first few commits in the PR are changing how evaluate treats regions. We now track whether region comparisons occurred, reverting the "staticized" query approach that @arielb1 put in. The problem with "staticized" queries is that it relied on the leak-check to get higher-ranked things correct, and we are removing the leak-check in this PR series, so that caused problems.

You can see at the end a collection of test updates. Mostly we behave the same but with atrocious diagnostics, but there are a number of cases where we used to error and now no longer do, as well as single case where we used to not error but we now do (the coherence-subtyping change).

(Note: it would be possible to do a version of leak-check that propagates universe information and recover the old behavior. I am reluctant to do so because I'd like to leave us room to get more precise -- e.g., I want to eventually handle things like exists<'a> { for<'b> { if ('a: 'b) { 'a: 'b } } } which presently the leak-check cannot cope with etc. Also because it seems more consistent to me: most folks I've talked to expect the new behavior and are surprised to learn that binding sites were so significant before when it comes to coherence. One question is, though, to what extent are people relying on this in the wild?)

@rust-highfive
Copy link
Collaborator

r? @eddyb

(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 Oct 30, 2018
@nikomatsakis
Copy link
Contributor Author

r? @scalexm

@rust-highfive rust-highfive assigned scalexm and unassigned eddyb Oct 30, 2018
@nikomatsakis
Copy link
Contributor Author

(NB: This builds on #55305)

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.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:03b94990:start=1541007419406398813,finish=1541007484369787706,duration=64963388893
$ 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
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:47:25] .................................................................................................... 1200/4989
[00:47:27] .................................................................................................... 1300/4989
[00:47:30] .................................................................................................... 1400/4989
[00:47:32] ..................................................................................i................. 1500/4989
[00:47:35] ........................................................i..F........................................ 1600/4989
[00:47:42] .................................................................................................... 1800/4989
[00:47:46] ................................................................................................i... 1900/4989
[00:47:49] .................................................................................................... 2000/4989
[00:47:53] .................................................................................................... 2100/4989
---
[00:49:16] ............................................................i....................................... 4600/4989
[00:49:20] .................................................................................................... 4700/4989
[00:49:23] .................................................................................................... 4800/4989
[00:49:26] .................................................................................................... 4900/4989
, 'a) })...
[00:49:28] 8    = note: ...so that the types are compatible:
[00:49:28] 9            expected Foo<&'a isize>
[00:49:28] 10               found Foo<&isize>
[00:49:28] 
[00:49:28] The actual stderr differed from the expected stderr.
[00:49:28] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hrtb/hrtb-perfect-forwarding/hrtb-perfect-forwarding.stderr
[00:49:28] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hrtb/hrtb-perfect-forwarding/hrtb-perfect-forwarding.stderr
[00:49:28] To update references, rerun the tests and pass the `--bless` flag
[00:49:28] To only update this specific test, also pass `--test-args hrtb/hrtb-perfect-forwarding.rs`
[00:49:28] error: 1 errors occurred comparing output.
[00:49:28] status: exit code: 1
[00:49:28] status: exit code: 1
[00:49:28] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/hrtb/hrtb-perfect-forwarding.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hrtb/hrtb-perfect-forwarding/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hrtb/hrtb-perfect-forwarding/auxiliary" "-A" "unused"
[00:49:28] ------------------------------------------
[00:49:28] 
[00:49:28] ------------------------------------------
[00:49:28] stderr:
[00:49:28] stderr:
[00:49:28] ------------------------------------------
[00:49:28] {"message":"cannot infer an appropriate lifetime due to conflicting requirements","code":{"code":"E0495","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/hrtb/hrtb-perfect-forwarding.rs","byte_start":1640,"byte_end":1656,"line_start":56,"line_end":56,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    foo_hrtb_bar_not(&mut t); //~ ERROR E0495","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U2, name: BrNamed(crate0:DefIndex(1:23), 'a) })...","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"...so that the types are compatible:\nexpected Foo<&'a isize>\n   found Foo<&isize>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"but, the lifetime must be valid for the lifetime 'b as defined on the function body at 49:21...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/hrtb/hrtb-perfect-forwarding.rs","byte_start":1305,"byte_end":1307,"line_start":49,"line_end":49,"column_start":21,"column_end":23,"is_primary":true,"text":[{"text":"fn foo_hrtb_bar_not<'b,T>(mut t: T)","highlight_start":21,"highlight_end":23}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...so that the types are compatible:\nexpected Bar<&isize>\n   found Bar<&'b isize>","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements\n  --> /checkout/src/test/ui/hrtb/hrtb-perfect-forwarding.rs:56:5\n   |\nLL |     foo_hrtlinux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib
70532 ./obj/build/x86_64-unknown-linux-gnu/native
70300 ./obj/build/x86_64-unknown-linux-gnu/native/jemalloc
67720 ./src/test
67612 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps

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)

@nikomatsakis
Copy link
Contributor Author

@bors try

@bors
Copy link
Contributor

bors commented Nov 1, 2018

⌛ Trying commit 89c5decf7f558fa6d0e04205ce54cc299bd772e2 with merge dc8b02d6f1e93f212fc39844ea688b634b4a03c7...

@bors
Copy link
Contributor

bors commented Nov 1, 2018

☀️ Test successful - status-travis
State: approved= try=True

@nikomatsakis
Copy link
Contributor Author

@craterbot run start=master#f6e9a6e41cd9b1fb687e296b5a6d4c6ad399f862 end=try#dc8b02d6f1e93f212fc39844ea688b634b4a03c7 mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-55517 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 1, 2018
Copy link
Member

@tmandry tmandry left a comment

Choose a reason for hiding this comment

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

left some (very minor) nits on tests

src/test/ui/coherence/coherence-subtyping.rs Outdated Show resolved Hide resolved
src/test/ui/hrtb/hrtb-exists-forall-fn.rs Outdated Show resolved Hide resolved
src/test/ui/hrtb/hrtb-exists-forall-fn.rs Outdated Show resolved Hide resolved
@craterbot
Copy link
Collaborator

🚧 Experiment pr-55517 is now running on agent aws-1.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-55517 is completed!
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Nov 3, 2018
@nikomatsakis
Copy link
Contributor Author

Crater results all look spurious.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.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:0a5fdd58:start=1542207737343698206,finish=1542207793850600983,duration=56506902777
$ 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
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:05:34]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:38]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:06:56]    Compiling proc_macro v0.0.0 (/checkout/src/libproc_macro)
[00:07:06]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:07:30] error[E0599]: no method named `replace_late_bound_regions_with_fresh_var` found for type `&infer::InferCtxt<'_, '_, '_>` in the current scope
[00:07:30]      |
[00:07:30]      |
[00:07:30] 1448 |         infcx.replace_late_bound_regions_with_fresh_var(
[00:07:30]      |
[00:07:30]      = help: did you mean `replace_late_bound_regions_with_placeholders`?
[00:07:30] 
[00:07:30] 
[00:07:30] error[E0599]: no method named `predicate_must_hold` found for type `&infer::InferCtxt<'_, '_, '_>` in the current scope
[00:07:30]     |
[00:07:30]     |
[00:07:30] 561 |             infcx.predicate_must_hold(&obligation)
[00:07:30]     |
[00:07:30]     |
[00:07:30]     = help: did you mean `predicate_may_hold`?
[00:07:30] error[E0061]: this function takes 5 parameters but 7 parameters were supplied
[00:07:30]     --> librustc/traits/select.rs:3024:42
[00:07:30]      |
[00:07:30]      |
[00:07:30] 3024 |               let trait_obligations = self.impl_or_trait_obligations(
[00:07:30] ...
[00:07:30] ...
[00:07:30] 3654 | /     fn impl_or_trait_obligations(
[00:07:30] 3655 | |         &mut self,
[00:07:30] 3656 | |         cause: ObligationCause<'tcx>,
[00:07:30] ...    |
[00:07:30] 3723 | |         predicates
[00:07:30] 3724 | |     }
[00:07:30]      | |_____- defined here
---
[00:07:36] 
[00:07:36] To learn more, run the command again with --verbose.
[00:07:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:07:36] expected success, got: exit code: 101
[00:07:36] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1101:9
[00:07:36] travis_fold:end:stage0-rustc

[00:07:36] travis_time:end:stage0-rustc:start=1542208097061533372,finish=1542208259729488577,duration=162667955205


[00:07:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:07:36] Build completed unsuccessfully in 0:03:47
[00:07:36] make: *** [all] Error 1
[00:07:36] Makefile:28: recipe for target 'all' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:14ee587d
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Nov 14 15:10:59 UTC 2018
---
32392 ./src/libcompiler_buitravis_time:end:0baebe78:start=1542208260455513808,finish=1542208260467103317,duration=11589509
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:06ae7be0
$ 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:02ce8254
$ 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 added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jan 3, 2019
Tested on commit rust-lang/rust@c0bbc39.
Direct link to PR: <rust-lang/rust#55517>

💔 clippy-driver on windows: test-fail → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-fail → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
phansch added a commit to phansch/rust-clippy that referenced this pull request Jan 3, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jan 3, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jan 3, 2019
@nikomatsakis
Copy link
Contributor Author

@matthiaskrgr are you working on fixing the toolstate change here? (I see some commits that look suggestive)

@matthiaskrgr
Copy link
Member

Yeah, sorry about the spam.

There is a recent regression in clippy rust-lang/rust-clippy#3628 which has not been very easy to track down which prevents use from landing the fix. :/

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 5, 2019
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 7, 2019
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
@pnkfelix pnkfelix mentioned this pull request Jul 9, 2019
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 5, 2020
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang/rust#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang/rust#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang/rust#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
@tmandry tmandry added the WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 label May 24, 2023
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. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants