-
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.
Update tests/ui/pattern/issue-115599.rs
- Loading branch information
Showing
2 changed files
with
11 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
const CONST_STRING: String = String::new(); | ||
//! Test that a type with derived (Partial)Eq, and thus Structural(Partial)Eq | ||
//! that is a newtype over a type without Structural(Partial)Eq correctly errors. | ||
// `String` in the stdlib no longer derives these traits, so make our own here. | ||
#[derive(PartialEq, Eq, PartialOrd, Ord)] | ||
struct String(Vec<u8>); | ||
|
||
const CONST_STRING: String = String(Vec::new()); | ||
|
||
fn main() { | ||
let empty_str = String::from(""); | ||
let empty_str = String(Vec::from(&[])); | ||
if let CONST_STRING = empty_str {} | ||
//~^ ERROR to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq)]` | ||
} |
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