mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Account sized bounds in parentheses printing inside of ptr/ref of rpit.
This commit is contained in:
parent
d9ec88ea23
commit
14898729f4
7 changed files with 153 additions and 38 deletions
|
@ -932,6 +932,50 @@ fn main() {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fn_hints_ptr_rpit_fn_parentheses() {
|
||||
check_types(
|
||||
r#"
|
||||
//- minicore: fn, sized
|
||||
trait Trait {}
|
||||
|
||||
fn foo1() -> *const impl Fn() { loop {} }
|
||||
fn foo2() -> *const (impl Fn() + Sized) { loop {} }
|
||||
fn foo3() -> *const (impl Fn() + ?Sized) { loop {} }
|
||||
fn foo4() -> *const (impl Sized + Fn()) { loop {} }
|
||||
fn foo5() -> *const (impl ?Sized + Fn()) { loop {} }
|
||||
fn foo6() -> *const (impl Fn() + Trait) { loop {} }
|
||||
fn foo7() -> *const (impl Fn() + Sized + Trait) { loop {} }
|
||||
fn foo8() -> *const (impl Fn() + ?Sized + Trait) { loop {} }
|
||||
fn foo9() -> *const (impl Fn() -> u8 + ?Sized) { loop {} }
|
||||
fn foo10() -> *const (impl Fn() + Sized + ?Sized) { loop {} }
|
||||
|
||||
fn main() {
|
||||
let foo = foo1();
|
||||
// ^^^ *const impl Fn()
|
||||
let foo = foo2();
|
||||
// ^^^ *const impl Fn()
|
||||
let foo = foo3();
|
||||
// ^^^ *const (impl Fn() + ?Sized)
|
||||
let foo = foo4();
|
||||
// ^^^ *const impl Fn()
|
||||
let foo = foo5();
|
||||
// ^^^ *const (impl Fn() + ?Sized)
|
||||
let foo = foo6();
|
||||
// ^^^ *const (impl Fn() + Trait)
|
||||
let foo = foo7();
|
||||
// ^^^ *const (impl Fn() + Trait)
|
||||
let foo = foo8();
|
||||
// ^^^ *const (impl Fn() + Trait + ?Sized)
|
||||
let foo = foo9();
|
||||
// ^^^ *const (impl Fn() -> u8 + ?Sized)
|
||||
let foo = foo10();
|
||||
// ^^^ *const impl Fn()
|
||||
}
|
||||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_structs_have_no_type_hints() {
|
||||
check_types(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue