-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3852 from veddan/type-limits
Lint pass like GCC's -Wtype-limits (#3833)
- Loading branch information
Showing
2 changed files
with
148 additions
and
0 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,25 @@ | ||
// compile-flags: -D type-limits | ||
fn main() { } | ||
|
||
fn foo() { | ||
let mut i = 100u; | ||
while i >= 0 { //~ ERROR comparison is useless due to type limits | ||
i -= 1; | ||
} | ||
} | ||
|
||
fn bar() -> i8 { | ||
return 123; | ||
} | ||
|
||
fn baz() -> bool { | ||
128 > bar() //~ ERROR comparison is useless due to type limits | ||
} | ||
|
||
fn qux() { | ||
let mut i = 1i8; | ||
while 200 != i { //~ ERROR comparison is useless due to type limits | ||
i += 1; | ||
} | ||
} | ||
|