forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#35765 - KiChjang:e0053-bonus, r=jonathandtu…
…rner Additional span info for E0053 Part of rust-lang#35233. Fixes rust-lang#35212. r? @jonathandturner
- Loading branch information
Showing
7 changed files
with
158 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2016 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. | ||
|
||
// rustc-env:RUST_NEW_ERROR_FORMAT | ||
|
||
trait Foo { | ||
fn foo(x: u16); | ||
fn bar(&mut self, bar: &mut Bar); | ||
} | ||
|
||
struct Bar; | ||
|
||
impl Foo for Bar { | ||
fn foo(x: i16) { } | ||
fn bar(&mut self, bar: &Bar) { } | ||
} | ||
|
||
fn main() { | ||
} | ||
|
23 changes: 23 additions & 0 deletions
23
src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error[E0053]: method `foo` has an incompatible type for trait | ||
--> $DIR/trait-impl-fn-incompatibility.rs:21:15 | ||
| | ||
14 | fn foo(x: u16); | ||
| --- original trait requirement | ||
... | ||
21 | fn foo(x: i16) { } | ||
| ^^^ expected u16, found i16 | ||
|
||
error[E0053]: method `bar` has an incompatible type for trait | ||
--> $DIR/trait-impl-fn-incompatibility.rs:22:28 | ||
| | ||
15 | fn bar(&mut self, bar: &mut Bar); | ||
| -------- original trait requirement | ||
... | ||
22 | fn bar(&mut self, bar: &Bar) { } | ||
| ^^^^ values differ in mutability | ||
| | ||
= note: expected type `fn(&mut Bar, &mut Bar)` | ||
= note: found type `fn(&mut Bar, &Bar)` | ||
|
||
error: aborting due to 2 previous errors | ||
|