about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-22 06:54:34 +0000
committerbors <bors@rust-lang.org>2018-05-22 06:54:34 +0000
commit1bbae5f38677e823ba6e23f1e0e105ceee4c6f8a (patch)
tree3fe8b76e82858f4a219fcf11dba457968d66510c /src/test
parent6835748725b9bd892d5b64d20ded4ced973ed3b7 (diff)
parentaa5635338c53fbd9f3ca326b55948bc21e655606 (diff)
downloadrust-1bbae5f38677e823ba6e23f1e0e105ceee4c6f8a.tar.gz
rust-1bbae5f38677e823ba6e23f1e0e105ceee4c6f8a.zip
Auto merge of #50876 - matthewjasper:rollback-trivial-bounds, r=nikomatsakis
Filter global bounds from ParamEnv again.

This PR adds back the filtering of global bounds from ParamEnv as a temporary solution for #50825.

<details>

Long term, the fix seems like it should be changing the priority in `candidate_should_be_dropped_in_favor_of` so that (global) where clauses aren't considered as highly.

https://github.com/rust-lang/rust/blob/a722296b6ec17fecd3f16a7d3f9232b83e5de800/src/librustc/traits/select.rs#L2017-L2022

</details>

r? @nikomatsakis
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/feature-gate-trivial_bounds.rs3
-rw-r--r--src/test/ui/feature-gate-trivial_bounds.stderr33
-rw-r--r--src/test/ui/issue-50825-1.rs32
-rw-r--r--src/test/ui/issue-50825.rs25
-rw-r--r--src/test/ui/trivial-bounds-inconsistent-associated-functions.rs1
-rw-r--r--src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs1
-rw-r--r--src/test/ui/trivial-bounds-inconsistent-copy.rs1
-rw-r--r--src/test/ui/trivial-bounds-inconsistent-sized.rs1
-rw-r--r--src/test/ui/trivial-bounds-inconsistent-well-formed.rs1
-rw-r--r--src/test/ui/trivial-bounds-inconsistent.rs1
-rw-r--r--src/test/ui/trivial-bounds-leak-copy.rs1
-rw-r--r--src/test/ui/trivial-bounds-leak.rs1
-rw-r--r--src/test/ui/trivial-bounds-lint.rs1
13 files changed, 97 insertions, 5 deletions
diff --git a/src/test/ui/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gate-trivial_bounds.rs
index ecc6896b754..e72b8782e50 100644
--- a/src/test/ui/feature-gate-trivial_bounds.rs
+++ b/src/test/ui/feature-gate-trivial_bounds.rs
@@ -28,7 +28,7 @@ union U where i32: Foo { f: i32 } //~ ERROR
 type Y where i32: Foo = (); // OK - bound is ignored
 
 impl Foo for () where i32: Foo { //~ ERROR
-    fn test(&self) {
+    fn test(&self) { //~ ERROR
         3i32.test();
         Foo::test(&4i32);
         generic_function(5i32);
@@ -60,6 +60,7 @@ struct Dst<X: ?Sized> {
 }
 
 struct TwoStrs(str, str) where str: Sized; //~ ERROR
+//~^ ERROR
 
 fn unsized_local() where Dst<A>: Sized { //~ ERROR
     let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr
index 0794e86175b..32b263119e5 100644
--- a/src/test/ui/feature-gate-trivial_bounds.stderr
+++ b/src/test/ui/feature-gate-trivial_bounds.stderr
@@ -38,7 +38,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
   --> $DIR/feature-gate-trivial_bounds.rs:30:1
    |
 LL | / impl Foo for () where i32: Foo { //~ ERROR
-LL | |     fn test(&self) {
+LL | |     fn test(&self) { //~ ERROR
 LL | |         3i32.test();
 LL | |         Foo::test(&4i32);
 LL | |         generic_function(5i32);
@@ -97,8 +97,17 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
    = help: see issue #48214
    = help: add #![feature(trivial_bounds)] to the crate attributes to enable
 
+error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
+  --> $DIR/feature-gate-trivial_bounds.rs:62:16
+   |
+LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
+   |                ^^^ `str` does not have a constant size known at compile-time
+   |
+   = help: the trait `std::marker::Sized` is not implemented for `str`
+   = note: only the last field of a struct may have a dynamically sized type
+
 error[E0277]: the trait bound `A + 'static: std::marker::Sized` is not satisfied in `Dst<A + 'static>`
-  --> $DIR/feature-gate-trivial_bounds.rs:64:1
+  --> $DIR/feature-gate-trivial_bounds.rs:65:1
    |
 LL | / fn unsized_local() where Dst<A>: Sized { //~ ERROR
 LL | |     let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
@@ -111,7 +120,7 @@ LL | | }
    = help: add #![feature(trivial_bounds)] to the crate attributes to enable
 
 error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
-  --> $DIR/feature-gate-trivial_bounds.rs:68:1
+  --> $DIR/feature-gate-trivial_bounds.rs:69:1
    |
 LL | / fn return_str() -> str where str: Sized { //~ ERROR
 LL | |     *"Sized".to_string().into_boxed_str()
@@ -122,6 +131,22 @@ LL | | }
    = help: see issue #48214
    = help: add #![feature(trivial_bounds)] to the crate attributes to enable
 
-error: aborting due to 11 previous errors
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+  --> $DIR/feature-gate-trivial_bounds.rs:31:5
+   |
+LL | /     fn test(&self) { //~ ERROR
+LL | |         3i32.test();
+LL | |         Foo::test(&4i32);
+LL | |         generic_function(5i32);
+LL | |     }
+   | |_____^ the trait `Foo` is not implemented for `i32`
+   |
+note: required by `Foo`
+  --> $DIR/feature-gate-trivial_bounds.rs:14:1
+   |
+LL | pub trait Foo {
+   | ^^^^^^^^^^^^^
+
+error: aborting due to 13 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-50825-1.rs b/src/test/ui/issue-50825-1.rs
new file mode 100644
index 00000000000..d179530c014
--- /dev/null
+++ b/src/test/ui/issue-50825-1.rs
@@ -0,0 +1,32 @@
+// Copyright 2018 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.
+
+// run-pass
+// regression test for issue #50825
+// Make sure that the `impl` bound (): X<T = ()> is prefered over
+// the (): X bound in the where clause.
+
+trait X {
+    type T;
+}
+
+trait Y<U>: X {
+    fn foo(x: &Self::T);
+}
+
+impl X for () {
+    type T = ();
+}
+
+impl<T> Y<Vec<T>> for () where (): Y<T> {
+    fn foo(_x: &()) {}
+}
+
+fn main () {}
diff --git a/src/test/ui/issue-50825.rs b/src/test/ui/issue-50825.rs
new file mode 100644
index 00000000000..bc15760e77c
--- /dev/null
+++ b/src/test/ui/issue-50825.rs
@@ -0,0 +1,25 @@
+// Copyright 2018 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.
+
+// run-pass
+// regression test for issue #50825
+// Make sure that the built-in bound {integer}: Sized is prefered over
+// the u64: Sized bound in the where clause.
+
+fn foo(y: &[()])
+where
+    u64: Sized,
+{
+    y[0]
+}
+
+fn main () {
+    foo(&[()]);
+}
diff --git a/src/test/ui/trivial-bounds-inconsistent-associated-functions.rs b/src/test/ui/trivial-bounds-inconsistent-associated-functions.rs
index 49c9df95bc7..4cacbc2c914 100644
--- a/src/test/ui/trivial-bounds-inconsistent-associated-functions.rs
+++ b/src/test/ui/trivial-bounds-inconsistent-associated-functions.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // run-pass
 // Inconsistent bounds with trait implementations
 
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs b/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs
index 2c4d9d81385..a743b429698 100644
--- a/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs
+++ b/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // Check that reborrows are still illegal with Copy mutable references
 #![feature(trivial_bounds)]
 #![allow(unused)]
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy.rs b/src/test/ui/trivial-bounds-inconsistent-copy.rs
index 375885a02c7..f73c96a002d 100644
--- a/src/test/ui/trivial-bounds-inconsistent-copy.rs
+++ b/src/test/ui/trivial-bounds-inconsistent-copy.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // run-pass
 // Check tautalogically false `Copy` bounds
 #![feature(trivial_bounds)]
diff --git a/src/test/ui/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds-inconsistent-sized.rs
index 14ba11c44de..11f0080fbab 100644
--- a/src/test/ui/trivial-bounds-inconsistent-sized.rs
+++ b/src/test/ui/trivial-bounds-inconsistent-sized.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // run-pass
 // Check tautalogically false `Sized` bounds
 #![feature(trivial_bounds)]
diff --git a/src/test/ui/trivial-bounds-inconsistent-well-formed.rs b/src/test/ui/trivial-bounds-inconsistent-well-formed.rs
index 5fcdbfc437a..a78ecdc8ff3 100644
--- a/src/test/ui/trivial-bounds-inconsistent-well-formed.rs
+++ b/src/test/ui/trivial-bounds-inconsistent-well-formed.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // run-pass
 // Test that inconsistent bounds are used in well-formedness checks
 #![feature(trivial_bounds)]
diff --git a/src/test/ui/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds-inconsistent.rs
index 2c8b873b8c9..c8e8c320bc5 100644
--- a/src/test/ui/trivial-bounds-inconsistent.rs
+++ b/src/test/ui/trivial-bounds-inconsistent.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // run-pass
 
 // Check that tautalogically false bounds are accepted, and are used
diff --git a/src/test/ui/trivial-bounds-leak-copy.rs b/src/test/ui/trivial-bounds-leak-copy.rs
index 9850ec2bd1f..6f000006ca9 100644
--- a/src/test/ui/trivial-bounds-leak-copy.rs
+++ b/src/test/ui/trivial-bounds-leak-copy.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // Check that false Copy bounds don't leak
 #![feature(trivial_bounds)]
 
diff --git a/src/test/ui/trivial-bounds-leak.rs b/src/test/ui/trivial-bounds-leak.rs
index 98cb5b2b503..15dee64f70e 100644
--- a/src/test/ui/trivial-bounds-leak.rs
+++ b/src/test/ui/trivial-bounds-leak.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 // Check that false bounds don't leak
 #![feature(trivial_bounds)]
 
diff --git a/src/test/ui/trivial-bounds-lint.rs b/src/test/ui/trivial-bounds-lint.rs
index e6988cb9f8b..e37600a653a 100644
--- a/src/test/ui/trivial-bounds-lint.rs
+++ b/src/test/ui/trivial-bounds-lint.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-test FIXME(#50825)
 #![feature(trivial_bounds)]
 #![allow(unused)]
 #![deny(trivial_bounds)]