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

do not run MIR type checker twice #48061

Merged
merged 3 commits into from
Feb 24, 2018

Conversation

nikomatsakis
Copy link
Contributor

The MIR type checker currently runs twice when NLL is enabled: once as a sanity check, and once "for real". No need for that.

@rust-highfive
Copy link
Collaborator

r? @eddyb

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

@eddyb
Copy link
Member

eddyb commented Feb 7, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Feb 7, 2018

📌 Commit 27d615a has been approved by eddyb

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 7, 2018
@kennytm
Copy link
Member

kennytm commented Feb 8, 2018

@bors r-

There are multiple UI failures in the CI, most of them looks like the errors being reordered.

[00:59:36] failures:
[00:59:36]     [ui] ui/nll/ty-outlives/projection-no-regions-closure.rs
[00:59:36]     [ui] ui/nll/ty-outlives/projection-one-region-closure.rs
[00:59:36]     [ui] ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs
[00:59:36]     [ui] ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs
[00:59:36]     [ui] ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
[00:59:36]     [ui] ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs
[00:59:36]     [ui] ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs

@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 Feb 8, 2018
@nikomatsakis
Copy link
Contributor Author

Argh. OK =)

@shepmaster
Copy link
Member

Ping from triage, @nikomatsakis — will you be able to address the UI test failures sometime soon?

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 22, 2018

📌 Commit b3fcbe2 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 Feb 22, 2018
@kennytm
Copy link
Member

kennytm commented Feb 23, 2018

@bors r-

The test compile-fail/borrowck/two-phase-nonrecv-autoref.rs failed, there is no error when NLL is enabled (???).

[01:06:34] ---- [compile-fail] compile-fail/borrowck/two-phase-nonrecv-autoref.rs stdout ----
[01:06:34] 	
[01:06:34] error in revision `nll`: /checkout/src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs:102: expected error not found: cannot move a value of type
[01:06:34] 
[01:06:34] error in revision `nll`: /checkout/src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs:102: expected error not found: cannot move a value of type
[01:06:34] 
[01:06:34] error in revision `nll`: 0 unexpected errors found, 2 expected errors not found
[01:06:34] status: exit code: 101
[01:06:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail" "--target=x86_64-unknown-linux-gnu" "--cfg" "nll" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/borrowck/two-phase-nonrecv-autoref.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "borrowck=mir" "-Z" "two-phase-borrows" "-Z" "nll" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/borrowck/two-phase-nonrecv-autoref.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[01:06:34] not found errors (from test file): [
[01:06:34]     Error {
[01:06:34]         line_num: 102,
[01:06:34]         kind: Some(
[01:06:34]             Error
[01:06:34]         ),
[01:06:34]         msg: "cannot move a value of type"
[01:06:34]     },
[01:06:34]     Error {
[01:06:34]         line_num: 102,
[01:06:34]         kind: Some(
[01:06:34]             Error
[01:06:34]         ),
[01:06:34]         msg: "cannot move a value of type"
[01:06:34]     }
[01:06:34] ]
[01:06:34] 
[01:06:34] thread '[compile-fail] compile-fail/borrowck/two-phase-nonrecv-autoref.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1253:13
[01:06:34] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:06:34] 
[01:06:34] 
[01:06:34] failures:
[01:06:34]     [compile-fail] compile-fail/borrowck/two-phase-nonrecv-autoref.rs

@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 Feb 23, 2018
@nikomatsakis
Copy link
Contributor Author

@kennytm hmm I don't have that test, I guess I have to rebase

@nikomatsakis nikomatsakis force-pushed the nll-do-not-run-mir-typeck-twice branch from b3fcbe2 to 9084f1d Compare February 23, 2018 15:37
@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Feb 23, 2018

Ah, I think that this is a case of not emitting duplicate errors (this is the vicinity of line 102):

    fn twice_ten_oo(f: Box<FnOnce(i32) -> i32>) {
        f(f(10));
        //[lxl]~^             ERROR cannot move a value of type
        //[lxl]~^^            ERROR cannot move a value of type
        //[lxl]~^^^           ERROR use of moved value: `*f`
        //[nll]~^^^^          ERROR cannot move a value of type
        //[nll]~^^^^^         ERROR cannot move a value of type
        //[nll]~^^^^^^        ERROR cannot move a value of type
        //[nll]~^^^^^^^       ERROR cannot move a value of type
        //[nll]~^^^^^^^^      ERROR use of moved value: `*f`
        //[g2p]~^^^^^^^^^     ERROR cannot move a value of type
        //[g2p]~^^^^^^^^^^    ERROR cannot move a value of type
        //[g2p]~^^^^^^^^^^^   ERROR cannot move a value of type
        //[g2p]~^^^^^^^^^^^^  ERROR cannot move a value of type
        //[g2p]~^^^^^^^^^^^^^ ERROR use of moved value: `*f`
    }

The type checker invokes the borrow checker for closures it finds, so
removing the NLL type checker affects ordering of errors somewhat.
@nikomatsakis nikomatsakis force-pushed the nll-do-not-run-mir-typeck-twice branch from 9084f1d to bcd9968 Compare February 23, 2018 15:46
@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 23, 2018

📌 Commit bcd9968 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 Feb 23, 2018
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 24, 2018
…eck-twice, r=eddyb

do not run MIR type checker twice

The MIR type checker currently runs twice when NLL is enabled: once as a sanity check, and once "for real". No need for that.
bors added a commit that referenced this pull request Feb 24, 2018
Rollup of 15 pull requests

- Successful merges: #47987, #48056, #48061, #48084, #48143, #48185, #48206, #48208, #48232, #48246, #48258, #48317, #48353, #48356, #48402
- Failed merges:
@@ -1585,6 +1585,12 @@ impl MirPass for TypeckMir {
let id = tcx.hir.as_local_node_id(def_id).unwrap();
debug!("run_pass: {:?}", def_id);

// When NLL is enabled, the borrow checker runs the typeck
// itself, so we don't need this MIR pass anymore.
if tcx.sess.nll() {
Copy link
Member

Choose a reason for hiding this comment

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

[00:12:34] error[E0599]: no method named `nll` found for type `&rustc::session::Session` in the current scope
[00:12:34]     --> librustc_mir/borrow_check/nll/type_check/mod.rs:1590:21
[00:12:34]      |
[00:12:34] 1590 |         if tcx.sess.nll() {
[00:12:34]      |                     ^^^

in the rollup

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 removed by f787bdd .

Copy link
Member

Choose a reason for hiding this comment

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

Actually, that PR seems to be more rollup-breaking, I'll put this back in, sorry about that

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 24, 2018
bors added a commit that referenced this pull request Feb 24, 2018
Rollup of 15 pull requests

- Successful merges: #47987, #48056, #48061, #48084, #48143, #48185, #48206, #48208, #48232, #48246, #48258, #48317, #48353, #48356, #48402
- Failed merges:
@bors bors merged commit bcd9968 into rust-lang:master Feb 24, 2018
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.

7 participants