mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
bless privacy tests (only diagnostic duplication)
This commit is contained in:
@@ -15,6 +15,7 @@ impl<const U: u8> Trait for Const<U> // OK, trait impl predicates
|
||||
{
|
||||
type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
//~^ ERROR private type
|
||||
//~| ERROR private type
|
||||
fn assoc_fn() -> Self::AssocTy {
|
||||
Const
|
||||
}
|
||||
|
||||
@@ -7,6 +7,17 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/eval-privacy.rs:16:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
...
|
||||
LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0446`.
|
||||
|
||||
@@ -74,6 +74,7 @@ impl<const U: u8> Trait for Const<U>
|
||||
{
|
||||
type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
//~^ ERROR private type
|
||||
//~| ERROR private type
|
||||
fn assoc_fn() -> Self::AssocTy {
|
||||
Const
|
||||
}
|
||||
|
||||
@@ -77,6 +77,17 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
||||
error: aborting due to 1 previous error; 5 warnings emitted
|
||||
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
|
||||
--> $DIR/where-priv-type.rs:75:5
|
||||
|
|
||||
LL | type AssocTy = Const<{ my_const_fn(U) }>;
|
||||
| ^^^^^^^^^^^^ can't leak private type
|
||||
...
|
||||
LL | const fn my_const_fn(val: u8) -> u8 {
|
||||
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 2 previous errors; 5 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0446`.
|
||||
|
||||
Reference in New Issue
Block a user