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#113651 - lcnr:parent-def-id, r=compiler-errors
self type param infer, avoid ICE fixes rust-lang#113610, which is caused by https://github.com/rust-lang/rust/blob/33a2c2487ac5d9927830ea4c1844335c6b9f77db/compiler/rustc_hir_analysis/src/collect/generics_of.rs#L190-L205
- Loading branch information
Showing
4 changed files
with
24 additions
and
4 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
7 changes: 7 additions & 0 deletions
7
tests/ui/inference/need_type_info/infer-var-for-self-param.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,7 @@ | ||
// Regression test for #113610 where we ICEd when trying to print | ||
// inference variables created by instantiating the self type parameter. | ||
|
||
fn main() { | ||
let _ = (Default::default(),); | ||
//~^ ERROR cannot call associated function on trait | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/inference/need_type_info/infer-var-for-self-param.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,14 @@ | ||
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type | ||
--> $DIR/infer-var-for-self-param.rs:5:14 | ||
| | ||
LL | let _ = (Default::default(),); | ||
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait | ||
| | ||
help: use a fully-qualified path to a specific available implementation (271 found) | ||
| | ||
LL | let _ = (</* self type */ as Default>::default(),); | ||
| +++++++++++++++++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0790`. |