}
#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
unsafe impl Send for .. { }
#[stable(feature = "rust1", since = "1.0.0")]
}
#[stable(feature = "rust1", since = "1.0.0")]
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
unsafe impl Sync for .. { }
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "freeze"]
unsafe trait Freeze {}
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
unsafe impl Freeze for .. {}
impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
// hardwired lints from librustc
pub use lint::builtin::*;
+declare_lint! {
+ pub AUTO_IMPL,
+ Deny,
+ "The form `impl Foo for .. {}` will be removed, please use `auto trait Foo {}`"
+}
+
+#[derive(Copy, Clone)]
+pub struct AutoImpl;
+
+impl LintPass for AutoImpl {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(AUTO_IMPL)
+ }
+}
+
+impl EarlyLintPass for AutoImpl {
+ fn check_item(&mut self, cx: &EarlyContext, item: &ast::Item) {
+ let msg = "The form `impl Foo for .. {}` will be removed, please use `auto trait Foo {}`";
+ match item.node {
+ ast::ItemKind::AutoImpl(..) => cx.span_lint(AUTO_IMPL, item.span, msg),
+ _ => ()
+ }
+ }
+}
+
declare_lint! {
WHILE_TRUE,
Warn,
AnonymousParameters,
IllegalFloatLiteralPattern,
UnusedDocComment,
+ AutoImpl,
);
add_early_builtin_with_new!(sess,
// - Eventually, remove lint
store.register_future_incompatible(sess,
vec![
+ FutureIncompatibleInfo {
+ id: LintId::of(AUTO_IMPL),
+ reference: "issue #13231 <https://github.com/rust-lang/rust/issues/13231>",
+ },
FutureIncompatibleInfo {
id: LintId::of(PRIVATE_IN_PUBLIC),
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
// * Types like Mutex/RwLock which are explicilty poisoned are unwind safe
// * Our custom AssertUnwindSafe wrapper is indeed unwind safe
#[stable(feature = "catch_unwind", since = "1.9.0")]
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
impl UnwindSafe for .. {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<'a, T: ?Sized> !UnwindSafe for &'a mut T {}
// only thing which doesn't implement it (which then transitively applies to
// everything else).
#[stable(feature = "catch_unwind", since = "1.9.0")]
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
impl RefUnwindSafe for .. {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: ?Sized> !RefUnwindSafe for UnsafeCell<T> {}
// When an executable or dylib image is linked, all user code and libraries are
// "sandwiched" between these two object files, so code or data from rsbegin.o
// become first in the respective sections of the image, whereas code and data
-// from rsend.o become the last ones. This effect can be used to place symbols
+// from rsend.o become the last ones. This effect can be used to place symbols
// at the beginning or at the end of a section, as well as to insert any required
// headers or footers.
//
trait Sized {}
#[lang = "sync"]
trait Sync {}
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
impl Sync for .. {}
#[lang = "copy"]
trait Copy {}
#[lang = "freeze"]
trait Freeze {}
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
impl Freeze for .. {}
#[lang = "drop_in_place"]
trait Copy {}
#[lang = "freeze"]
trait Freeze {}
+#[allow(unknown_lints)]
+#[allow(auto_impl)]
impl Freeze for .. {}
#[lang = "drop_in_place"]
--- /dev/null
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {}
+impl Foo for .. {}
trait MyTrait { fn foo() {} }
+#[allow(auto_impl)]
impl MyTrait for .. {}
//~^ ERROR redundant auto implementations of trait `MyTrait`
+#[allow(auto_impl)]
impl MyTrait for .. {}
trait MySafeTrait {}
+#[allow(auto_impl)]
unsafe impl MySafeTrait for .. {}
//~^ ERROR implementing the trait `MySafeTrait` is not unsafe
unsafe trait MyUnsafeTrait {}
+#[allow(auto_impl)]
impl MyUnsafeTrait for .. {}
//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
auto trait AutoDummyTrait {}
//~^ ERROR auto traits are experimental and possibly buggy
+#[allow(auto_impl)]
impl DummyTrait for .. {}
//~^ ERROR auto trait implementations are experimental and possibly buggy
type Output;
}
+#[allow(auto_impl)]
unsafe impl Trait for .. {}
fn call_method<T: Trait>(x: T) {}
}
}
+#[allow(auto_impl)]
unsafe impl Trait for .. {}
fn call_method<T: Trait>(x: T) {
unsafe trait Zen {}
+#[allow(auto_impl)]
unsafe impl Zen for .. {}
unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
}
struct Ts(pub u8);
+#[allow(auto_impl)]
pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
pub fn f() {} //~ ERROR unnecessary visibility qualifier
}
struct Ts(pub u8);
+ #[allow(auto_impl)]
pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
pub fn f() {} //~ ERROR unnecessary visibility qualifier
}
struct Ts(pub u8);
+ #[allow(auto_impl)]
pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
pub fn f() {} //~ ERROR unnecessary visibility qualifier
trait Foo {}
+#[allow(auto_impl)]
default impl Foo for .. {}
//~^ ERROR `default impl` is not allowed for auto trait implementations
trait Foo {}
+#[allow(auto_impl)]
impl Foo for .. {}
impl<T> Foo for T {}
trait Bar {}
+#[allow(auto_impl)]
impl Bar for .. {}
impl<T> !Bar for T {}
trait MyAutoImpl {}
+#[allow(auto_impl)]
impl<T> MyAutoImpl for .. {}
//~^ ERROR auto trait implementations are not allowed to have generics
#![feature(optin_builtin_traits)]
trait Magic: Copy {} //~ ERROR E0568
+#[allow(auto_impl)]
impl Magic for .. {}
fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
#![feature(optin_builtin_traits)]
trait Magic : Sized where Option<Self> : Magic {} //~ ERROR E0568
+#[allow(auto_impl)]
impl Magic for .. {}
impl<T:Magic> Magic for T {}
#![feature(optin_builtin_traits)]
trait Magic: Copy {} //~ ERROR E0568
+#[allow(auto_impl)]
impl Magic for .. {}
impl<T:Magic> Magic for T {}
#![feature(optin_builtin_traits)]
trait Magic<T> {} //~ ERROR E0567
+#[allow(auto_impl)]
impl Magic<isize> for .. {}
trait MyTrait {}
+#[allow(auto_impl)]
impl MyTrait for .. {}
struct MyS;
trait MyTrait {}
+#[allow(auto_impl)]
impl MyTrait for .. {}
impl<T> !MyTrait for *mut T {}
trait MyTrait {}
+#[allow(auto_impl)]
impl MyTrait for .. {}
unsafe trait MyUnsafeTrait {}
+#[allow(auto_impl)]
unsafe impl MyUnsafeTrait for .. {}
struct ThisImplsTrait;
#![feature(optin_builtin_traits)]
+#[allow(auto_impl)]
impl Copy for .. {} //~ ERROR E0318
//~^ NOTE `Copy` trait not defined in this crate
fn main() {}
#[lang = "freeze"]
trait Freeze {}
+#[allow(auto_impl)]
impl Freeze for .. {}
#[lang = "freeze"]
trait Freeze {}
+#[allow(auto_impl)]
impl Freeze for .. {}
#[lang="start"]
auto trait Auto {}
// Redundant but accepted until we remove it.
+#[allow(auto_impl)]
impl Auto for .. {}
unsafe auto trait AutoUnsafe {}
#![feature(optin_builtin_traits)]
trait NotSame {}
+#[allow(auto_impl)]
impl NotSame for .. {}
impl<A> !NotSame for (A, A) {}
pub trait Bar {}
+ #[allow(auto_impl)]
impl Bar for .. {}
pub trait Foo {
pub trait AnOibit {}
+#[allow(auto_impl)]
impl AnOibit for .. {}
pub trait AnOibit {}
+#[allow(auto_impl)]
impl AnOibit for .. {}
pub struct Foo<T> { field: T }