Skip to content

Commit

Permalink
Rollup merge of rust-lang#69031 - Centril:dyntest, r=eddyb
Browse files Browse the repository at this point in the history
Use `dyn Trait` more in tests

Here are some tests using the old trait object type syntax which are not testing the syntax itself.

This has been extracted from rust-lang#66364.
  • Loading branch information
Dylan-DPC authored Feb 11, 2020
2 parents d8b4abc + 75afd0b commit dc98cb0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/test/ui/hygiene/assoc_ty_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ trait Derived: Base {
}

macro mac() {
type A = Base<AssocTy = u8>;
type B = Derived<AssocTy = u8>;
type A = dyn Base<AssocTy = u8>;
type B = dyn Derived<AssocTy = u8>;

impl Base for u8 {
type AssocTy = u8;
Expand Down
16 changes: 8 additions & 8 deletions src/test/ui/privacy/associated-item-privacy-type-binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ mod priv_trait {
pub trait PubTr: PrivTr {}

pub macro mac1() {
let _: Box<PubTr<AssocTy = u8>>;
let _: Box<dyn PubTr<AssocTy = u8>>;
//~^ ERROR trait `priv_trait::PrivTr` is private
//~| ERROR trait `priv_trait::PrivTr` is private
type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
type InSignatureTy2 = Box<dyn PubTr<AssocTy = u8>>;
//~^ ERROR trait `priv_trait::PrivTr` is private
trait InSignatureTr2: PubTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private
}
pub macro mac2() {
let _: Box<PrivTr<AssocTy = u8>>;
let _: Box<dyn PrivTr<AssocTy = u8>>;
//~^ ERROR trait `priv_trait::PrivTr` is private
//~| ERROR trait `priv_trait::PrivTr` is private
type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
type InSignatureTy1 = Box<dyn PrivTr<AssocTy = u8>>;
//~^ ERROR trait `priv_trait::PrivTr` is private
trait InSignatureTr1: PrivTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private
Expand All @@ -41,15 +41,15 @@ mod priv_parent_substs {
pub trait PubTr: PubTrWithParam<Priv> {}

pub macro mac() {
let _: Box<PubTrWithParam<AssocTy = u8>>;
let _: Box<dyn PubTrWithParam<AssocTy = u8>>;
//~^ ERROR type `priv_parent_substs::Priv` is private
//~| ERROR type `priv_parent_substs::Priv` is private
let _: Box<PubTr<AssocTy = u8>>;
let _: Box<dyn PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_parent_substs::Priv` is private
//~| ERROR type `priv_parent_substs::Priv` is private
pub type InSignatureTy1 = Box<PubTrWithParam<AssocTy = u8>>;
pub type InSignatureTy1 = Box<dyn PubTrWithParam<AssocTy = u8>>;
//~^ ERROR type `priv_parent_substs::Priv` is private
pub type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
pub type InSignatureTy2 = Box<dyn PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_parent_substs::Priv` is private
trait InSignatureTr1: PubTrWithParam<AssocTy = u8> {}
//~^ ERROR type `priv_parent_substs::Priv` is private
Expand Down
40 changes: 20 additions & 20 deletions src/test/ui/privacy/associated-item-privacy-type-binding.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:11:13
|
LL | let _: Box<PubTr<AssocTy = u8>>;
LL | let _: Box<dyn PubTr<AssocTy = u8>>;
| ^
...
LL | priv_trait::mac1!();
Expand All @@ -12,8 +12,8 @@ LL | priv_trait::mac1!();
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:11:16
|
LL | let _: Box<PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | let _: Box<dyn PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
Expand All @@ -23,8 +23,8 @@ LL | priv_trait::mac1!();
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:14:31
|
LL | type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | type InSignatureTy2 = Box<dyn PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_trait::mac1!();
| -------------------- in this macro invocation
Expand All @@ -45,7 +45,7 @@ LL | priv_trait::mac1!();
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:20:13
|
LL | let _: Box<PrivTr<AssocTy = u8>>;
LL | let _: Box<dyn PrivTr<AssocTy = u8>>;
| ^
...
LL | priv_trait::mac2!();
Expand All @@ -56,8 +56,8 @@ LL | priv_trait::mac2!();
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:20:16
|
LL | let _: Box<PrivTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | let _: Box<dyn PrivTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
Expand All @@ -67,8 +67,8 @@ LL | priv_trait::mac2!();
error: trait `priv_trait::PrivTr` is private
--> $DIR/associated-item-privacy-type-binding.rs:23:31
|
LL | type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type InSignatureTy1 = Box<dyn PrivTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_trait::mac2!();
| -------------------- in this macro invocation
Expand All @@ -89,7 +89,7 @@ LL | priv_trait::mac2!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:44:13
|
LL | let _: Box<PubTrWithParam<AssocTy = u8>>;
LL | let _: Box<dyn PubTrWithParam<AssocTy = u8>>;
| ^
...
LL | priv_parent_substs::mac!();
Expand All @@ -100,8 +100,8 @@ LL | priv_parent_substs::mac!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:44:16
|
LL | let _: Box<PubTrWithParam<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | let _: Box<dyn PubTrWithParam<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
Expand All @@ -111,7 +111,7 @@ LL | priv_parent_substs::mac!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:47:13
|
LL | let _: Box<PubTr<AssocTy = u8>>;
LL | let _: Box<dyn PubTr<AssocTy = u8>>;
| ^
...
LL | priv_parent_substs::mac!();
Expand All @@ -122,8 +122,8 @@ LL | priv_parent_substs::mac!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:47:16
|
LL | let _: Box<PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | let _: Box<dyn PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
Expand All @@ -133,8 +133,8 @@ LL | priv_parent_substs::mac!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:50:35
|
LL | pub type InSignatureTy1 = Box<PubTrWithParam<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | pub type InSignatureTy1 = Box<dyn PubTrWithParam<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
Expand All @@ -144,8 +144,8 @@ LL | priv_parent_substs::mac!();
error: type `priv_parent_substs::Priv` is private
--> $DIR/associated-item-privacy-type-binding.rs:52:35
|
LL | pub type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | pub type InSignatureTy2 = Box<dyn PubTr<AssocTy = u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | priv_parent_substs::mac!();
| --------------------------- in this macro invocation
Expand Down

0 comments on commit dc98cb0

Please sign in to comment.