diff options
| author | bors <bors@rust-lang.org> | 2024-03-03 18:22:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-03 18:22:40 +0000 |
| commit | 30642113b218f625de8df0e388c720f9a41641be (patch) | |
| tree | 63a48aa92bbea6f1909b7fbd34e723a4a1a90fbe /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 28e11b31deef5fd0f59a1e289f8f2173ed6e5944 (diff) | |
| parent | 3735bf93ff62eee7818852a1b31b7d75939c90db (diff) | |
| download | rust-30642113b218f625de8df0e388c720f9a41641be.tar.gz rust-30642113b218f625de8df0e388c720f9a41641be.zip | |
Auto merge of #12406 - MarcusGrass:fix-duplicate-std-instead-of-core, r=Alexendoo
Dedup std_instead_of_core by using first segment span for uniqueness
Relates to #12379.
Instead of checking that the paths have an identical span, it checks that the relevant `std` part of the path segment's span is identical. Added a multiline test, because my first implementation was worse and failed that, then I realized that you could grab the span off the first_segment `Ident`.
I did find another bug that isn't addressed by this, and that exists on master as well.
The path:
```Rust
use std::{io::Write, fmt::Display};
```
Will get fixed into:
```Rust
use core::{io::Write, fmt::Display};
```
Which doesn't compile since `io::Write` isn't in `core`, if any of those paths are present in `core` it'll do the replace and cause a miscompilation. Do you think I should file a separate bug for that? Since `rustfmt` default splits those up it isn't that big of a deal.
Rustfmt:
```Rust
// Pre
use std::{io::Write, fmt::Display};
// Post
use std::fmt::Display;
use std::io::Write;
```
---
changelog: [`std_instead_of_core`]: Fix duplicated output on multiple imports
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
