Skip to content
Keegan McAllister edited this page Aug 19, 2014 · 1 revision

html5ever makes... heavy use of procedural macros. This sometimes produces unhelpful error messages like

<quote expansion>:3:50: 3:70 error: mismatched types: expected `&<generic #672>` but found `tree_builder::types::Token` (expected &-ptr but found
             enum tree_builder::types::Token)
<quote expansion>:3         ^@name_1,ctxt_6643^@.^@name_1274,ctxt_6643^@(^@name_479,ctxt_6643^@);

In this case, attempting to compile the output of rustc --pretty expanded on the crate in question gives much better errors:

foo.rs:21253:57: 21253:62 error: mismatched types: expected `&<generic #672>` but found `tree_builder::types::Token` (expected &-ptr but found enum tree_builder::types::Token)
foo.rs:21253                                         self.unexpected(token);
                                                                     ^~~~~

Note that the --pretty expanded output may have a different meaning if multiple variables of the same name (but different syntax contexts) are in play in the same scope.

Clone this wiki locally