Rollup merge of #100387 - cjgillot:hygiene-trait-impl, r=petrochenkov
Check uniqueness of impl items by trait item when applicable. When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items. This means that a plain item and one generated by a macro 2.0 do not collide. This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls. This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice. There should be no stable breakage, since macros 2.0 are still unstable. r? ``@petrochenkov`` cc ``@RalfJung`` Fixes https://github.com/rust-lang/rust/issues/71614.
This commit is contained in:
commit
6d58ff7fe6
11 changed files with 142 additions and 30 deletions
|
@ -235,6 +235,8 @@ enum ResolutionError<'a> {
|
|||
trait_item_span: Span,
|
||||
code: rustc_errors::DiagnosticId,
|
||||
},
|
||||
/// Error E0201: multiple impl items for the same trait item.
|
||||
TraitImplDuplicate { name: Symbol, trait_item_span: Span, old_span: Span },
|
||||
/// Inline asm `sym` operand must refer to a `fn` or `static`.
|
||||
InvalidAsmSym,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue