-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #63859 - matthewjasper:check-snippet-result, r=Centril
Don't unwrap the result of `span_to_snippet` Closes #63800
- Loading branch information
Showing
5 changed files
with
90 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// ignore-test | ||
|
||
macro_rules! aaa { | ||
($c:ident) => {{ | ||
let a = $c; | ||
}} | ||
} |
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,23 @@ | ||
// Test that we don't ICE after trying to construct a cross-file snippet #63800. | ||
|
||
// compile-flags: --test | ||
|
||
#[macro_use] | ||
#[path = "move-error-snippets-ext.rs"] | ||
mod move_error_snippets_ext; | ||
|
||
struct A; | ||
|
||
macro_rules! sss { | ||
() => { | ||
#[test] | ||
fn fff() { | ||
static D: A = A; | ||
aaa!(D); //~ ERROR cannot move | ||
} | ||
}; | ||
} | ||
|
||
sss!(); | ||
|
||
fn main() {} |
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[E0507]: cannot move out of static item `D` | ||
--> $DIR/move-error-snippets.rs:16:18 | ||
| | ||
LL | | #[macro_use] | ||
| |__________________^ move occurs because `D` has type `A`, which does not implement the `Copy` trait | ||
... | ||
LL | aaa!(D); | ||
| __________________^ | ||
... | ||
LL | sss!(); | ||
| ------- in this macro invocation | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0507`. |