mirror of
https://github.com/rust-lang/rust
synced 2024-10-02 23:04:50 +00:00
Rollup merge of #72912 - GuillaumeGomez:add-e0755, r=estebank
Add new E0758 error code
This commit is contained in:
commit
82fd390d67
|
@ -437,6 +437,7 @@
|
|||
E0752: include_str!("./error_codes/E0752.md"),
|
||||
E0753: include_str!("./error_codes/E0753.md"),
|
||||
E0754: include_str!("./error_codes/E0754.md"),
|
||||
E0758: include_str!("./error_codes/E0758.md"),
|
||||
E0760: include_str!("./error_codes/E0760.md"),
|
||||
;
|
||||
// E0006, // merged with E0005
|
||||
|
|
20
src/librustc_error_codes/error_codes/E0758.md
Normal file
20
src/librustc_error_codes/error_codes/E0758.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
A multi-line (doc-)comment is unterminated.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0758
|
||||
/* I am not terminated!
|
||||
```
|
||||
|
||||
The same goes for doc comments:
|
||||
|
||||
```compile_fail,E0758
|
||||
/*! I am not terminated!
|
||||
```
|
||||
|
||||
You need to end your multi-line comment with `*/` in order to fix this error:
|
||||
|
||||
```
|
||||
/* I am terminated! */
|
||||
/*! I am also terminated! */
|
||||
```
|
|
@ -191,7 +191,15 @@ fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Tok
|
|||
"unterminated block comment"
|
||||
};
|
||||
let last_bpos = self.pos;
|
||||
self.fatal_span_(start, last_bpos, msg).raise();
|
||||
self.sess
|
||||
.span_diagnostic
|
||||
.struct_span_fatal_with_code(
|
||||
self.mk_sp(start, last_bpos),
|
||||
msg,
|
||||
error_code!(E0758),
|
||||
)
|
||||
.emit();
|
||||
FatalError.raise();
|
||||
}
|
||||
|
||||
if is_doc_comment {
|
||||
|
|
1
src/test/ui/unterminated-comment.rs
Normal file
1
src/test/ui/unterminated-comment.rs
Normal file
|
@ -0,0 +1 @@
|
|||
/* //~ ERROR E0758
|
9
src/test/ui/unterminated-comment.stderr
Normal file
9
src/test/ui/unterminated-comment.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0758]: unterminated block comment
|
||||
--> $DIR/unterminated-comment.rs:1:1
|
||||
|
|
||||
LL | /*
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0758`.
|
1
src/test/ui/unterminated-doc-comment.rs
Normal file
1
src/test/ui/unterminated-doc-comment.rs
Normal file
|
@ -0,0 +1 @@
|
|||
/*! //~ ERROR E0758
|
9
src/test/ui/unterminated-doc-comment.stderr
Normal file
9
src/test/ui/unterminated-doc-comment.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0758]: unterminated block doc-comment
|
||||
--> $DIR/unterminated-doc-comment.rs:1:1
|
||||
|
|
||||
LL | /*!
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0758`.
|
Loading…
Reference in a new issue