Auto merge of #30241 - Manishearth:diag-30236, r=eddyb

r? @eddyb
This commit is contained in:
bors 2015-12-06 17:50:44 +00:00
commit 64c21f9ee2
2 changed files with 21 additions and 4 deletions

View File

@ -704,9 +704,9 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
hir::ItemStruct(..) => {
check_struct(ccx, it.id, it.span);
}
hir::ItemTy(ref t, ref generics) => {
hir::ItemTy(_, ref generics) => {
let pty_ty = ccx.tcx.node_id_to_type(it.id);
check_bounds_are_used(ccx, t.span, &generics.ty_params, pty_ty);
check_bounds_are_used(ccx, &generics.ty_params, pty_ty);
}
hir::ItemForeignMod(ref m) => {
if m.abi == abi::RustIntrinsic {
@ -4904,7 +4904,6 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &hir::Block) -> bool {
}
pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
span: Span,
tps: &OwnedSlice<hir::TyParam>,
ty: Ty<'tcx>) {
debug!("check_bounds_are_used(n_tps={}, ty={:?})",
@ -4923,7 +4922,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
for (i, b) in tps_used.iter().enumerate() {
if !*b {
span_err!(ccx.tcx.sess, span, E0091,
span_err!(ccx.tcx.sess, tps[i].span, E0091,
"type parameter `{}` is unused",
tps[i].name);
}

View File

@ -0,0 +1,18 @@
// Copyright 2015 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<
Unused //~ ERROR type parameter `Unused` is unused
> = u8;
fn main() {
}