Skip to content

fix unresolved import suggestion before outer attributes#158054

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
pbkx:issue-69733-import-before-attrs
Jun 18, 2026
Merged

fix unresolved import suggestion before outer attributes#158054
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
pbkx:issue-69733-import-before-attrs

Conversation

@pbkx

@pbkx pbkx commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 17, 2026
@pbkx pbkx marked this pull request as ready for review June 18, 2026 01:10
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 18, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 18, 2026
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a0888bb has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 18, 2026
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-bors rust-bors Bot merged commit 08ea125 into rust-lang:main Jun 18, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 18, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import suggestion at incorrect line when first line is a struct attribute

3 participants