diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2018-10-13 13:21:04 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2018-10-20 23:11:30 +0100 |
| commit | a2c24873b110365c88ca3154d4538610829614f7 (patch) | |
| tree | 2171487fcf0ea95a5da0deb8dd7d3eaf3ba78d1d /src | |
| parent | 22cc2ae8057d14e980b7c784e1eb2eee26b59e7d (diff) | |
Prefer type annotations and returns in free region errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/nll/where_clauses_in_functions.stderr | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 5ff50c606d6..88293943193 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -138,6 +138,8 @@ impl<'tcx> RegionInferenceContext<'tcx> { | ConstraintCategory::Boring | ConstraintCategory::BoringNoLocation | ConstraintCategory::Internal => false, + ConstraintCategory::TypeAnnotation + | ConstraintCategory::Return => true, _ => constraint_sup_scc != target_scc, } }); diff --git a/src/test/ui/nll/where_clauses_in_functions.stderr b/src/test/ui/nll/where_clauses_in_functions.stderr index 0c6913911ed..19cb16d495b 100644 --- a/src/test/ui/nll/where_clauses_in_functions.stderr +++ b/src/test/ui/nll/where_clauses_in_functions.stderr @@ -6,7 +6,7 @@ LL | fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { | | | lifetime `'a` defined here LL | foo(x, y) - | ^^^^^^^^^ argument requires that `'a` must outlive `'b` + | ^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` error: aborting due to previous error |
