Commit Graph

172729 Commits

Author SHA1 Message Date
Dominik Schwaiger da2bbfbbec add llvm writable attribute conditionally 2026-04-16 12:29:39 +00:00
usamoi 05081b96c9 fix arch names in cfg pretty printer 2026-04-14 23:38:25 +08:00
bors 12f35ad39e Auto merge of #155209 - JonathanBrouwer:attr_cleanup2, r=jdonszelmann
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of https://github.com/rust-lang/rust/pull/154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
2026-04-14 08:59:40 +00:00
bors 0006519783 Auto merge of #155267 - jhpratt:rollup-fgQZJCS, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#149357 (Implement `-Z allow-partial-mitigations` (RFC 3855))
 - rust-lang/rust#154939 (Refactor: simplify report_selection_error)
 - rust-lang/rust#152688 (Trait aliases: Also imply default trait bounds on type params other than `Self`)
 - rust-lang/rust#154352 (rustdoc: dep-info for standalone markdown inputs)
 - rust-lang/rust#155195 (tidy: handle `#[cfg_attr(bootstrap, doc = "...")]` in `compiler/` comments)
2026-04-14 01:06:31 +00:00
Jacob Pratt 30d2f5aca6 Rollup merge of #155195 - jieyouxu:tidy-compiler-doc-attr, r=WaffleLapkin
tidy: handle `#[cfg_attr(bootstrap, doc = "...")]` in `compiler/` comments

For the unbalanced backtick check that Waffle ran into in https://github.com/rust-lang/rust/pull/154887.

This PR cherry-picks Waffle's tidy patch in that PR (and adds some explaining comments) even though I'd say this is somewhat hacky[^1]. But since the original tidy check implementation is already based on heuristics and so are likewise fuzzy, this is probably fine in practice for most cases.

[^1]: There can be false positives/negatives like having both fragments `cfg_attr` and `doc` inside a string literal, but I would expect that to be very very niche, so it's "good enough".

