Skip to content

Commit 600507d

Browse files
committed
auto merge of #13782 : alexcrichton/rust/issue-13775, r=pcwalton
These often crop up when using default methods that don't actually bind their argument names. Closes #13775
2 parents d943b0f + cf9dd70 commit 600507d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ fn check_pat_uppercase_variable(cx: &Context, p: &ast::Pat) {
12701270
// last identifier alone is right choice for this lint.
12711271
let ident = path.segments.last().unwrap().identifier;
12721272
let s = token::get_ident(ident);
1273-
if s.get().char_at(0).is_uppercase() {
1273+
if s.get().len() > 0 && s.get().char_at(0).is_uppercase() {
12741274
cx.span_lint(
12751275
UppercaseVariables,
12761276
path.span,

src/test/run-pass/issue-13775.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 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+
trait Foo {
12+
fn bar(&self, int) {}
13+
}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)