mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
31bc7e2c47
Rollup of 7 pull requests Successful merges: - #116862 (Detect when trait is implemented for type and suggest importing it) - #117389 (Some diagnostics improvements of `gen` blocks) - #117396 (Don't treat closures/coroutine types as part of the public API) - #117398 (Correctly handle nested or-patterns in exhaustiveness) - #117403 (Poison check_well_formed if method receivers are invalid to prevent typeck from running on it) - #117411 (Improve some diagnostics around `?Trait` bounds) - #117414 (Don't normalize to an un-revealed opaque when we hit the recursion limit) r? `@ghost` `@rustbot` modify labels: rollup
187 lines
5.8 KiB
Plaintext
187 lines
5.8 KiB
Plaintext
error[E0599]: no method named `a` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:67:7
|
|
|
|
|
LL | struct S;
|
|
| -------- method `a` not found for this struct
|
|
...
|
|
LL | S.a();
|
|
| ^ method not found in `S`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use method::A;
|
|
|
|
|
|
|
error[E0599]: no method named `b` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:68:7
|
|
|
|
|
LL | struct S;
|
|
| -------- method `b` not found for this struct
|
|
...
|
|
LL | fn b(&self) { }
|
|
| - the method is available for `S` here
|
|
...
|
|
LL | S.b();
|
|
| ^ method not found in `S`
|
|
|
|
|
= help: items from traits can only be used if the trait is in scope
|
|
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use method::B;
|
|
|
|
|
|
|
error[E0624]: method `a` is private
|
|
--> $DIR/item-privacy.rs:72:7
|
|
|
|
|
LL | fn a(&self) { }
|
|
| ----------- private method defined here
|
|
...
|
|
LL | c.a();
|
|
| ^ private method
|
|
|
|
error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:78:8
|
|
|
|
|
LL | struct S;
|
|
| -------- function or associated item `a` not found for this struct
|
|
...
|
|
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: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use method::A;
|
|
|
|
|
|
|
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:80:8
|
|
|
|
|
LL | struct S;
|
|
| -------- function or associated item `b` not found for this struct
|
|
...
|
|
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: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use method::B;
|
|
|
|
|
|
|
error[E0624]: method `a` is private
|
|
--> $DIR/item-privacy.rs:84:14
|
|
|
|
|
LL | fn a(&self) { }
|
|
| ----------- private method defined here
|
|
...
|
|
LL | <dyn C>::a(&S);
|
|
| ^ private method
|
|
|
|
error[E0599]: no associated item named `A` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:97:8
|
|
|
|
|
LL | struct S;
|
|
| -------- associated item `A` not found for this struct
|
|
...
|
|
LL | S::A;
|
|
| ^ associated item not found in `S`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use assoc_const::A;
|
|
|
|
|
|
|
error[E0599]: no associated item named `B` found for struct `S` in the current scope
|
|
--> $DIR/item-privacy.rs:98:8
|
|
|
|
|
LL | struct S;
|
|
| -------- associated item `B` not found for this struct
|
|
...
|
|
LL | S::B;
|
|
| ^ associated item not found in `S`
|
|
|
|
|
= help: items from traits can only be used if the trait is in scope
|
|
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
|
|
|
|
LL + use assoc_const::B;
|
|
|
|
|
|
|
error[E0624]: associated constant `A` is private
|
|
--> $DIR/item-privacy.rs:101:14
|
|
|
|
|
LL | const A: u8 = 0;
|
|
| ----------- private associated constant defined here
|
|
...
|
|
LL | <dyn C>::A;
|
|
| ^ private associated constant
|
|
|
|
error[E0038]: the trait `assoc_const::C` cannot be made into an object
|
|
--> $DIR/item-privacy.rs:101:6
|
|
|
|
|
LL | <dyn C>::A;
|
|
| ^^^^^ `assoc_const::C` cannot be made into an object
|
|
|
|
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
|
--> $DIR/item-privacy.rs:25:15
|
|
|
|
|
LL | const A: u8 = 0;
|
|
| ^ ...because it contains this associated `const`
|
|
...
|
|
LL | const B: u8 = 0;
|
|
| ^ ...because it contains this associated `const`
|
|
...
|
|
LL | pub trait C: A + B {
|
|
| - this trait cannot be made into an object...
|
|
LL | const C: u8 = 0;
|
|
| ^ ...because it contains this associated `const`
|
|
= help: consider moving `C` to another trait
|
|
= help: consider moving `A` to another trait
|
|
= help: consider moving `B` to another trait
|
|
= help: only type `S` implements the trait, consider using it directly instead
|
|
|
|
error[E0223]: ambiguous associated type
|
|
--> $DIR/item-privacy.rs:115:12
|
|
|
|
|
LL | let _: S::A;
|
|
| ^^^^
|
|
|
|
|
help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path
|
|
|
|
|
LL | let _: <S as Example>::A;
|
|
| ~~~~~~~~~~~~~~~~~
|
|
|
|
error[E0223]: ambiguous associated type
|
|
--> $DIR/item-privacy.rs:116:12
|
|
|
|
|
LL | let _: S::B;
|
|
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
|
|
|
|
error[E0223]: ambiguous associated type
|
|
--> $DIR/item-privacy.rs:117:12
|
|
|
|
|
LL | let _: S::C;
|
|
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
|
|
|
|
error[E0624]: associated type `A` is private
|
|
--> $DIR/item-privacy.rs:119:12
|
|
|
|
|
LL | type A = u8;
|
|
| ------ associated type defined here
|
|
...
|
|
LL | let _: T::A;
|
|
| ^^^^ private associated type
|
|
|
|
error: associated type `A` is private
|
|
--> $DIR/item-privacy.rs:128:9
|
|
|
|
|
LL | A = u8,
|
|
| ^^^^^^ private associated type
|
|
|
|
error: aborting due to 15 previous errors
|
|
|
|
Some errors have detailed explanations: E0038, E0223, E0599, E0624.
|
|
For more information about an error, try `rustc --explain E0038`.
|