From 2083a123a50e9939bab639d9f06b9ef4cdc3d3ed Mon Sep 17 00:00:00 2001 From: Samy Kacimi Date: Tue, 23 Jul 2019 20:03:20 +0200 Subject: Normalize use of backticks in compiler messages for libsyntax/* https://github.com/rust-lang/rust/issues/60532 --- src/libsyntax/attr/mod.rs | 4 ++-- src/libsyntax/error_codes.rs | 2 +- src/libsyntax/ext/expand.rs | 2 +- src/libsyntax/test.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index a9f2429560a..7be21ff9029 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -30,7 +30,7 @@ use std::iter; use std::ops::DerefMut; pub fn mark_used(attr: &Attribute) { - debug!("Marking {:?} as used.", attr); + debug!("marking {:?} as used", attr); GLOBALS.with(|globals| { globals.used_attrs.lock().insert(attr.id); }); @@ -43,7 +43,7 @@ pub fn is_used(attr: &Attribute) -> bool { } pub fn mark_known(attr: &Attribute) { - debug!("Marking {:?} as known.", attr); + debug!("marking {:?} as known", attr); GLOBALS.with(|globals| { globals.known_attrs.lock().insert(attr.id); }); diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs index e2d212eb721..029ce73498c 100644 --- a/src/libsyntax/error_codes.rs +++ b/src/libsyntax/error_codes.rs @@ -182,7 +182,7 @@ beta compilers will not comply. Example of erroneous code (on a stable compiler): ```ignore (depends on release channel) -#![feature(non_ascii_idents)] // error: #![feature] may not be used on the +#![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the // stable release channel ``` diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ae72f1fd108..14d573d07d0 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -602,7 +602,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { None => return TokenStream::empty(), } self.cx.span_err(span, "custom attribute invocations must be \ - of the form #[foo] or #[foo(..)], the macro name must only be \ + of the form `#[foo]` or `#[foo(..)]`, the macro name must only be \ followed by a delimiter token"); TokenStream::empty() } diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index d82cdce2ce9..2ada7104843 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -414,7 +414,7 @@ fn get_test_runner(sd: &errors::Handler, krate: &ast::Crate) -> Option meta_item.path.clone(), -- cgit 1.4.1-3-g733a5 From e26e6749fb5638749ed8d73fcb595a11c12f7eb2 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Tue, 23 Jul 2019 16:28:20 -0700 Subject: Always emit trailing slash error --- src/libsyntax/parse/unescape_error_reporting.rs | 2 +- src/test/ui/parser/issue-62913.rs | 3 +++ src/test/ui/parser/issue-62913.stderr | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/parser/issue-62913.rs create mode 100644 src/test/ui/parser/issue-62913.stderr (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/unescape_error_reporting.rs b/src/libsyntax/parse/unescape_error_reporting.rs index 71b41161ad8..34af3238fb0 100644 --- a/src/libsyntax/parse/unescape_error_reporting.rs +++ b/src/libsyntax/parse/unescape_error_reporting.rs @@ -191,7 +191,7 @@ pub(crate) fn emit_unescape_error( handler.span_err(span, "empty character literal") } EscapeError::LoneSlash => { - panic!("lexer accepted unterminated literal with trailing slash") + handler.span_err(span, "invalid trailing slash in literal") } } } diff --git a/src/test/ui/parser/issue-62913.rs b/src/test/ui/parser/issue-62913.rs new file mode 100644 index 00000000000..cfa19a2a310 --- /dev/null +++ b/src/test/ui/parser/issue-62913.rs @@ -0,0 +1,3 @@ +"\u\\" +//~^ ERROR incorrect unicode escape sequence +//~| ERROR invalid trailing slash in literal diff --git a/src/test/ui/parser/issue-62913.stderr b/src/test/ui/parser/issue-62913.stderr new file mode 100644 index 00000000000..05c5c4d000a --- /dev/null +++ b/src/test/ui/parser/issue-62913.stderr @@ -0,0 +1,16 @@ +error: incorrect unicode escape sequence + --> $DIR/issue-62913.rs:1:2 + | +LL | "\u\" + | ^^^ incorrect unicode escape sequence + | + = help: format of unicode escape sequences is `\u{...}` + +error: invalid trailing slash in literal + --> $DIR/issue-62913.rs:1:5 + | +LL | "\u\" + | ^ + +error: aborting due to 2 previous errors + -- cgit 1.4.1-3-g733a5