aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/method_resolution.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-04 17:44:37 +0000
committerGitHub <[email protected]>2020-12-04 17:44:37 +0000
commit7efab3ed032e84ae8d8acf807aeb914365a9ac50 (patch)
tree60a3fa0fdd2162092c6a97f960da677150889bda /crates/hir_ty/src/tests/method_resolution.rs
parent6943b530235df98c1ceec27d7f80a974511d3c7e (diff)
parente5fd550dfdc7b67e22b0889983c5698439dc0bd5 (diff)
Merge #6723
6723: Use correct, full substs for self type in impl r=flodiebold a=flodiebold Without arbitrary self types, the self type could never refer to the method type parameters, so this wasn't a problem; but with arbitrary self types, it can. This fixes the crash from #6668; but it doesn't make method resolution work for these methods. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/method_resolution.rs')
-rw-r--r--crates/hir_ty/src/tests/method_resolution.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs
index 0f17ff151..a6a54e542 100644
--- a/crates/hir_ty/src/tests/method_resolution.rs
+++ b/crates/hir_ty/src/tests/method_resolution.rs
@@ -1087,3 +1087,22 @@ fn method_resolution_foreign_opaque_type() {
1087 "#]], 1087 "#]],
1088 ); 1088 );
1089} 1089}
1090
1091#[test]
1092fn method_with_allocator_box_self_type() {
1093 check_types(
1094 r#"
1095struct Slice<T> {}
1096struct Box<T, A> {}
1097
1098impl<T> Slice<T> {
1099 pub fn into_vec<A>(self: Box<Self, A>) { }
1100}
1101
1102fn main() {
1103 let foo: Slice<u32>;
1104 (foo.into_vec()); // we don't actually support arbitrary self types, but we shouldn't crash at least
1105} //^ {unknown}
1106"#,
1107 );
1108}