Skip to content

Commit a86aa75

Browse files
committed
Second batch of tests
1 parent 21eb7d3 commit a86aa75

8 files changed

+94
-4
lines changed

tests/ui/internal/unstable-feature-bound.stderr renamed to tests/ui/internal/unstable-feature-cross-crate-exact-symbol.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_moo``
2-
--> $DIR/unstable-feature-bound.rs:11:5
2+
--> $DIR/unstable-feature-cross-crate-exact-symbol.rs:11:5
33
|
4-
LL | Moo::foo();
4+
LL | Moo::foo();
55
| ^^^ cannot satisfy `unstable feature: `feat_moo``
66
|
77
= note: required for `Moo` to implement `Foo`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ aux-build:unstable_feature.rs
2+
//@ check-pass
3+
#![feature(feat_bar, feat_moo)]
4+
extern crate unstable_feature;
5+
use unstable_feature::{Foo, Bar, Moo};
6+
7+
/// Bar::foo() should still be usable even if we enable multiple feature.
8+
9+
fn main() {
10+
Bar::foo();
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ aux-build:unstable_feature.rs
2+
3+
extern crate unstable_feature;
4+
use unstable_feature::{Foo, Bar};
5+
6+
/// #[feature(..)] is required to use unstable impl.
7+
/// FIXME: write check-pass variant
8+
9+
fn main() {
10+
Bar::foo();
11+
//~^ ERROR: cannot satisfy `unstable feature: `feat_bar``
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_bar``
2+
--> $DIR/unstable-feature-cross-crate-require-bound.rs:10:5
3+
|
4+
LL | Bar::foo();
5+
| ^^^ cannot satisfy `unstable feature: `feat_bar``
6+
|
7+
= note: required for `Bar` to implement `Foo`
8+
9+
error: aborting due to 1 previous error
10+
11+
For more information about this error, try `rustc --explain E0284`.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#![allow(internal_features)]
2+
#![feature(staged_api)]
3+
#![feature(impl_stability)]
4+
#![allow(dead_code)]
5+
#![unstable(feature = "feat_foo", issue = "none" )]
6+
7+
/// In staged-api crate, impl that is marked with `feat_moo`
8+
/// should not be accessible if only `feat_foo` is enabled.
9+
10+
/// FIXME: add one more check pass test with revision?
11+
12+
pub trait Foo {
13+
fn foo();
14+
}
15+
16+
pub trait Moo {
17+
fn moo();
18+
}
19+
20+
pub struct Bar;
21+
22+
#[unstable_feature_bound(feat_foo)]
23+
impl Foo for Bar {
24+
fn foo() {}
25+
}
26+
27+
#[unstable_feature_bound(feat_moo)]
28+
impl Moo for Bar {
29+
fn moo() {}
30+
}
31+
32+
#[unstable_feature_bound(feat_foo)]
33+
fn bar() {
34+
Bar::foo();
35+
Bar::moo();
36+
//~^ ERROR cannot satisfy `unstable feature: `feat_moo``
37+
}
38+
39+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_moo``
2+
--> $DIR/unstable-feature-exact-symbol.rs:35:5
3+
|
4+
LL | Bar::moo();
5+
| ^^^ cannot satisfy `unstable feature: `feat_moo``
6+
|
7+
note: required for `Bar` to implement `Moo`
8+
--> $DIR/unstable-feature-exact-symbol.rs:28:6
9+
|
10+
LL | #[unstable_feature_bound(feat_moo)]
11+
| ----------------------------------- unsatisfied trait bound introduced here
12+
LL | impl Moo for Bar {
13+
| ^^^ ^^^
14+
15+
error: aborting due to 1 previous error
16+
17+
For more information about this error, try `rustc --explain E0284`.

tests/ui/internal/unstable-impl-require-bound.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0284]: type annotations needed: cannot satisfy `unstable feature: `feat_foo``
2-
--> $DIR/unstable-impl-require-bound.rs:23:5
2+
--> $DIR/unstable-impl-require-bound.rs:24:5
33
|
44
LL | Bar::foo();
55
| ^^^ cannot satisfy `unstable feature: `feat_foo``
66
|
77
note: required for `Bar` to implement `Foo`
8-
--> $DIR/unstable-impl-require-bound.rs:18:6
8+
--> $DIR/unstable-impl-require-bound.rs:19:6
99
|
1010
LL | #[unstable_feature_bound(feat_foo)]
1111
| ----------------------------------- unsatisfied trait bound introduced here

0 commit comments

Comments
 (0)