Skip to content

Commit

Permalink
Rollup merge of #48061 - nikomatsakis:nll-do-not-run-mir-typeck-twice…
Browse files Browse the repository at this point in the history
…, r=eddyb

Fixes #47311.
r? @nrc
  • Loading branch information
Manishearth committed Feb 24, 2018
2 parents 6ec5dc3 + bcd9968 commit 182f882
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 414 deletions.
6 changes: 6 additions & 0 deletions src/librustc_mir/borrow_check/nll/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
return;
}

if tcx.sess.err_count() > 0 {
// compiling a broken program can obviously result in a
// broken MIR, so try not to report duplicate errors.
Expand Down
12 changes: 4 additions & 8 deletions src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,10 @@ fn overloaded_call_traits() {
//[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`
//[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 use of moved value: `*f`
}

twice_ten_sm(&mut |x| x + 1);
Expand Down
94 changes: 47 additions & 47 deletions src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,6 @@ note: External requirements
= note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '_#2r

note: External requirements
--> $DIR/projection-no-regions-closure.rs:46:23
|
46 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:18 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r>
]
= note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '_#2r

note: External requirements
--> $DIR/projection-no-regions-closure.rs:54:23
|
54 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r>
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r

note: External requirements
--> $DIR/projection-no-regions-closure.rs:65:23
|
65 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:26 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r>
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r

error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:36:23
|
Expand All @@ -97,6 +50,21 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-no-regions-closure.rs:46:23
|
46 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:18 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r>
]
= note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '_#2r

note: No external requirements
--> $DIR/projection-no-regions-closure.rs:42:1
|
Expand All @@ -113,6 +81,22 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-no-regions-closure.rs:54:23
|
54 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r>
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r

error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:54:23
|
Expand All @@ -139,6 +123,22 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-no-regions-closure.rs:65:23
|
65 | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:26 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r>
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r

note: No external requirements
--> $DIR/projection-no-regions-closure.rs:60:1
|
Expand Down
102 changes: 51 additions & 51 deletions src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -32,57 +32,6 @@ note: External requirements
= note: where T: '_#2r
= note: where '_#1r: '_#2r

note: External requirements
--> $DIR/projection-one-region-closure.rs:68:29
|
68 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:23 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

note: External requirements
--> $DIR/projection-one-region-closure.rs:90:29
|
90 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:27 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

note: External requirements
--> $DIR/projection-one-region-closure.rs:103:29
|
103 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:31 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:56:29
|
Expand Down Expand Up @@ -114,6 +63,23 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-one-region-closure.rs:68:29
|
68 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:23 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:68:29
|
Expand Down Expand Up @@ -146,6 +112,23 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-one-region-closure.rs:90:29
|
90 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:27 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:90:29
|
Expand Down Expand Up @@ -178,6 +161,23 @@ note: No external requirements
T
]

note: External requirements
--> $DIR/projection-one-region-closure.rs:103:29
|
103 | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:31 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T))
]
= note: number of external vids: 4
= note: where T: '_#3r
= note: where '_#2r: '_#3r

note: No external requirements
--> $DIR/projection-one-region-closure.rs:97:1
|
Expand Down
Loading

0 comments on commit 182f882

Please sign in to comment.