mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-27 18:56:24 +00:00

`resolve_ident_in_lexical_scope` checks for an empty name. Why is this necessary? Because `parse_item_impl` can produce an `impl` block with an empty trait name in some cases. This is pretty gross and very non-obvious. This commit avoids the use of the empty trait name. In one case the trait name is instead pulled from `TyKind::ImplTrait`, which prevents the output for `tests/ui/impl-trait/extra-impl-in-trait-impl.rs` from changing. In the other case we just fail the parse and don't try to recover. I think losing error recovery in this obscure case is worth the code cleanup. This change affects `tests/ui/parser/impl-parsing.rs`, which is split in two, and the obsolete `..` syntax cases are removed (they are tested elsewhere).
19 lines
541 B
Plaintext
19 lines
541 B
Plaintext
error: `default` is not followed by an item
|
|
--> $DIR/impl-parsing-2.rs:3:1
|
|
|
|
|
LL | default unsafe FAIL
|
|
| ^^^^^^^ the `default` qualifier
|
|
|
|
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
|
|
|
|
error: expected item, found keyword `unsafe`
|
|
--> $DIR/impl-parsing-2.rs:3:9
|
|
|
|
|
LL | default unsafe FAIL
|
|
| ^^^^^^ expected item
|
|
|
|
|
= note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
|
|
|
|
error: aborting due to 2 previous errors
|
|
|