about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-08-06 11:21:35 +0900
committerGitHub <noreply@github.com>2021-08-06 11:21:35 +0900
commit8bad35095b3dcd424fd2d1802f77f3923c8a5487 (patch)
treefc4484d33c1bfd4b3ceee4fab22a58547c18d2cc /src
parent41076a8ac94659e2f062f211f0e1b334155b72ab (diff)
parentfa4671500273991967b293dd611e645512608d98 (diff)
Rollup merge of #87770 - BoxyUwU:cec-drop-impl, r=lcnr
permit drop impls with generic constants in where clauses

Fixes #79248

`==` is not sufficient to check for equality between unevaluated consts which causes the above issue because the const in `[(); N - 1]:` on the impl and the const in `[(); N - 1]:` on the struct def are not seen as equal. Any predicate that can contain an unevaluated const cant use `==` here as it will cause us to incorrectly emit an error.

I dont know much about chalk but it seems like we ought to be relating the `TypeWellFormedFromEnv` instead of `==` as it contains a `Ty` so I added that too...

r? ``````@lcnr``````
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs b/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs
new file mode 100644
index 00000000000..41fb5d70afd
--- /dev/null
+++ b/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs
@@ -0,0 +1,16 @@
+//check-pass
+#![feature(const_generics, const_evaluatable_checked)]
+#![allow(incomplete_features)]
+
+struct Foo<const N: usize>
+where
+    [(); N + 1]: ;
+
+impl<const N: usize> Drop for Foo<N>
+where
+    [(); N + 1]: ,
+{
+    fn drop(&mut self) {}
+}
+
+fn main() {}