fix unresolved import suggestion before outer attributes#158054
Merged
rust-bors[bot] merged 1 commit intoJun 18, 2026
Conversation
Collaborator
|
rustbot has assigned @JonathanBrouwer. Use Why was this reviewer chosen?The reviewer was selected based on:
|
JonathanBrouwer
approved these changes
Jun 18, 2026
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 18, 2026
…rs, r=JonathanBrouwer fix unresolved import suggestion before outer attributes Fixes rust-lang#69733. Issue rust-lang#69733 reports an invalid import suggestion where rustc could insert a new `use ...;` item between an outer attribute and the item it annotates. This invalid import suggestion produces broken code. My PR adds a `run-rustfix` UI regression test for that. The fixed output verifies that the suggested import is inserted before the leading outer attribute
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 18, 2026
Rollup of 8 pull requests Successful merges: - #158056 (Put internal lints into a single combined pass) - #151132 (Take care to use MSG_EOR with SOCK_SEQPACKET sockets) - #157644 (wasm32-wasip1-threads: Correct llvm target name) - #157912 (stabilize str_from_utf16_endian) - #158048 (Revert "add regression test for Redundant memory strores with mut parameters in by-value returns") - #158051 (Document `with_added_extension` edge cases) - #158054 (fix unresolved import suggestion before outer attributes) - #158062 (rustc book: Update wasm32-wasip1-threads's maintainers list)
rust-timer
added a commit
that referenced
this pull request
Jun 18, 2026
Rollup merge of #158054 - pbkx:issue-69733-import-before-attrs, r=JonathanBrouwer fix unresolved import suggestion before outer attributes Fixes #69733. Issue #69733 reports an invalid import suggestion where rustc could insert a new `use ...;` item between an outer attribute and the item it annotates. This invalid import suggestion produces broken code. My PR adds a `run-rustfix` UI regression test for that. The fixed output verifies that the suggested import is inserted before the leading outer attribute
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #69733.
Issue #69733 reports an invalid import suggestion where rustc could insert a new
use ...;item between an outer attribute and the item it annotates. This invalid import suggestion produces broken code.My PR adds a
run-rustfixUI regression test for that. The fixed output verifies that the suggested import is inserted before the leading outer attribute