diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index dc517fc4a..f6e3e07cd 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -2378,3 +2378,27 @@ fn main() { | |||
2378 | ); | 2378 | ); |
2379 | assert_eq!(t, "Foo"); | 2379 | assert_eq!(t, "Foo"); |
2380 | } | 2380 | } |
2381 | |||
2382 | #[test] | ||
2383 | fn trait_object_no_coercion() { | ||
2384 | assert_snapshot!( | ||
2385 | infer_with_mismatches(r#" | ||
2386 | trait Foo {} | ||
2387 | |||
2388 | fn foo(x: &dyn Foo) {} | ||
2389 | |||
2390 | fn test(x: &dyn Foo) { | ||
2391 | foo(x); | ||
2392 | } | ||
2393 | "#, true), | ||
2394 | @r###" | ||
2395 | [22; 23) 'x': &dyn Foo | ||
2396 | [35; 37) '{}': () | ||
2397 | [47; 48) 'x': &dyn Foo | ||
2398 | [60; 75) '{ foo(x); }': () | ||
2399 | [66; 69) 'foo': fn foo(&dyn Foo) | ||
2400 | [66; 72) 'foo(x)': () | ||
2401 | [70; 71) 'x': &dyn Foo | ||
2402 | "### | ||
2403 | ); | ||
2404 | } | ||