-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix emit_inference_failure_err
ICE
#98610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
trait Foo { | ||
type Output; | ||
|
||
fn baz() -> Self::Output; | ||
} | ||
|
||
fn needs_infer<T>() {} | ||
|
||
enum Bar { | ||
Variant {} | ||
} | ||
|
||
impl Foo for u8 { | ||
type Output = Bar; | ||
fn baz() -> Self::Output { | ||
needs_infer(); //~ ERROR type annotations needed | ||
Self::Output::Variant {} | ||
} | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/expr-struct-type-relative-enum.rs:16:9 | ||
| | ||
LL | needs_infer(); | ||
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` | ||
| | ||
help: consider specifying the generic argument | ||
| | ||
LL | needs_infer::<T>(); | ||
| +++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
trait Foo { | ||
type Output<T>; | ||
|
||
fn baz(); | ||
} | ||
|
||
enum Bar<T> { | ||
Simple {}, | ||
Generic(T), | ||
} | ||
|
||
impl Foo for u8 { | ||
type Output<T> = Bar<T>; | ||
fn baz() { | ||
Self::Output::Simple {}; //~ ERROR type annotations needed | ||
} | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/expr-struct-type-relative-gat.rs:17:9 | ||
| | ||
LL | Self::Output::Simple {}; | ||
| ^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the associated type `Output` | ||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should point at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what exactly do you mean with this? This should suggest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant something like
as a stop gap solution, but ideally all of this would look like this
Edit: although thinking about it for a second, maybe we should suggest other forms, like adding a param to |
||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// regression test for #98598 | ||
|
||
trait Foo { | ||
type Output; | ||
|
||
fn baz() -> Self::Output; | ||
} | ||
|
||
fn needs_infer<T>() {} | ||
|
||
struct Bar {} | ||
|
||
impl Foo for u8 { | ||
type Output = Bar; | ||
fn baz() -> Self::Output { | ||
needs_infer(); //~ ERROR type annotations needed | ||
Self::Output {} | ||
} | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/expr-struct-type-relative.rs:16:9 | ||
| | ||
LL | needs_infer(); | ||
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` | ||
| | ||
help: consider specifying the generic argument | ||
| | ||
LL | needs_infer::<T>(); | ||
| +++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the filtering above, this change isn't also needed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it isn't strictly needed, but it feels weird to call
path_inferred_subst_iter
if we already know that we're only dealing with resolved paths.