Commit 52b1c4d
committed
fix panic on macro-expanded impls with primitive self type
The new is_macro_expanded path in get_attributes_for_automatic_derive
runs for any macro-expanded impl, not just #[automatically_derived]
ones. Unlike derive impls, macro-expanded impls can target primitive
types (e.g. vstd's std_specs/ops.rs generates impl ... for u8/usize/...
via macro_rules!), whose Res is PrimTy and has no DefId. Calling
path.res.def_id() on those panics; switch to opt_def_id() and fall
through to normal classification when there's no def_id, matching
the existing fallback arms.1 parent 952b802 commit 52b1c4d
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
| 687 | + | |
| 688 | + | |
687 | 689 | | |
688 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
689 | 699 | | |
690 | 700 | | |
691 | 701 | | |
| |||
0 commit comments