mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Collect inherent impls in unnamed consts
This commit is contained in:
parent
b777d46ae6
commit
20c27dbdbe
2 changed files with 62 additions and 17 deletions
|
@ -1294,7 +1294,7 @@ mod b {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn impl_in_unnamed_const() {
|
||||
fn trait_impl_in_unnamed_const() {
|
||||
check_types(
|
||||
r#"
|
||||
struct S;
|
||||
|
@ -1314,3 +1314,38 @@ fn f() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inherent_impl_in_unnamed_const() {
|
||||
check_types(
|
||||
r#"
|
||||
struct S;
|
||||
|
||||
const _: () = {
|
||||
impl S {
|
||||
fn method(&self) -> u16 { 0 }
|
||||
|
||||
pub(super) fn super_method(&self) -> u16 { 0 }
|
||||
|
||||
pub(crate) fn crate_method(&self) -> u16 { 0 }
|
||||
|
||||
pub fn pub_method(&self) -> u16 { 0 }
|
||||
}
|
||||
};
|
||||
|
||||
fn f() {
|
||||
S.method();
|
||||
//^^^^^^^^^^ u16
|
||||
|
||||
S.super_method();
|
||||
//^^^^^^^^^^^^^^^^ u16
|
||||
|
||||
S.crate_method();
|
||||
//^^^^^^^^^^^^^^^^ u16
|
||||
|
||||
S.pub_method();
|
||||
//^^^^^^^^^^^^^^ u16
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue