about summary refs log tree commit diff
path: root/tests/ui/coercion
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-07-24 17:45:27 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-08-05 19:02:23 +0500
commit62c92f30cf02fc56b8a774c77097f1111dc2f4ea (patch)
treefe8c9846c6ca02b176ea9adcb8a348bd5ead1846 /tests/ui/coercion
parent0f353363965ebf05e0757f7679c800b39c51a07e (diff)
downloadrust-62c92f30cf02fc56b8a774c77097f1111dc2f4ea.tar.gz
rust-62c92f30cf02fc56b8a774c77097f1111dc2f4ea.zip
moved 35 tests to organized locations
Diffstat (limited to 'tests/ui/coercion')
-rw-r--r--tests/ui/coercion/method-return-trait-object-14399.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/coercion/method-return-trait-object-14399.rs b/tests/ui/coercion/method-return-trait-object-14399.rs
new file mode 100644
index 00000000000..a539e270fb0
--- /dev/null
+++ b/tests/ui/coercion/method-return-trait-object-14399.rs
@@ -0,0 +1,17 @@
+//@ run-pass
+// #14399
+// We'd previously ICE if we had a method call whose return
+// value was coerced to a trait object. (v.clone() returns Box<B1>
+// which is coerced to Box<A>).
+
+
+#[derive(Clone)]
+struct B1;
+
+trait A { fn foo(&self) {} } //~ WARN method `foo` is never used
+impl A for B1 {}
+
+fn main() {
+    let v: Box<_> = Box::new(B1);
+    let _c: Box<dyn A> = v.clone();
+}