From 3d6480bc3103f7238b1b0e020518e8aa72af3156 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 12 Jan 2021 20:19:13 +0100 Subject: Render Fn* trait objects and impl types as rust does --- crates/hir_ty/src/tests/display_source_code.rs | 15 +++++++++++++++ crates/hir_ty/src/tests/traits.rs | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src/tests') diff --git a/crates/hir_ty/src/tests/display_source_code.rs b/crates/hir_ty/src/tests/display_source_code.rs index b502135d8..3d29021aa 100644 --- a/crates/hir_ty/src/tests/display_source_code.rs +++ b/crates/hir_ty/src/tests/display_source_code.rs @@ -39,3 +39,18 @@ fn main() { "#, ); } + +#[test] +fn render_raw_ptr_impl_ty() { + check_types_source_code( + r#" +trait Sized {} +trait Unpin {} +fn foo() -> *const (impl Unpin + Sized) { loop {} } +fn main() { + let foo = foo(); + foo; +} //^ *const (impl Unpin + Sized) +"#, + ); +} diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 41d097519..e5a3f95a6 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -3038,16 +3038,16 @@ fn infer_box_fn_arg() { 406..417 '&self.inner': &*mut T 407..411 'self': &Box 407..417 'self.inner': *mut T - 478..575 '{ ...(&s) }': FnOnce::Output,)>, (&Option,)> + 478..575 '{ ...(&s) }': FnOnce::Output), (&Option,)> 488..489 's': Option 492..504 'Option::None': Option - 514..515 'f': Box,)>> + 514..515 'f': Box)> 549..562 'box (|ps| {})': Box<|{unknown}| -> ()> 554..561 '|ps| {}': |{unknown}| -> () 555..557 'ps': {unknown} 559..561 '{}': () - 568..569 'f': Box,)>> - 568..573 'f(&s)': FnOnce::Output,)>, (&Option,)> + 568..569 'f': Box)> + 568..573 'f(&s)': FnOnce::Output), (&Option,)> 570..572 '&s': &Option 571..572 's': Option "#]], -- cgit v1.2.3