Skip to content

Commit 72c5810

Browse files
committed
Test unstable feature bound
1 parent 0a3c00b commit 72c5810

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

tests/ui/internal/auxiliary/unstable_feature.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#![allow(internal_features)] // Enabled to use #![feature(staged_api)] and #![feature(impl_stability)]
22
#![feature(staged_api)] // Enabled to use #![unstable(feature = "feat_foo", issue = "none")]
33
#![feature(impl_stability)] // Enabled to use #[unstable_feature_bound(feat_foo)]
4-
#![unstable(feature = "feat_foo", issue = "none")]
4+
#![allow(dead_code)]
5+
#![unstable(feature = "feat_foo", issue = "none" )]
56

7+
#[stable(feature = "a", since = "1.1.1" )]
68
pub trait Foo {
9+
#[stable(feature = "a", since = "1.1.1" )]
710
fn foo();
811
}
12+
#[stable(feature = "a", since = "1.1.1" )]
913
pub struct Bar;
1014

1115
// Annotate the impl as unstable.
@@ -16,7 +20,6 @@ impl Foo for Bar {
1620

1721
// Use the unstable impl inside std/core.
1822
#[unstable_feature_bound(feat_foo)]
19-
#[allow(dead_code)]
2023
fn bar() {
2124
Bar::foo();
2225
}

tests/ui/internal/unstable-feature-bound.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ use unstable_feature::{Foo, Bar}; //~ ERROR: use of unstable library feature `fe
77

88
fn main() {
99
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`
1210
}

tests/ui/internal/unstable-feature-bound.stderr

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ LL | use unstable_feature::{Foo, Bar};
3535
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3636
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3737

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-
5638
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_foo``
5739
--> $DIR/unstable-feature-bound.rs:9:5
5840
|
@@ -61,7 +43,7 @@ LL | Bar::foo();
6143
|
6244
= note: required for `Bar` to implement `Foo`
6345

64-
error: aborting due to 7 previous errors
46+
error: aborting due to 5 previous errors
6547

6648
Some errors have detailed explanations: E0284, E0658.
6749
For more information about an error, try `rustc --explain E0284`.

0 commit comments

Comments
 (0)