-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #10980 - Alexendoo:format-args-incremental-spans, r=dswij
Fix `find_format_arg_expr` when incremental compilation is enabled Fixes #10969 [`lower_span`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html#method.lower_span) gives AST spans a [parent](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.SpanData.html#structfield.parent) when lowering to the HIR. That meant the `==` span comparison would return false even though the spans are pointing to the same thing. We now ignore the parent when comparing the spans Debugging this was quite the puzzle, because the parent is not included in the debug output of `Span`s or `SpanData` 😬 changelog: none
- Loading branch information
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@run-rustfix | ||
//@compile-flags: -C incremental=target/debug/test/incr | ||
|
||
// see https://github.com/rust-lang/rust-clippy/issues/10969 | ||
|
||
fn main() { | ||
let s = "Hello, world!"; | ||
println!("{}", s); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@run-rustfix | ||
//@compile-flags: -C incremental=target/debug/test/incr | ||
|
||
// see https://github.com/rust-lang/rust-clippy/issues/10969 | ||
|
||
fn main() { | ||
let s = "Hello, world!"; | ||
println!("{}", s.to_string()); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: `to_string` applied to a type that implements `Display` in `println!` args | ||
--> $DIR/to_string_in_format_args_incremental.rs:8:21 | ||
| | ||
LL | println!("{}", s.to_string()); | ||
| ^^^^^^^^^^^^ help: remove this | ||
| | ||
= note: `-D clippy::to-string-in-format-args` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|