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.
Fix handling of substitutions and binders when deciding whether to su…
…ggest references When suggesting references, substitutions were being forgotten and some types were misused. This led to at least one ICE and other incorrectly emitted diagnostics. This has been fixed; in some cases this leads to diagnostics changing, and tests have been adjusted.
- Loading branch information
1 parent
d71ba74
commit d58d52a
Showing
5 changed files
with
55 additions
and
50 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
11 changes: 11 additions & 0 deletions
11
src/test/ui/typeck/issue-90804-incorrect-reference-suggestion.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 @@ | ||
// Do not suggest referencing the parameter to `check` | ||
|
||
trait Marker<T> {} | ||
|
||
impl<T> Marker<i32> for T {} | ||
|
||
pub fn check<T: Marker<u32>>(_: T) {} | ||
|
||
pub fn main() { | ||
check::<()>(()); //~ ERROR [E0277] | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/ui/typeck/issue-90804-incorrect-reference-suggestion.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,17 @@ | ||
error[E0277]: the trait bound `(): Marker<u32>` is not satisfied | ||
--> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:17 | ||
| | ||
LL | check::<()>(()); | ||
| ----------- ^^ the trait `Marker<u32>` is not implemented for `()` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
note: required by a bound in `check` | ||
--> $DIR/issue-90804-incorrect-reference-suggestion.rs:7:17 | ||
| | ||
LL | pub fn check<T: Marker<u32>>(_: T) {} | ||
| ^^^^^^^^^^^ required by this bound in `check` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |