Make sure feature gate errors are recoverable (take 2)

This commit is contained in:
Vadim Petrochenkov 2019-01-02 17:14:24 +03:00
parent af2c159cc3
commit 10a00e120d
54 changed files with 244 additions and 128 deletions

View File

@ -2839,7 +2839,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.impl_polarity(def_id1) == self.impl_polarity(def_id2)
&& trait1_is_empty
&& trait2_is_empty
} else if self.features().marker_trait_attr {
} else {
let is_marker_impl = |def_id: DefId| -> bool {
let trait_ref = self.impl_trait_ref(def_id);
trait_ref.map_or(false, |tr| self.trait_def(tr.def_id).is_marker)
@ -2847,8 +2847,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.impl_polarity(def_id1) == self.impl_polarity(def_id2)
&& is_marker_impl(def_id1)
&& is_marker_impl(def_id2)
} else {
false
};
if is_legit {

View File

@ -1098,23 +1098,20 @@ where
ast_validation::check_crate(sess, &krate)
});
time(sess, "name resolution", || -> CompileResult {
time(sess, "name resolution", || {
resolver.resolve_crate(&krate);
Ok(())
})?;
});
// Needs to go *after* expansion to be able to check the results of macro expansion.
time(sess, "complete gated feature checking", || {
sess.track_errors(|| {
syntax::feature_gate::check_crate(
&krate,
&sess.parse_sess,
&sess.features_untracked(),
&attributes,
sess.opts.unstable_features,
);
})
})?;
syntax::feature_gate::check_crate(
&krate,
&sess.parse_sess,
&sess.features_untracked(),
&attributes,
sess.opts.unstable_features,
);
});
// Lower ast -> hir.
// First, we need to collect the dep_graph.

View File

@ -1,8 +1,8 @@
//
// compile-flags: --cfg broken
// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
// compile-flags: --cfg broken
#![crate_type = "lib"]
#![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental
fn main() { }
pub struct S {}

View File

@ -1,7 +1,7 @@
//
// compile-flags: --cfg broken
#![feature(cfg_attr_multi)]
#![crate_type = "lib"]
#![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
fn main() { }
pub struct S {}

View File

@ -1,7 +1,7 @@
//
// compile-flags: --cfg broken
#![feature(cfg_attr_multi)]
#![crate_type = "lib"]
#![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
fn main() { }
pub struct S {}

View File

@ -9,3 +9,6 @@ use core::alloc::Layout;
fn oom(info: Layout) -> ! {
loop {}
}
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }

View File

@ -5,3 +5,4 @@ fn ok_to_fail() {
assert!(false);
}
fn main() {}

View File

@ -6,5 +6,5 @@ async fn foo() {} //~ ERROR async fn is unstable
fn main() {
let _ = async {}; //~ ERROR cannot find struct, variant or union type `async`
let _ = async || {}; //~ ERROR cannot find value `async` in this scope
let _ = async || { true }; //~ ERROR cannot find value `async` in this scope
}

View File

@ -7,7 +7,7 @@ LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `
error[E0425]: cannot find value `async` in this scope
--> $DIR/feature-gate-async-await-2015-edition.rs:9:13
|
LL | let _ = async || {}; //~ ERROR cannot find value `async` in this scope
LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope
| ^^^^^ not found in this scope
error[E0658]: async fn is unstable (see issue #50547)

View File

@ -9,14 +9,16 @@ trait Foo {
//~| ERROR trait fns cannot be declared const
}
impl Foo {
const fn baz() -> u32 { 0 } // ok
}
impl Foo for u32 {
const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
}
trait Bar {}
impl dyn Bar {
const fn baz() -> u32 { 0 } // ok
}
static FOO: usize = foo();
const BAR: usize = foo();

View File

@ -11,7 +11,7 @@ LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^ trait fns cannot be const
error[E0379]: trait fns cannot be declared const
--> $DIR/feature-gate-const_fn.rs:17:5
--> $DIR/feature-gate-const_fn.rs:13:5
|
LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
| ^^^^^ trait fns cannot be const

View File

@ -1,3 +1,5 @@
#[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental
/// wonderful
mod foo{}
fn main() {}

View File

@ -1,14 +1,11 @@
// gate-test-dropck_parametricity
// Ensure that attempts to use the unsafe attribute are feature-gated.
// Example adapted from RFC 1238 text (just left out the feature gate).
// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
// #example-of-the-unguarded-escape-hatch
// #![feature(dropck_parametricity)]
use std::cell::Cell;
struct Concrete<'a>(u32, Cell<Option<&'a Concrete<'a>>>);
@ -18,6 +15,7 @@ struct Foo<T> { data: Vec<T> }
impl<T> Drop for Foo<T> {
#[unsafe_destructor_blind_to_params] // This is the UGEH attribute
//~^ ERROR unsafe_destructor_blind_to_params has been replaced
//~| WARN use of deprecated attribute `dropck_parametricity`
fn drop(&mut self) { }
}
@ -29,4 +27,3 @@ fn main() {
foo.data[0].1.set(Some(&foo.data[1]));
foo.data[1].1.set(Some(&foo.data[0]));
}

View File

@ -1,11 +1,19 @@
error[E0658]: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future (see issue #28498)
--> $DIR/feature-gate-dropck-ugeh.rs:19:5
--> $DIR/feature-gate-dropck-ugeh.rs:16:5
|
LL | #[unsafe_destructor_blind_to_params] // This is the UGEH attribute
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(dropck_parametricity)] to the crate attributes to enable
warning: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761
--> $DIR/feature-gate-dropck-ugeh.rs:16:5
|
LL | #[unsafe_destructor_blind_to_params] // This is the UGEH attribute
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]`
|
= note: #[warn(deprecated)] on by default
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,15 +1,17 @@
// Check that existential types must be ungated to use the `existential` keyword
existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable
trait Bar {
type Baa: std::fmt::Debug;
fn define() -> Self::Baa;
}
impl Bar for () {
existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable
fn define() -> Self::Baa { 0 }
}
fn define() -> Foo { 0 }
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0658]: existential types are unstable (see issue #34511)
--> $DIR/feature-gate-existential-type.rs:5:1
--> $DIR/feature-gate-existential-type.rs:3:1
|
LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unst
= help: add #![feature(existential_type)] to the crate attributes to enable
error[E0658]: existential types are unstable (see issue #34511)
--> $DIR/feature-gate-existential-type.rs:12:5
--> $DIR/feature-gate-existential-type.rs:11:5
|
LL | existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,3 +1,4 @@
fn main() {
yield true; //~ ERROR yield syntax is experimental
//~^ ERROR yield statement outside of generator literal
}

View File

@ -6,6 +6,13 @@ LL | yield true; //~ ERROR yield syntax is experimental
|
= help: add #![feature(generators)] to the crate attributes to enable
error: aborting due to previous error
error[E0627]: yield statement outside of generator literal
--> $DIR/feature-gate-generators.rs:2:5
|
LL | yield true; //~ ERROR yield syntax is experimental
| ^^^^^^^^^^
For more information about this error, try `rustc --explain E0658`.
error: aborting due to 2 previous errors
Some errors occurred: E0627, E0658.
For more information about an error, try `rustc --explain E0627`.

View File

@ -11,9 +11,9 @@ trait PointerFamily<U> {
struct Foo;
impl PointerFamily<u32> for Foo {
type Pointer<usize> = Box<usize>;
type Pointer<Usize> = Box<Usize>;
//~^ ERROR generic associated types are unstable
type Pointer2<u32> = Box<u32>;
type Pointer2<U32> = Box<U32>;
//~^ ERROR generic associated types are unstable
}

View File

@ -25,7 +25,7 @@ LL | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone;
error[E0658]: generic associated types are unstable (see issue #44265)
--> $DIR/feature-gate-generic_associated_types.rs:14:5
|
LL | type Pointer<usize> = Box<usize>;
LL | type Pointer<Usize> = Box<Usize>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_associated_types)] to the crate attributes to enable
@ -33,7 +33,7 @@ LL | type Pointer<usize> = Box<usize>;
error[E0658]: generic associated types are unstable (see issue #44265)
--> $DIR/feature-gate-generic_associated_types.rs:16:5
|
LL | type Pointer2<u32> = Box<u32>;
LL | type Pointer2<U32> = Box<U32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_associated_types)] to the crate attributes to enable

View File

@ -1,9 +1,7 @@
extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
fn bar();
fn bar(); //~ ERROR unrecognized intrinsic function: `bar`
}
extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change
}
extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change
fn main() {
}
fn main() {}

View File

@ -2,7 +2,7 @@ error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-intrinsics.rs:1:1
|
LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
LL | | fn bar();
LL | | fn bar(); //~ ERROR unrecognized intrinsic function: `bar`
LL | | }
| |_^
|
@ -11,12 +11,18 @@ LL | | }
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-intrinsics.rs:5:1
|
LL | / extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change
LL | | }
| |_^
LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(intrinsics)] to the crate attributes to enable
error: aborting due to 2 previous errors
error[E0093]: unrecognized intrinsic function: `bar`
--> $DIR/feature-gate-intrinsics.rs:2:5
|
LL | fn bar(); //~ ERROR unrecognized intrinsic function: `bar`
| ^^^^^^^^^ unrecognized intrinsic
For more information about this error, try `rustc --explain E0658`.
error: aborting due to 3 previous errors
Some errors occurred: E0093, E0658.
For more information about an error, try `rustc --explain E0093`.

View File

@ -1,5 +1,5 @@
#[lang="foo"] //~ ERROR language items are subject to change
#[lang = "foo"] //~ ERROR language items are subject to change
//~^ ERROR definition of an unknown language item: `foo`
trait Foo {}
fn main() {
}
fn main() {}

View File

@ -1,11 +1,18 @@
error[E0658]: language items are subject to change
--> $DIR/feature-gate-lang-items.rs:1:1
|
LL | #[lang="foo"] //~ ERROR language items are subject to change
| ^^^^^^^^^^^^^
LL | #[lang = "foo"] //~ ERROR language items are subject to change
| ^^^^^^^^^^^^^^^
|
= help: add #![feature(lang_items)] to the crate attributes to enable
error: aborting due to previous error
error[E0522]: definition of an unknown language item: `foo`
--> $DIR/feature-gate-lang-items.rs:1:1
|
LL | #[lang = "foo"] //~ ERROR language items are subject to change
| ^^^^^^^^^^^^^^^ definition of unknown language item `foo`
For more information about this error, try `rustc --explain E0658`.
error: aborting due to 2 previous errors
Some errors occurred: E0522, E0658.
For more information about an error, try `rustc --explain E0522`.

View File

@ -2,3 +2,5 @@ extern {
#[linkage = "extern_weak"] static foo: isize;
//~^ ERROR: the `linkage` attribute is experimental and not portable
}
fn main() {}

View File

@ -3,7 +3,9 @@
// Check that `may_dangle` is rejected if `dropck_eyepatch` feature gate is absent.
struct Pt<A>(A);
impl<#[may_dangle] A> Drop for Pt<A> {
unsafe impl<#[may_dangle] A> Drop for Pt<A> {
//~^ ERROR may_dangle has unstable semantics and may be removed in the future
fn drop(&mut self) { }
}
fn main() {}

View File

