do not use associated types placeholder for inlay hint
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
0aca7b78de
commit
ec3638adb9
4 changed files with 17 additions and 8 deletions
|
@ -332,7 +332,11 @@ impl HirDisplay for ApplicationTy {
|
||||||
let ret_display = if f.omit_verbose_types() {
|
let ret_display = if f.omit_verbose_types() {
|
||||||
ret.display_truncated(f.db, f.max_size)
|
ret.display_truncated(f.db, f.max_size)
|
||||||
} else {
|
} else {
|
||||||
ret.display(f.db)
|
if f.display_target.is_test() {
|
||||||
|
ret.display_test(f.db)
|
||||||
|
} else {
|
||||||
|
ret.display(f.db)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
write!(f, " -> {}", ret_display)?;
|
write!(f, " -> {}", ret_display)?;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +476,11 @@ impl HirDisplay for ApplicationTy {
|
||||||
let ret_display = if f.omit_verbose_types() {
|
let ret_display = if f.omit_verbose_types() {
|
||||||
sig.ret().display_truncated(f.db, f.max_size)
|
sig.ret().display_truncated(f.db, f.max_size)
|
||||||
} else {
|
} else {
|
||||||
sig.ret().display(f.db)
|
if f.display_target.is_test() {
|
||||||
|
sig.ret().display_test(f.db)
|
||||||
|
} else {
|
||||||
|
sig.ret().display(f.db)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
write!(f, " -> {}", ret_display)?;
|
write!(f, " -> {}", ret_display)?;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -74,7 +74,7 @@ fn check_types_impl(ra_fixture: &str, display_source: bool) {
|
||||||
let module = db.module_for_file(file_id);
|
let module = db.module_for_file(file_id);
|
||||||
ty.display_source_code(&db, module).unwrap()
|
ty.display_source_code(&db, module).unwrap()
|
||||||
} else {
|
} else {
|
||||||
ty.display(&db).to_string()
|
ty.display_test(&db).to_string()
|
||||||
};
|
};
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
checked_one = true;
|
checked_one = true;
|
||||||
|
|
|
@ -832,7 +832,7 @@ fn issue_4966() {
|
||||||
365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
|
365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
|
||||||
383..388 'inner': Map<|&f64| -> f64>
|
383..388 'inner': Map<|&f64| -> f64>
|
||||||
401..404 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
401..404 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
||||||
407..416 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>, Repeat<Map<|&f64| -> f64>>>(Repeat<Map<|&f64| -> f64>>) -> Vec<<Repeat<Map<|&f64| -> f64>> as IntoIterator>::Item>
|
407..416 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>, Repeat<Map<|&f64| -> f64>>>(Repeat<Map<|&f64| -> f64>>) -> Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
||||||
407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
||||||
417..423 'repeat': Repeat<Map<|&f64| -> f64>>
|
417..423 'repeat': Repeat<Map<|&f64| -> f64>>
|
||||||
431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
|
||||||
|
|
|
@ -907,7 +907,8 @@ fn test<T: Trait>(t: T) { (*t); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn associated_type_inlay_hints() {
|
fn associated_type_placeholder() {
|
||||||
|
// inside the generic function, the associated type gets normalized to a placeholder `ApplL::Out<T>` [https://rust-lang.github.io/rustc-guide/traits/associated-types.html#placeholder-associated-types].
|
||||||
check_types(
|
check_types(
|
||||||
r#"
|
r#"
|
||||||
pub trait ApplyL {
|
pub trait ApplyL {
|
||||||
|
@ -923,13 +924,13 @@ impl<T> ApplyL for RefMutL<T> {
|
||||||
fn test<T: ApplyL>() {
|
fn test<T: ApplyL>() {
|
||||||
let y: <RefMutL<T> as ApplyL>::Out = no_matter;
|
let y: <RefMutL<T> as ApplyL>::Out = no_matter;
|
||||||
y;
|
y;
|
||||||
} //^ <T as ApplyL>::Out
|
} //^ ApplyL::Out<T>
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn associated_type_inlay_hints_2() {
|
fn associated_type_placeholder_2() {
|
||||||
check_types(
|
check_types(
|
||||||
r#"
|
r#"
|
||||||
pub trait ApplyL {
|
pub trait ApplyL {
|
||||||
|
@ -940,7 +941,7 @@ fn foo<T: ApplyL>(t: T) -> <T as ApplyL>::Out;
|
||||||
fn test<T: ApplyL>(t: T) {
|
fn test<T: ApplyL>(t: T) {
|
||||||
let y = foo(t);
|
let y = foo(t);
|
||||||
y;
|
y;
|
||||||
} //^ <T as ApplyL>::Out
|
} //^ ApplyL::Out<T>
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue