forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assert that the first
assert!
expression is bool
In the desugaring of `assert!`, assign the condition expression to a `bool` biding in order to provide better type errors when passed the wrong thing. The span will point only at the expression, and not the whole `assert!` invokation. ``` error[E0308]: mismatched types --> $DIR/issue-14091.rs:2:13 | LL | assert!(1,1); | ^ | | | expected `bool`, found integer | expected due to this ``` We no longer mention the expression needing to implement the `Not` trait. ``` error[E0308]: mismatched types --> $DIR/issue-14091-2.rs:15:13 | LL | assert!(x, x); | ^ | | | expected `bool`, found `BytePos` | expected due to this ``` Fix rust-lang#122159.
- Loading branch information
Showing
43 changed files
with
216 additions
and
169 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
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#[test] | ||
fn seq_compare() { | ||
assert!(("hello".to_string() < "hellr".to_string())); | ||
assert!(("hello ".to_string() > "hello".to_string())); | ||
assert!(("hello".to_string() != "there".to_string())); | ||
assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); | ||
assert!((vec![1, 2, 3] < vec![1, 2, 3, 4])); | ||
assert!((vec![1, 2, 4, 4] > vec![1, 2, 3, 4])); | ||
assert!((vec![1, 2, 3, 4] < vec![1, 2, 4, 4])); | ||
assert!((vec![1, 2, 3] <= vec![1, 2, 3])); | ||
assert!((vec![1, 2, 3] <= vec![1, 2, 3, 3])); | ||
assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); | ||
assert!("hello".to_string() < "hellr".to_string()); | ||
assert!("hello ".to_string() > "hello".to_string()); | ||
assert!("hello".to_string() != "there".to_string()); | ||
assert!(vec![1, 2, 3, 4] > vec![1, 2, 3]); | ||
assert!(vec![1, 2, 3] < vec![1, 2, 3, 4]); | ||
assert!(vec![1, 2, 4, 4] > vec![1, 2, 3, 4]); | ||
assert!(vec![1, 2, 3, 4] < vec![1, 2, 4, 4]); | ||
assert!(vec![1, 2, 3] <= vec![1, 2, 3]); | ||
assert!(vec![1, 2, 3] <= vec![1, 2, 3, 3]); | ||
assert!(vec![1, 2, 3, 4] > vec![1, 2, 3]); | ||
assert_eq!(vec![1, 2, 3], vec![1, 2, 3]); | ||
assert!((vec![1, 2, 3] != vec![1, 1, 3])); | ||
assert!(vec![1, 2, 3] != vec![1, 1, 3]); | ||
} |
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
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
Oops, something went wrong.