Skip to content

Commit 31d56cb

Browse files
committed
Add UI test for E0053
1 parent 34bc3c9 commit 31d56cb

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2016 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+
11+
// rustc-env:RUST_NEW_ERROR_FORMAT
12+
13+
trait Foo {
14+
fn foo(x: u16);
15+
fn bar(&mut self, bar: &mut Bar);
16+
}
17+
18+
struct Bar;
19+
20+
impl Foo for Bar {
21+
fn foo(x: i16) { }
22+
fn bar(&mut self, bar: &Bar) { }
23+
}
24+
25+
fn main() {
26+
}
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0053]: method `foo` has an incompatible type for trait
2+
--> $DIR/trait-impl-fn-incompatibility.rs:21:15
3+
|
4+
14 | fn foo(x: u16);
5+
| --- original trait requirement
6+
...
7+
21 | fn foo(x: i16) { }
8+
| ^^^ expected u16, found i16
9+
10+
error[E0053]: method `bar` has an incompatible type for trait
11+
--> $DIR/trait-impl-fn-incompatibility.rs:22:28
12+
|
13+
15 | fn bar(&mut self, bar: &mut Bar);
14+
| -------- original trait requirement
15+
...
16+
22 | fn bar(&mut self, bar: &Bar) { }
17+
| ^^^^ values differ in mutability
18+
|
19+
= note: expected type `fn(&mut Bar, &mut Bar)`
20+
= note: found type `fn(&mut Bar, &Bar)`
21+
22+
error: aborting due to 2 previous errors
23+

0 commit comments

Comments
 (0)