Skip to content

Commit 3672c13

Browse files
committed
Improve test
1 parent a7171a3 commit 3672c13

File tree

3 files changed

+87
-22
lines changed

3 files changed

+87
-22
lines changed
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
#![allow(internal_features)]
2-
3-
#![feature(impl_stability)]
4-
#![feature(trivial_bounds)] // TODO: figure out what is this
5-
1+
#![allow(internal_features)] // Enabled to use #![feature(staged_api)] and #![feature(impl_stability)]
2+
#![feature(staged_api)] // Enabled to use #![unstable(feature = "feat_foo", issue = "none")]
3+
#![feature(impl_stability)] // Enabled to use #[unstable_feature_bound(feat_foo)]
4+
#![unstable(feature = "feat_foo", issue = "none")]
65

76
pub trait Foo {
87
fn foo();
98
}
10-
119
pub struct Bar;
1210

13-
#[unstable_feature_bound(feat_foo)]
11+
// Annotate the impl as unstable.
12+
#[unstable_feature_bound(feat_foo)]
1413
impl Foo for Bar {
1514
fn foo() {}
1615
}
1716

18-
fn main() {}
17+
// Use the unstable impl inside std/core.
18+
#[unstable_feature_bound(feat_foo)]
19+
#[allow(dead_code)]
20+
fn bar() {
21+
Bar::foo();
22+
}
23+
24+
fn main() {
25+
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//@ aux-build:unstable_feature.rs
22

3-
#![feature(impl_stability)]
4-
#![feature(trivial_bounds)]
3+
extern crate unstable_feature; //~ ERROR: use of unstable library feature `feat_foo`
4+
use unstable_feature::{Foo, Bar}; //~ ERROR: use of unstable library feature `feat_foo`
5+
//~^ ERROR: use of unstable library feature `feat_foo`
6+
//~^^ ERROR: use of unstable library feature `feat_foo`
57

6-
extern crate unstable_feature;
7-
use unstable_feature::{Foo, Bar};
8-
9-
#[unstable_feature_bound(feat_foo)]
10-
fn main() { //~ ERROR: `main` function is not allowed to have a `where` clause
11-
Bar::foo();
8+
fn main() {
9+
Bar::foo(); //~ ERROR: type annotations needed: cannot satisfy `unstable feature: `feat_foo``
10+
//~^ ERROR: use of unstable library feature `feat_foo`
11+
//~^^ ERROR: use of unstable library feature `feat_foo`
1212
}
Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,67 @@
1-
error[E0646]: `main` function is not allowed to have a `where` clause
2-
--> $DIR/unstable-feature-bound.rs:10:10
1+
error[E0658]: use of unstable library feature `feat_foo`
2+
--> $DIR/unstable-feature-bound.rs:3:1
33
|
4-
LL | fn main() {
5-
| ^ `main` cannot have a `where` clause
4+
LL | extern crate unstable_feature;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
8+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9+
10+
error[E0658]: use of unstable library feature `feat_foo`
11+
--> $DIR/unstable-feature-bound.rs:4:24
12+
|
13+
LL | use unstable_feature::{Foo, Bar};
14+
| ^^^
15+
|
16+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
17+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
18+
19+
error[E0658]: use of unstable library feature `feat_foo`
20+
--> $DIR/unstable-feature-bound.rs:4:29
21+
|
22+
LL | use unstable_feature::{Foo, Bar};
23+
| ^^^
24+
|
25+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
26+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
27+
28+
error[E0658]: use of unstable library feature `feat_foo`
29+
--> $DIR/unstable-feature-bound.rs:4:29
30+
|
31+
LL | use unstable_feature::{Foo, Bar};
32+
| ^^^
33+
|
34+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
35+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
36+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
37+
38+
error[E0658]: use of unstable library feature `feat_foo`
39+
--> $DIR/unstable-feature-bound.rs:9:5
40+
|
41+
LL | Bar::foo();
42+
| ^^^
43+
|
44+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
45+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
46+
47+
error[E0658]: use of unstable library feature `feat_foo`
48+
--> $DIR/unstable-feature-bound.rs:9:5
49+
|
50+
LL | Bar::foo();
51+
| ^^^^^^^^
52+
|
53+
= help: add `#![feature(feat_foo)]` to the crate attributes to enable
54+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
55+
56+
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_foo``
57+
--> $DIR/unstable-feature-bound.rs:9:5
58+
|
59+
LL | Bar::foo();
60+
| ^^^ cannot satisfy `unstable feature: `feat_foo``
61+
|
62+
= note: required for `Bar` to implement `Foo`
663

7-
error: aborting due to 1 previous error
64+
error: aborting due to 7 previous errors
865

9-
For more information about this error, try `rustc --explain E0646`.
66+
Some errors have detailed explanations: E0284, E0658.
67+
For more information about an error, try `rustc --explain E0284`.

0 commit comments

Comments
 (0)