mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-03 15:00:03 +00:00
```
error[E0277]: the trait bound `usize: Neg` is not satisfied
--> $DIR/negative-literal-infered-to-unsigned.rs:2:14
|
LL | for x in -5..5 {
| ^^ the trait `Neg` is not implemented for `usize`
|
help: consider specifying an integer type that can be negative
|
LL | for x in -5isize..5 {
| +++++
```
14 lines
412 B
Rust
14 lines
412 B
Rust
fn main() {
|
|
for x in -5..5 {
|
|
//~^ ERROR: the trait bound `usize: Neg` is not satisfied
|
|
//~| HELP: consider specifying an integer type that can be negative
|
|
do_something(x);
|
|
}
|
|
let x = -5;
|
|
//~^ ERROR: the trait bound `usize: Neg` is not satisfied
|
|
//~| HELP: consider specifying an integer type that can be negative
|
|
do_something(x);
|
|
}
|
|
|
|
fn do_something(_val: usize) {}
|