-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Generic arg disambiguation #66104
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
Generic arg disambiguation #66104
Changes from all commits
041a612
128ca74
7b4642f
fb6cfde
eaf8fd0
0207a15
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
struct S<const X: u32>; | ||
|
||
impl<const X: u32> S<{X}> { | ||
impl<const X: u32> S<X> { | ||
fn x() -> u32 { | ||
X | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,30 +20,8 @@ LL | use foo2::Bar; | |
LL | use foo3::Bar; | ||
| | ||
|
||
error[E0573]: expected type, found function `Bar` | ||
--> $DIR/privacy-ns1.rs:35:17 | ||
| | ||
LL | pub struct Baz; | ||
| --------------- similarly named struct `Baz` defined here | ||
... | ||
LL | let _x: Box<Bar>; | ||
| ^^^ | ||
| | ||
help: a struct with a similar name exists | ||
| | ||
LL | let _x: Box<Baz>; | ||
| ^^^ | ||
help: possible better candidates are found in other modules, you can import them into scope | ||
| | ||
LL | use foo1::Bar; | ||
| | ||
LL | use foo2::Bar; | ||
| | ||
LL | use foo3::Bar; | ||
| | ||
|
||
error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope | ||
--> $DIR/privacy-ns1.rs:50:5 | ||
--> $DIR/privacy-ns1.rs:51:5 | ||
| | ||
LL | pub struct Baz; | ||
| --------------- similarly named unit struct `Baz` defined here | ||
|
@@ -65,7 +43,7 @@ LL | use foo3::Bar; | |
| | ||
|
||
error[E0412]: cannot find type `Bar` in this scope | ||
--> $DIR/privacy-ns1.rs:51:17 | ||
--> $DIR/privacy-ns1.rs:52:17 | ||
| | ||
LL | pub struct Baz; | ||
| --------------- similarly named struct `Baz` defined here | ||
|
@@ -86,7 +64,19 @@ LL | use foo2::Bar; | |
LL | use foo3::Bar; | ||
| | ||
|
||
error: aborting due to 4 previous errors | ||
error[E0107]: wrong number of const arguments: expected 0, found 1 | ||
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. This is interesting fallout. I imagine we should be able to special-case this sort of error to get back the old ones, though I'm not sure how much work that would be. 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. As far as I remember, the fix may be non-trivial and error-prone, so it's better to make an issue and fix it in a separate PR. |
||
--> $DIR/privacy-ns1.rs:35:17 | ||
| | ||
LL | let _x: Box<Bar>; | ||
| ^^^ unexpected const argument | ||
|
||
error[E0107]: wrong number of type arguments: expected 1, found 0 | ||
--> $DIR/privacy-ns1.rs:35:13 | ||
| | ||
LL | let _x: Box<Bar>; | ||
| ^^^^^^^^ expected 1 type argument | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
Some errors have detailed explanations: E0412, E0423, E0425, E0573. | ||
For more information about an error, try `rustc --explain E0412`. | ||
Some errors have detailed explanations: E0107, E0412, E0423, E0425. | ||
For more information about an error, try `rustc --explain E0107`. |
Uh oh!
There was an error while loading. Please reload this page.