mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 18:43:01 +00:00
Fix a bug in MBE expansion that arose from incorrect fixing of an older bug in MBE
Specifically, #18744 was the PR that was supposed to fix the old bug, but it fixed it incorrectly (and didn't add a test!) The underlying reason was that we marked metavariables in expansions as joint if they were joint in the macro call, which is incorrect. This wrong fix causes other bug, #19497, which this PR fixes by removing the old (incorrect) fix.
This commit is contained in:
parent
df0174e988
commit
3953b604ce
7 changed files with 107 additions and 11 deletions
|
|
@ -1979,3 +1979,51 @@ fn f() {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn semicolon_does_not_glue() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! bug {
|
||||
($id: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*; $norm: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*;; $print: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*; $norm: expr; $print: expr) => {
|
||||
true
|
||||
};
|
||||
}
|
||||
|
||||
let _ = bug!(a;;;test);
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! bug {
|
||||
($id: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*; $norm: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*;; $print: expr) => {
|
||||
true
|
||||
};
|
||||
($id: expr; $($attr: ident),*; $norm: expr; $print: expr) => {
|
||||
true
|
||||
};
|
||||
}
|
||||
|
||||
let _ = true;
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -582,8 +582,8 @@ macro_rules! arbitrary {
|
|||
}
|
||||
|
||||
impl <A: Arbitrary> $crate::arbitrary::Arbitrary for Vec<A> {
|
||||
type Parameters = RangedParams1<A::Parameters>;
|
||||
type Strategy = VecStrategy<A::Strategy>;
|
||||
type Parameters = RangedParams1<A::Parameters> ;
|
||||
type Strategy = VecStrategy<A::Strategy> ;
|
||||
fn arbitrary_with(args: Self::Parameters) -> Self::Strategy { {
|
||||
let product_unpack![range, a] = args;
|
||||
vec(any_with::<A>(a), range)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue