File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ extern crate proc_macro;
2+
3+ use proc_macro:: TokenStream ;
4+
5+ #[ proc_macro]
6+ pub fn matcher ( input : TokenStream ) -> TokenStream {
7+ "
8+ struct S(());
9+ let s = S(());
10+ match s {
11+ true => {}
12+ _ => {}
13+ }
14+ " . parse ( ) . unwrap ( )
15+ }
Original file line number Diff line number Diff line change 1+ //@ proc-macro: match-expander.rs
2+ // Ensure that we don't point at macro invocation when providing inference contexts.
3+
4+ #[ macro_use]
5+ extern crate match_expander;
6+
7+ fn main ( ) {
8+ match_expander:: matcher!( ) ;
9+ //~^ ERROR: mismatched types
10+ //~| NOTE: expected `S`, found `bool`
11+ //~| NOTE: this expression has type `S`
12+ //~| NOTE: in this expansion of match_expander::matcher!
13+ }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/match-expander.rs:8:5
3+ |
4+ LL | match_expander::matcher!();
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ | |
7+ | expected `S`, found `bool`
8+ | this expression has type `S`
9+ |
10+ = note: this error originates in the macro `match_expander::matcher` (in Nightly builds, run with -Z macro-backtrace for more info)
11+
12+ error: aborting due to 1 previous error
13+
14+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments