1
Fork 0

Replace illegal with invalid in most diagnostics

This commit is contained in:
Simonas Kazlauskas 2015-07-27 03:49:38 +03:00
parent ffcdf0881b
commit cca0ea718d
19 changed files with 61 additions and 62 deletions

View file

@ -674,8 +674,7 @@ impl<'a> LifetimeContext<'a> {
for lifetime in lifetimes { for lifetime in lifetimes {
if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) { if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
span_err!(self.sess, lifetime.lifetime.span, E0262, span_err!(self.sess, lifetime.lifetime.span, E0262,
"illegal lifetime parameter name: `{}`", "invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
lifetime.lifetime.name);
} }
} }

View file

@ -2325,7 +2325,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
_ => { _ => {
bcx.tcx().sess.span_bug( bcx.tcx().sess.span_bug(
expr.span, expr.span,
&format!("deref invoked on expr of illegal type {:?}", &format!("deref invoked on expr of invalid type {:?}",
datum.ty)); datum.ty));
} }
}; };

View file

@ -3468,7 +3468,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
let tcx = fcx.tcx(); let tcx = fcx.tcx();
if !tcx.expr_is_lval(&**lhs) { if !tcx.expr_is_lval(&**lhs) {
span_err!(tcx.sess, expr.span, E0070, span_err!(tcx.sess, expr.span, E0070,
"illegal left-hand side expression"); "invalid left-hand side expression");
} }
let lhs_ty = fcx.expr_ty(&**lhs); let lhs_ty = fcx.expr_ty(&**lhs);

View file

@ -57,7 +57,7 @@ pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
let tcx = fcx.tcx(); let tcx = fcx.tcx();
if !tcx.expr_is_lval(lhs_expr) { if !tcx.expr_is_lval(lhs_expr) {
span_err!(tcx.sess, lhs_expr.span, E0067, "illegal left-hand side expression"); span_err!(tcx.sess, lhs_expr.span, E0067, "invalid left-hand side expression");
} }
fcx.require_expr_have_sized_type(lhs_expr, traits::AssignmentLhsSized); fcx.require_expr_have_sized_type(lhs_expr, traits::AssignmentLhsSized);

View file

@ -694,7 +694,7 @@ impl<'a> StringReader<'a> {
accum_int *= 16; accum_int *= 16;
accum_int += c.to_digit(16).unwrap_or_else(|| { accum_int += c.to_digit(16).unwrap_or_else(|| {
self.err_span_char(self.last_pos, self.pos, self.err_span_char(self.last_pos, self.pos,
"illegal character in numeric character escape", c); "invalid character in numeric character escape", c);
valid = false; valid = false;
0 0
@ -714,7 +714,7 @@ impl<'a> StringReader<'a> {
Some(_) => valid, Some(_) => valid,
None => { None => {
let last_bpos = self.last_pos; let last_bpos = self.last_pos;
self.err_span_(start_bpos, last_bpos, "illegal numeric character escape"); self.err_span_(start_bpos, last_bpos, "invalid numeric character escape");
false false
} }
} }
@ -846,7 +846,7 @@ impl<'a> StringReader<'a> {
"unterminated unicode escape (needed a `}`)"); "unterminated unicode escape (needed a `}`)");
} else { } else {
self.err_span_char(self.last_pos, self.pos, self.err_span_char(self.last_pos, self.pos,
"illegal character in unicode escape", c); "invalid character in unicode escape", c);
} }
valid = false; valid = false;
0 0
@ -862,7 +862,7 @@ impl<'a> StringReader<'a> {
} }
if valid && (char::from_u32(accum_int).is_none() || count == 0) { if valid && (char::from_u32(accum_int).is_none() || count == 0) {
self.err_span_(start_bpos, self.last_pos, "illegal unicode character escape"); self.err_span_(start_bpos, self.last_pos, "invalid unicode character escape");
valid = false; valid = false;
} }
@ -1138,8 +1138,8 @@ impl<'a> StringReader<'a> {
let last_bpos = self.last_pos; let last_bpos = self.last_pos;
let curr_char = self.curr.unwrap(); let curr_char = self.curr.unwrap();
self.fatal_span_char(start_bpos, last_bpos, self.fatal_span_char(start_bpos, last_bpos,
"only `#` is allowed in raw string delimitation; \ "found invalid character; \
found illegal character", only `#` is allowed in raw string delimitation",
curr_char); curr_char);
} }
self.bump(); self.bump();
@ -1323,8 +1323,8 @@ impl<'a> StringReader<'a> {
let last_pos = self.last_pos; let last_pos = self.last_pos;
let ch = self.curr.unwrap(); let ch = self.curr.unwrap();
self.fatal_span_char(start_bpos, last_pos, self.fatal_span_char(start_bpos, last_pos,
"only `#` is allowed in raw string delimitation; \ "found invalid character; \
found illegal character", only `#` is allowed in raw string delimitation",
ch); ch);
} }
self.bump(); self.bump();

