-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow interpolated paths after use
during macro expansion.
#10415
Comments
Triage, the error message has improved slightly, but no change (I updated the example code & diagnostics). It's worth noting that import paths are actually different to normal paths, since e.g. (For completeness, I believe there's no import paths that are invalid normal paths, e.g. |
Triage: no change |
syntax: Parse import prefixes as paths Fixes rust-lang#10415 r? @eddyb (This partially intersects with rust-lang#33041)
Paths are mostly parsed without taking whitespaces into account, e.g. `std :: vec :: Vec :: new ()` parses successfully, however, there are some special cases involving keywords `super`, `self` and `Self`. For example, `self::` is considered a path start only if there are no spaces between `self` and `::`. These restrictions probably made sense when `self` and friends weren't keywords, but now they are unnecessary. The first two commits remove this special treatment of whitespaces by removing `token::IdentStyle` entirely and therefore fix rust-lang#14109. This change also affects naked `self` and `super` (which are not tightly followed by `::`, obviously) they can now be parsed as paths, however they are still not resolved correctly in imports (cc @jseyfried, see `compile-fail/use-keyword.rs`), so rust-lang#29036 is not completely fixed. The third commit also makes `super`, `self`, `Self` and `static` keywords nominally (before this they acted as keywords for all purposes) and removes most of remaining \"special idents\". The last commit (before tests) contains some small improvements - some qualified paths with type parameters are parsed correctly, `parse_path` is not used for parsing single identifiers, imports are sanity checked for absence of type parameters - such type parameters can be generated by syntax extensions or by macros when rust-lang#10415 is fixed (~~soon!~~already!). This patch changes some pretty basic things in `libsyntax`, like `token::Token` and the keyword list, so it's a plugin-[breaking-change]. r? @eddyb
…llogiq Add `collection_is_never_read` Fixes rust-lang#9267 `@flip1995` and `@llogiq,` I talked with you about this one at Rust Nation in London last week. :-) This is my first contribution to Clippy, so lots of feedback would be greatly appreciated. - \[ ] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[x] Executed `cargo dev update_lints` - \[x] Added lint documentation - \[x] Run `cargo dev fmt` `dogfood` found one true positive (see rust-lang#9509) and no false positives. `lintcheck` found no (true or false) positives, even when running on an extended set of crates. --- changelog: new lint [`collection_is_never_read`] [rust-lang#10415](rust-lang/rust-clippy#10415) <!-- changelog_checked -->
The text was updated successfully, but these errors were encountered: