Added fully elaborated type label for inferred arguments.

This commit is contained in:
David Wood 2018-07-23 13:09:30 +02:00
parent 41ce2e9dd2
commit 53dda8e915
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
6 changed files with 112 additions and 16 deletions

View file

@ -0,0 +1,17 @@
warning: not reporting region error due to nll
--> $DIR/issue-52533.rs:15:16
|
LL | foo(|a, b| b)
| ^
error: unsatisfied lifetime constraints
--> $DIR/issue-52533.rs:15:16
|
LL | foo(|a, b| b)
| - - ^ free region requires that `'1` must outlive `'2`
| | |
| | lifetime `'1` appears in this argument
| lifetime `'2` appears in this argument
error: aborting due to previous error

View file

@ -0,0 +1,17 @@
// Copyright 2018 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.
fn foo(_: impl for<'a> FnOnce(&'a u32, &u32) -> &'a u32) {
}
fn main() {
foo(|a, b| b)
//~^ ERROR lifetime of reference outlives lifetime of borrowed content...
}

View file

@ -0,0 +1,20 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-52533.rs:15:16
|
LL | foo(|a, b| b)
| ^
|
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 15:9...
--> $DIR/issue-52533.rs:15:9
|
LL | foo(|a, b| b)
| ^^^^^^^^
note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 15:9
--> $DIR/issue-52533.rs:15:9
|
LL | foo(|a, b| b)
| ^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0312`.