about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjackh726 <git@jackhuey.me>2025-08-14 17:04:54 +0000
committerjackh726 <git@jackhuey.me>2025-08-15 05:03:44 +0000
commitcc3c5cfb2e46c04778ebba4b0c71e87cb7f7cef7 (patch)
tree62beff963b6afb2f51bf408fa29fa5817c8241bf
parent0dbacbc957c5c10ff4bd4976a44c40ca4c5362a3 (diff)
downloadrust-cc3c5cfb2e46c04778ebba4b0c71e87cb7f7cef7.tar.gz
rust-cc3c5cfb2e46c04778ebba4b0c71e87cb7f7cef7.zip
Add test for webrender-2022 metrics
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
index 2e4346a8697..9d72105624a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
@@ -4994,3 +4994,35 @@ fn main() {
         "#]],
     );
 }
+
+#[test]
+fn trait_object_binders() {
+    check_infer(
+        r#"
+//- minicore: iterator, dispatch_from_dyn
+fn main() {
+    struct Box<T: ?Sized>(*const T);
+    impl<I: Iterator + ?Sized> Iterator for Box<I> {
+        type Item = I::Item;
+        fn next(&mut self) -> Option<I::Item> {
+            loop {}
+        }
+    }
+    let iter: Box<dyn Iterator<Item = &[u8]> + 'static> = loop {};
+    let _ = iter.into_iter();
+}"#,
+        expect![[r#"
+            10..313 '{     ...r(); }': ()
+            223..227 'iter': Box<dyn Iterator<Item = &'? [u8]> + 'static>
+            273..280 'loop {}': !
+            278..280 '{}': ()
+            290..291 '_': Box<dyn Iterator<Item = &'? [u8]> + 'static>
+            294..298 'iter': Box<dyn Iterator<Item = &'? [u8]> + 'static>
+            294..310 'iter.i...iter()': Box<dyn Iterator<Item = &'? [u8]> + 'static>
+            152..156 'self': &'? mut Box<I>
+            177..208 '{     ...     }': Option<Iterator::Item<I>>
+            191..198 'loop {}': !
+            196..198 '{}': ()
+        "#]],
+    );
+}