Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hygiene: Fix identifier comparison in impl overlap check
- Loading branch information
1 parent
89573b3
commit fa01389
Showing
3 changed files
with
36 additions
and
1 deletion.
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
23 changes: 23 additions & 0 deletions
23
src/test/ui/specialization/specialization-overlap-hygiene.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,23 @@ | ||
#![feature(decl_macro)] | ||
|
||
struct X; | ||
|
||
macro_rules! define_f_legacy { () => { | ||
fn f() {} | ||
}} | ||
macro define_g_modern() { | ||
fn g() {} | ||
} | ||
|
||
impl X { | ||
fn f() {} //~ ERROR duplicate definitions with name `f` | ||
fn g() {} // OK | ||
} | ||
impl X { | ||
define_f_legacy!(); | ||
} | ||
impl X { | ||
define_g_modern!(); | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/specialization/specialization-overlap-hygiene.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,12 @@ | ||
error[E0592]: duplicate definitions with name `f` | ||
--> $DIR/specialization-overlap-hygiene.rs:13:4 | ||
| | ||
LL | fn f() {} | ||
| --------- other definition for `f` | ||
... | ||
LL | fn f() {} | ||
| ^^^^^^^^^ duplicate definitions for `f` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0592`. |