@ -1,8 +1,8 @@
error[E0658]: may_dangle has unstable semantics and may be removed in the future (see issue #34761)
--> $DIR/feature-gate-may-dangle.rs:6:6
--> $DIR/feature-gate-may-dangle.rs:6:13
|
LL | impl<#[may_dangle] A> Drop for Pt<A> {
| ^^^^^^^^^^^^^
LL | unsafe impl<#[may_dangle] A> Drop for Pt<A> {
| ^^^^^^^^^^^^^
|
= help: add #![feature(dropck_eyepatch)] to the crate attributes to enable

View File

@ -9,14 +9,16 @@ trait Foo {
//~| ERROR trait fns cannot be declared const
}
impl Foo {
const fn baz() -> u32 { 0 } // stabilized
}
impl Foo for u32 {
const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
}
trait Bar {}
impl dyn Bar {
const fn baz() -> u32 { 0 } // stabilized
}
static FOO: usize = foo();
const BAR: usize = foo();

View File

@ -11,7 +11,7 @@ LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^ trait fns cannot be const
error[E0379]: trait fns cannot be declared const
--> $DIR/feature-gate-min_const_fn.rs:17:5
--> $DIR/feature-gate-min_const_fn.rs:13:5
|
LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const
| ^^^^^ trait fns cannot be const

View File

@ -7,3 +7,5 @@ fn naked() {}
fn naked_2() -> isize {
0
}
fn main() {}

View File

@ -6,8 +6,8 @@ trait Foo {
type Ma = (u32, !, i32); //~ ERROR type is experimental
type Meeshka = Vec<!>; //~ ERROR type is experimental
type Mow = &fn(!) -> !; //~ ERROR type is experimental
type Skwoz = &mut !; //~ ERROR type is experimental
type Mow = &'static fn(!) -> !; //~ ERROR type is experimental
type Skwoz = &'static mut !; //~ ERROR type is experimental
impl Foo for Meeshka {
type Wub = !; //~ ERROR type is experimental

View File

@ -15,18 +15,18 @@ LL | type Meeshka = Vec<!>; //~ ERROR type is experimental
= help: add #![feature(never_type)] to the crate attributes to enable
error[E0658]: The `!` type is experimental (see issue #35121)
--> $DIR/feature-gate-never_type.rs:9:16
--> $DIR/feature-gate-never_type.rs:9:24
|
LL | type Mow = &fn(!) -> !; //~ ERROR type is experimental
| ^
LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental
| ^
|
= help: add #![feature(never_type)] to the crate attributes to enable
error[E0658]: The `!` type is experimental (see issue #35121)
--> $DIR/feature-gate-never_type.rs:10:19
--> $DIR/feature-gate-never_type.rs:10:27
|
LL | type Skwoz = &mut !; //~ ERROR type is experimental
| ^
LL | type Skwoz = &'static mut !; //~ ERROR type is experimental
| ^
|
= help: add #![feature(never_type)] to the crate attributes to enable

View File

@ -1,3 +1,5 @@
#![crate_type = "rlib"]
#![no_core] //~ ERROR no_core is experimental
fn main() {}
pub struct S {}

View File

@ -1,5 +1,5 @@
error[E0658]: no_core is experimental (see issue #29639)
--> $DIR/feature-gate-no_core.rs:1:1
--> $DIR/feature-gate-no_core.rs:3:1
|
LL | #![no_core] //~ ERROR no_core is experimental
| ^^^^^^^^^^^

View File

@ -3,14 +3,10 @@
struct DummyStruct;
trait DummyTrait {
fn dummy(&self) {}
}
auto trait AutoDummyTrait {}
//~^ ERROR auto traits are experimental and possibly buggy
impl !DummyTrait for DummyStruct {}
impl !AutoDummyTrait for DummyStruct {}
//~^ ERROR negative trait bounds are not yet fully implemented; use marker types for now
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0658]: auto traits are experimental and possibly buggy (see issue #13231)
--> $DIR/feature-gate-optin-builtin-traits.rs:10:1
--> $DIR/feature-gate-optin-builtin-traits.rs:6:1
|
LL | auto trait AutoDummyTrait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,10 +7,10 @@ LL | auto trait AutoDummyTrait {}
= help: add #![feature(optin_builtin_traits)] to the crate attributes to enable
error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now (see issue #13231)
--> $DIR/feature-gate-optin-builtin-traits.rs:13:1
--> $DIR/feature-gate-optin-builtin-traits.rs:9:1
|
LL | impl !DummyTrait for DummyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | impl !AutoDummyTrait for DummyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(optin_builtin_traits)] to the crate attributes to enable

View File

@ -1,7 +1,7 @@
#[repr(simd)] //~ error: SIMD types are experimental
struct Foo(u64, u64);
#[repr(C)]
#[repr(C)] //~ warn: conflicting representation hints
#[repr(simd)] //~ error: SIMD types are experimental
struct Bar(u64, u64);

View File

@ -14,6 +14,15 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental
|
= help: add #![feature(repr_simd)] to the crate attributes to enable
warning[E0566]: conflicting representation hints
--> $DIR/feature-gate-repr-simd.rs:4:8
|
LL | #[repr(C)] //~ warn: conflicting representation hints
| ^
LL | #[repr(simd)] //~ error: SIMD types are experimental
| ^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
Some errors occurred: E0566, E0658.
For more information about an error, try `rustc --explain E0566`.

View File

@ -5,4 +5,4 @@
#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
fn main() {}
fn main() {} //~ ERROR []

View File

@ -14,6 +14,13 @@ LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for ru
|
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
error: aborting due to 2 previous errors
error[E0208]: []
--> $DIR/feature-gate-rustc-attrs-1.rs:8:1
|
LL | fn main() {} //~ ERROR []
| ^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0658`.
error: aborting due to 3 previous errors
Some errors occurred: E0208, E0658.
For more information about an error, try `rustc --explain E0208`.

View File

@ -1,2 +1,3 @@
#[start]
fn foo() {} //~ ERROR: a #[start] function is an experimental feature
fn foo(_: isize, _: *const *const u8) -> isize { 0 }
//~^ ERROR a #[start] function is an experimental feature

View File

@ -1,8 +1,8 @@
error[E0658]: a #[start] function is an experimental feature whose signature may change over time (see issue #29633)
--> $DIR/feature-gate-start.rs:2:1
|
LL | fn foo() {} //~ ERROR: a #[start] function is an experimental feature
| ^^^^^^^^^^^
LL | fn foo(_: isize, _: *const *const u8) -> isize { 0 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(start)] to the crate attributes to enable

View File

@ -8,8 +8,4 @@
#[thread_local] //~ ERROR `#[thread_local]` is an experimental feature
static FOO: i32 = 3;
pub fn main() {
FOO.with(|x| {
println!("x: {}", x);
});
}
pub fn main() {}

View File

@ -3,25 +3,29 @@
// never triggers (yet), because they encounter other problems around
// angle bracket vs parentheses notation.
#![allow(dead_code)]
#![feature(fn_traits)]
struct Foo;
impl Fn<()> for Foo {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
extern "rust-call" fn call(self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}
struct Foo1;
impl FnOnce() for Foo1 {
//~^ ERROR associated type bindings are not allowed here
extern "rust-call" fn call_once(self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}
struct Bar;
impl FnMut<()> for Bar {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}
struct Baz;
impl FnOnce<()> for Baz {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
extern "rust-call" fn call_once(&self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}

View File

@ -1,5 +1,5 @@
error[E0658]: rust-call ABI is subject to change (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:10:5
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:11:5
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {}
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:15:5
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:17:5
|
LL | extern "rust-call" fn call_once(self, args: ()) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -15,7 +15,7 @@ LL | extern "rust-call" fn call_once(self, args: ()) -> () {}
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:20:5
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:23:5
|
LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -23,13 +23,44 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {}
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:25:5
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:29:5
|
LL | extern "rust-call" fn call_once(&self, args: ()) -> () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error: aborting due to 4 previous errors
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:6
|
LL | impl Fn<()> for Foo {
| ^^^^^^
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
For more information about this error, try `rustc --explain E0658`.
error[E0229]: associated type bindings are not allowed here
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:15:12
|
LL | impl FnOnce() for Foo1 {
| ^^ associated type not allowed here
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:21:6
|
LL | impl FnMut<()> for Bar {
| ^^^^^^^^^
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:27:6
|
LL | impl FnOnce<()> for Baz {
| ^^^^^^^^^^
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error: aborting due to 8 previous errors
Some errors occurred: E0229, E0658.
For more information about an error, try `rustc --explain E0229`.

View File

@ -1,6 +1,9 @@
#![feature(fn_traits)]
struct Test;
impl FnOnce<(u32, u32)> for Test {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
type Output = u32;
extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 {

View File

@ -1,5 +1,5 @@
error[E0658]: rust-call ABI is subject to change (see issue #29625)
--> $DIR/feature-gate-unboxed-closures.rs:6:5
--> $DIR/feature-gate-unboxed-closures.rs:9:5
|
LL | / extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 {
LL | | a + b
@ -8,6 +8,14 @@ LL | | }
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error: aborting due to previous error
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
--> $DIR/feature-gate-unboxed-closures.rs:5:6
|
LL | impl FnOnce<(u32, u32)> for Test {
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(unboxed_closures)] to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -15,7 +15,7 @@ pub struct Y<#[cfg(none)] T>(T); // shouldn't care when the entire item is strip
struct M<T>(*const T);
unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
//~^ ERROR #[cfg_attr] cannot be applied on a generic parameter
fn drop(&mut self) {}
}
@ -23,3 +23,5 @@ unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
//~^ ERROR #[cfg] cannot be applied on a generic parameter
//~| ERROR attribute `ignored` is currently unknown to the compiler
fn main() {}

View File

@ -35,10 +35,10 @@ LL | pub fn f<#[cfg(none)] 'a, #[cfg(none)] T>(_: &'a T) {}
| ^^^^^^^^^^^^
error: #[cfg_attr] cannot be applied on a generic parameter
--> $DIR/issue-51279.rs:18:13
--> $DIR/issue-51279.rs:18:6
|
LL | unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: #[cfg] cannot be applied on a generic parameter
--> $DIR/issue-51279.rs:23:23

View File

@ -4,11 +4,10 @@
#![feature(on_unimplemented)]
#[rustc_on_unimplemented(
#[rustc_on_unimplemented( //~ ERROR `#[rustc_on_unimplemented]` requires a value
message="the message"
label="the label"
label="the label" //~ ERROR expected one of `)` or `,`, found `label`
)]
trait T {}
//~^^^ ERROR expected one of `)` or `,`, found `label`
fn main() { }

View File

@ -3,8 +3,20 @@ error: expected one of `)` or `,`, found `label`
|
LL | message="the message"
| - expected one of `)` or `,` here
LL | label="the label"
LL | label="the label" //~ ERROR expected one of `)` or `,`, found `label`
| ^^^^^ unexpected token
error: aborting due to previous error
error[E0232]: `#[rustc_on_unimplemented]` requires a value
--> $DIR/expected-comma-found-token.rs:7:1
|
LL | / #[rustc_on_unimplemented( //~ ERROR `#[rustc_on_unimplemented]` requires a value
LL | | message="the message"
LL | | label="the label" //~ ERROR expected one of `)` or `,`, found `label`
LL | | )]
| |__^ value required here
|
= note: eg `#[rustc_on_unimplemented(message="foo")]`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0232`.

View File

@ -1,7 +1,7 @@
#[repr(simd)] //~ ERROR are experimental
struct Weapon {
name: String,
damage: u32
struct Coord {
x: u32,
y: u32,
}
fn main() {}

View File

@ -3,6 +3,7 @@
fn foo<
'β, //~ ERROR non-ascii idents are not fully supported
γ //~ ERROR non-ascii idents are not fully supported
//~^ WARN type parameter `γ` should have a camel case name such as `Γ`
>() {}
struct X {

View File

@ -15,7 +15,7 @@ LL | γ //~ ERROR non-ascii idents are not fully supported
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
--> $DIR/utf8_idents.rs:9:5
--> $DIR/utf8_idents.rs:10:5
|
LL | δ: usize //~ ERROR non-ascii idents are not fully supported
| ^
@ -23,13 +23,21 @@ LL | δ: usize //~ ERROR non-ascii idents are not fully supported
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported. (see issue #55467)
--> $DIR/utf8_idents.rs:13:9
--> $DIR/utf8_idents.rs:14:9
|
LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported
| ^
|
= help: add #![feature(non_ascii_idents)] to the crate attributes to enable
warning: type parameter `γ` should have a camel case name such as `Γ`
--> $DIR/utf8_idents.rs:5:5
|
LL | γ //~ ERROR non-ascii idents are not fully supported
| ^
|
= note: #[warn(non_camel_case_types)] on by default
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.