-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tweak: Error has basic parse mode without fields
- Loading branch information
Showing
11 changed files
with
174 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use preinterpret::*; | ||
|
||
fn main() { | ||
preinterpret!([!error! { }]); | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/compilation_failures/core/error_invalid_structure.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: required fields are missing: message | ||
Occurred whilst parsing [!error! ..] - Expected [!error! "Expected X, found: " #world] or [!error! { | ||
// The error message to display | ||
message: "...", | ||
// An optional [token stream], to determine where to show the error message | ||
spans?: [$abc], | ||
}] | ||
--> tests/compilation_failures/core/error_invalid_structure.rs:4:28 | ||
| | ||
4 | preinterpret!([!error! { }]); | ||
| ^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use preinterpret::*; | ||
|
||
macro_rules! assert_literals_eq { | ||
($input1:literal, $input2:literal) => {preinterpret!{ | ||
[!if! ($input1 != $input2) { | ||
[!error! "Expected " $input1 " to equal " $input2] | ||
}] | ||
}}; | ||
} | ||
|
||
fn main() { | ||
assert_literals_eq!(102, 64); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error: Expected 102 to equal 64 | ||
--> tests/compilation_failures/core/error_no_fields.rs:4:44 | ||
| | ||
4 | ($input1:literal, $input2:literal) => {preinterpret!{ | ||
| ____________________________________________^ | ||
5 | | [!if! ($input1 != $input2) { | ||
6 | | [!error! "Expected " $input1 " to equal " $input2] | ||
7 | | }] | ||
8 | | }}; | ||
| |_____^ | ||
... | ||
12 | assert_literals_eq!(102, 64); | ||
| ---------------------------- in this macro invocation | ||
| | ||
= note: this error originates in the macro `preinterpret` which comes from the expansion of the macro `assert_literals_eq` (in Nightly builds, run with -Z macro-backtrace for more info) |