summaryrefslogtreecommitdiffstats
path: root/tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs')
-rw-r--r--tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs b/tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs
new file mode 100644
index 000000000..16df272df
--- /dev/null
+++ b/tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs
@@ -0,0 +1,28 @@
+trait Zero {
+ const ZERO: Self;
+}
+
+impl Zero for String {
+ const ZERO: Self = String::new();
+}
+
+fn foo() {
+ match String::new() {
+ Zero::ZERO ..= Zero::ZERO => {},
+ //~^ ERROR only `char` and numeric types are allowed in range patterns
+ _ => {},
+ }
+}
+
+fn bar() {
+ match Zero::ZERO {
+ Zero::ZERO ..= Zero::ZERO => {},
+ //~^ ERROR type annotations needed [E0282]
+ _ => {},
+ }
+}
+
+fn main() {
+ foo();
+ bar();
+}