internal: switch some tests to minicore

This commit is contained in:
Aleksey Kladov 2021-06-15 21:57:56 +03:00
parent 0bb1f1bc90
commit ee13e895e3
2 changed files with 32 additions and 55 deletions

View File

@ -927,35 +927,33 @@ fn issue_6628() {
fn issue_6852() { fn issue_6852() {
check_infer( check_infer(
r#" r#"
#[lang = "deref"] //- minicore: deref
pub trait Deref { use core::ops::Deref;
type Target;
}
struct BufWriter {} struct BufWriter {}
struct Mutex<T> {} struct Mutex<T> {}
struct MutexGuard<'a, T> {} struct MutexGuard<'a, T> {}
impl<T> Mutex<T> { impl<T> Mutex<T> {
fn lock(&self) -> MutexGuard<'_, T> {} fn lock(&self) -> MutexGuard<'_, T> {}
} }
impl<'a, T: 'a> Deref for MutexGuard<'a, T> { impl<'a, T: 'a> Deref for MutexGuard<'a, T> {
type Target = T; type Target = T;
} }
fn flush(&self) { fn flush(&self) {
let w: &Mutex<BufWriter>; let w: &Mutex<BufWriter>;
*(w.lock()); *(w.lock());
} }
"#, "#,
expect![[r#" expect![[r#"
156..160 'self': &Mutex<T> 123..127 'self': &Mutex<T>
183..185 '{}': () 150..152 '{}': ()
267..271 'self': &{unknown} 234..238 'self': &{unknown}
273..323 '{ ...()); }': () 240..290 '{ ...()); }': ()
283..284 'w': &Mutex<BufWriter> 250..251 'w': &Mutex<BufWriter>
309..320 '*(w.lock())': BufWriter 276..287 '*(w.lock())': BufWriter
311..312 'w': &Mutex<BufWriter> 278..279 'w': &Mutex<BufWriter>
311..319 'w.lock()': MutexGuard<BufWriter> 278..286 'w.lock()': MutexGuard<BufWriter>
"#]], "#]],
); );
} }

View File

@ -704,14 +704,9 @@ mod ops {
fn deref_trait() { fn deref_trait() {
check_types( check_types(
r#" r#"
#[lang = "deref"] //- minicore: deref
trait Deref {
type Target;
fn deref(&self) -> &Self::Target;
}
struct Arc<T>; struct Arc<T>;
impl<T> Deref for Arc<T> { impl<T> core::ops::Deref for Arc<T> {
type Target = T; type Target = T;
} }
@ -731,16 +726,10 @@ fn test(s: Arc<S>) {
fn deref_trait_with_inference_var() { fn deref_trait_with_inference_var() {
check_types( check_types(
r#" r#"
//- /main.rs //- minicore: deref
#[lang = "deref"]
trait Deref {
type Target;
fn deref(&self) -> &Self::Target;
}
struct Arc<T>; struct Arc<T>;
fn new_arc<T>() -> Arc<T> {} fn new_arc<T>() -> Arc<T> {}
impl<T> Deref for Arc<T> { impl<T> core::ops::Deref for Arc<T> {
type Target = T; type Target = T;
} }
@ -761,15 +750,10 @@ fn test() {
fn deref_trait_infinite_recursion() { fn deref_trait_infinite_recursion() {
check_types( check_types(
r#" r#"
#[lang = "deref"] //- minicore: deref
trait Deref {
type Target;
fn deref(&self) -> &Self::Target;
}
struct S; struct S;
impl Deref for S { impl core::ops::Deref for S {
type Target = S; type Target = S;
} }
@ -784,14 +768,9 @@ fn test(s: S) {
fn deref_trait_with_question_mark_size() { fn deref_trait_with_question_mark_size() {
check_types( check_types(
r#" r#"
#[lang = "deref"] //- minicore: deref
trait Deref {
type Target;
fn deref(&self) -> &Self::Target;
}
struct Arc<T>; struct Arc<T>;
impl<T> Deref for Arc<T> { impl<T: ?Sized> core::ops::Deref for Arc<T> {
type Target = T; type Target = T;
} }