We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Add
1 parent 9a36824 commit 160e630Copy full SHA for 160e630
src/test/ui/rfc-2632-const-trait-impl/generic-bound.rs
@@ -0,0 +1,32 @@
1
+// run-pass
2
+
3
+#![allow(incomplete_features)]
4
+#![feature(const_trait_impl)]
5
+#![feature(const_fn)]
6
7
+use std::marker::PhantomData;
8
9
+struct S<T>(PhantomData<T>);
10
11
+impl<T> Copy for S<T> {}
12
+impl<T> Clone for S<T> {
13
+ fn clone(&self) -> Self {
14
+ S(PhantomData)
15
+ }
16
+}
17
18
+impl<T> const std::ops::Add for S<T> {
19
+ type Output = Self;
20
21
+ fn add(self, _: Self) -> Self {
22
+ S(std::marker::PhantomData)
23
24
25
26
+const fn twice<T: std::ops::Add>(arg: S<T>) -> S<T> {
27
+ arg + arg
28
29
30
+fn main() {
31
+ let _ = twice(S(PhantomData::<i32>));
32
0 commit comments