diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-01-19 11:56:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-19 11:56:08 +0100 |
| commit | 2c044753f92c4981b1f761aaeea1b5d31a9d7653 (patch) | |
| tree | ac7eb5c454c6fb7708cf6dff4237adf387d1ca54 | |
| parent | 4603c0e37f4606adf359ae8b587964f86f7c370e (diff) | |
| parent | 5c58653e46b73bbc2bb6811be2eefa4b6675c942 (diff) | |
| download | rust-2c044753f92c4981b1f761aaeea1b5d31a9d7653.tar.gz rust-2c044753f92c4981b1f761aaeea1b5d31a9d7653.zip | |
Rollup merge of #39149 - circuitfox:E0122-type-def-trait-bounds-where-clause, r=arielb1
E0122 should apply with where clauses Fixes #39122
| -rw-r--r-- | src/librustc_typeck/collect.rs | 10 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-17994.rs | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-39122.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/private-in-public-warn.rs | 1 |
4 files changed, 26 insertions, 1 deletions
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index f832bf8d86e..e13434db5d8 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -716,6 +716,16 @@ fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, } } + for predicate in generics.where_clause.predicates.iter() { + match *predicate { + hir::WherePredicate::BoundPredicate(..) => { + warn = true; + } + hir::WherePredicate::RegionPredicate(..) => { } + hir::WherePredicate::EqPredicate(..) => { } + } + } + if warn { // According to accepted RFC #XXX, we should // eventually accept these, but it will not be diff --git a/src/test/compile-fail/issue-17994.rs b/src/test/compile-fail/issue-17994.rs index fcbc08327b9..ac15bd9d15b 100644 --- a/src/test/compile-fail/issue-17994.rs +++ b/src/test/compile-fail/issue-17994.rs @@ -9,5 +9,6 @@ // except according to those terms. trait Tr {} -type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused +type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused + //~| WARNING E0122 fn main() {} diff --git a/src/test/compile-fail/issue-39122.rs b/src/test/compile-fail/issue-39122.rs new file mode 100644 index 00000000000..2e8a740f893 --- /dev/null +++ b/src/test/compile-fail/issue-39122.rs @@ -0,0 +1,13 @@ +// 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. + +type Foo<T: std::ops::Add> = T; //~ WARNING E0122 + +type Bar<T> where T: std::ops::Add = T; //~ WARNING E0122 diff --git a/src/test/compile-fail/private-in-public-warn.rs b/src/test/compile-fail/private-in-public-warn.rs index 3496348985d..92d96595fd7 100644 --- a/src/test/compile-fail/private-in-public-warn.rs +++ b/src/test/compile-fail/private-in-public-warn.rs @@ -89,6 +89,7 @@ mod traits_where { pub type Alias<T> where T: PrivTr = T; //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error + //~| WARNING E0122 pub trait Tr2<T> where T: PrivTr {} //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error |
