diff options
| author | Andy Russell <arussell123@gmail.com> | 2018-12-16 22:21:47 -0500 |
|---|---|---|
| committer | Andy Russell <arussell123@gmail.com> | 2018-12-24 12:58:52 -0500 |
| commit | 6474de904c1aca3a6eb131edc0e4e869ecabeb90 (patch) | |
| tree | bbbad65469f1a6d0dee875bc024409ecc8584cc8 /src/test/ui/regions | |
| parent | ddab10a692aab2e2984b5c826ed9d78a57e94851 (diff) | |
| download | rust-6474de904c1aca3a6eb131edc0e4e869ecabeb90.tar.gz rust-6474de904c1aca3a6eb131edc0e4e869ecabeb90.zip | |
make non_camel_case_types an early lint
Diffstat (limited to 'src/test/ui/regions')
29 files changed, 150 insertions, 151 deletions
diff --git a/src/test/ui/regions/regions-addr-of-self.rs b/src/test/ui/regions/regions-addr-of-self.rs index 04ee0526403..c606d0c65cf 100644 --- a/src/test/ui/regions/regions-addr-of-self.rs +++ b/src/test/ui/regions/regions-addr-of-self.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct dog { +struct Dog { cats_chased: usize, } -impl dog { +impl Dog { pub fn chase_cat(&mut self) { let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer *p += 1; @@ -24,8 +24,8 @@ impl dog { } } -fn dog() -> dog { - dog { +fn dog() -> Dog { + Dog { cats_chased: 0 } } diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs index 28491f1155c..47073535eda 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.rs +++ b/src/test/ui/regions/regions-addr-of-upvar-self.rs @@ -10,11 +10,11 @@ use std::usize; -struct dog { +struct Dog { food: usize, } -impl dog { +impl Dog { pub fn chase_cat(&mut self) { let _f = || { let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer diff --git a/src/test/ui/regions/regions-bounds.rs b/src/test/ui/regions/regions-bounds.rs index 5ce80be98d9..b646bc8835f 100644 --- a/src/test/ui/regions/regions-bounds.rs +++ b/src/test/ui/regions/regions-bounds.rs @@ -12,14 +12,14 @@ // nominal types (but not on other types) and that they are type // checked. -struct an_enum<'a>(&'a isize); -struct a_class<'a> { x:&'a isize } +struct TupleStruct<'a>(&'a isize); +struct Struct<'a> { x:&'a isize } -fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { return e; //~ ERROR mismatched types } -fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { return e; //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr index 7d5a47c0df3..f21b2aebc20 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.stderr @@ -4,17 +4,17 @@ error[E0308]: mismatched types LL | return e; //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `an_enum<'b>` - found type `an_enum<'a>` + = note: expected type `TupleStruct<'b>` + found type `TupleStruct<'a>` note: the lifetime 'a as defined on the function body at 18:10... --> $DIR/regions-bounds.rs:18:10 | -LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 18:13 --> $DIR/regions-bounds.rs:18:13 | -LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ error[E0308]: mismatched types @@ -23,17 +23,17 @@ error[E0308]: mismatched types LL | return e; //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `a_class<'b>` - found type `a_class<'a>` + = note: expected type `Struct<'b>` + found type `Struct<'a>` note: the lifetime 'a as defined on the function body at 22:10... --> $DIR/regions-bounds.rs:22:10 | -LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 22:13 --> $DIR/regions-bounds.rs:22:13 | -LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index de3142939b7..8a004543d94 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:33:16 | -LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough | ^----------------- | || | |temporary value created here @@ -10,7 +10,7 @@ LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live l error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:38:16 | -LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough | ^------------------ | || | |temporary value created here diff --git a/src/test/ui/regions/regions-creating-enums.rs b/src/test/ui/regions/regions-creating-enums.rs index ad2dc28afef..555c0e008a2 100644 --- a/src/test/ui/regions/regions-creating-enums.rs +++ b/src/test/ui/regions/regions-creating-enums.rs @@ -8,34 +8,34 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } fn build() { - let x = ast::num(3); - let y = ast::num(4); - let z = ast::add(&x, &y); + let x = Ast::Num(3); + let y = Ast::Num(4); + let z = Ast::Add(&x, &y); compute(&z); } -fn compute(x: &ast) -> usize { +fn compute(x: &Ast) -> usize { match *x { - ast::num(x) => { x } - ast::add(x, y) => { compute(x) + compute(y) } + Ast::Num(x) => { x } + Ast::Add(x, y) => { compute(x) + compute(y) } } } -fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { match *x { - ast::num(x) => { - return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough + Ast::Num(x) => { + return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough } - ast::add(x, y) => { + Ast::Add(x, y) => { let m_x = map_nums(x, f); let m_y = map_nums(y, f); - return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough + return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough } } } diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr index 7b0847739d7..216f8dbbf70 100644 --- a/src/test/ui/regions/regions-creating-enums.stderr +++ b/src/test/ui/regions/regions-creating-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:33:17 | -LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -9,14 +9,14 @@ LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live l note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... --> $DIR/regions-creating-enums.rs:30:13 | -LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { | ^^ = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:38:17 | -LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -24,7 +24,7 @@ LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... --> $DIR/regions-creating-enums.rs:30:13 | -LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { | ^^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/regions/regions-creating-enums3.rs b/src/test/ui/regions/regions-creating-enums3.rs index dcc579d26c1..d179f825d08 100644 --- a/src/test/ui/regions/regions-creating-enums3.rs +++ b/src/test/ui/regions/regions-creating-enums3.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } -fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { - ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] +fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { + Ast::Add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.stderr index b2cca9a3c62..6431f27e587 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch --> $DIR/regions-creating-enums3.rs:17:5 | -LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { +LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- | | | this parameter and the return type are declared with different lifetimes... -LL | ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] +LL | Ast::Add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] | ^^^^^^^^^^^^^^ ...but data from `y` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums4.rs b/src/test/ui/regions/regions-creating-enums4.rs index 5dc9b370f32..e6b8bbe47ad 100644 --- a/src/test/ui/regions/regions-creating-enums4.rs +++ b/src/test/ui/regions/regions-creating-enums4.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } -fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { - ast::add(x, y) //~ ERROR cannot infer +fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { + Ast::Add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 729dc2f107a..97573504e3e 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -1,25 +1,25 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-creating-enums4.rs:17:5 | -LL | ast::add(x, y) //~ ERROR cannot infer +LL | Ast::Add(x, y) //~ ERROR cannot infer | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 16:16... --> $DIR/regions-creating-enums4.rs:16:16 | -LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { +LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ = note: ...so that the expression is assignable: - expected &ast<'_> - found &ast<'a> + expected &Ast<'_> + found &Ast<'a> note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 16:19... --> $DIR/regions-creating-enums4.rs:16:19 | -LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { +LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ = note: ...so that the expression is assignable: - expected ast<'b> - found ast<'_> + expected Ast<'b> + found Ast<'_> error: aborting due to previous error diff --git a/src/test/ui/regions/regions-in-enums.rs b/src/test/ui/regions/regions-in-enums.rs index 613a90dda67..070ea7be95e 100644 --- a/src/test/ui/regions/regions-in-enums.rs +++ b/src/test/ui/regions/regions-in-enums.rs @@ -11,19 +11,19 @@ // Test that lifetimes must be declared for use on enums. // See also regions-undeclared.rs -enum yes0<'lt> { +enum Yes0<'lt> { X3(&'lt usize) } -enum yes1<'a> { +enum Yes1<'a> { X4(&'a usize) } -enum no0 { +enum No0 { X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo` } -enum no1 { +enum No1 { X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a` } diff --git a/src/test/ui/regions/regions-in-structs.rs b/src/test/ui/regions/regions-in-structs.rs index c231d3a913e..26354317701 100644 --- a/src/test/ui/regions/regions-in-structs.rs +++ b/src/test/ui/regions/regions-in-structs.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct yes1<'a> { +struct Yes1<'a> { x: &'a usize, } -struct yes2<'a> { +struct Yes2<'a> { x: &'a usize, } diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.rs b/src/test/ui/regions/regions-infer-at-fn-not-param.rs index ec73bf90b6e..d2bfd960325 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.rs +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.rs @@ -8,22 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct parameterized1<'a> { +struct Parameterized1<'a> { g: Box<FnMut() + 'a> } -struct not_parameterized1 { +struct NotParameterized1 { g: Box<FnMut() + 'static> } -struct not_parameterized2 { +struct NotParameterized2 { g: Box<FnMut() + 'static> } -fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p } +fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } //~^ ERROR explicit lifetime required in the type of `p` -fn take3(p: not_parameterized1) -> not_parameterized1 { p } -fn take4(p: not_parameterized2) -> not_parameterized2 { p } +fn take3(p: NotParameterized1) -> NotParameterized1 { p } +fn take4(p: NotParameterized2) -> NotParameterized2 { p } fn main() {} diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.stderr b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr index f129ffae23a..ddc7ebcd4ed 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.stderr +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `p` --> $DIR/regions-infer-at-fn-not-param.rs:23:57 | -LL | fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p } +LL | fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } | -------------- ^ lifetime `'a` required | | - | help: add explicit lifetime `'a` to the type of `p`: `parameterized1<'a>` + | help: add explicit lifetime `'a` to the type of `p`: `Parameterized1<'a>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr index a444f90bbe1..eb1128f8e0e 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*p` - --> $DIR/regions-infer-borrow-scope-too-big.rs:24:12 + --> $DIR/regions-infer-borrow-scope-too-big.rs:23:12 | LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough | --- `*p` is borrowed here diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs index 2628e6a1ce2..9937970a9bf 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs @@ -8,17 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -struct point { +struct Point { x: isize, y: isize, } -fn x_coord<'r>(p: &'r point) -> &'r isize { +fn x_coord<'r>(p: &'r Point) -> &'r isize { return &p.x; } -fn foo<'a>(p: Box<point>) -> &'a isize { +fn foo<'a>(p: Box<Point>) -> &'a isize { let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough assert_eq!(*xc, 3); return xc; diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr index 4c4a9b91958..6a66cd256c1 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr @@ -1,5 +1,5 @@ error[E0597]: `*p` does not live long enough - --> $DIR/regions-infer-borrow-scope-too-big.rs:22:23 + --> $DIR/regions-infer-borrow-scope-too-big.rs:21:23 | LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough | ^^ borrowed value does not live long enough @@ -7,10 +7,10 @@ LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:8... - --> $DIR/regions-infer-borrow-scope-too-big.rs:21:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:8... + --> $DIR/regions-infer-borrow-scope-too-big.rs:20:8 | -LL | fn foo<'a>(p: Box<point>) -> &'a isize { +LL | fn foo<'a>(p: Box<Point>) -> &'a isize { | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs index 8c191fbd5bb..14d32f8e470 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs @@ -10,15 +10,15 @@ use std::marker; -struct invariant<'a> { +struct Invariant<'a> { marker: marker::PhantomData<*mut &'a()> } -fn to_same_lifetime<'r>(b_isize: invariant<'r>) { - let bj: invariant<'r> = b_isize; +fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { + let bj: Invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { b_isize //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr index edd37b1622a..23ada7067f5 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr @@ -4,12 +4,12 @@ error[E0308]: mismatched types LL | b_isize //~ ERROR mismatched types | ^^^^^^^ lifetime mismatch | - = note: expected type `invariant<'static>` - found type `invariant<'r>` + = note: expected type `Invariant<'static>` + found type `Invariant<'r>` note: the lifetime 'r as defined on the function body at 21:23... --> $DIR/regions-infer-invariance-due-to-decl.rs:21:23 | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index f280e4d978e..9949c2fc285 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -9,15 +9,15 @@ // except according to those terms. -struct invariant<'a> { +struct Invariant<'a> { f: Box<FnOnce(&mut &'a isize) + 'static>, } -fn to_same_lifetime<'r>(b_isize: invariant<'r>) { - let bj: invariant<'r> = b_isize; +fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { + let bj: Invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { b_isize //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr index 3a807b755af..3a9060d7c72 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr @@ -4,12 +4,12 @@ error[E0308]: mismatched types LL | b_isize //~ ERROR mismatched types | ^^^^^^^ lifetime mismatch | - = note: expected type `invariant<'static>` - found type `invariant<'r>` + = note: expected type `Invariant<'static>` + found type `Invariant<'r>` note: the lifetime 'r as defined on the function body at 20:23... --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:20:23 | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 131b7170951..4e5bf5ad83f 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -8,29 +8,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct direct<'a> { +struct Direct<'a> { f: &'a isize } -struct indirect1 { +struct Indirect1 { // Here the lifetime parameter of direct is bound by the fn() - g: Box<FnOnce(direct) + 'static> + g: Box<FnOnce(Direct) + 'static> } -struct indirect2<'a> { +struct Indirect2<'a> { // But here it is set to 'a - g: Box<FnOnce(direct<'a>) + 'static> + g: Box<FnOnce(Direct<'a>) + 'static> } -fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types -fn take_indirect1(p: indirect1) -> indirect1 { p } +fn take_indirect1(p: Indirect1) -> Indirect1 { p } -fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types -//~| expected type `indirect2<'b>` -//~| found type `indirect2<'a>` +fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +//~| expected type `Indirect2<'b>` +//~| found type `Indirect2<'a>` //~| ERROR mismatched types -//~| expected type `indirect2<'b>` -//~| found type `indirect2<'a>` +//~| expected type `Indirect2<'b>` +//~| found type `Indirect2<'a>` fn main() {} diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index 2a029518953..d7b95408f96 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -1,58 +1,58 @@ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:25:54 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `direct<'b>` - found type `direct<'a>` + = note: expected type `Direct<'b>` + found type `Direct<'a>` note: the lifetime 'a as defined on the function body at 25:16... --> $DIR/regions-infer-not-param.rs:25:16 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 25:19 --> $DIR/regions-infer-not-param.rs:25:19 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:29:63 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `indirect2<'b>` - found type `indirect2<'a>` + = note: expected type `Indirect2<'b>` + found type `Indirect2<'a>` note: the lifetime 'a as defined on the function body at 29:19... --> $DIR/regions-infer-not-param.rs:29:19 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 29:22 --> $DIR/regions-infer-not-param.rs:29:22 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:29:63 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `indirect2<'b>` - found type `indirect2<'a>` + = note: expected type `Indirect2<'b>` + found type `Indirect2<'a>` note: the lifetime 'b as defined on the function body at 29:22... --> $DIR/regions-infer-not-param.rs:29:22 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 29:19 --> $DIR/regions-infer-not-param.rs:29:19 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.rs b/src/test/ui/regions/regions-infer-paramd-indirect.rs index c559992c865..3ccaa894b81 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.rs +++ b/src/test/ui/regions/regions-infer-paramd-indirect.rs @@ -12,24 +12,24 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. -type a<'a> = &'a isize; -type b<'a> = Box<a<'a>>; +type A<'a> = &'a isize; +type B<'a> = Box<A<'a>>; -struct c<'a> { - f: Box<b<'a>> +struct C<'a> { + f: Box<B<'a>> } -trait set_f<'a> { - fn set_f_ok(&mut self, b: Box<b<'a>>); - fn set_f_bad(&mut self, b: Box<b>); +trait SetF<'a> { + fn set_f_ok(&mut self, b: Box<B<'a>>); + fn set_f_bad(&mut self, b: Box<B>); } -impl<'a> set_f<'a> for c<'a> { - fn set_f_ok(&mut self, b: Box<b<'a>>) { +impl<'a> SetF<'a> for C<'a> { + fn set_f_ok(&mut self, b: Box<B<'a>>) { self.f = b; } - fn set_f_bad(&mut self, b: Box<b>) { + fn set_f_bad(&mut self, b: Box<B>) { self.f = b; //~^ ERROR mismatched types //~| expected type `std::boxed::Box<std::boxed::Box<&'a isize>>` diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr index 602f30957f1..52e5e74c83b 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr @@ -9,7 +9,7 @@ LL | self.f = b; note: the anonymous lifetime #2 defined on the method body at 32:5... --> $DIR/regions-infer-paramd-indirect.rs:32:5 | -LL | / fn set_f_bad(&mut self, b: Box<b>) { +LL | / fn set_f_bad(&mut self, b: Box<B>) { LL | | self.f = b; LL | | //~^ ERROR mismatched types LL | | //~| expected type `std::boxed::Box<std::boxed::Box<&'a isize>>` @@ -20,7 +20,7 @@ LL | | } note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 27:6 --> $DIR/regions-infer-paramd-indirect.rs:27:6 | -LL | impl<'a> set_f<'a> for c<'a> { +LL | impl<'a> SetF<'a> for C<'a> { | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-steal-closure.rs b/src/test/ui/regions/regions-steal-closure.rs index 7ca63b9896f..ebdb5636cdb 100644 --- a/src/test/ui/regions/regions-steal-closure.rs +++ b/src/test/ui/regions/regions-steal-closure.rs @@ -10,12 +10,12 @@ #![feature(fn_traits)] -struct closure_box<'a> { +struct ClosureBox<'a> { cl: Box<FnMut() + 'a>, } -fn box_it<'r>(x: Box<FnMut() + 'r>) -> closure_box<'r> { - closure_box {cl: x} +fn box_it<'r>(x: Box<FnMut() + 'r>) -> ClosureBox<'r> { + ClosureBox {cl: x} } fn main() { diff --git a/src/test/ui/regions/regions-trait-1.rs b/src/test/ui/regions/regions-trait-1.rs index 9cd08656b62..7cc64ede0f9 100644 --- a/src/test/ui/regions/regions-trait-1.rs +++ b/src/test/ui/regions/regions-trait-1.rs @@ -10,31 +10,31 @@ #![feature(box_syntax)] -struct ctxt { v: usize } +struct Ctxt { v: usize } -trait get_ctxt { +trait GetCtxt { // Here the `&` is bound in the method definition: - fn get_ctxt(&self) -> &ctxt; + fn get_ctxt(&self) -> &Ctxt; } -struct has_ctxt<'a> { c: &'a ctxt } +struct HasCtxt<'a> { c: &'a Ctxt } -impl<'a> get_ctxt for has_ctxt<'a> { +impl<'a> GetCtxt for HasCtxt<'a> { // Here an error occurs because we used `&self` but // the definition used `&`: - fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait + fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait self.c } } -fn get_v(gc: Box<get_ctxt>) -> usize { +fn get_v(gc: Box<GetCtxt>) -> usize { gc.get_ctxt().v } fn main() { - let ctxt = ctxt { v: 22 }; - let hc = has_ctxt { c: &ctxt }; - assert_eq!(get_v(box hc as Box<get_ctxt>), 22); + let ctxt = Ctxt { v: 22 }; + let hc = HasCtxt { c: &ctxt }; + assert_eq!(get_v(box hc as Box<GetCtxt>), 22); } diff --git a/src/test/ui/regions/regions-trait-1.stderr b/src/test/ui/regions/regions-trait-1.stderr index dbc47a55950..be81d7ce40f 100644 --- a/src/test/ui/regions/regions-trait-1.stderr +++ b/src/test/ui/regions/regions-trait-1.stderr @@ -1,20 +1,20 @@ error[E0308]: method not compatible with trait --> $DIR/regions-trait-1.rs:26:5 | -LL | fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait +LL | fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected type `fn(&has_ctxt<'a>) -> &ctxt` - found type `fn(&has_ctxt<'a>) -> &'a ctxt` + = note: expected type `fn(&HasCtxt<'a>) -> &Ctxt` + found type `fn(&HasCtxt<'a>) -> &'a Ctxt` note: the lifetime 'a as defined on the impl at 22:6... --> $DIR/regions-trait-1.rs:22:6 | -LL | impl<'a> get_ctxt for has_ctxt<'a> { +LL | impl<'a> GetCtxt for HasCtxt<'a> { | ^^ note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 26:5 --> $DIR/regions-trait-1.rs:26:5 | -LL | / fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait +LL | / fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait LL | | self.c LL | | } | |_____^ |
