Commit 6046f4a
committed
Do not lint
The existing `KeywordIdents` lint blindly scans the token stream for a
macro or macro definition. It does not attempt to parse the input,
which means it cannot distinguish between occurrences of `dyn` that
are truly instances of it as an identifier (e.g. `let dyn = 3;`)
versus occurrences that follow its usage as a contextual keyword (e.g.
the type `Box<dyn Trait>`).
In an ideal world the lint would parse the token stream in order to
distinguish such occurrences; but in general we cannot do this,
because a macro_rules definition does not specify what parsing
contexts the macro being defined is allowed to be used within.
So rather than put a lot of work into attempting to come up with a
more precise but still incomplete solution, I am just taking the short
cut of not linting any instance of `dyn` under a macro. This prevents
`rustfix` from injecting bugs into legal 2015 edition code.dyn tokens under macros.1 parent 267fb90 commit 6046f4a
1 file changed
+36
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1618 | 1618 | | |
1619 | 1619 | | |
1620 | 1620 | | |
| 1621 | + | |
| 1622 | + | |
1621 | 1623 | | |
1622 | 1624 | | |
1623 | 1625 | | |
1624 | 1626 | | |
1625 | 1627 | | |
1626 | 1628 | | |
1627 | 1629 | | |
1628 | | - | |
| 1630 | + | |
1629 | 1631 | | |
1630 | 1632 | | |
1631 | 1633 | | |
| |||
1638 | 1640 | | |
1639 | 1641 | | |
1640 | 1642 | | |
1641 | | - | |
1642 | 1643 | | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
1647 | | - | |
1648 | | - | |
1649 | | - | |
1650 | | - | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
1651 | 1649 | | |
1652 | 1650 | | |
1653 | 1651 | | |
| |||
1656 | 1654 | | |
1657 | 1655 | | |
1658 | 1656 | | |
1659 | | - | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
1660 | 1673 | | |
1661 | 1674 | | |
1662 | 1675 | | |
| |||
1714 | 1727 | | |
1715 | 1728 | | |
1716 | 1729 | | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
1717 | 1742 | | |
1718 | 1743 | | |
1719 | 1744 | | |
| |||
0 commit comments