-
Notifications
You must be signed in to change notification settings - Fork 13.4k
do not run MIR type checker twice #48061
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
do not run MIR type checker twice #48061
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 27d615a has been approved by |
@bors r- There are multiple UI failures in the CI, most of them looks like the errors being reordered.
|
Argh. OK =) |
Ping from triage, @nikomatsakis — will you be able to address the UI test failures sometime soon? |
@bors r=eddyb |
📌 Commit b3fcbe2 has been approved by |
@bors r- The test
|
@kennytm hmm I don't have that test, I guess I have to rebase |
b3fcbe2
to
9084f1d
Compare
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.
9084f1d
to
bcd9968
Compare
@bors r=eddyb |
📌 Commit bcd9968 has been approved by |
…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.
@@ -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() { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 .
There was a problem hiding this comment.
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
…eck-twice, r=eddyb Fixes rust-lang#47311. r? @nrc
The MIR type checker currently runs twice when NLL is enabled: once as a sanity check, and once "for real". No need for that.