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 where T: Tr = isize; //~ ERROR type parameter `T` is unused +type Huh 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +type Foo = T; //~ WARNING E0122 + +type Bar 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 where T: PrivTr = T; //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error + //~| WARNING E0122 pub trait Tr2 where T: PrivTr {} //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error