-
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.
Check for both
StmtKind::MacCall
and ExprKind::MacCall
- Loading branch information
Showing
6 changed files
with
466 additions
and
36 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 was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.rs
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,20 @@ | ||
// Regression test for #131915 where we did not handle macro calls as | ||
// statements correctly when determining if a const argument should | ||
// have a `DefId` created or not. | ||
|
||
macro_rules! y { | ||
( $($matcher:tt)*) => { | ||
x | ||
//~^ ERROR: cannot find value `x` in this scope | ||
}; | ||
} | ||
|
||
const _: A< | ||
//~^ ERROR: free constant item without body | ||
//~| ERROR: cannot find type `A` in this scope | ||
{ | ||
y! { test.tou8 } | ||
}, | ||
>; | ||
|
||
fn main() {} |
39 changes: 39 additions & 0 deletions
39
tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.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,39 @@ | ||
error: free constant item without body | ||
--> $DIR/const_arg_trivial_macro_expansion-2.rs:12:1 | ||
| | ||
LL | / const _: A< | ||
LL | | | ||
LL | | | ||
LL | | { | ||
LL | | y! { test.tou8 } | ||
LL | | }, | ||
LL | | >; | ||
| | ^ help: provide a definition for the constant: `= <expr>;` | ||
| |__| | ||
| | ||
|
||
error[E0412]: cannot find type `A` in this scope | ||
--> $DIR/const_arg_trivial_macro_expansion-2.rs:12:10 | ||
| | ||
LL | const _: A< | ||
| ^ not found in this scope | ||
|
||
error[E0425]: cannot find value `x` in this scope | ||
--> $DIR/const_arg_trivial_macro_expansion-2.rs:7:9 | ||
| | ||
LL | x | ||
| ^ not found in this scope | ||
... | ||
LL | y! { test.tou8 } | ||
| ---------------- in this macro invocation | ||
| | ||
= note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: you might be missing a const parameter | ||
| | ||
LL | const _<const x: /* Type */>: A< | ||
| +++++++++++++++++++++ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0412, E0425. | ||
For more information about an error, try `rustc --explain E0412`. |
Oops, something went wrong.