diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-06 16:28:42 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-06 16:28:42 +0100 |
commit | c859a6480af7baece2eec38c19f71cb714db9e3b (patch) | |
tree | 57e2591705e62e646f1dea42c65bda04042e66fb /crates/ra_hir_ty/src/tests | |
parent | 109bb1a7935e31d4ee3c036775a89ad0ac0e012b (diff) | |
parent | 236ac630f6ffc403257d4c77e6187819432956cf (diff) |
Merge #3868
3868: Fix Chalk panic r=flodiebold a=flodiebold
Fixes #3865. Basically I forgot to shift 'back' when we got `dyn Trait`s back from Chalk, so after going through Chalk a few times, the panic happened.
And yes, I did run `analysis-stats` now ;)
cc @edwin0cheng
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 081aa943a..22ae6ca90 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -2021,3 +2021,28 @@ fn main() { | |||
2021 | "### | 2021 | "### |
2022 | ); | 2022 | ); |
2023 | } | 2023 | } |
2024 | |||
2025 | #[test] | ||
2026 | fn dyn_trait_through_chalk() { | ||
2027 | let t = type_at( | ||
2028 | r#" | ||
2029 | //- /main.rs | ||
2030 | struct Box<T> {} | ||
2031 | #[lang = "deref"] | ||
2032 | trait Deref { | ||
2033 | type Target; | ||
2034 | } | ||
2035 | impl<T> Deref for Box<T> { | ||
2036 | type Target = T; | ||
2037 | } | ||
2038 | trait Trait { | ||
2039 | fn foo(&self); | ||
2040 | } | ||
2041 | |||
2042 | fn test(x: Box<dyn Trait>) { | ||
2043 | x.foo()<|>; | ||
2044 | } | ||
2045 | "#, | ||
2046 | ); | ||
2047 | assert_eq!(t, "()"); | ||
2048 | } | ||