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.
Refactor InferenceFudger (née RegionFudger)
- Rename `RegionFudger` (and related methods) to `InferenceFudger`.
- Take integer and float inference variables into account.
- Refactor `types_created_since_snapshot` and `vars_created_since_snapshot` with the [new version of ena](https://github.com/rust-lang-nursery/ena/pull/21).
- Some other refactoring in the area.
r? @eddyb
Introduce proc_macro::Span::source_text
A function to extract the actual source behind a Span.
Background: I would like to use `syn` in a `build.rs` script to parse the rust code, and extract part of the source code. However, `syn` only gives access to proc_macro2::Span, and i would like to get the source code behind that.
I opened an issue on proc_macro2 bug tracker for this feature https://github.com/alexcrichton/proc-macro2/issues/110 and @alexcrichton said the feature should first go upstream in proc_macro. So there it is!
Since most of the Span API is unstable anyway, this is guarded by the same `proc_macro_span` feature as everything else.
Rollup of 7 pull requests
Successful merges:
- #59004 ([rustdoc] Improve "in parameters" search and search more generally)
- #59026 (Fix moving text in search tabs headers)
- #59197 (Exclude old book redirect stubs from search engines)
- #59330 (Improve the documentation for std::convert (From, Into, AsRef and AsMut))
- #59424 (Fix code block display in portability element in dark theme)
- #59427 (Link to PhantomData in NonNull documentation)
- #59432 (Improve some compiletest documentation)
Failed merges:
r? @ghost