forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
respect visibility & stability of inherent associated types
- Loading branch information
Showing
7 changed files
with
122 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/test/ui/associated-inherent-types/assoc-inherent-private.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![feature(inherent_associated_types)] | ||
#![allow(incomplete_features)] | ||
|
||
mod m { | ||
pub struct T; | ||
impl T { | ||
type P = (); | ||
} | ||
} | ||
type U = m::T::P; //~ ERROR associated type `P` is private | ||
|
||
mod n { | ||
pub mod n { | ||
pub struct T; | ||
impl T { | ||
pub(super) type P = bool; | ||
} | ||
} | ||
type U = n::T::P; | ||
} | ||
type V = n::n::T::P; //~ ERROR associated type `P` is private | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/associated-inherent-types/assoc-inherent-private.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0624]: associated type `P` is private | ||
--> $DIR/assoc-inherent-private.rs:10:10 | ||
| | ||
LL | type P = (); | ||
| ------ associated type defined here | ||
... | ||
LL | type U = m::T::P; | ||
| ^^^^^^^ private associated type | ||
|
||
error[E0624]: associated type `P` is private | ||
--> $DIR/assoc-inherent-private.rs:21:10 | ||
| | ||
LL | pub(super) type P = bool; | ||
| ----------------- associated type defined here | ||
... | ||
LL | type V = n::n::T::P; | ||
| ^^^^^^^^^^ private associated type | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0624`. |
6 changes: 6 additions & 0 deletions
6
src/test/ui/associated-inherent-types/assoc-inherent-unstable.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// aux-crate:aux=assoc-inherent-unstable.rs | ||
// edition: 2021 | ||
|
||
type Data = aux::Owner::Data; //~ ERROR use of unstable library feature 'data' | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/associated-inherent-types/assoc-inherent-unstable.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0658]: use of unstable library feature 'data' | ||
--> $DIR/assoc-inherent-unstable.rs:4:13 | ||
| | ||
LL | type Data = aux::Owner::Data; | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add `#![feature(data)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
11 changes: 11 additions & 0 deletions
11
src/test/ui/associated-inherent-types/auxiliary/assoc-inherent-unstable.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(staged_api)] | ||
#![feature(inherent_associated_types)] | ||
#![stable(feature = "main", since = "1.0.0")] | ||
|
||
#[stable(feature = "main", since = "1.0.0")] | ||
pub struct Owner; | ||
|
||
impl Owner { | ||
#[unstable(feature = "data", issue = "none")] | ||
pub type Data = (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters