Skip to content

Commit

Permalink
Reword un-closed delimiter label
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Sep 5, 2018
1 parent 1c2e17f commit 5238b52
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/libsyntax/parse/lexer/tokentrees.rs
Expand Up @@ -49,7 +49,7 @@ impl<'a> StringReader<'a> {
let msg = "this file contains an un-closed delimiter";
let mut err = self.sess.span_diagnostic.struct_span_err(self.span, msg);
for &(_, sp) in &self.open_braces {
err.span_help(sp, "did you mean to close this delimiter?");
err.span_label(sp, "un-closed delimiter");
}

Err(err)
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<'a> StringReader<'a> {
// delimiter. The previous unclosed delimiters could actually be
// closed! The parser just hasn't gotten to them yet.
if let Some(&(_, sp)) = self.open_braces.last() {
err.span_label(sp, "unclosed delimiter");
err.span_label(sp, "un-closed delimiter");
};
err.emit();
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/issue-10636-1.rs
Expand Up @@ -10,7 +10,8 @@

// compile-flags: -Z parse-only

struct Obj { //~ NOTE: unclosed delimiter
struct Obj {
//~^ NOTE: un-closed delimiter
member: usize
)
//~^ ERROR incorrect close delimiter
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/issue-10636-1.stderr
@@ -1,9 +1,9 @@
error: incorrect close delimiter: `)`
--> $DIR/issue-10636-1.rs:15:1
--> $DIR/issue-10636-1.rs:16:1
|
LL | struct Obj { //~ NOTE: unclosed delimiter
| - unclosed delimiter
LL | member: usize
LL | struct Obj {
| - un-closed delimiter
...
LL | )
| ^ incorrect close delimiter

Expand Down
9 changes: 5 additions & 4 deletions src/test/ui/parser-recovery-1.rs
Expand Up @@ -14,11 +14,12 @@

trait Foo {
fn bar() {
let x = foo(); //~ ERROR cannot find function `foo` in this scope

let x = foo();
//~^ ERROR cannot find function `foo` in this scope
}

fn main() {
let x = y.; //~ ERROR unexpected token
//~^ ERROR cannot find value `y` in this scope
let x = y.;
//~^ ERROR unexpected token
//~| ERROR cannot find value `y` in this scope
} //~ ERROR this file contains an un-closed delimiter
17 changes: 7 additions & 10 deletions src/test/ui/parser-recovery-1.stderr
@@ -1,31 +1,28 @@
error: this file contains an un-closed delimiter
--> $DIR/parser-recovery-1.rs:24:55
--> $DIR/parser-recovery-1.rs:25:55
|
LL | trait Foo {
| - un-closed delimiter
...
LL | } //~ ERROR this file contains an un-closed delimiter
| ^
|
help: did you mean to close this delimiter?
--> $DIR/parser-recovery-1.rs:15:11
|
LL | trait Foo {
| ^

error: unexpected token: `;`
--> $DIR/parser-recovery-1.rs:22:15
|
LL | let x = y.; //~ ERROR unexpected token
LL | let x = y.;
| ^

error[E0425]: cannot find function `foo` in this scope
--> $DIR/parser-recovery-1.rs:17:17
|
LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope
LL | let x = foo();
| ^^^ not found in this scope

error[E0425]: cannot find value `y` in this scope
--> $DIR/parser-recovery-1.rs:22:13
|
LL | let x = y.; //~ ERROR unexpected token
LL | let x = y.;
| ^ not found in this scope

error[E0601]: `main` function not found in crate `parser_recovery_1`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser-recovery-2.stderr
Expand Up @@ -2,7 +2,7 @@ error: incorrect close delimiter: `)`
--> $DIR/parser-recovery-2.rs:18:5
|
LL | fn bar() {
| - unclosed delimiter
| - un-closed delimiter
LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope
LL | ) //~ ERROR incorrect close delimiter: `)`
| ^ incorrect close delimiter
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/resolve/token-error-correct-2.stderr
Expand Up @@ -2,7 +2,7 @@ error: incorrect close delimiter: `)`
--> $DIR/token-error-correct-2.rs:16:5
|
LL | if foo {
| - unclosed delimiter
| - un-closed delimiter
LL | //~^ ERROR: cannot find value `foo`
LL | ) //~ ERROR: incorrect close delimiter: `)`
| ^ incorrect close delimiter
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/resolve/token-error-correct-3.stderr
Expand Up @@ -2,7 +2,7 @@ error: incorrect close delimiter: `}`
--> $DIR/token-error-correct-3.rs:30:9
|
LL | callback(path.as_ref(); //~ ERROR expected one of
| - unclosed delimiter
| - un-closed delimiter
...
LL | } else { //~ ERROR: incorrect close delimiter: `}`
| ^ incorrect close delimiter
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/resolve/token-error-correct.stderr
Expand Up @@ -2,7 +2,7 @@ error: incorrect close delimiter: `}`
--> $DIR/token-error-correct.rs:16:1
|
LL | foo(bar(;
| - unclosed delimiter
| - un-closed delimiter
LL | //~^ ERROR: expected expression, found `;`
LL | }
| ^ incorrect close delimiter
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/token/issue-10636-2.stderr
Expand Up @@ -2,7 +2,7 @@ error: incorrect close delimiter: `}`
--> $DIR/issue-10636-2.rs:18:1
|
LL | option.map(|some| 42;
| - unclosed delimiter
| - un-closed delimiter
...
LL | } //~ ERROR: incorrect close delimiter
| ^ incorrect close delimiter
Expand Down

0 comments on commit 5238b52

Please sign in to comment.