mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-14 04:56:49 +00:00
Better account for associated const found for fn call expr
This commit is contained in:
parent
76885673d6
commit
14277ef201
@ -1421,7 +1421,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if let Mode::Path = mode {
|
||||
} else if let Mode::Path = mode
|
||||
&& args.unwrap_or(&[]).is_empty()
|
||||
{
|
||||
// We have an associated item syntax and we found something that isn't an fn.
|
||||
err.span_suggestion_verbose(
|
||||
span,
|
||||
|
@ -58,14 +58,15 @@ LL | S::a(&S);
|
||||
| ^ function or associated item not found in `S`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
help: there is an associated constant `B` with a similar name
|
||||
--> $DIR/item-privacy.rs:29:9
|
||||
|
|
||||
LL | const B: u8 = 0;
|
||||
| ^^^^^^^^^^^
|
||||
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
||||
|
|
||||
LL + use method::A;
|
||||
|
|
||||
help: there is an associated constant with a similar name
|
||||
|
|
||||
LL | S::B(&S);
|
||||
| ~
|
||||
|
||||
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
|
||||
--> $DIR/item-privacy.rs:80:8
|
||||
@ -77,14 +78,15 @@ LL | S::b(&S);
|
||||
| ^ function or associated item not found in `S`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is in scope
|
||||
help: there is an associated constant `B` with a similar name
|
||||
--> $DIR/item-privacy.rs:29:9
|
||||
|
|
||||
LL | const B: u8 = 0;
|
||||
| ^^^^^^^^^^^
|
||||
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
||||
|
|
||||
LL + use method::B;
|
||||
|
|
||||
help: there is an associated constant with a similar name
|
||||
|
|
||||
LL | S::B(&S);
|
||||
| ~
|
||||
|
||||
error[E0624]: method `a` is private
|
||||
--> $DIR/item-privacy.rs:84:14
|
||||
|
Loading…
Reference in New Issue
Block a user