impose inputs/ouputs on MIR after the fact
The input/output types found in `UniversalRegions` are not normalized. The old code used to assign them directly into the MIR, which would lead to errors when there was a projection in a argument or return type. This also led to some special cases in the `renumber` code. We now renumber uniformly but then pass the input/output types into the MIR type-checker, which equates them with the types found in MIR. This allows us to normalize at the same time.
This commit is contained in:
parent
3fcb13ae45
commit
e9824c50ed
6 changed files with 94 additions and 68 deletions
|
|
@ -39,7 +39,11 @@ fn main() {
|
|||
// | '_#2r | {'_#2r, bb0[0], bb0[1]}
|
||||
// | '_#3r | {'_#3r, bb0[0], bb0[1]}
|
||||
// | '_#4r | {'_#4r, bb0[0], bb0[1]}
|
||||
// | '_#5r | {'_#1r, bb0[0], bb0[1]}
|
||||
// | '_#6r | {'_#2r, bb0[0], bb0[1]}
|
||||
// | '_#7r | {'_#1r, bb0[0], bb0[1]}
|
||||
// | '_#8r | {'_#3r, bb0[0], bb0[1]}
|
||||
// |
|
||||
// ...
|
||||
// fn use_x(_1: &'_#1r mut i32, _2: &'_#2r u32, _3: &'_#1r u32, _4: &'_#3r u32) -> bool {
|
||||
// fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool {
|
||||
// END rustc.use_x.nll.0.mir
|
||||
|
|
|
|||
29
src/test/ui/nll/projection-return.rs
Normal file
29
src/test/ui/nll/projection-return.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir
|
||||
// must-compile-successfully
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
trait Foo {
|
||||
type Bar;
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
type Bar = u32;
|
||||
}
|
||||
|
||||
fn foo() -> <() as Foo>::Bar {
|
||||
22
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue