Add a test showing how `impl_trait_in_bindings` is a breaking change

This commit is contained in:
Oli Scherer 2021-03-12 10:54:12 +00:00
parent 1f7df1956a
commit 3abdb08351
4 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,17 @@
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-75053.rs:5:32
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-75053.rs:51:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error; 1 warning emitted

View File

@ -0,0 +1,24 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-75053.rs:7:34
|
LL | #![cfg_attr(in_bindings, feature(impl_trait_in_bindings))]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0282]: type annotations needed
--> $DIR/issue-75053.rs:53:38
|
LL | type O;
| ------- `<Self as MyIndex<T>>::O` defined here
...
LL | let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
| ^^^^^^^^^^-------------
| |
| this method call resolves to `<Self as MyIndex<T>>::O`
| cannot infer type for type parameter `T`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0282`.

View File

@ -0,0 +1,8 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-75053.rs:51:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -1,7 +1,11 @@
// compile-flags: -Z mir-opt-level=3
// build-pass
#![feature(min_type_alias_impl_trait)]
// revisions: min_tait full_tait in_bindings
#![feature(min_type_alias_impl_trait, rustc_attrs)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
#![cfg_attr(in_bindings, feature(impl_trait_in_bindings))]
//[in_bindings]~^ WARN incomplete
use std::marker::PhantomData;
@ -43,6 +47,9 @@ impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
}
}
#[rustc_error]
fn main() {
//[min_tait,full_tait]~^ ERROR rustc_error
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
//[in_bindings]~^ ERROR type annotations needed
}