about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorb-naber <bn263@gmx.de>2021-10-29 13:14:44 +0200
committerb-naber <bn263@gmx.de>2021-10-29 13:47:53 +0200
commit87fbf3c5aaff62cb70cf95ccfd756f4f147e8fea (patch)
treef80d05f4a333610824fab53d72a18450a3870c10 /src
parent4e0d3973fafdfb1c51011bc74e44257b5e3863f1 (diff)
downloadrust-87fbf3c5aaff62cb70cf95ccfd756f4f147e8fea.tar.gz
rust-87fbf3c5aaff62cb70cf95ccfd756f4f147e8fea.zip
ignore type flags insertion in default_anon_const_substs if error occurred
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/const-generics/issues/issue-88997.rs14
-rw-r--r--src/test/ui/const-generics/issues/issue-88997.stderr15
-rw-r--r--src/test/ui/const-generics/issues/issue-90364.rs9
-rw-r--r--src/test/ui/const-generics/issues/issue-90364.stderr9
4 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issues/issue-88997.rs b/src/test/ui/const-generics/issues/issue-88997.rs
new file mode 100644
index 00000000000..7666a514101
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-88997.rs
@@ -0,0 +1,14 @@
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+struct ConstAssert<const COND: bool>;
+trait True {}
+impl True for ConstAssert<true> {}
+
+struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T)
+//~^ ERROR the type of const parameters must not depend on other generic parameters
+//~| ERROR the type of const parameters must not depend on other generic parameters
+where
+    ConstAssert<{ MIN <= MAX }>: True;
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issues/issue-88997.stderr b/src/test/ui/const-generics/issues/issue-88997.stderr
new file mode 100644
index 00000000000..505ba0da232
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-88997.stderr
@@ -0,0 +1,15 @@
+error[E0770]: the type of const parameters must not depend on other generic parameters
+  --> $DIR/issue-88997.rs:8:40
+   |
+LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T)
+   |                                        ^ the type must not depend on the parameter `T`
+
+error[E0770]: the type of const parameters must not depend on other generic parameters
+  --> $DIR/issue-88997.rs:8:54
+   |
+LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T)
+   |                                                      ^ the type must not depend on the parameter `T`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0770`.
diff --git a/src/test/ui/const-generics/issues/issue-90364.rs b/src/test/ui/const-generics/issues/issue-90364.rs
new file mode 100644
index 00000000000..b11b07b5023
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-90364.rs
@@ -0,0 +1,9 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+pub struct Foo<T, const H: T>(T)
+//~^ ERROR the type of const parameters must not depend on other generic parameters
+where
+    [(); 1]:;
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issues/issue-90364.stderr b/src/test/ui/const-generics/issues/issue-90364.stderr
new file mode 100644
index 00000000000..e85bd136ef6
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-90364.stderr
@@ -0,0 +1,9 @@
+error[E0770]: the type of const parameters must not depend on other generic parameters
+  --> $DIR/issue-90364.rs:4:28
+   |
+LL | pub struct Foo<T, const H: T>(T)
+   |                            ^ the type must not depend on the parameter `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0770`.