2020-03-09 16:56:20 -05:00
|
|
|
#![feature(cfg_accessible)]
|
|
|
|
|
|
|
|
mod m {
|
|
|
|
pub struct ExistingPublic;
|
|
|
|
struct ExistingPrivate;
|
|
|
|
}
|
|
|
|
|
2022-05-20 14:27:34 -05:00
|
|
|
trait Trait {
|
|
|
|
type Assoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Enum {
|
|
|
|
Existing,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_accessible(Enum)]
|
|
|
|
struct ExistingResolved;
|
|
|
|
|
|
|
|
#[cfg_accessible(Enum::Existing)]
|
|
|
|
struct ExistingResolvedVariant;
|
|
|
|
|
2020-03-09 16:56:20 -05:00
|
|
|
#[cfg_accessible(m::ExistingPublic)]
|
|
|
|
struct ExistingPublic;
|
|
|
|
|
2022-05-20 14:27:34 -05:00
|
|
|
#[cfg_accessible(m::ExistingPrivate)]
|
2020-03-09 16:56:20 -05:00
|
|
|
struct ExistingPrivate;
|
|
|
|
|
2022-05-20 14:27:34 -05:00
|
|
|
#[cfg_accessible(m::NonExistent)]
|
|
|
|
struct NonExistingPrivate;
|
2020-03-09 16:56:20 -05:00
|
|
|
|
|
|
|
#[cfg_accessible(n::AccessibleExpanded)] // OK, `cfg_accessible` can wait and retry.
|
|
|
|
struct AccessibleExpanded;
|
|
|
|
|
2022-05-20 14:27:34 -05:00
|
|
|
#[cfg_accessible(Trait::Assoc)]
|
|
|
|
struct AccessibleTraitAssoc;
|
|
|
|
|
2020-03-09 16:56:20 -05:00
|
|
|
macro_rules! generate_accessible_expanded {
|
|
|
|
() => {
|
|
|
|
mod n {
|
|
|
|
pub struct AccessibleExpanded;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
generate_accessible_expanded!();
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
ExistingPublic;
|
|
|
|
AccessibleExpanded;
|
2022-05-20 14:27:34 -05:00
|
|
|
AccessibleTraitAssoc;
|
|
|
|
|
|
|
|
ExistingPrivate; //~ ERROR cannot find
|
|
|
|
NonExistingPrivate; //~ ERROR cannot find
|
|
|
|
NonExistingTraitAlias; //~ ERROR cannot find
|
2020-03-09 16:56:20 -05:00
|
|
|
}
|