diff --git a/src/librustc/infer/error_reporting/different_lifetimes.rs b/src/librustc/infer/error_reporting/different_lifetimes.rs index 9546d8a4dd2..a54e75857dd 100644 --- a/src/librustc/infer/error_reporting/different_lifetimes.rs +++ b/src/librustc/infer/error_reporting/different_lifetimes.rs @@ -210,7 +210,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { self.depth -= 1; return; } - + hir::TyRptr(ref lifetime, _) => { // the lifetime of the TyRptr let hir_id = self.infcx.tcx.hir.node_to_hir_id(lifetime.id); diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs index 5920eeed6b1..4933dbb7e7a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -11,11 +11,7 @@ struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { -<<<<<<< HEAD y.b = x; -======= - x = y.b; ->>>>>>> Adding E0623 for structs } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs new file mode 100644 index 00000000000..9220c34489f --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs @@ -0,0 +1,14 @@ +// Copyright 2017 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { + y.push(z); +} + +fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr new file mode 100644 index 00000000000..0913abad3cc --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs:11:10 + | +10 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { + | --- --- these two types are declared with different lifetimes... +11 | y.push(z); + | ^ ...but data from `z` flows into `y` here + +error: aborting due to previous error +