E0122 should apply with where clauses

This commit is contained in:
Chris Stankus 2017-01-18 00:16:19 -06:00
parent c07a6ae77c
commit 5c58653e46
4 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -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() {}

View File

@ -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

View File

@ -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