Skip to content

Commit 64c21f9

Browse files
committed
Auto merge of #30241 - Manishearth:diag-30236, r=eddyb
r? @eddyb
2 parents 85b031b + 050ad0d commit 64c21f9

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/librustc_typeck/check/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
704704
hir::ItemStruct(..) => {
705705
check_struct(ccx, it.id, it.span);
706706
}
707-
hir::ItemTy(ref t, ref generics) => {
707+
hir::ItemTy(_, ref generics) => {
708708
let pty_ty = ccx.tcx.node_id_to_type(it.id);
709-
check_bounds_are_used(ccx, t.span, &generics.ty_params, pty_ty);
709+
check_bounds_are_used(ccx, &generics.ty_params, pty_ty);
710710
}
711711
hir::ItemForeignMod(ref m) => {
712712
if m.abi == abi::RustIntrinsic {
@@ -4904,7 +4904,6 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &hir::Block) -> bool {
49044904
}
49054905

49064906
pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
4907-
span: Span,
49084907
tps: &OwnedSlice<hir::TyParam>,
49094908
ty: Ty<'tcx>) {
49104909
debug!("check_bounds_are_used(n_tps={}, ty={:?})",
@@ -4923,7 +4922,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
49234922

49244923
for (i, b) in tps_used.iter().enumerate() {
49254924
if !*b {
4926-
span_err!(ccx.tcx.sess, span, E0091,
4925+
span_err!(ccx.tcx.sess, tps[i].span, E0091,
49274926
"type parameter `{}` is unused",
49284927
tps[i].name);
49294928
}

src/test/compile-fail/issue-30236.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
type Foo<
12+
Unused //~ ERROR type parameter `Unused` is unused
13+
> = u8;
14+
15+
fn main() {
16+
17+
}
18+

0 commit comments

Comments
 (0)