-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
span_extend_to_prev_str()
more robust
- Loading branch information
1 parent
ec4bcaa
commit 3f609b7
Showing
6 changed files
with
116 additions
and
39 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
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,21 @@ | ||
// Regression test for issue #91560. | ||
|
||
// run-rustfix | ||
|
||
#![allow(unused,non_upper_case_globals)] | ||
|
||
fn foo() { | ||
const length: usize = 2; | ||
//~^ HELP: consider using `const` | ||
let arr = [0; length]; | ||
//~^ ERROR: attempt to use a non-constant value in a constant [E0435] | ||
} | ||
|
||
fn bar() { | ||
const length: usize = 2; | ||
//~^ HELP: consider using `const` | ||
let arr = [0; length]; | ||
//~^ ERROR: attempt to use a non-constant value in a constant [E0435] | ||
} | ||
|
||
fn main() {} |
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,21 @@ | ||
// Regression test for issue #91560. | ||
|
||
// run-rustfix | ||
|
||
#![allow(unused,non_upper_case_globals)] | ||
|
||
fn foo() { | ||
let mut length: usize = 2; | ||
//~^ HELP: consider using `const` | ||
let arr = [0; length]; | ||
//~^ ERROR: attempt to use a non-constant value in a constant [E0435] | ||
} | ||
|
||
fn bar() { | ||
let length: usize = 2; | ||
//~^ HELP: consider using `const` | ||
let arr = [0; length]; | ||
//~^ ERROR: attempt to use a non-constant value in a constant [E0435] | ||
} | ||
|
||
fn main() {} |
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,21 @@ | ||
error[E0435]: attempt to use a non-constant value in a constant | ||
--> $DIR/issue-91560.rs:10:19 | ||
| | ||
LL | let mut length: usize = 2; | ||
| -------------- help: consider using `const` instead of `let`: `const length` | ||
LL | | ||
LL | let arr = [0; length]; | ||
| ^^^^^^ non-constant value | ||
|
||
error[E0435]: attempt to use a non-constant value in a constant | ||
--> $DIR/issue-91560.rs:17:19 | ||
| | ||
LL | let length: usize = 2; | ||
| ------------ help: consider using `const` instead of `let`: `const length` | ||
LL | | ||
LL | let arr = [0; length]; | ||
| ^^^^^^ non-constant value | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0435`. |