diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-11-17 15:30:42 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-11-21 20:36:15 +0000 |
| commit | 4d9451b1d1e334e90e6725d5577545eae4e28545 (patch) | |
| tree | 1b73efa60256650d13d9a21c98f606cf1f5bdbd4 /src/test/ui/pattern | |
| parent | a9f3c2209c6ac4ff36df1816b842d0a1c1540624 (diff) | |
| download | rust-4d9451b1d1e334e90e6725d5577545eae4e28545.tar.gz rust-4d9451b1d1e334e90e6725d5577545eae4e28545.zip | |
Fix an ICE that I just made worse
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.rs b/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.rs new file mode 100644 index 00000000000..daa432d9ae5 --- /dev/null +++ b/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.rs @@ -0,0 +1,20 @@ +#![allow(warnings)] + +struct MyType; + +impl PartialEq<usize> for MyType { + fn eq(&self, y: &usize) -> bool { + true + } +} + +const CONSTANT: &&MyType = &&MyType; + +fn main() { + if let CONSTANT = &&MyType { + //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + println!("semantic!"); + } else { + println!("structural!"); + } +} diff --git a/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr b/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr new file mode 100644 index 00000000000..358421cd6d2 --- /dev/null +++ b/src/test/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr @@ -0,0 +1,8 @@ +error: to use a constant of type `MyType` in a pattern, `MyType` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/const-partial_eq-fallback-ice.rs:14:12 + | +LL | if let CONSTANT = &&MyType { + | ^^^^^^^^ + +error: aborting due to previous error + |
