@@ -324,16 +324,16 @@ pub trait BangProcMacro {
324
324
325
325
impl < F > BangProcMacro for F
326
326
where
327
- F : Fn ( TokenStream ) -> TokenStream ,
327
+ F : Fn ( & mut ExtCtxt < ' _ > , Span , TokenStream ) -> Result < TokenStream , ErrorGuaranteed > ,
328
328
{
329
329
fn expand < ' cx > (
330
330
& self ,
331
- _ecx : & ' cx mut ExtCtxt < ' _ > ,
332
- _span : Span ,
331
+ ecx : & ' cx mut ExtCtxt < ' _ > ,
332
+ span : Span ,
333
333
ts : TokenStream ,
334
334
) -> Result < TokenStream , ErrorGuaranteed > {
335
335
// FIXME setup implicit context in TLS before calling self.
336
- Ok ( self ( ts ) )
336
+ self ( ecx , span , ts )
337
337
}
338
338
}
339
339
@@ -999,17 +999,14 @@ impl SyntaxExtension {
999
999
1000
1000
/// A dummy bang macro `foo!()`.
1001
1001
pub fn dummy_bang ( edition : Edition ) -> SyntaxExtension {
1002
- fn expander < ' cx > (
1003
- cx : & ' cx mut ExtCtxt < ' _ > ,
1002
+ fn expand (
1003
+ ecx : & mut ExtCtxt < ' _ > ,
1004
1004
span : Span ,
1005
- _: TokenStream ,
1006
- ) -> MacroExpanderResult < ' cx > {
1007
- ExpandResult :: Ready ( DummyResult :: any (
1008
- span,
1009
- cx. dcx ( ) . span_delayed_bug ( span, "expanded a dummy bang macro" ) ,
1010
- ) )
1005
+ _ts : TokenStream ,
1006
+ ) -> Result < TokenStream , ErrorGuaranteed > {
1007
+ Err ( ecx. dcx ( ) . span_delayed_bug ( span, "expanded a dummy bang macro" ) )
1011
1008
}
1012
- SyntaxExtension :: default ( SyntaxExtensionKind :: LegacyBang ( Arc :: new ( expander ) ) , edition)
1009
+ SyntaxExtension :: default ( SyntaxExtensionKind :: Bang ( Arc :: new ( expand ) ) , edition)
1013
1010
}
1014
1011
1015
1012
/// A dummy derive macro `#[derive(Foo)]`.
0 commit comments