Skip to content

Commit 93529b4

Browse files
committed
add ui test for fn items, tidy fixes
1 parent a128051 commit 93529b4

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

src/librustc/infer/error_reporting/different_lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
210210
self.depth -= 1;
211211
return;
212212
}
213-
213+
214214
hir::TyRptr(ref lifetime, _) => {
215215
// the lifetime of the TyRptr
216216
let hir_id = self.infcx.tcx.hir.node_to_hir_id(lifetime.id);

src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 }
1212

1313
fn foo(mut y: Ref, x: &u32) {
14-
<<<<<<< HEAD
1514
y.b = x;
16-
=======
17-
x = y.b;
18-
>>>>>>> Adding E0623 for structs
1915
}
2016

2117
fn main() { }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
11+
y.push(z);
12+
}
13+
14+
fn main() { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0623]: lifetime mismatch
2+
--> src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs:11:10
3+
|
4+
10 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
5+
| --- --- these two types are declared with different lifetimes...
6+
11 | y.push(z);
7+
| ^ ...but data from `z` flows into `y` here
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)