File: allow-unstable-reexport.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 (30 lines) | stat: -rw-r--r-- 1,221 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
// Allow an unstable re-export without requiring a feature gate.
// #94972

//@ aux-build:lint-stability.rs
//@ aux-build:lint-stability-reexport.rs
#![feature(staged_api)]
#![stable(feature = "lint_stability", since = "1.0.0")]

extern crate lint_stability;
extern crate lint_stability_reexport;

#[unstable(feature = "unstable_test_feature", issue = "none")]
pub use lint_stability::unstable;

// We want to confirm that using a re-export through another crate behaves
// the same way as using an item directly
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub use lint_stability_reexport::unstable_text;

// Ensure items which aren't marked as unstable can't re-export unstable items
#[stable(feature = "lint_stability", since = "1.0.0")]
pub use lint_stability::unstable as unstable2;
//~^ ERROR use of unstable library feature `unstable_test_feature`

fn main() {
    // Since we didn't enable the feature in this crate, we still can't
    // use these items, even though they're in scope from the `use`s which are now allowed.
    unstable(); //~ ERROR use of unstable library feature `unstable_test_feature`
    unstable_text(); //~ ERROR use of unstable library feature `unstable_test_feature`
}