提交 94fd0458 编写于 作者: B bors

Auto merge of #58948 - petrochenkov:overlap, r=cramertj

hygiene: Fix identifier comparison in impl overlap check

Fixes https://github.com/rust-lang/rust/issues/58942
...@@ -25,7 +25,7 @@ fn check_for_common_items_in_impls(&self, impl1: DefId, impl2: DefId, ...@@ -25,7 +25,7 @@ fn check_for_common_items_in_impls(&self, impl1: DefId, impl2: DefId,
let name_and_namespace = |def_id| { let name_and_namespace = |def_id| {
let item = self.tcx.associated_item(def_id); let item = self.tcx.associated_item(def_id);
(item.ident, Namespace::from(item.kind)) (item.ident.modern(), Namespace::from(item.kind))
}; };
let impl_items1 = self.tcx.associated_item_def_ids(impl1); let impl_items1 = self.tcx.associated_item_def_ids(impl1);
......
#![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() {}
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`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册