aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/coercion.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-15 19:34:26 +0100
committerAleksey Kladov <[email protected]>2021-06-15 19:34:26 +0100
commit7ebac5e54c51c6b8f1ddf3bb905f625416cc09fa (patch)
tree1eb45c7a221654c7da7ac3baebbb6deb02271593 /crates/hir_ty/src/tests/coercion.rs
parent047520153878ade5b0136bc151fc53a43419b1c9 (diff)
internal: switch some tests to minicore
Diffstat (limited to 'crates/hir_ty/src/tests/coercion.rs')
-rw-r--r--crates/hir_ty/src/tests/coercion.rs65
1 files changed, 32 insertions, 33 deletions
diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs
index eca6ae1fe..713b74165 100644
--- a/crates/hir_ty/src/tests/coercion.rs
+++ b/crates/hir_ty/src/tests/coercion.rs
@@ -426,15 +426,15 @@ fn coerce_autoderef() {
426#[test] 426#[test]
427fn coerce_autoderef_generic() { 427fn coerce_autoderef_generic() {
428 check_infer_with_mismatches( 428 check_infer_with_mismatches(
429 r" 429 r#"
430 struct Foo; 430struct Foo;
431 fn takes_ref<T>(x: &T) -> T { *x } 431fn takes_ref<T>(x: &T) -> T { *x }
432 fn test() { 432fn test() {
433 takes_ref(&Foo); 433 takes_ref(&Foo);
434 takes_ref(&&Foo); 434 takes_ref(&&Foo);
435 takes_ref(&&&Foo); 435 takes_ref(&&&Foo);
436 } 436}
437 ", 437"#,
438 expect![[r" 438 expect![[r"
439 28..29 'x': &T 439 28..29 'x': &T
440 40..46 '{ *x }': T 440 40..46 '{ *x }': T
@@ -464,30 +464,29 @@ fn coerce_autoderef_generic() {
464fn coerce_autoderef_block() { 464fn coerce_autoderef_block() {
465 check_infer_with_mismatches( 465 check_infer_with_mismatches(
466 r#" 466 r#"
467 struct String {} 467//- minicore: deref
468 #[lang = "deref"] 468struct String {}
469 trait Deref { type Target; } 469impl core::ops::Deref for String { type Target = str; }
470 impl Deref for String { type Target = str; } 470fn takes_ref_str(x: &str) {}
471 fn takes_ref_str(x: &str) {} 471fn returns_string() -> String { loop {} }
472 fn returns_string() -> String { loop {} } 472fn test() {
473 fn test() { 473 takes_ref_str(&{ returns_string() });
474 takes_ref_str(&{ returns_string() }); 474}
475 } 475"#,
476 "#, 476 expect![[r#"
477 expect![[r" 477 90..91 'x': &str
478 126..127 'x': &str 478 99..101 '{}': ()
479 135..137 '{}': () 479 132..143 '{ loop {} }': String
480 168..179 '{ loop {} }': String 480 134..141 'loop {}': !
481 170..177 'loop {}': ! 481 139..141 '{}': ()
482 175..177 '{}': () 482 154..199 '{ ... }); }': ()
483 190..235 '{ ... }); }': () 483 160..173 'takes_ref_str': fn takes_ref_str(&str)
484 196..209 'takes_ref_str': fn takes_ref_str(&str) 484 160..196 'takes_...g() })': ()
485 196..232 'takes_...g() })': () 485 174..195 '&{ ret...ng() }': &String
486 210..231 '&{ ret...ng() }': &String 486 175..195 '{ retu...ng() }': String
487 211..231 '{ retu...ng() }': String 487 177..191 'returns_string': fn returns_string() -> String
488 213..227 'returns_string': fn returns_string() -> String 488 177..193 'return...ring()': String
489 213..229 'return...ring()': String 489 "#]],
490 "]],
491 ); 490 );
492} 491}
493 492