From 48a682398acb48d4fe09adbf94616d1270bd1b7a Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Mon, 19 Aug 2013 15:49:37 -0700 Subject: [PATCH] Don't ICE if an argument in a default method doesn't have a name. Closes #8417. --- src/librustc/middle/liveness.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index edb805cfc40ae..a18fffda32e4b 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1617,7 +1617,7 @@ impl Liveness { pub fn should_warn(&self, var: Variable) -> Option<@str> { let name = self.ir.variable_name(var); - if name[0] == ('_' as u8) { None } else { Some(name) } + if name.len() == 0 || name[0] == ('_' as u8) { None } else { Some(name) } } pub fn warn_about_unused_args(&self, decl: &fn_decl, entry_ln: LiveNode) {