View file

@ -446,11 +446,11 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
Some(suf) => { Some(suf) => {
if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) { if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) {
// if it looks like a width, lets try to be helpful. // if it looks like a width, lets try to be helpful.
sd.span_err(sp, &*format!("illegal width `{}` for float literal, \ sd.span_err(sp, &*format!("invalid width `{}` for float literal", &suf[1..]));
valid widths are 32 and 64", &suf[1..])); sd.fileline_help(sp, "valid widths are 32 and 64");
} else { } else {
sd.span_err(sp, &*format!("illegal suffix `{}` for float literal, \ sd.span_err(sp, &*format!("invalid suffix `{}` for float literal", suf));
valid suffixes are `f32` and `f64`", suf)); sd.fileline_help(sp, "valid suffixes are `f32` and `f64`");
} }
ast::LitFloatUnsuffixed(data) ast::LitFloatUnsuffixed(data)
@ -619,11 +619,11 @@ pub fn integer_lit(s: &str,
// i<digits> and u<digits> look like widths, so lets // i<digits> and u<digits> look like widths, so lets
// give an error message along those lines // give an error message along those lines
if looks_like_width_suffix(&['i', 'u'], suf) { if looks_like_width_suffix(&['i', 'u'], suf) {
sd.span_err(sp, &*format!("illegal width `{}` for integer literal; \ sd.span_err(sp, &*format!("invalid width `{}` for integer literal",
valid widths are 8, 16, 32 and 64",
&suf[1..])); &suf[1..]));
sd.fileline_help(sp, "valid widths are 8, 16, 32 and 64");
} else { } else {
sd.span_err(sp, &*format!("illegal suffix `{}` for numeric literal", suf)); sd.span_err(sp, &*format!("invalid suffix `{}` for numeric literal", suf));
sd.fileline_help(sp, "the suffix must be one of the integral types \ sd.fileline_help(sp, "the suffix must be one of the integral types \
(`u32`, `isize`, etc)"); (`u32`, `isize`, etc)");
} }

View file

@ -681,7 +681,7 @@ impl<'a> Parser<'a> {
if text.is_empty() { if text.is_empty() {
self.span_bug(sp, "found empty literal suffix in Some") self.span_bug(sp, "found empty literal suffix in Some")
} }
self.span_err(sp, &*format!("{} with a suffix is illegal", kind)); self.span_err(sp, &*format!("{} with a suffix is invalid", kind));
} }
} }
} }
@ -5286,7 +5286,7 @@ impl<'a> Parser<'a> {
let last_span = self.last_span; let last_span = self.last_span;
self.span_err( self.span_err(
last_span, last_span,
&format!("illegal ABI: expected one of [{}], \ &format!("invalid ABI: expected one of [{}], \
found `{}`", found `{}`",
abi::all_names().join(", "), abi::all_names().join(", "),
s)); s));

View file

