about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-16 10:57:28 +0000
committerbors <bors@rust-lang.org>2023-04-16 10:57:28 +0000
commit1b50ea9abb65b33aac7285dbe36b37f9e33381a2 (patch)
tree470812612f11875dc2c4c766273a787482ce9fe5 /tests
parent18109d5032b0fd95ae81e30857a71e31e263044a (diff)
parent7fb14ae84d927c54bcfea57f03ba38fd86326cb0 (diff)
Auto merge of #110401 - fee1-dead-contrib:rollup-1f2smz2, r=fee1-dead
Rollup of 3 pull requests

Successful merges:

 - #109665 (Remove `remap_env_constness` in queries)
 - #110345 (Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.)
 - #110396 (Use lint via `lint_defs` instead of `lints`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs b/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs
new file mode 100644
index 00000000000..7d7cb967c66
--- /dev/null
+++ b/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+struct LazyLock<T> {
+    data: (Option<T>, fn() -> T),
+}
+
+impl<T> LazyLock<T> {
+    pub const fn new(f: fn() -> T) -> LazyLock<T> {
+        LazyLock { data: (None, f) }
+    }
+}
+
+struct A<T = i32>(Option<T>);
+
+impl<T> Default for A<T> {
+    fn default() -> Self {
+        A(None)
+    }
+}
+
+static EMPTY_SET: LazyLock<A<i32>> = LazyLock::new(A::default);
+
+fn main() {}