about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-30 19:04:55 +0000
committerMichael Goulet <michael@errs.io>2023-01-30 19:04:59 +0000
commit343a359109a48f4ece657831bf0331e22d108800 (patch)
treec5a036c1a80cc94867a3b06d3e90c8f8b233b812 /tests
parentf55b0022db8dccc6aa6bf3f650b562eaec0fdc54 (diff)
downloadrust-343a359109a48f4ece657831bf0331e22d108800.tar.gz
rust-343a359109a48f4ece657831bf0331e22d108800.zip
Use ObligationCtxt::new_in_snapshot in satisfied_from_param_env
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc/document-item-with-associated-const-in-where-clause.rs17
-rw-r--r--tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs39
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs b/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs
new file mode 100644
index 00000000000..c9408ef3360
--- /dev/null
+++ b/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs
@@ -0,0 +1,17 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+pub trait Enumerable {
+    const N: usize;
+}
+
+#[derive(Clone)]
+pub struct SymmetricGroup<S>
+where
+    S: Enumerable,
+    [(); S::N]: Sized,
+{
+    _phantom: std::marker::PhantomData<S>,
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs
new file mode 100644
index 00000000000..0ba0c5a72ef
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs
@@ -0,0 +1,39 @@
+// check-pass
+
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+use std::marker::PhantomData;
+
+pub trait Bytes {
+    const BYTES: usize;
+}
+
+#[derive(Clone, Debug)]
+pub struct Conster<OT>
+where
+    OT: Bytes,
+    [(); OT::BYTES]: Sized,
+{
+    _offset_type: PhantomData<fn(OT) -> OT>,
+}
+
+impl<OT> Conster<OT>
+where
+    OT: Bytes,
+    [(); OT::BYTES]: Sized,
+{
+    pub fn new() -> Self {
+        Conster { _offset_type: PhantomData }
+    }
+}
+
+pub fn make_conster<COT>() -> Conster<COT>
+where
+    COT: Bytes,
+    [(); COT::BYTES]: Sized,
+{
+    Conster::new()
+}
+
+fn main() {}