@ -9,12 +9,12 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
1 = 2; //~ ERROR illegal left-hand side expression 1 = 2; //~ ERROR invalid left-hand side expression
1 += 2; //~ ERROR illegal left-hand side expression 1 += 2; //~ ERROR invalid left-hand side expression
(1, 2) = (3, 4); //~ ERROR illegal left-hand side expression (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression
let (a, b) = (1, 2); let (a, b) = (1, 2);
(a, b) = (3, 4); //~ ERROR illegal left-hand side expression (a, b) = (3, 4); //~ ERROR invalid left-hand side expression
None = Some(3); //~ ERROR illegal left-hand side expression None = Some(3); //~ ERROR invalid left-hand side expression
} }

View file

@ -14,6 +14,6 @@ mod A {
fn main() { fn main() {
A::C = 1; A::C = 1;
//~^ ERROR: illegal left-hand side expression //~^ ERROR: invalid left-hand side expression
//~| ERROR: mismatched types //~| ERROR: mismatched types
} }

View file

@ -9,6 +9,6 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let a = 1_is; //~ ERROR illegal suffix let a = 1_is; //~ ERROR invalid suffix
let b = 2_us; //~ ERROR illegal suffix let b = 2_us; //~ ERROR invalid suffix
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
struct Foo<'static> { //~ ERROR illegal lifetime parameter name: `'static` struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static`
x: &'static isize x: &'static isize
} }

View file

@ -12,28 +12,28 @@
extern extern
"C"suffix //~ ERROR ABI spec with a suffix is illegal "C"suffix //~ ERROR ABI spec with a suffix is invalid
fn foo() {} fn foo() {}
extern extern
"C"suffix //~ ERROR ABI spec with a suffix is illegal "C"suffix //~ ERROR ABI spec with a suffix is invalid
{} {}
fn main() { fn main() {
""suffix; //~ ERROR str literal with a suffix is illegal ""suffix; //~ ERROR str literal with a suffix is invalid
b""suffix; //~ ERROR binary str literal with a suffix is illegal b""suffix; //~ ERROR binary str literal with a suffix is invalid
r#""#suffix; //~ ERROR str literal with a suffix is illegal r#""#suffix; //~ ERROR str literal with a suffix is invalid
br#""#suffix; //~ ERROR binary str literal with a suffix is illegal br#""#suffix; //~ ERROR binary str literal with a suffix is invalid
'a'suffix; //~ ERROR char literal with a suffix is illegal 'a'suffix; //~ ERROR char literal with a suffix is invalid
b'a'suffix; //~ ERROR byte literal with a suffix is illegal b'a'suffix; //~ ERROR byte literal with a suffix is invalid
1234u1024; //~ ERROR illegal width `1024` for integer literal 1234u1024; //~ ERROR invalid width `1024` for integer literal
1234i1024; //~ ERROR illegal width `1024` for integer literal 1234i1024; //~ ERROR invalid width `1024` for integer literal
1234f1024; //~ ERROR illegal width `1024` for float literal 1234f1024; //~ ERROR invalid width `1024` for float literal
1234.5f1024; //~ ERROR illegal width `1024` for float literal 1234.5f1024; //~ ERROR invalid width `1024` for float literal
1234suffix; //~ ERROR illegal suffix `suffix` for numeric literal 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
0b101suffix; //~ ERROR illegal suffix `suffix` for numeric literal 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
1.0suffix; //~ ERROR illegal suffix `suffix` for float literal 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
1.0e10suffix; //~ ERROR illegal suffix `suffix` for float literal 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
} }

View file

