forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#100643 - TaKO8Ki:point-at-type-parameter-sh…
…adowing-another-type, r=estebank Point at a type parameter shadowing another type This patch fixes a part of rust-lang#97459.
- Loading branch information
Showing
7 changed files
with
54 additions
and
3 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
21 changes: 21 additions & 0 deletions
21
src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.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,21 @@ | ||
trait Foo<T> { | ||
fn foo(&self, name: T) -> usize; | ||
} | ||
|
||
struct Bar { | ||
baz: Baz, | ||
} | ||
|
||
struct Baz { | ||
num: usize, | ||
} | ||
|
||
impl<Baz> Foo<Baz> for Bar { | ||
fn foo(&self, _name: Baz) -> usize { | ||
match self.baz { | ||
Baz { num } => num, //~ ERROR expected struct, variant or union type, found type parameter `Baz` | ||
} | ||
} | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.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,12 @@ | ||
error[E0574]: expected struct, variant or union type, found type parameter `Baz` | ||
--> $DIR/point-at-type-parameter-shadowing-another-type.rs:16:13 | ||
| | ||
LL | impl<Baz> Foo<Baz> for Bar { | ||
| --- found this type pararmeter | ||
... | ||
LL | Baz { num } => num, | ||
| ^^^ not a struct, variant or union type | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0574`. |
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