about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-08 04:56:01 +0000
committerbors <bors@rust-lang.org>2018-05-08 04:56:01 +0000
commit295d98069f34dce6f7a88422bfa7fbd0a1425aac (patch)
tree24148550b68ba0f9d9eae2ae66db79ec1411da55
parent0da1a69003bd37ef0ee2cde2eb66a9e2752fc6c2 (diff)
parentcabbe50c550a7eaba9a6877458f4598d2e63a3ac (diff)
Auto merge of #50390 - hdhoang:46205_deny_by_default, r=nikomatsakis
lint: deny incoherent_fundamental_impls by default

Warn the ecosystem of the pending intent-to-disallow in #49799.

There are 4 ICEs on my machine, look unrelated (having happened before in https://github.com/rust-lang/rust/issues/49146#issuecomment-384473523)

```rust
thread 'main' panicked at 'assertion failed: position <= slice.len()', libserialize/leb128.rs:97:1
```

```
    [run-pass] run-pass/allocator/xcrate-use2.rs
    [run-pass] run-pass/issue-12133-3.rs
    [run-pass] run-pass/issue-32518.rs
    [run-pass] run-pass/trait-default-method-xc-2.rs
```

r? @nikomatsakis
-rw-r--r--src/doc/rustc/src/lints/listing/deny-by-default.md41
-rw-r--r--src/doc/rustc/src/lints/listing/warn-by-default.md41
-rw-r--r--src/librustc/lint/builtin.rs2
-rw-r--r--src/test/compile-fail/issue-43355.rs2
-rw-r--r--src/test/run-pass/issue-43355.rs36
5 files changed, 42 insertions, 80 deletions
diff --git a/src/doc/rustc/src/lints/listing/deny-by-default.md b/src/doc/rustc/src/lints/listing/deny-by-default.md
index e7ec6af8be1..ef76295f04d 100644
--- a/src/doc/rustc/src/lints/listing/deny-by-default.md
+++ b/src/doc/rustc/src/lints/listing/deny-by-default.md
@@ -239,3 +239,44 @@ error: invalid `crate_type` value
   | ^^^^^^^^^^^^^^^^^^^^
   |
 ```
+
+## incoherent-fundamental-impls
+
+This lint detects potentially-conflicting impls that were erroneously allowed. Some
+example code that triggers this lint:
+
+```rust,ignore
+pub trait Trait1<X> {
+    type Output;
+}
+
+pub trait Trait2<X> {}
+
+pub struct A;
+
+impl<X, T> Trait1<X> for T where T: Trait2<X> {
+    type Output = ();
+}
+
+impl<X> Trait1<Box<X>> for A {
+    type Output = i32;
+}
+```
+
+This will produce:
+
+```text
+error: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
+  --> src/main.rs:13:1
+   |
+9  | impl<X, T> Trait1<X> for T where T: Trait2<X> {
+   | --------------------------------------------- first implementation here
+...
+13 | impl<X> Trait1<Box<X>> for A {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
+   |
+   = note: #[deny(incoherent_fundamental_impls)] on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
+   = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
+```
diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md
index 1171f75caa1..b49708ff6ad 100644
--- a/src/doc/rustc/src/lints/listing/warn-by-default.md
+++ b/src/doc/rustc/src/lints/listing/warn-by-default.md
@@ -117,47 +117,6 @@ warning: found struct without foreign-function-safe representation annotation in
   |
 ```
 
-## incoherent-fundamental-impls
-
-This lint detects potentially-conflicting impls that were erroneously allowed. Some
-example code that triggers this lint:
-
-```rust
-pub trait Trait1<X> {
-    type Output;
-}
-
-pub trait Trait2<X> {}
-
-pub struct A;
-
-impl<X, T> Trait1<X> for T where T: Trait2<X> {
-    type Output = ();
-}
-
-impl<X> Trait1<Box<X>> for A {
-    type Output = i32;
-}
-```
-
-This will produce:
-
-```text
-warning: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
-  --> src/main.rs:13:1
-   |
-9  | impl<X, T> Trait1<X> for T where T: Trait2<X> {
-   | --------------------------------------------- first implementation here
-...
-13 | impl<X> Trait1<Box<X>> for A {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
-   |
-   = note: #[warn(incoherent_fundamental_impls)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
-   = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
-```
-
 ## late-bound-lifetime-arguments
 
 This lint detects detects generic lifetime arguments in path segments with
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 175b44991fd..398d7d5704c 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -208,7 +208,7 @@ declare_lint! {
 
 declare_lint! {
     pub INCOHERENT_FUNDAMENTAL_IMPLS,
-    Warn,
+    Deny,
     "potentially-conflicting impls were erroneously allowed"
 }
 
diff --git a/src/test/compile-fail/issue-43355.rs b/src/test/compile-fail/issue-43355.rs
index 4db5c84df9a..d793a78799a 100644
--- a/src/test/compile-fail/issue-43355.rs
+++ b/src/test/compile-fail/issue-43355.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![deny(incoherent_fundamental_impls)]
-
 pub trait Trait1<X> {
     type Output;
 }
diff --git a/src/test/run-pass/issue-43355.rs b/src/test/run-pass/issue-43355.rs
deleted file mode 100644
index 19431a6a429..00000000000
--- a/src/test/run-pass/issue-43355.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.
-
-// Check that the code for issue #43355 can run without an ICE, please remove
-// this test when it becomes an hard error.
-
-pub trait Trait1<X> {
-    type Output;
-}
-pub trait Trait2<X> {}
-
-impl<X, T> Trait1<X> for T where T: Trait2<X> {
-    type Output = ();
-}
-impl<X> Trait1<Box<X>> for A {
-    type Output = i32;
-}
-
-pub struct A;
-
-fn f<X, T: Trait1<Box<X>>>() {
-    println!("k: {}", ::std::mem::size_of::<<T as Trait1<Box<X>>>::Output>());
-}
-
-pub fn g<X, T: Trait2<Box<X>>>() {
-    f::<X, T>();
-}
-
-fn main() {}