(I wanted to write a regression test, but this check needs some restructuring to make it more easy to test that I don't want to bundle in this PR.)

r? wafflelapkin (or bootstrap/compiler)
2026-04-13 20:12:07 -04:00
Jacob Pratt 4691e61f79 Rollup merge of #154352 - notriddle:emit-md, r=fmease
rustdoc: dep-info for standalone markdown inputs

Part of https://github.com/rust-lang/rust/pull/146220#issuecomment-3936957755

r? @fmease
2026-04-13 20:12:07 -04:00
Jacob Pratt 7d1b042d45 Rollup merge of #149357 - arielb1:enforce-partial-mitigations, r=rcvalle
Implement `-Z allow-partial-mitigations` (RFC 3855)

This implements `-Z allow-partial-mitigations` as an unstable option, currently with support for control-flow-guard and stack-protector.

As a difference from the RFC, we have `-Z allow-partial-mitigations=!foo` rather than `-Z deny-partial-mitigations=foo`, since I couldn't find an easy way to have an allow/deny pair of flags where the latter flag wins.

To allow for stabilization, this is only enabled starting from the next edition. Maybe a better policy is possible (bikeshed).

r? @rcvalle
2026-04-13 20:12:05 -04:00
bors 338dff3e3a Auto merge of #136006 - oli-obk:push-tzonluoyuwkq, r=wesleywiser
Start using pattern types in libcore



cc rust-lang/rust#135996

Replaces the innards of `NonNull` with `*const T is !null`.

This does affect LLVM's optimizations, as now reading the field preserves the metadata that the field is not null, and transmuting to another type (e.g. just a raw pointer), will also preserve that information for optimizations. This can cause LLVM opts to do more work, but it's not guaranteed to produce better machine code.

Once we also remove all uses of rustc_layout_scalar_range_start from rustc itself, we can remove the support for that attribute entirely and handle all such needs via pattern types
2026-04-13 21:54:46 +00:00
Jonathan Brouwer da8cf97e64 Remove AttributeDuplicates from BUILTIN_ATTRIBUTES 2026-04-13 20:51:24 +02:00
bors 17584a1819 Auto merge of #155253 - JonathanBrouwer:rollup-lERdTAB, r=JonathanBrouwer
Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#155162 (relnotes for 1.95)
 - rust-lang/rust#140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`)
 - rust-lang/rust#153604 (Fix thread::available_parallelism on WASI targets with threads)
 - rust-lang/rust#154193 (Implement EII for statics)
 - rust-lang/rust#154389 (Add more robust handling of nested query cycles)
 - rust-lang/rust#154435 (resolve: Some import resolution cleanups)
 - rust-lang/rust#155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`)
 - rust-lang/rust#155243 (cg_ssa: transmute between scalable vectors)
 - rust-lang/rust#153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable)
 - rust-lang/rust#154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests)
 - rust-lang/rust#154624 (Make `DerefPure` dyn-incompatible)
 - rust-lang/rust#154929 (Add `const Default` impls for `LazyCell` and `LazyLock`)
 - rust-lang/rust#154944 (Small refactor of `arena_cache` query values)
 - rust-lang/rust#155055 (UI automation)
 - rust-lang/rust#155062 (Move tests from `tests/ui/issues/` to appropriate directories)
 - rust-lang/rust#155131 (Stabilize feature `uint_bit_width`)
 - rust-lang/rust#155147 (Stabilize feature `int_lowest_highest_one`)
 - rust-lang/rust#155174 (Improve emission of `UnknownDiagnosticAttribute` lint)
 - rust-lang/rust#155194 (Fix manpage version replacement and use verbose version)
2026-04-13 18:32:47 +00:00
Jonathan Brouwer 9f11d53cd3 Rollup merge of #155194 - davidkna:man-version, r=clubby789
Fix manpage version replacement and use verbose version

- Fix a bug where `t!(fs::copy(&page_src, &page_dst))` was called after`fs::write`, silently overwriting the substituted content with the original template (restoring the `<INSERT VERSION HERE>` placeholder verbatim) (Related rust-lang/rust#93685)
- Use `rust_info().version()` instead of the bare version number, so the man page now includes the full version string with commit hash and date
2026-04-13 20:20:08 +02:00
Jonathan Brouwer 46997fb00f Rollup merge of #154587 - Ayuse:compiletest-quiet-run-make, r=jieyouxu
Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests

- Adds `--verbose-run-make-subprocess-output` flag to `./x test` and compiletest
- `./x test --no-capture --verbose-run-make-subprocess-output=false` suppresses verbose subprocess output for passing run-make tests
- Failed tests always print their output regardless of `--verbose-run-make-subprocess-output`
- Default behavior (verbose) is unchanged

This addresses the request from @bjorn3  which needs `--no-capture` (due to `panic=abort`) but doesn't want output dumped for every passing test.

Helps with rust-lang/rust#154069

## Test plan

- [x] `./x test tests/run-make/bare-outfile --no-capture --force-rerun` — verbose output for passing test
- [x] `./x test tests/run-make/bare-outfile --no-capture --verbose-run-make-subprocess-output=false --force-rerun` — no verbose output for passing test
- [x] Failing test still dumps output with `--verbose-run-make-subprocess-output=false`
2026-04-13 20:20:00 +02:00
Jonathan Brouwer d2fa85cd4d Rollup merge of #154193 - JonathanBrouwer:external-static, r=jdonszelmann
Implement EII for statics

This PR implements EII for statics. I've tried to mirror the implementation for functions in a few places, this causes some duplicate code but I'm also not really sure whether there's a clean way to merge the implementations.

This does not implement defaults for static EIIs yet, I will do that in a followup PR
2026-04-13 20:19:56 +02:00
Oli Scherer 834137afd7 Use !null pattern type in libcore 2026-04-13 17:23:03 +02:00
Jonathan Brouwer f8a8c9e244 Rollup merge of #155003 - malezjaa:update-thinvec, r=davidtwco
update thin-vec

With thin-vec v0.2.15 released, copy-pasted implementation of ExtractIf can be removed.
2026-04-13 14:02:35 +02:00
Jonathan Brouwer 14b5df4749 Rollup merge of #155226 - aerooneqq:delegation-hir-crate-items-revert, r=petrochenkov
delegation: revert execution of hir_crate_items before delayed lowering

This PR reverts rust-lang/rust#154368, as after weekend consideration I don't think that it is a correct way of fixing cycles during delayed lowering:

- The number of ICEs were reported, fixing them would require to develop solution from rust-lang/rust#154368 but I am afraid that it would lead to cancer code growing,
- The [memory regression](https://github.com/rust-lang/rust/pull/154368#issuecomment-4229353764) for rustdoc was reported, it can be fixed with moving `tcx.force_delayed_owners_lowering` call earlier, but it is already bad that this is call is now required everywhere, before rust-lang/rust#154368 AST was dropped before `hir_crate_items` automatically and users of `rustc` API did not have to think about it.

I will try to come up with a more robust solution leaving rust-lang/rust#154368 as a last resort if nothing else will work.

Re-opens rust-lang/rust#154169.
Fixes rust-lang/rust#155125. Fixes rust-lang/rust#155127. Fixes rust-lang/rust#155128. Fixes rust-lang/rust#155164. Fixes rust-lang/rust#155202.
Part of rust-lang/rust#118212.

r? @petrochenkov
2026-04-13 14:02:34 +02:00
Jonathan Brouwer d4037f7d8f Rollup merge of #153335 - Ozzy1423:removed-features, r=jdonszelmann
Add #![unstable_removed(..)] attribute to track removed features

Adds the #![unstable_removed(..)] attribute to enable tracking removed library features.
Produce an error when a removed attribute is used.
Add a test that it works.

For https://github.com/rust-lang/rust/issues/141617

r? @jyn514
2026-04-13 14:02:30 +02:00
Jonathan Brouwer 23c6bc9fe5 Rollup merge of #155227 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/7b6e1249b7320e16792e31ce67bb2e5f4acd6a8b.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-13 14:02:29 +02:00
aerooneqq 791a3dcef0 Revert "Fix cycles during delayed lowering" 2026-04-13 10:19:33 +03:00
Jieyou Xu 67be8c2543 tidy: handle #[cfg_attr(bootstrap, doc = "...")] in compiler/ comments
For the unbalanced backtick check. This fix is arguably a hack, however
the original tidy check implementation is already based on heuristics
and so are likewise fuzzy. This is probably fine in practice.

Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
2026-04-13 09:28:58 +08:00
Ayuse 6733ce938f Add --verbose-run-make-subprocess-output flag to suppress run-make output
Add a flag to control verbose subprocess output for run-make tests. When using --no-capture on panic=abort test suites like cg_clif, passing test output can flood the terminal. This flag (default true) lets users opt out via --verbose-run-make-subprocess-output=false.

Extract a private print_command_output helper in run-make-support to avoid inlining the output logic in handle_failed_output, ensuring failures always print regardless of the flag.
2026-04-12 16:25:34 +01:00
Jonathan Brouwer fa6fedceba Rollup merge of #155197 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/871d3d06c549cb554dec9a3a7c37cdd723254d06.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-12 15:44:18 +02:00
David Knaack b26760f10c Fix manpage version replacement and use verbose version 2026-04-12 13:37:16 +02:00
Oscar Bray 25a92d208d Add #![unstable_removed(..)] attribute to track removed features
Move concat_idents to use the unstable_removed attribute
2026-04-12 11:18:10 +01:00
Ralf Jung edf04e18af Merge pull request #4950 from WhySoBad/fix-blocking-io-manager
Fix panic when multiple threads block on same fd
2026-04-12 09:04:53 +00:00
Lukas Wirth c0ad60428b Merge pull request #22009 from A4-Tacks/no-expr-in-qualified
fix: no complete term expressions on qualified path
2026-04-12 07:37:10 +00:00
Lukas Wirth 8865266c4e Merge pull request #22012 from A4-Tacks/no-import-on-type-anchor-qualifier
fix: no imports on type anchor qualified path
2026-04-12 07:37:06 +00:00
Matthias Krüger 8bd29964c0 Rollup merge of #155171 - cuviper:musl-cves, r=Mark-Simulacrum
Patch musl's CVE-2026-6042 and CVE-2026-40200

- [CVE-2026-6042] is a denial of service in `iconv`.
- [CVE-2026-40200] is an out-of-bounds write in `qsort`.

Neither is relevant to Rust itself, but they could be used in mixed-language projects that link with our `self-contained/libc.a`.

[CVE-2026-6042]: https://www.openwall.com/lists/oss-security/2026/04/09/19
[CVE-2026-40200]: https://www.openwall.com/lists/musl/2026/04/10/3
2026-04-12 08:15:46 +02:00
Jacob Pratt 1700a21d10 Rollup merge of #155126 - folkertdev:target-object-format, r=Urgau
add `cfg(target_object_format = "...")`

tracking issue: https://github.com/rust-lang/rust/issues/152586

I'm implementing the predicate as `target_object_format`, because that's what is useful to me (for testing `#[link_section = "..."]` where `mach-o` has some extra restrictions) and maps cleanly to the `BinaryFormat` enum that is used internally. There is still room for a future `target_executable_format` when there is a use case.

cc @joshtriplett as the lang sponsor of this feature, @workingjubilee as the author of the proposal.

r? JonathanBrouwer a sidequest from the sidequest that is https://github.com/rust-lang/rust/pull/155065
2026-04-11 21:12:20 -04:00
Josh Stone 88305519bb Patch musl's CVE-2026-6042 and CVE-2026-40200
- [CVE-2026-6042] is a denial of service in `iconv`.
- [CVE-2026-40200] is an out-of-bounds write in `qsort`.

Neither is relevant to Rust itself, but they could be used in mixed-
language projects that link with our `self-contained/libc.a`.

[CVE-2026-6042]: https://www.openwall.com/lists/oss-security/2026/04/09/19
[CVE-2026-40200]: https://www.openwall.com/lists/musl/2026/04/10/3
2026-04-11 15:25:37 -07:00
Chayim Refael Friedman 671b6606c2 Parse cfg_attr and cfg specially
This allows us to simplify expansion of cfg_attr in `expand_cfg_attr()`, and also fixes a bunch of bugs like expansion of `doc = macro!()` inside `cfg_attr`.
2026-04-11 23:15:10 +03:00
Lukas Wirth 198e4c46a2 Merge pull request #22010 from erfanio/rustfmt-fix
Fix rustfmt relative custom command
2026-04-11 14:39:21 +00:00
Folkert de Vries 6bcd172f5a add cfg(target_object_format = "...") 2026-04-11 14:12:39 +02:00
bors 5f36a7f807 Auto merge of #155145 - jhpratt:rollup-atReM8h, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#154827 (distinguish "expected a single argument" and "expected an argument" on attribute parsing)
 - rust-lang/rust#155104 (bootstrap: auto-patch libgccjit.so for NixOS)
 - rust-lang/rust#155120 (Use a linting node closer the parsing of `#[cfg_attr]`)
2026-04-11 09:03:13 +00:00
Jacob Pratt 38ea36790f Rollup merge of #155104 - nbdd0121:bootstrap-gcc, r=Kobzol
bootstrap: auto-patch libgccjit.so for NixOS

Currently all downloaded rustc and LLVM components are auto patched on NixOS, but this is not done for libgccjit.so, so when GCC backend is enabled on NixOS, the build ICEs with errors like this:

    thread 'rustc' (2286205) panicked at compiler/rustc_codegen_gcc/src/lib.rs:191:9:
    Cannot load libgccjit.so: libzstd.so.1: cannot open shared object file: No such file or directory

Fix this by auto-patch libgccjit.so, too. `zstd` is added to the dependency environment.
2026-04-11 04:50:16 -04:00
Jonathan Brouwer e756d1607d Add eii_impls argument to StaticItem 2026-04-11 10:17:07 +02:00
Jacob Pratt 44bad026ce Rollup merge of #154661 - CoCo-Japan-pan:impl-restriction-check, r=jhpratt,Urgau
Semantic checks of `impl` restrictions

This PR implements semantic checks for `impl` restrictions proposed in the [Restrictions RFC](https://rust-lang.github.io/rfcs/3323-restrictions.html) (Tracking Issue rust-lang/rust#105077), and linked to a [GSOC idea/proposal](https://github.com/rust-lang/google-summer-of-code/tree/142433eb3b104b2f32bae0b9dfafb78a0a2ac579?tab=readme-ov-file#implementing-impl-and-mut-restrictions).

It lowers the resolved paths of `impl` restrictions from the AST to HIR and into `TraitDef`, and integrates the checks into the coherence phase by extending `check_impl`. As parsing (rust-lang/rust#152943) and path resolution (rust-lang/rust#153556) have already been implemented, this PR provides a working implementation of `impl` restrictions.

r? @Urgau
cc @jhpratt
2026-04-11 01:49:12 -04:00
bors d1d3ef45a6 Auto merge of #155105 - Mark-Simulacrum:bump-release, r=Mark-Simulacrum
Bump to 1.97.0 release

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? me
2026-04-10 21:31:42 +00:00
WhySoBad 6d4d7a6daa fix: deregister I/O sources in blocking I/O manager 2026-04-10 23:19:58 +02:00
WhySoBad 0b7f2254be fix: implement feedback 2026-04-10 21:06:22 +02:00
bors 02c7f9bec0 Auto merge of #155115 - JonathanBrouwer:rollup-RePrRPQ, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152901 (Introduce a `#[diagnostic::on_unknown]` attribute)
 - rust-lang/rust#155078 (Reject dangling attributes in where clauses)
 - rust-lang/rust#154449 (Invert dependency between `rustc_errors` and `rustc_abi`.)
 - rust-lang/rust#154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing)
 - rust-lang/rust#154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths)
 - rust-lang/rust#155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
2026-04-10 18:19:03 +00:00
Laurențiu Nicola 79758acd6e Merge pull request #21998 from rust-lang/ci/gen-lints
Update generated lints
2026-04-10 17:49:21 +00:00
Jonathan Brouwer d07454f5ef Rollup merge of #154993 - DeepeshWR:compiletest-custom-target-unstable, r=davidtwco
compiletest: pass -Zunstable-options for unpretty and no-codegen paths

When using custom targets via `RUST_TARGET_PATH`, compiletest does not
consistently pass `-Zunstable-options` in all code paths.

In particular, `unpretty` and `-Zno-codegen` (typecheck) paths invoke
rustc without `-Zunstable-options`, which causes failures when the
target is not built-in.

Pass `-Zunstable-options` in these code paths to ensure consistent
behavior when using custom targets.

This primarily affects setups using custom targets without `.json`
suffix (resolved via `RUST_TARGET_PATH`).
2026-04-10 18:38:14 +02:00
Jonathan Brouwer 9c01701171 Rollup merge of #154646 - m4rch3n1ng:144792-cow-diag, r=davidtwco
Add suggestion to `.to_owned()` used on `Cow` when borrowing

fixes rust-lang/rust#144792
supersedes rust-lang/rust#144925 with the review comments addressed

the tests suggested from @Kivooeo from https://github.com/rust-lang/rust/pull/144925#discussion_r2252703007 didn't work entirely, because these tests failed due to error `[E0308]` mismatched types, which actually already provides a suggestion, that actually makes the code compile:

```
$ cargo check
error[E0308]: mismatched types
 --> src/main.rs:3:5
  |
1 | fn test_cow_suggestion() -> String {
  |                             ------ expected `std::string::String` because of return type
2 |     let os_string = std::ffi::OsString::from("test");
3 |     os_string.to_string_lossy().to_owned()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Cow<'_, str>`
  |
  = note: expected struct `std::string::String`
               found enum `std::borrow::Cow<'_, str>`
help: try using a conversion method
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |                                           ++++++++++++
```

now this suggestion is of course not good or efficient code, but via clippy with `-Wclippy::nursery` lint group you can actually get to the correct code, so i don't think this is too much of an issue:

<details>
<summary>the clippy suggestions</summary>

```
$ cargo clippy -- -Wclippy::nursery
warning: this `to_owned` call clones the `Cow<'_, str>` itself and does not cause its contents to become owned
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#suspicious_to_owned
  = note: `#[warn(clippy::suspicious_to_owned)]` on by default
help: depending on intent, either make the `Cow` an `Owned` variant
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                 ++
help: or clone the `Cow` itself
  |
3 -     os_string.to_string_lossy().to_owned().to_string()
3 +     os_string.to_string_lossy().clone().to_string()
  |
$ # apply first suggestion
$ cargo c -- -Wclippy::nursery
warning: redundant clone
 --> src/main.rs:3:45
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                             ^^^^^^^^^^^^ help: remove this
  |
note: this value is dropped without further use
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#redundant_clone
  = note: `-W clippy::redundant-clone` implied by `-W clippy::nursery`
  = help: to override `-W clippy::nursery` add `#[allow(clippy::redundant_clone)]`
```

</details>

the actual error that we are looking for is error `[E0515]`, cannot return value referencing local variable, which was only present in the original issue due to automatic type inference assuming you want to return a cloned `Cow<'_, str>`, which is of course not possible. this is why i took the original test functions and turned them into closures, where it's less obvious that it's trying to return the wrong type.

r? davidtwco

(because you reviewed the last attempt)
(also, let me know if i should squash this down to one commit and add myself as the co-contributor)
2026-04-10 18:38:14 +02:00
Laurențiu Nicola 2629a77d33 Use last good clippy lints JSON in codegen 2026-04-10 19:36:39 +03:00
workflows-rust-analyzer[bot] cdcd9b4274 internal: update generated lints 2026-04-10 19:36:18 +03:00
Laurențiu Nicola 247651d4f9 Bump create-github-app-token 2026-04-10 18:29:55 +03:00
Chayim Refael Friedman a816b21f9e Merge pull request #22002 from Shourya742/2026-04-09-remove-try-normalize-use-tree
Remove try-normalize-use-tree
2026-04-10 15:17:40 +00:00
Laurențiu Nicola 65bae63b98 Use create-github-app-token to get token for gen-lints 2026-04-10 17:59:57 +03:00
A4-Tacks f1f6d566a3 fix: no imports on type anchor qualified path
Example
---
```rust
fn main() {
    <Bar as Foo>::foo$0
}
mod m {
    pub fn foo() {}
}
struct Bar;
trait Foo {}
impl Foo for Bar {}
```

**Before this PR**

```
fn foo() (use m::foo) fn()
```

**After this PR**

no any imports
2026-04-10 22:57:25 +08:00