Skip to content

Commit 0f6621f

Browse files
committed
Fix tests.
1 parent 5f2486e commit 0f6621f

File tree

6 files changed

+355
-336
lines changed

6 files changed

+355
-336
lines changed

crates/hir_ty/src/display.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,10 +791,10 @@ fn write_bounds_like_dyn_trait(
791791
if default_sized.is_sized_trait(trait_, f.db.upcast()) {
792792
is_sized = true;
793793
if matches!(default_sized, SizedByDefault::Sized { .. }) {
794-
// Don't print +Sized, but rather +?Sized if absent.
795-
continue;
796-
}
794+
// Don't print +Sized, but rather +?Sized if absent.
795+
continue;
797796
}
797+
}
798798
if !is_fn_trait {
799799
is_fn_trait = fn_traits(f.db.upcast(), trait_).any(|it| it == trait_);
800800
}

crates/hir_ty/src/tests/display_source_code.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn render_raw_ptr_impl_ty() {
4545
// FIXME: remove parens, they apper because there is an implicit Sized bound
4646
check_types_source_code(
4747
r#"
48-
#[lang = "sized"] trait Sized {}
48+
//- minicore: sized
4949
trait Unpin {}
5050
fn foo() -> *const impl Unpin { loop {} }
5151
fn main() {
@@ -73,8 +73,7 @@ fn foo(foo: &dyn for<'a> Foo<'a>) {}
7373
fn sized_bounds_apit() {
7474
check_types_source_code(
7575
r#"
76-
#[lang = "sized"] trait Sized {}
77-
76+
//- minicore: sized
7877
trait Foo {}
7978
trait Bar<T> {}
8079
struct S<T>;
@@ -106,8 +105,7 @@ fn test(
106105
fn sized_bounds_rpit() {
107106
check_types_source_code(
108107
r#"
109-
#[lang = "sized"] trait Sized {}
110-
108+
//- minicore: sized
111109
trait Foo {}
112110
fn foo() -> impl Foo { loop {} }
113111
fn test<T: Foo>() {
@@ -122,8 +120,7 @@ fn test<T: Foo>() {
122120
fn sized_bounds_impl_traits_in_fn_signature() {
123121
check_types_source_code(
124122
r#"
125-
#[lang = "sized"] trait Sized {}
126-
123+
//- minicore: sized
127124
trait Foo {}
128125
fn test(
129126
a: fn(impl Foo) -> impl Foo,

crates/hir_ty/src/tests/method_resolution.rs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ fn test() { foo.call(); }
922922
fn super_trait_impl_return_trait_method_resolution() {
923923
check_infer(
924924
r#"
925-
#[lang = "sized"] trait Sized {}
925+
//- minicore: sized
926926
trait Base {
927927
fn foo(self) -> usize;
928928
}
@@ -940,26 +940,26 @@ fn super_trait_impl_return_trait_method_resolution() {
940940
}
941941
"#,
942942
expect![[r#"
943-
57..61 'self': Self
944-
123..134 '{ loop {} }': !
945-
125..132 'loop {}': !
946-
130..132 '{}': ()
947-
161..172 '{ loop {} }': !
948-
163..170 'loop {}': !
949-
168..170 '{}': ()
950-
182..187 'base2': impl Base
951-
200..206 'super2': impl Super
952-
220..297 '{ ...o(); }': ()
953-
226..231 'base1': fn base1() -> impl Base
954-
226..233 'base1()': impl Base
955-
226..239 'base1().foo()': usize
956-
245..251 'super1': fn super1() -> impl Super
957-
245..253 'super1()': impl Super
958-
245..259 'super1().foo()': usize
959-
265..270 'base2': impl Base
960-
265..276 'base2.foo()': usize
961-
282..288 'super2': impl Super
962-
282..294 'super2.foo()': usize
943+
24..28 'self': Self
944+
90..101 '{ loop {} }': !
945+
92..99 'loop {}': !
946+
97..99 '{}': ()
947+
128..139 '{ loop {} }': !
948+
130..137 'loop {}': !
949+
135..137 '{}': ()
950+
149..154 'base2': impl Base
951+
167..173 'super2': impl Super
952+
187..264 '{ ...o(); }': ()
953+
193..198 'base1': fn base1() -> impl Base
954+
193..200 'base1()': impl Base
955+
193..206 'base1().foo()': usize
956+
212..218 'super1': fn super1() -> impl Super
957+
212..220 'super1()': impl Super
958+
212..226 'super1().foo()': usize
959+
232..237 'base2': impl Base
960+
232..243 'base2.foo()': usize
961+
249..255 'super2': impl Super
962+
249..261 'super2.foo()': usize
963963
"#]],
964964
);
965965
}
@@ -1318,9 +1318,7 @@ impl<'a, T> IntoIterator for &'a [T] {
13181318
fn sized_blanket_impl() {
13191319
check_infer(
13201320
r#"
1321-
#[lang = "sized"]
1322-
pub trait Sized {}
1323-
1321+
//- minicore: sized
13241322
trait Foo { fn foo() -> u8; }
13251323
impl<T: Sized> Foo for T {}
13261324
fn f<S: Sized, T, U: ?Sized>() {
@@ -1332,12 +1330,12 @@ fn f<S: Sized, T, U: ?Sized>() {
13321330
}
13331331
"#,
13341332
expect![[r#"
1335-
127..198 '{ ...foo; }': ()
1336-
133..141 'u32::foo': fn foo<u32>() -> u8
1337-
147..153 'S::foo': fn foo<S>() -> u8
1338-
159..165 'T::foo': fn foo<T>() -> u8
1339-
171..177 'U::foo': {unknown}
1340-
183..195 '<[u32]>::foo': {unknown}
1333+
89..160 '{ ...foo; }': ()
1334+
95..103 'u32::foo': fn foo<u32>() -> u8
1335+
109..115 'S::foo': fn foo<S>() -> u8
1336+
121..127 'T::foo': fn foo<T>() -> u8
1337+
133..139 'U::foo': {unknown}
1338+
145..157 '<[u32]>::foo': {unknown}
13411339
"#]],
13421340
);
13431341
}

0 commit comments

Comments
 (0)