-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emitter: current substitution can be multi-line
In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. Signed-off-by: David Wood <david.wood@huawei.com>
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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
10 changes: 10 additions & 0 deletions
10
src/test/ui/errors/issue-89280-emitter-overflow-splice-lines.rs
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 @@ | ||
// check-pass | ||
|
||
trait X { | ||
fn test(x: u32, ( | ||
//~^ WARN anonymous parameters are deprecated and will be removed in the next edition | ||
//~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
)) {} | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
src/test/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr
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,23 @@ | ||
warning: anonymous parameters are deprecated and will be removed in the next edition | ||
--> $DIR/issue-89280-emitter-overflow-splice-lines.rs:4:21 | ||
| | ||
LL | fn test(x: u32, ( | ||
| _____________________^ | ||
LL | | | ||
LL | | | ||
LL | | )) {} | ||
| |_____^ | ||
| | ||
= note: `#[warn(anonymous_parameters)]` on by default | ||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! | ||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> | ||
help: try naming the parameter or explicitly ignoring it | ||
| | ||
LL ~ fn test(x: u32, _: ( | ||
LL + | ||
LL + | ||
LL ~ )) {} | ||
| | ||
|
||
warning: 1 warning emitted | ||
|