rust/tests/ui/traits/item-privacy.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

214 lines
6.5 KiB
Plaintext
Raw Normal View History

error[E0599]: no method named `a` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:67:7
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- method `a` not found for this struct
2018-08-08 12:28:26 +00:00
...
2019-03-09 12:03:44 +00:00
LL | S.a();
| ^
2018-08-08 12:28:26 +00:00
|
= help: items from traits can only be used if the trait is implemented and in scope
help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it
|
LL + use method::A;
2020-02-25 02:55:51 +00:00
|
help: there is a method `b` with a similar name
|
LL | S.b();
| ~
2018-08-08 12:28:26 +00:00
error[E0599]: no method named `b` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:68:7
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- method `b` not found for this struct
2018-08-08 12:28:26 +00:00
...
2021-04-24 01:24:02 +00:00
LL | fn b(&self) { }
| - the method is available for `S` here
...
2019-03-09 12:03:44 +00:00
LL | S.b();
| ^
2018-08-08 12:28:26 +00:00
|
= help: items from traits can only be used if the trait is in scope
help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it
2018-08-08 12:28:26 +00:00
|
2023-03-18 02:18:39 +00:00
LL + use method::B;
2018-08-08 12:28:26 +00:00
|
help: there is a method `c` with a similar name
|
LL | S.c();
| ~
2018-08-08 12:28:26 +00:00
error[E0624]: method `a` is private
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:72:7
2018-08-08 12:28:26 +00:00
|
LL | fn a(&self) { }
| ----------- private method defined here
...
2019-03-09 12:03:44 +00:00
LL | c.a();
| ^ private method
2018-08-08 12:28:26 +00:00
error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:78:8
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- function or associated item `a` not found for this struct
2018-08-08 12:28:26 +00:00
...
LL | S::a(&S);
2019-03-10 23:20:15 +00:00
| ^ function or associated item not found in `S`
2018-08-08 12:28:26 +00:00
|
= 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: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it
|
LL + use method::A;
2020-02-25 02:55:51 +00:00
|
2018-08-08 12:28:26 +00:00
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:80:8
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- function or associated item `b` not found for this struct
2018-08-08 12:28:26 +00:00
...
LL | S::b(&S);
2019-03-10 23:20:15 +00:00
| ^ function or associated item not found in `S`
2018-08-08 12:28:26 +00:00
|
= 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: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it
2018-08-08 12:28:26 +00:00
|
2023-03-18 02:18:39 +00:00
LL + use method::B;
2018-08-08 12:28:26 +00:00
|
error[E0624]: method `a` is private
--> $DIR/item-privacy.rs:84:14
2018-08-08 12:28:26 +00:00
|
LL | fn a(&self) { }
| ----------- private method defined here
...
LL | <dyn C>::a(&S);
| ^ private method
2018-08-08 12:28:26 +00:00
error[E0599]: no associated item named `A` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:97:8
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- associated item `A` not found for this struct
2018-08-08 12:28:26 +00:00
...
2019-03-09 12:03:44 +00:00
LL | S::A;
2019-03-10 23:20:15 +00:00
| ^ associated item not found in `S`
2018-08-08 12:28:26 +00:00
|
= help: items from traits can only be used if the trait is implemented and in scope
help: trait `A` which provides `A` is implemented but not in scope; perhaps you want to import it
|
LL + use assoc_const::A;
2020-02-25 02:55:51 +00:00
|
help: there is an associated constant `B` with a similar name
|
LL | S::B;
| ~
2018-08-08 12:28:26 +00:00
error[E0599]: no associated item named `B` found for struct `S` in the current scope
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:98:8
2018-08-08 12:28:26 +00:00
|
LL | struct S;
| -------- associated item `B` not found for this struct
2018-08-08 12:28:26 +00:00
...
2019-03-09 12:03:44 +00:00
LL | S::B;
2019-03-10 23:20:15 +00:00
| ^ associated item not found in `S`
2018-08-08 12:28:26 +00:00
|
= help: items from traits can only be used if the trait is in scope
help: there is a method `b` with a similar name
--> $DIR/item-privacy.rs:11:9
|
LL | fn b(&self) { }
| ^^^^^^^^^^^
help: trait `B` which provides `B` is implemented but not in scope; perhaps you want to import it
2018-08-08 12:28:26 +00:00
|
2023-03-18 02:18:39 +00:00
LL + use assoc_const::B;
2018-08-08 12:28:26 +00:00
|
error[E0624]: associated constant `A` is private
--> $DIR/item-privacy.rs:101:14
2018-08-08 12:28:26 +00:00
|
LL | const A: u8 = 0;
2022-02-13 15:27:59 +00:00
| ----------- private associated constant defined here
...
LL | <dyn C>::A;
| ^ private associated constant
2018-08-08 12:28:26 +00:00
error[E0038]: the trait `assoc_const::C` cannot be made into an object
--> $DIR/item-privacy.rs:101:6
2018-08-08 12:28:26 +00:00
|
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>
2021-02-08 22:15:45 +00:00
--> $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
2018-08-08 12:28:26 +00:00
error[E0223]: ambiguous associated type
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:115:12
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
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;
| ~~~~~~~~~~~~~~~~~
2018-08-08 12:28:26 +00:00
error[E0223]: ambiguous associated type
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:116:12
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _: S::B;
2023-10-16 18:25:11 +00:00
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
2018-08-08 12:28:26 +00:00
error[E0223]: ambiguous associated type
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:117:12
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _: S::C;
2023-10-16 18:25:11 +00:00
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
2018-08-08 12:28:26 +00:00
error[E0624]: associated type `A` is private
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:119:12
2018-08-08 12:28:26 +00:00
|
LL | type A = u8;
| ------ associated type defined here
...
2019-03-09 12:03:44 +00:00
LL | let _: T::A;
| ^^^^ private associated type
2018-08-08 12:28:26 +00:00
error: associated type `A` is private
2021-02-08 22:15:45 +00:00
--> $DIR/item-privacy.rs:128:9
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | A = u8,
| ^^^^^^ private associated type
2018-08-08 12:28:26 +00:00
error: aborting due to 15 previous errors
2018-08-08 12:28:26 +00:00
Some errors have detailed explanations: E0038, E0223, E0599, E0624.
2018-08-08 12:28:26 +00:00
For more information about an error, try `rustc --explain E0038`.