mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Correct span in privacy error
This commit is contained in:
parent
126db549b0
commit
3e0cdb6339
@ -1261,13 +1261,13 @@ impl<'a, 'tcx> VisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn check_ty_param_bound(&self,
|
||||
span: Span,
|
||||
ty_param_bound: &ast::TyParamBound) {
|
||||
if let ast::TraitTyParamBound(ref trait_ref) = *ty_param_bound {
|
||||
if !self.tcx.sess.features.borrow().visible_private_types &&
|
||||
self.path_is_private_type(trait_ref.trait_ref.ref_id) {
|
||||
let span = trait_ref.trait_ref.path.span;
|
||||
self.tcx.sess.span_err(span,
|
||||
"private type in exported type \
|
||||
"private trait in exported type \
|
||||
parameter bound");
|
||||
}
|
||||
}
|
||||
@ -1311,7 +1311,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
for bound in bounds.iter() {
|
||||
self.check_ty_param_bound(item.span, bound)
|
||||
self.check_ty_param_bound(bound)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1449,14 +1449,14 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
fn visit_generics(&mut self, generics: &ast::Generics) {
|
||||
for ty_param in generics.ty_params.iter() {
|
||||
for bound in ty_param.bounds.iter() {
|
||||
self.check_ty_param_bound(ty_param.span, bound)
|
||||
self.check_ty_param_bound(bound)
|
||||
}
|
||||
}
|
||||
for predicate in generics.where_clause.predicates.iter() {
|
||||
match predicate {
|
||||
&ast::WherePredicate::BoundPredicate(ref bound_pred) => {
|
||||
for bound in bound_pred.bounds.iter() {
|
||||
self.check_ty_param_bound(bound_pred.span, bound)
|
||||
self.check_ty_param_bound(bound)
|
||||
}
|
||||
}
|
||||
&ast::WherePredicate::EqPredicate(ref eq_pred) => {
|
||||
|
@ -10,17 +10,14 @@
|
||||
|
||||
trait Foo {}
|
||||
|
||||
pub fn f<T:Foo>() {} //~ ERROR private type in exported type
|
||||
pub fn f<
|
||||
T
|
||||
: Foo //~ ERROR private trait in exported type parameter bound
|
||||
>() {}
|
||||
|
||||
pub fn g<T>() where T: Foo {} //~ ERROR private type in exported type
|
||||
|
||||
pub struct H<T:Foo> { //~ ERROR private type in exported type
|
||||
x: T,
|
||||
}
|
||||
|
||||
pub struct I<T> where T: Foo { //~ ERROR private type in exported type
|
||||
x: T,
|
||||
}
|
||||
pub fn g<T>() where
|
||||
T
|
||||
: Foo //~ ERROR private trait in exported type parameter bound
|
||||
{}
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
trait Foo {}
|
||||
|
||||
pub trait Bar : Foo {} //~ ERROR private type in exported type
|
||||
pub trait Bar : Foo {} //~ ERROR private trait in exported type
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user