@ -17,7 +17,7 @@ static FOO: u8 = b'\f'; //~ ERROR unknown byte escape
pub fn main() { pub fn main() {
b'\f'; //~ ERROR unknown byte escape b'\f'; //~ ERROR unknown byte escape
b'\x0Z'; //~ ERROR illegal character in numeric character escape: Z b'\x0Z'; //~ ERROR invalid character in numeric character escape: Z
b' '; //~ ERROR byte constant must be escaped b' '; //~ ERROR byte constant must be escaped
b'''; //~ ERROR byte constant must be escaped b'''; //~ ERROR byte constant must be escaped
b'é'; //~ ERROR byte constant must be ASCII b'é'; //~ ERROR byte constant must be ASCII

View file

@ -17,7 +17,7 @@ static FOO: &'static [u8] = b"\f"; //~ ERROR unknown byte escape
pub fn main() { pub fn main() {
b"\f"; //~ ERROR unknown byte escape b"\f"; //~ ERROR unknown byte escape
b"\x0Z"; //~ ERROR illegal character in numeric character escape: Z b"\x0Z"; //~ ERROR invalid character in numeric character escape: Z
b"é"; //~ ERROR byte constant must be ASCII b"é"; //~ ERROR byte constant must be ASCII
b"a //~ ERROR unterminated double quote byte string b"a //~ ERROR unterminated double quote byte string
} }

View file

@ -23,25 +23,25 @@ fn main() {
//~^ ERROR numeric character escape is too short //~^ ERROR numeric character escape is too short
let _ = b'\xxy'; let _ = b'\xxy';
//~^ ERROR illegal character in numeric character escape: x //~^ ERROR invalid character in numeric character escape: x
//~^^ ERROR illegal character in numeric character escape: y //~^^ ERROR invalid character in numeric character escape: y
let _ = '\x5'; let _ = '\x5';
//~^ ERROR numeric character escape is too short //~^ ERROR numeric character escape is too short
let _ = '\xxy'; let _ = '\xxy';
//~^ ERROR illegal character in numeric character escape: x //~^ ERROR invalid character in numeric character escape: x
//~^^ ERROR illegal character in numeric character escape: y //~^^ ERROR invalid character in numeric character escape: y
let _ = b"\u{a4a4} \xf \u"; let _ = b"\u{a4a4} \xf \u";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
//~^^ ERROR illegal character in numeric character escape: //~^^ ERROR invalid character in numeric character escape:
//~^^^ ERROR incorrect unicode escape sequence //~^^^ ERROR incorrect unicode escape sequence
//~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string //~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = "\u{ffffff} \xf \u"; let _ = "\u{ffffff} \xf \u";
//~^ ERROR illegal unicode character escape //~^ ERROR invalid unicode character escape
//~^^ ERROR illegal character in numeric character escape: //~^^ ERROR invalid character in numeric character escape:
//~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f] //~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
//~^^^^ ERROR incorrect unicode escape sequence //~^^^^ ERROR incorrect unicode escape sequence
} }

View file

@ -11,7 +11,7 @@
// compile-flags: -Z parse-only // compile-flags: -Z parse-only
pub extern pub extern
"invalid-ab_isize" //~ ERROR illegal ABI "invalid-ab_isize" //~ ERROR invalid ABI
fn foo() {} fn foo() {}
fn main() {} fn main() {}

View file

@ -11,5 +11,5 @@
// compile-flags: -Z parse-only // compile-flags: -Z parse-only
pub fn main() { pub fn main() {
let s = "\u{d805}"; //~ ERROR illegal unicode character escape let s = "\u{d805}"; //~ ERROR invalid unicode character escape
} }

View file

@ -12,7 +12,7 @@
pub fn main() { pub fn main() {
let s = "\u{lol}"; let s = "\u{lol}";
//~^ ERROR illegal character in unicode escape: l //~^ ERROR invalid character in unicode escape: l
//~^^ ERROR illegal character in unicode escape: o //~^^ ERROR invalid character in unicode escape: o
//~^^^ ERROR illegal character in unicode escape: l //~^^^ ERROR invalid character in unicode escape: l
} }

View file

@ -11,5 +11,5 @@
// compile-flags: -Z parse-only // compile-flags: -Z parse-only
static s: &'static str = static s: &'static str =
r#x"#"x# //~ ERROR only `#` is allowed in raw string delimitation; found illegal character r#x"#"x# //~ ERROR found invalid character; only `#` is allowed in raw string delimitation
; ;