]> git.lizzy.rs Git - rust.git/blob - src/test/ui/stability-attribute/stable-in-unstable.rs
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / stability-attribute / stable-in-unstable.rs
1 // This test is meant to test that we can have a stable item in an unstable module, and that
2 // calling that item through the unstable module is unstable, but that re-exporting it from another
3 // crate in a stable module is fine.
4 //
5 // This is necessary to support moving items from `std` into `core` or `alloc` unstably while still
6 // exporting the original stable interface in `std`, such as moving `Error` into `core`.
7 //
8 // aux-build:stable-in-unstable-core.rs
9 // aux-build:stable-in-unstable-std.rs
10 #![crate_type = "lib"]
11
12 extern crate stable_in_unstable_core;
13 extern crate stable_in_unstable_std;
14
15 mod isolated1 {
16     use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature 'unstable_test_feature'
17     use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
18 }
19
20 mod isolated2 {
21     use stable_in_unstable_std::old_stable_module::OldTrait;
22
23     struct LocalType;
24
25     impl OldTrait for LocalType {}
26 }
27
28 mod isolated3 {
29     use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
30
31     struct LocalType;
32
33     impl OldTrait for LocalType {}
34 }
35
36 mod isolated4 {
37     struct LocalType;
38
39     impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature 'unstable_test_feature'
40 }
41
42 mod isolated5 {
43     struct LocalType;
44
45     impl stable_in_unstable_std::old_stable_module::OldTrait for LocalType {}
46 }
47
48 mod isolated6 {
49     use stable_in_unstable_core::new_unstable_module::{OldTrait}; //~ ERROR use of unstable library feature 'unstable_test_feature'
50 }
51
52 mod isolated7 {
53     use stable_in_unstable_core::new_unstable_module::*; //~ ERROR use of unstable library feature 'unstable_test_feature'
54 }