E0122 should apply with where clauses
This commit is contained in:
parent
c07a6ae77c
commit
5c58653e46
@ -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 {
|
if warn {
|
||||||
// According to accepted RFC #XXX, we should
|
// According to accepted RFC #XXX, we should
|
||||||
// eventually accept these, but it will not be
|
// eventually accept these, but it will not be
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Tr {}
|
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() {}
|
fn main() {}
|
||||||
|
13
src/test/compile-fail/issue-39122.rs
Normal file
13
src/test/compile-fail/issue-39122.rs
Normal 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
|
@ -89,6 +89,7 @@ mod traits_where {
|
|||||||
pub type Alias<T> where T: PrivTr = T;
|
pub type Alias<T> where T: PrivTr = T;
|
||||||
//~^ ERROR private trait `traits_where::PrivTr` in public interface
|
//~^ ERROR private trait `traits_where::PrivTr` in public interface
|
||||||
//~| WARNING hard error
|
//~| WARNING hard error
|
||||||
|
//~| WARNING E0122
|
||||||
pub trait Tr2<T> where T: PrivTr {}
|
pub trait Tr2<T> where T: PrivTr {}
|
||||||
//~^ ERROR private trait `traits_where::PrivTr` in public interface
|
//~^ ERROR private trait `traits_where::PrivTr` in public interface
|
||||||
//~| WARNING hard error
|
//~| WARNING hard error
|
||||||
|
Loading…
Reference in New Issue
Block a user