]> git.lizzy.rs Git - rust.git/commitdiff
Replace illegal with invalid in most diagnostics
authorSimonas Kazlauskas <git@kazlauskas.me>
Mon, 27 Jul 2015 00:49:38 +0000 (03:49 +0300)
committerSimonas Kazlauskas <git@kazlauskas.me>
Tue, 28 Jul 2015 22:59:31 +0000 (01:59 +0300)
19 files changed:
src/librustc/middle/resolve_lifetime.rs
src/librustc_trans/trans/expr.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/test/compile-fail/bad-expr-lhs.rs
src/test/compile-fail/issue-13407.rs
src/test/compile-fail/old-suffixes-are-really-forbidden.rs
src/test/compile-fail/regions-name-static.rs
src/test/parse-fail/bad-lit-suffixes.rs
src/test/parse-fail/byte-literals.rs
src/test/parse-fail/byte-string-literals.rs
src/test/parse-fail/issue-23620-invalid-escapes.rs
src/test/parse-fail/issue-8537.rs
src/test/parse-fail/new-unicode-escapes-3.rs
src/test/parse-fail/new-unicode-escapes-4.rs
src/test/parse-fail/raw-str-delim.rs

index 90e24213818a7146280e3e0ad81f5245cfd2a403..95b8161ac342979d4e84aa3aaf02563d79585d71 100644 (file)
@@ -674,8 +674,7 @@ fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &Vec<ast::Lifetim
             for lifetime in lifetimes {
                 if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
                     span_err!(self.sess, lifetime.lifetime.span, E0262,
-                        "illegal lifetime parameter name: `{}`",
-                                lifetime.lifetime.name);
+                        "invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
                 }
             }
 
index 35e3c96d09c8013cd9e4360bccec1ce2c99810df..2dae1aca8351daf56fab345303fa42273e875074 100644 (file)
@@ -2325,7 +2325,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         _ => {
             bcx.tcx().sess.span_bug(
                 expr.span,
-                &format!("deref invoked on expr of illegal type {:?}",
+                &format!("deref invoked on expr of invalid type {:?}",
                         datum.ty));
         }
     };
index 96f6f5eb566a3ddf5e3210394c4747c21fa8720f..819f44372979613323413ddc33d46ae50ad67b3c 100644 (file)
@@ -3468,7 +3468,7 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         let tcx = fcx.tcx();
         if !tcx.expr_is_lval(&**lhs) {
             span_err!(tcx.sess, expr.span, E0070,
-                "illegal left-hand side expression");
+                "invalid left-hand side expression");
         }
 
         let lhs_ty = fcx.expr_ty(&**lhs);
index c419a986f95b189491811fe1a1476af6a0386798..c6d13d3b0a5ca6326e4860b5c45257fcf945c53c 100644 (file)
@@ -57,7 +57,7 @@ pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
 
     let tcx = fcx.tcx();
     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);
index 621335ecd979cf1ee5a97a03c09881ec280127cf..019a8404dfb0df00c1624837b18172e6f83d24f2 100644 (file)
@@ -694,7 +694,7 @@ fn scan_hex_digits(&mut self,
             accum_int *= 16;
             accum_int += c.to_digit(16).unwrap_or_else(|| {
                 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;
                 0
@@ -714,7 +714,7 @@ fn scan_hex_digits(&mut self,
             Some(_) => valid,
             None => {
                 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
             }
         }
@@ -846,7 +846,7 @@ fn scan_unicode_escape(&mut self, delim: char) -> bool {
                                      "unterminated unicode escape (needed a `}`)");
                 } else {
                     self.err_span_char(self.last_pos, self.pos,
-                                   "illegal character in unicode escape", c);
+                                   "invalid character in unicode escape", c);
                 }
                 valid = false;
                 0
@@ -862,7 +862,7 @@ fn scan_unicode_escape(&mut self, delim: char) -> bool {
         }
 
         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;
         }
 
@@ -1138,8 +1138,8 @@ fn next_token_inner(&mut self) -> token::Token {
                 let last_bpos = self.last_pos;
                 let curr_char = self.curr.unwrap();
                 self.fatal_span_char(start_bpos, last_bpos,
-                                "only `#` is allowed in raw string delimitation; \
-                                 found illegal character",
+                                "found invalid character; \
+                                 only `#` is allowed in raw string delimitation",
                                 curr_char);
             }
             self.bump();
@@ -1323,8 +1323,8 @@ fn scan_raw_byte_string(&mut self) -> token::Lit {
             let last_pos = self.last_pos;
             let ch = self.curr.unwrap();
             self.fatal_span_char(start_bpos, last_pos,
-                            "only `#` is allowed in raw string delimitation; \
-                             found illegal character",
+                            "found invalid character; \
+                             only `#` is allowed in raw string delimitation",
                             ch);
         }
         self.bump();
index 70da512e898854c0927a98b91ef51547d73da611..c5a73601d895c93dd495755f765e56020dff8c43 100644 (file)
@@ -446,11 +446,11 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
         Some(suf) => {
             if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) {
                 // if it looks like a width, lets try to be helpful.
-                sd.span_err(sp, &*format!("illegal width `{}` for float literal, \
-                                          valid widths are 32 and 64", &suf[1..]));
+                sd.span_err(sp, &*format!("invalid width `{}` for float literal", &suf[1..]));
+                sd.fileline_help(sp, "valid widths are 32 and 64");
             } else {
-                sd.span_err(sp, &*format!("illegal suffix `{}` for float literal, \
-                                          valid suffixes are `f32` and `f64`", suf));
+                sd.span_err(sp, &*format!("invalid suffix `{}` for float literal", suf));
+                sd.fileline_help(sp, "valid suffixes are `f32` and `f64`");
             }
 
             ast::LitFloatUnsuffixed(data)
@@ -619,11 +619,11 @@ pub fn integer_lit(s: &str,
                 // i<digits> and u<digits> look like widths, so lets
                 // give an error message along those lines
                 if looks_like_width_suffix(&['i', 'u'], suf) {
-                    sd.span_err(sp, &*format!("illegal width `{}` for integer literal; \
-                                              valid widths are 8, 16, 32 and 64",
+                    sd.span_err(sp, &*format!("invalid width `{}` for integer literal",
                                               &suf[1..]));
+                    sd.fileline_help(sp, "valid widths are 8, 16, 32 and 64");
                 } 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 \
                                       (`u32`, `isize`, etc)");
                 }
index 2cae6a4be6520e74247ee3c8e2f77a5debb9046c..11611c9adb0bc57996f33213f51d919ac09873e4 100644 (file)
@@ -681,7 +681,7 @@ pub fn expect_no_suffix(&self, sp: Span, kind: &str, suffix: Option<ast::Name>)
                 if text.is_empty() {
                     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 @@ fn parse_opt_abi(&mut self) -> PResult<Option<abi::Abi>> {
                         let last_span = self.last_span;
                         self.span_err(
                             last_span,
-                            &format!("illegal ABI: expected one of [{}], \
+                            &format!("invalid ABI: expected one of [{}], \
                                      found `{}`",
                                     abi::all_names().join(", "),
                                     s));
index 6907bf4b5b8137ee361bf542368dbf3107edaa06..c7d2f2c472f49e15bc94f39232a4145be2ada6ab 100644 (file)
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 fn main() {
-    1 = 2; //~ ERROR illegal left-hand side expression
-    1 += 2; //~ ERROR illegal left-hand side expression
-    (1, 2) = (3, 4); //~ ERROR illegal left-hand side expression
+    1 = 2; //~ ERROR invalid left-hand side expression
+    1 += 2; //~ ERROR invalid left-hand side expression
+    (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression
 
     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
 }
index f845eba406041be1106adbd4dd19a4eafffdb61b..311280bd497605f429b179754bc9b60586e7338d 100644 (file)
@@ -14,6 +14,6 @@ mod A {
 
 fn main() {
     A::C = 1;
-    //~^ ERROR: illegal left-hand side expression
+    //~^ ERROR: invalid left-hand side expression
     //~| ERROR: mismatched types
 }
index b18741d3932f9971ce87874abb11b3c4ca2fe1c9..9a71dc980149c18e9458229affda4fcd44e8b687 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    let a = 1_is; //~ ERROR illegal suffix
-    let b = 2_us; //~ ERROR illegal suffix
+    let a = 1_is; //~ ERROR invalid suffix
+    let b = 2_us; //~ ERROR invalid suffix
 }
index 29896aa486b499469ec85801f9aa2cc43eea75ce..69d63f3820c6c257a38da6a19e72fb4566e32e00 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // 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
 }
 
index a64ee6a9ce2651f91a18f0a2c441899f24e8a2bd..a2ee2f6e88ca646f54f024f07bf6c24a8b6179b1 100644 (file)
 
 
 extern
-    "C"suffix //~ ERROR ABI spec with a suffix is illegal
+    "C"suffix //~ ERROR ABI spec with a suffix is invalid
     fn foo() {}
 
 extern
-    "C"suffix //~ ERROR ABI spec with a suffix is illegal
+    "C"suffix //~ ERROR ABI spec with a suffix is invalid
 {}
 
 fn main() {
-    ""suffix; //~ ERROR str literal with a suffix is illegal
-    b""suffix; //~ ERROR binary str literal with a suffix is illegal
-    r#""#suffix; //~ ERROR str literal with a suffix is illegal
-    br#""#suffix; //~ ERROR binary str literal with a suffix is illegal
-    'a'suffix; //~ ERROR char literal with a suffix is illegal
-    b'a'suffix; //~ ERROR byte 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 invalid
+    r#""#suffix; //~ ERROR str literal with a suffix is invalid
+    br#""#suffix; //~ ERROR binary str literal with a suffix is invalid
+    'a'suffix; //~ ERROR char literal with a suffix is invalid
+    b'a'suffix; //~ ERROR byte literal with a suffix is invalid
 
-    1234u1024; //~ ERROR illegal width `1024` for integer literal
-    1234i1024; //~ ERROR illegal width `1024` for integer literal
-    1234f1024; //~ ERROR illegal width `1024` for float literal
-    1234.5f1024; //~ ERROR illegal width `1024` for float literal
+    1234u1024; //~ ERROR invalid width `1024` for integer literal
+    1234i1024; //~ ERROR invalid width `1024` for integer literal
+    1234f1024; //~ ERROR invalid width `1024` for float literal
+    1234.5f1024; //~ ERROR invalid width `1024` for float literal
 
-    1234suffix; //~ ERROR illegal suffix `suffix` for numeric literal
-    0b101suffix; //~ ERROR illegal suffix `suffix` for numeric literal
-    1.0suffix; //~ ERROR illegal suffix `suffix` for float literal
-    1.0e10suffix; //~ ERROR illegal suffix `suffix` for float literal
+    1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
+    0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
+    1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
+    1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
 }
index 6685a29bb426443bdefcb532f87dc2b5d7ebbf5d..3321f2450c1885b6016eb7be3b1f479ef7c93f3e 100644 (file)
@@ -17,7 +17,7 @@
 
 pub fn main() {
     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 ASCII
index 7049363c21b77d2f12d51289ce0a21940b8c1426..22f123416f26e75d168e2de52b3fa0b3ff626dee 100644 (file)
@@ -17,7 +17,7 @@
 
 pub fn main() {
     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"a  //~ ERROR unterminated double quote byte string
 }
index 1790b9164b7efd0216e9f5644c000a6bbe6efbe0..d2f78ef897b353da482e94178131040c5b77aaca 100644 (file)
@@ -23,25 +23,25 @@ fn main() {
     //~^ ERROR numeric character escape is too short
 
     let _ = b'\xxy';
-    //~^ ERROR illegal character in numeric character escape: x
-    //~^^ ERROR illegal character in numeric character escape: y
+    //~^ ERROR invalid character in numeric character escape: x
+    //~^^ ERROR invalid character in numeric character escape: y
 
     let _ = '\x5';
     //~^ ERROR numeric character escape is too short
 
     let _ = '\xxy';
-    //~^ ERROR illegal character in numeric character escape: x
-    //~^^ ERROR illegal character in numeric character escape: y
+    //~^ ERROR invalid character in numeric character escape: x
+    //~^^ ERROR invalid character in numeric character escape: y
 
     let _ = b"\u{a4a4} \xf \u";
     //~^ 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 unicode escape sequences cannot be used as a byte or in a byte string
 
     let _ = "\u{ffffff} \xf \u";
-    //~^ ERROR illegal unicode character escape
-    //~^^ ERROR illegal character in numeric character escape:
+    //~^ ERROR invalid unicode 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 incorrect unicode escape sequence
 }
index 5996b744566ce15d33c41823c67eaa3bfddf37af..e152a369290b71f6861f993f9f7ca07596c16c77 100644 (file)
@@ -11,7 +11,7 @@
 // compile-flags: -Z parse-only
 
 pub extern
-  "invalid-ab_isize" //~ ERROR illegal ABI
+  "invalid-ab_isize" //~ ERROR invalid ABI
 fn foo() {}
 
 fn main() {}
index 5e8bc16ac6e9f2d6af93016cea891001fca4d5c4..d12bb63111b9efb287db4d87c045e830303d802b 100644 (file)
@@ -11,5 +11,5 @@
 // compile-flags: -Z parse-only
 
 pub fn main() {
-    let s = "\u{d805}"; //~ ERROR illegal unicode character escape
+    let s = "\u{d805}"; //~ ERROR invalid unicode character escape
 }
index 896751bd4a727a9c9d6011a6438e15a8b8917d10..fe125da1755bd6c52c4f0bd4ddf7a8977568671f 100644 (file)
@@ -12,7 +12,7 @@
 
 pub fn main() {
     let s = "\u{lol}";
-     //~^ ERROR illegal character in unicode escape: l
-     //~^^ ERROR illegal character in unicode escape: o
-     //~^^^ ERROR illegal character in unicode escape: l
+     //~^ ERROR invalid character in unicode escape: l
+     //~^^ ERROR invalid character in unicode escape: o
+     //~^^^ ERROR invalid character in unicode escape: l
 }
index c7ef91f14f578739d79a1ba8d0acdb940b918a52..3fc5f8aae1876a80394db694213dbaea0e52c4f9 100644 (file)
@@ -11,5 +11,5 @@
 // compile-flags: -Z parse-only
 
 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
 ;