From 2a02d6d714c95f59cfbc4ac9ab3e6d82022515b0 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 2 Jan 2019 17:14:24 +0300 Subject: [PATCH] Make sure feature gate errors are recoverable (take 2) --- src/librustc/ty/mod.rs | 4 +- src/librustc_driver/driver.rs | 23 +++++----- .../cfg-attr-crate-2.rs | 8 ++-- .../cfg-attr-multi-invalid-1.rs | 4 +- .../cfg-attr-multi-invalid-2.rs | 4 +- .../feature-gate-alloc-error-handler.rs | 3 ++ .../feature-gates/feature-gate-allow_fail.rs | 1 + .../feature-gate-async-await-2015-edition.rs | 2 +- ...ature-gate-async-await-2015-edition.stderr | 2 +- .../ui/feature-gates/feature-gate-const_fn.rs | 10 +++-- .../feature-gate-const_fn.stderr | 2 +- .../feature-gates/feature-gate-doc_keyword.rs | 2 + .../feature-gates/feature-gate-dropck-ugeh.rs | 5 +-- .../feature-gate-dropck-ugeh.stderr | 10 ++++- .../feature-gate-existential-type.rs | 6 ++- .../feature-gate-existential-type.stderr | 4 +- .../feature-gates/feature-gate-generators.rs | 1 + .../feature-gate-generators.stderr | 11 ++++- .../feature-gate-generic_associated_types.rs | 4 +- ...ature-gate-generic_associated_types.stderr | 4 +- .../feature-gates/feature-gate-intrinsics.rs | 8 ++-- .../feature-gate-intrinsics.stderr | 18 +++++--- .../feature-gates/feature-gate-lang-items.rs | 6 +-- .../feature-gate-lang-items.stderr | 15 +++++-- .../ui/feature-gates/feature-gate-linkage.rs | 2 + .../feature-gates/feature-gate-may-dangle.rs | 4 +- .../feature-gate-may-dangle.stderr | 6 +-- .../feature-gate-min_const_fn.rs | 10 +++-- .../feature-gate-min_const_fn.stderr | 2 +- .../feature-gate-naked_functions.rs | 2 + .../feature-gates/feature-gate-never_type.rs | 4 +- .../feature-gate-never_type.stderr | 12 +++--- .../ui/feature-gates/feature-gate-no_core.rs | 4 +- .../feature-gates/feature-gate-no_core.stderr | 2 +- .../feature-gate-optin-builtin-traits.rs | 6 +-- .../feature-gate-optin-builtin-traits.stderr | 8 ++-- .../feature-gates/feature-gate-repr-simd.rs | 2 +- .../feature-gate-repr-simd.stderr | 11 ++++- .../feature-gate-rustc-attrs-1.rs | 2 +- .../feature-gate-rustc-attrs-1.stderr | 11 ++++- .../ui/feature-gates/feature-gate-start.rs | 3 +- .../feature-gates/feature-gate-start.stderr | 4 +- .../feature-gate-thread_local.rs | 6 +-- ...ture-gate-unboxed-closures-manual-impls.rs | 6 ++- ...-gate-unboxed-closures-manual-impls.stderr | 43 ++++++++++++++++--- .../feature-gate-unboxed-closures.rs | 3 ++ .../feature-gate-unboxed-closures.stderr | 12 +++++- src/test/ui/issues/issue-51279.rs | 4 +- src/test/ui/issues/issue-51279.stderr | 6 +-- .../expected-comma-found-token.rs | 5 +-- .../expected-comma-found-token.stderr | 16 ++++++- src/test/ui/span/gated-features-attr-spans.rs | 6 +-- src/test/ui/utf8_idents.rs | 1 + src/test/ui/utf8_idents.stderr | 12 +++++- 54 files changed, 244 insertions(+), 128 deletions(-) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index d40dd830e9fb9..8768d3c5034e8 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2801,7 +2801,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) @@ -2809,8 +2809,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 } } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 9b232edc11d4a..9bb5747665600 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1101,23 +1101,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. diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs index 9345229704a67..0dceba28b6ec3 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs @@ -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 {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs index 0638f481ae569..16813a7623c77 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs @@ -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 {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs index 26b4936ac70b2..39f8fc4b8b9f1 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs @@ -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 {} diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs index fbd9291afbe03..daa2bb5d6fafc 100644 --- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs +++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs @@ -9,3 +9,6 @@ use core::alloc::Layout; fn oom(info: Layout) -> ! { loop {} } + +#[panic_handler] +fn panic(_: &core::panic::PanicInfo) -> ! { loop {} } diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.rs b/src/test/ui/feature-gates/feature-gate-allow_fail.rs index cd8b096294261..f9ad48551410c 100644 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.rs +++ b/src/test/ui/feature-gates/feature-gate-allow_fail.rs @@ -5,3 +5,4 @@ fn ok_to_fail() { assert!(false); } +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs index 00a3103af2cbc..84dd1b9f814c2 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs @@ -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 } diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr index 7754dbb3b3736..450b2c42f119d 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr @@ -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) diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.rs b/src/test/ui/feature-gates/feature-gate-const_fn.rs index 5a0a5ac9edc6c..f46d1dc13d3f0 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.rs +++ b/src/test/ui/feature-gates/feature-gate-const_fn.rs @@ -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(); diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr index 32a57719edbe5..b3fc587b1cf77 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs index f417828db15ad..b08940e28f443 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs @@ -1,3 +1,5 @@ #[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental /// wonderful mod foo{} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs index 02aa5000661d3..a2377cda9bd66 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs @@ -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>>); @@ -18,6 +15,7 @@ struct Foo { data: Vec } impl Drop for Foo { #[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])); } - diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr index 99ca454bcabab..bc62fc01b4438 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr @@ -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`. diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.rs b/src/test/ui/feature-gates/feature-gate-existential-type.rs index e14467d6c3eb5..6dfd2d10870e0 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.rs +++ b/src/test/ui/feature-gates/feature-gate-existential-type.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.stderr b/src/test/ui/feature-gates/feature-gate-existential-type.stderr index e88bdc01fdc19..e83d5cdbde1e6 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.stderr +++ b/src/test/ui/feature-gates/feature-gate-existential-type.stderr @@ -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 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-generators.rs b/src/test/ui/feature-gates/feature-gate-generators.rs index 88e8781d2b9ba..cee930fd785b9 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.rs +++ b/src/test/ui/feature-gates/feature-gate-generators.rs @@ -1,3 +1,4 @@ fn main() { yield true; //~ ERROR yield syntax is experimental + //~^ ERROR yield statement outside of generator literal } diff --git a/src/test/ui/feature-gates/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr index 4b90cd1c1f8e4..aea1e00d698a6 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.stderr +++ b/src/test/ui/feature-gates/feature-gate-generators.stderr @@ -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 + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0627, E0658. +For more information about an error, try `rustc --explain E0627`. diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs index 86a1f5ca4d5d5..17548d7b9e88c 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs @@ -11,9 +11,9 @@ trait PointerFamily { struct Foo; impl PointerFamily for Foo { - type Pointer = Box; + type Pointer = Box; //~^ ERROR generic associated types are unstable - type Pointer2 = Box; + type Pointer2 = Box; //~^ ERROR generic associated types are unstable } diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr index 392d0f1bd7e15..8a207c966cdab 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr @@ -25,7 +25,7 @@ LL | type Pointer2: Deref 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 = Box; +LL | type Pointer = Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | type Pointer = Box; error[E0658]: generic associated types are unstable (see issue #44265) --> $DIR/feature-gate-generic_associated_types.rs:16:5 | -LL | type Pointer2 = Box; +LL | type Pointer2 = Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.rs b/src/test/ui/feature-gates/feature-gate-intrinsics.rs index 0916d7fcd36d3..d1da94338283b 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.rs +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr index 034e2b1b588b5..092cb98a2f963 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr @@ -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 + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0093, E0658. +For more information about an error, try `rustc --explain E0093`. diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.rs b/src/test/ui/feature-gates/feature-gate-lang-items.rs index 943ca161d678d..93262f2171bfe 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.rs +++ b/src/test/ui/feature-gates/feature-gate-lang-items.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.stderr b/src/test/ui/feature-gates/feature-gate-lang-items.stderr index 3383eaab01f32..ccbb711fe6d43 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.stderr +++ b/src/test/ui/feature-gates/feature-gate-lang-items.stderr @@ -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` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0522, E0658. +For more information about an error, try `rustc --explain E0522`. diff --git a/src/test/ui/feature-gates/feature-gate-linkage.rs b/src/test/ui/feature-gates/feature-gate-linkage.rs index 282c9a8b843f9..70f33cc0c6cc7 100644 --- a/src/test/ui/feature-gates/feature-gate-linkage.rs +++ b/src/test/ui/feature-gates/feature-gate-linkage.rs @@ -2,3 +2,5 @@ extern { #[linkage = "extern_weak"] static foo: isize; //~^ ERROR: the `linkage` attribute is experimental and not portable } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-may-dangle.rs b/src/test/ui/feature-gates/feature-gate-may-dangle.rs index 45666e90b210a..20896e426f65d 100644 --- a/src/test/ui/feature-gates/feature-gate-may-dangle.rs +++ b/src/test/ui/feature-gates/feature-gate-may-dangle.rs @@ -3,7 +3,9 @@ // Check that `may_dangle` is rejected if `dropck_eyepatch` feature gate is absent. struct Pt(A); -impl<#[may_dangle] A> Drop for Pt { +unsafe impl<#[may_dangle] A> Drop for Pt { //~^ ERROR may_dangle has unstable semantics and may be removed in the future fn drop(&mut self) { } } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-may-dangle.stderr b/src/test/ui/feature-gates/feature-gate-may-dangle.stderr index b537a5815886f..6d21147c9eeb3 100644 --- a/src/test/ui/feature-gates/feature-gate-may-dangle.stderr +++ b/src/test/ui/feature-gates/feature-gate-may-dangle.stderr @@ -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 { - | ^^^^^^^^^^^^^ +LL | unsafe impl<#[may_dangle] A> Drop for Pt { + | ^^^^^^^^^^^^^ | = help: add #![feature(dropck_eyepatch)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.rs b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs index e685b500ff3bb..669631df2ad17 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.rs +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs @@ -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(); diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr index 998a2243edcfa..bcc5b0198c319 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.rs b/src/test/ui/feature-gates/feature-gate-naked_functions.rs index 36bc636b0bb7b..16a51a1e82fc6 100644 --- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs +++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs @@ -7,3 +7,5 @@ fn naked() {} fn naked_2() -> isize { 0 } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-never_type.rs b/src/test/ui/feature-gates/feature-gate-never_type.rs index 44a3bdd2ca36b..be8c27dbb1b02 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.rs +++ b/src/test/ui/feature-gates/feature-gate-never_type.rs @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr index 927758b67b9cc..c4f8771171e8b 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.stderr +++ b/src/test/ui/feature-gates/feature-gate-never_type.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-no_core.rs b/src/test/ui/feature-gates/feature-gate-no_core.rs index 03b237867aa91..40178edd74b8d 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.rs +++ b/src/test/ui/feature-gates/feature-gate-no_core.rs @@ -1,3 +1,5 @@ +#![crate_type = "rlib"] + #![no_core] //~ ERROR no_core is experimental -fn main() {} +pub struct S {} diff --git a/src/test/ui/feature-gates/feature-gate-no_core.stderr b/src/test/ui/feature-gates/feature-gate-no_core.stderr index cb8fe25df58a2..7390051b95da2 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.stderr +++ b/src/test/ui/feature-gates/feature-gate-no_core.stderr @@ -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 | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs index 9d70cbee53b09..35c05b75d365c 100644 --- a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs +++ b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr index c523147611a81..e5d0a8681fb45 100644 --- a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr +++ b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.rs b/src/test/ui/feature-gates/feature-gate-repr-simd.rs index 67ae538e22c9d..9d28f437415c9 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.rs @@ -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); diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 161cc67e81344..20cdbceeb689a 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -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`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs index f7ff3eb3ac9ff..2b23388fdc96d 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs @@ -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 [] diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr index 2b90699384b48..31e24f5b99f1e 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr @@ -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 [] + | ^^^^^^^^^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0208, E0658. +For more information about an error, try `rustc --explain E0208`. diff --git a/src/test/ui/feature-gates/feature-gate-start.rs b/src/test/ui/feature-gates/feature-gate-start.rs index bf097c8203156..46a1279a3fb16 100644 --- a/src/test/ui/feature-gates/feature-gate-start.rs +++ b/src/test/ui/feature-gates/feature-gate-start.rs @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-start.stderr b/src/test/ui/feature-gates/feature-gate-start.stderr index 255703d767388..d39e5f3555537 100644 --- a/src/test/ui/feature-gates/feature-gate-start.stderr +++ b/src/test/ui/feature-gates/feature-gate-start.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-thread_local.rs b/src/test/ui/feature-gates/feature-gate-thread_local.rs index c47bdc1006c72..0efae1f6bc356 100644 --- a/src/test/ui/feature-gates/feature-gate-thread_local.rs +++ b/src/test/ui/feature-gates/feature-gate-thread_local.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs index fc5902721d788..ff6e2b8290389 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs @@ -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 } diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 0e40e1fddb0c7..865b87e7dd5d7 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -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 + +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 -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0229, E0658. +For more information about an error, try `rustc --explain E0229`. diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs index 4c0d7d14a5064..c3f5c99dcb482 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs @@ -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 { diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr index 420b331ccccb3..e7b1fc589bb4a 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr @@ -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`. diff --git a/src/test/ui/issues/issue-51279.rs b/src/test/ui/issues/issue-51279.rs index ad5438fbd46cb..f8f3626caabe7 100644 --- a/src/test/ui/issues/issue-51279.rs +++ b/src/test/ui/issues/issue-51279.rs @@ -15,7 +15,7 @@ pub struct Y<#[cfg(none)] T>(T); // shouldn't care when the entire item is strip struct M(*const T); -unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M { +impl<#[cfg_attr(none, may_dangle)] T> Drop for M { //~^ 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 { 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() {} diff --git a/src/test/ui/issues/issue-51279.stderr b/src/test/ui/issues/issue-51279.stderr index 1706e98e83b63..bc33eacac9994 100644 --- a/src/test/ui/issues/issue-51279.stderr +++ b/src/test/ui/issues/issue-51279.stderr @@ -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 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl<#[cfg_attr(none, may_dangle)] T> Drop for M { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter --> $DIR/issue-51279.rs:23:23 diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.rs b/src/test/ui/on-unimplemented/expected-comma-found-token.rs index a3e6609f98215..a4e2a1754f013 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.rs +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.rs @@ -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() { } diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index 5bbdbe29416c1..aa1b520e01529 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -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`. diff --git a/src/test/ui/span/gated-features-attr-spans.rs b/src/test/ui/span/gated-features-attr-spans.rs index ff722a5352079..69511ab8e1fc7 100644 --- a/src/test/ui/span/gated-features-attr-spans.rs +++ b/src/test/ui/span/gated-features-attr-spans.rs @@ -1,7 +1,7 @@ #[repr(simd)] //~ ERROR are experimental -struct Weapon { - name: String, - damage: u32 +struct Coord { + x: u32, + y: u32, } fn main() {} diff --git a/src/test/ui/utf8_idents.rs b/src/test/ui/utf8_idents.rs index c9f433c3c3b3d..bed0d9bb2be54 100644 --- a/src/test/ui/utf8_idents.rs +++ b/src/test/ui/utf8_idents.rs @@ -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 { diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr index b1bb4a3001557..1ccf767491cdb 100644 --- a/src/test/ui/utf8_idents.stderr +++ b/src/test/ui/utf8_idents.stderr @@ -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`.