about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-06-19 14:24:25 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2024-06-22 06:34:09 +0200
commit38bd7a0fcbfeb206d7d38791c884e036dfbb04ff (patch)
tree2334a71fb38520a74fdd2e70c2fc70313e31e370 /tests
parentbc12972bcd7fb93e515c14b9e1f514bc3d2683d8 (diff)
Add `#[rustc_dump_{predicates,item_bounds}]`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/attributes/dump-preds.rs20
-rw-r--r--tests/ui/attributes/dump-preds.stderr39
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/ui/attributes/dump-preds.rs b/tests/ui/attributes/dump-preds.rs
new file mode 100644
index 00000000000..1e15ff2f9bd
--- /dev/null
+++ b/tests/ui/attributes/dump-preds.rs
@@ -0,0 +1,20 @@
+//@ normalize-stderr-test "DefId\(.+?\)" -> "DefId(..)"
+
+#![feature(rustc_attrs)]
+
+#[rustc_dump_predicates]
+trait Trait<T>: Iterator<Item: Copy>
+//~^ ERROR rustc_dump_predicates
+where
+    String: From<T>
+{
+    #[rustc_dump_predicates]
+    #[rustc_dump_item_bounds]
+    type Assoc<P: Eq>: std::ops::Deref<Target = ()>
+    //~^ ERROR rustc_dump_predicates
+    //~| ERROR rustc_dump_item_bounds
+    where
+        Self::Assoc<()>: Copy;
+}
+
+fn main() {}
diff --git a/tests/ui/attributes/dump-preds.stderr b/tests/ui/attributes/dump-preds.stderr
new file mode 100644
index 00000000000..26834376e76
--- /dev/null
+++ b/tests/ui/attributes/dump-preds.stderr
@@ -0,0 +1,39 @@
+error: rustc_dump_predicates
+  --> $DIR/dump-preds.rs:6:1
+   |
+LL | trait Trait<T>: Iterator<Item: Copy>
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: Binder { value: TraitPredicate(<Self as std::iter::Iterator>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<<Self as std::iter::Iterator>::Item as std::marker::Copy>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<std::string::String as std::convert::From<T>>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<Self as Trait<T>>, polarity:Positive), bound_vars: [] }
+
+error: rustc_dump_predicates
+  --> $DIR/dump-preds.rs:13:5
+   |
+LL |     type Assoc<P: Eq>: std::ops::Deref<Target = ()>
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: Binder { value: TraitPredicate(<Self as std::iter::Iterator>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<<Self as std::iter::Iterator>::Item as std::marker::Copy>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<std::string::String as std::convert::From<T>>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<Self as Trait<T>>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<P as std::marker::Sized>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<P as std::cmp::Eq>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<()> as std::marker::Copy>, polarity:Positive), bound_vars: [] }
+
+error: rustc_dump_item_bounds
+  --> $DIR/dump-preds.rs:13:5
+   |
+LL |     type Assoc<P: Eq>: std::ops::Deref<Target = ()>
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: Binder { value: ProjectionPredicate(AliasTerm { args: [Alias(Projection, AliasTy { args: [Self/#0, T/#1, P/#2], def_id: DefId(..) })], def_id: DefId(..) }, Term::Ty(())), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::ops::Deref>, polarity:Positive), bound_vars: [] }
+   = note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::marker::Sized>, polarity:Positive), bound_vars: [] }
+
+error: aborting due to 3 previous errors
+