-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark all erroneous generic params as invariant
- Loading branch information
Showing
14 changed files
with
122 additions
and
70 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
11 changes: 11 additions & 0 deletions
11
tests/ui/associated-consts/wrong-projection-self-ty-on-invalid-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,11 @@ | ||
struct Fail<T>; | ||
//~^ ERROR: type parameter `T` is never used | ||
|
||
impl Fail<i32> { | ||
const C: () = (); | ||
} | ||
|
||
fn main() { | ||
Fail::<()>::C | ||
//~^ ERROR: no associated item named `C` found for struct `Fail<()>` | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/ui/associated-consts/wrong-projection-self-ty-on-invalid-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,25 @@ | ||
error[E0392]: type parameter `T` is never used | ||
--> $DIR/wrong-projection-self-ty-on-invalid-type.rs:1:13 | ||
| | ||
LL | struct Fail<T>; | ||
| ^ unused type parameter | ||
| | ||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` | ||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead | ||
|
||
error[E0599]: no associated item named `C` found for struct `Fail<()>` in the current scope | ||
--> $DIR/wrong-projection-self-ty-on-invalid-type.rs:9:17 | ||
| | ||
LL | struct Fail<T>; | ||
| -------------- associated item `C` not found for this struct | ||
... | ||
LL | Fail::<()>::C | ||
| ^ associated item not found in `Fail<()>` | ||
| | ||
= note: the associated item was found for | ||
- `Fail<i32>` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0392, E0599. | ||
For more information about an error, try `rustc --explain E0392`. |
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ fn main() { | |
impl<T> Type<T> { | ||
fn new() -> Type<T> { | ||
Type | ||
//~^ ERROR type annotations needed | ||
} | ||
} | ||
}; | ||
|
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
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