diff options
| author | bors <bors@rust-lang.org> | 2024-01-09 15:41:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-09 15:41:48 +0000 |
| commit | da6f7e2c7b64a0e3c3401ad754abbd7854d13e8a (patch) | |
| tree | b953d82f6c791756e68e670edd5f565f1f2d81ea /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | bffafc4eb16e6dbef97cc76984503c50980c7ed9 (diff) | |
| parent | 89d6b011c4e104af34cb6f687af014c97992979e (diff) | |
| download | rust-da6f7e2c7b64a0e3c3401ad754abbd7854d13e8a.tar.gz rust-da6f7e2c7b64a0e3c3401ad754abbd7854d13e8a.zip | |
Auto merge of #16275 - davidsemakula:ast-path-segments, r=Veykril
fix: Fix `ast::Path::segments` implementation
calling `ast::Path::segments` on a qualifier currently returns all the segments of the top path instead of just the segments of the qualifier.
The issue can be summarized by the simple failing test below:
```rust
#[test]
fn path_segments() {
//use ra_ap_syntax::ast;
let path: ast::Path = ...; // e.g. `ast::Path` for "foo::bar::item".
let path_segments: Vec<_> = path.segments().collect();
let qualifier_segments: Vec<_> = path.qualifier().unwrap().segments().collect();
assert_eq!(path_segments.len(), qualifier_segments.len() + 1); // Fails because `LHS = RHS`.
}
```
This PR:
- Fixes the implementation of `ast::Path::segments`
- Fixes `ast::Path::segments` callers that either implicitly relied on behavior of previous implementation or exhibited other "wrong" behavior directly related to the result of `ast::Path::segments` (all callers have been reviewed, only one required modification)
- Removes unnecessary (and now unused) `ast::Path::segments` alternatives
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
