File: explore-issue-38412.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (64 lines) | stat: -rw-r--r-- 2,405 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//@ aux-build:pub-and-stability.rs

// A big point of this test is that we *enable* `unstable_declared`,
// but do *not* enable `unstable_undeclared`. This way we can check
// that the compiler is letting in uses of enabled feature-gated
// stuff but still rejecting uses of disabled feature-gated stuff.
#![feature(unstable_declared)]

extern crate pub_and_stability;
use pub_and_stability::{Record, Trait, Tuple};

fn main() {
    // Okay
    let Record { .. } = Record::new();

    // Okay
    let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();

    let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
        Record::new();
    //~^^ ERROR use of unstable library feature `unstable_undeclared`

    let r = Record::new();
    let t = Tuple::new();

    r.a_stable_pub;
    r.a_unstable_declared_pub;
    r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
    r.b_crate;                   //~ ERROR is private
    r.c_mod;                     //~ ERROR is private
    r.d_priv;                    //~ ERROR is private

    t.0;
    t.1;
    t.2;                         //~ ERROR use of unstable library feature
    t.3;                         //~ ERROR is private
    t.4;                         //~ ERROR is private
    t.5;                         //~ ERROR is private

    r.stable_trait_method();
    r.unstable_declared_trait_method();
    r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature

    r.stable();
    r.unstable_declared();
    r.unstable_undeclared();              //~ ERROR use of unstable library feature

    r.pub_crate();                        //~ ERROR `pub_crate` is private
    r.pub_mod();                          //~ ERROR `pub_mod` is private
    r.private();                          //~ ERROR `private` is private

    let t = Tuple::new();
    t.stable_trait_method();
    t.unstable_declared_trait_method();
    t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature

    t.stable();
    t.unstable_declared();
    t.unstable_undeclared();              //~ ERROR use of unstable library feature

    t.pub_crate();                        //~ ERROR `pub_crate` is private
    t.pub_mod();                          //~ ERROR `pub_mod` is private
    t.private();                          //~ ERROR `private` is private
}