-
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.
Rollup merge of #70006 - petrochenkov:fresh, r=Centril
resolve: Fix two issues in fresh binding disambiguation Prevent fresh bindings from shadowing ambiguity items. Fixes #46079 Correctly treat const generic parameters in fresh binding disambiguation. Fixes #68853
- Loading branch information
Showing
9 changed files
with
123 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Identifier pattern referring to an ambiguity item is an error (issue #46079). | ||
|
||
mod m { | ||
pub fn f() {} | ||
} | ||
use m::*; | ||
|
||
mod n { | ||
pub fn f() {} | ||
} | ||
use n::*; // OK, no conflict with `use m::*;` | ||
|
||
fn main() { | ||
let v = f; //~ ERROR `f` is ambiguous | ||
match v { | ||
f => {} //~ ERROR `f` is ambiguous | ||
} | ||
} |
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,41 @@ | ||
error[E0659]: `f` is ambiguous (glob import vs glob import in the same module) | ||
--> $DIR/ambiguity-item.rs:14:13 | ||
| | ||
LL | let v = f; | ||
| ^ ambiguous name | ||
| | ||
note: `f` could refer to the function imported here | ||
--> $DIR/ambiguity-item.rs:6:5 | ||
| | ||
LL | use m::*; | ||
| ^^^^ | ||
= help: consider adding an explicit import of `f` to disambiguate | ||
note: `f` could also refer to the function imported here | ||
--> $DIR/ambiguity-item.rs:11:5 | ||
| | ||
LL | use n::*; // OK, no conflict with `use m::*;` | ||
| ^^^^ | ||
= help: consider adding an explicit import of `f` to disambiguate | ||
|
||
error[E0659]: `f` is ambiguous (glob import vs glob import in the same module) | ||
--> $DIR/ambiguity-item.rs:16:9 | ||
| | ||
LL | f => {} | ||
| ^ ambiguous name | ||
| | ||
note: `f` could refer to the function imported here | ||
--> $DIR/ambiguity-item.rs:6:5 | ||
| | ||
LL | use m::*; | ||
| ^^^^ | ||
= help: consider adding an explicit import of `f` to disambiguate | ||
note: `f` could also refer to the function imported here | ||
--> $DIR/ambiguity-item.rs:11:5 | ||
| | ||
LL | use n::*; // OK, no conflict with `use m::*;` | ||
| ^^^^ | ||
= help: consider adding an explicit import of `f` to disambiguate | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0659`. |
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,12 @@ | ||
// Identifier pattern referring to a const generic parameter is an error (issue #68853). | ||
|
||
#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete | ||
|
||
fn check<const N: usize>() { | ||
match 1 { | ||
N => {} //~ ERROR const parameters cannot be referenced in patterns | ||
_ => {} | ||
} | ||
} | ||
|
||
fn main() {} |
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 @@ | ||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash | ||
--> $DIR/const-param.rs:3:12 | ||
| | ||
LL | #![feature(const_generics)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0158]: const parameters cannot be referenced in patterns | ||
--> $DIR/const-param.rs:7:9 | ||
| | ||
LL | N => {} | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0158`. |