| Age | Commit message (Collapse) | Author | Lines |
|
Partially address #82827.
|
|
|
|
Rust contains various size checks conditional on target_arch = "x86_64",
but these checks were never intended to apply to
x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the
conditions.
|
|
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
Otherwise, all `rustdoc::` lints would be ignored.
- Register all existing lints as removed
This unfortunately doesn't work with `register_renamed` because tool
lints have not yet been registered when rustc is running. For similar
reasons, `check_backwards_compat` doesn't work either. Call
`register_removed` directly instead.
- Fix fallout
+ Rustdoc lints for compiler/
+ Rustdoc lints for library/
Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.
|
|
When token-based attribute handling is implemeneted in #80689,
we will need to access tokens from `HasAttrs` (to perform
cfg-stripping), and we will to access attributes from `HasTokens` (to
construct a `PreexpTokenStream`).
This PR merges the `HasAttrs` and `HasTokens` traits into a new
`AstLike` trait. The previous `HasAttrs` impls from `Vec<Attribute>` and `AttrVec`
are removed - they aren't attribute targets, so the impls never really
made sense.
|
|
AST: Remove some unnecessary boxes
|
|
|
|
|
|
Also remove `ast::Mod` which is mostly redundant now
|
|
Crate root is sufficiently different from `mod` items, at least at syntactic level.
Also remove customization point for "`mod` item or crate root" from AST visitors.
|
|
This is a pure refactoring split out from #80689.
It represents the most invasive part of that PR, requiring changes in
every caller of `parse_outer_attributes`
In order to eagerly expand `#[cfg]` attributes while preserving the
original `TokenStream`, we need to know the range of tokens that
corresponds to every attribute target. This is accomplished by making
`parse_outer_attributes` return an opaque `AttrWrapper` struct. An
`AttrWrapper` must be converted to a plain `AttrVec` by passing it to
`collect_tokens_trailing_token`. This makes it difficult to accidentally
construct an AST node with attributes without calling `collect_tokens_trailing_token`,
since AST nodes store an `AttrVec`, not an `AttrWrapper`.
As a result, we now call `collect_tokens_trailing_token` for attribute
targets which only support inert attributes, such as generic arguments
and struct fields. Currently, the constructed `LazyTokenStream` is
simply discarded. Future PRs will record the token range corresponding
to the attribute target, allowing those tokens to be removed from an
enclosing `collect_tokens_trailing_token` call if necessary.
|
|
Document `NodeId`
|
|
|
|
Add lint for `panic!(123)` which is not accepted in Rust 2021.
This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021.
It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.
It renames the lint to `non_fmt_panic` to match the lint naming guidelines.

This is part of #80162.
r? ```@estebank```
|
|
|
|
|
|
This allows to directly map from a DefPathHash to the crate it
originates from, without constructing side tables to do that mapping.
It also allows to reliably and cheaply check for DefPathHash collisions.
|
|
|
|
|
|
|
|
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
|
|
|
|
Set tokens on AST node in `collect_tokens`
A new `HasTokens` trait is introduced, which is used to move logic from
the callers of `collect_tokens` into the body of `collect_tokens`.
In addition to reducing duplication, this paves the way for PR #80689,
which needs to perform additional logic during token collection.
|
|
A new `HasTokens` trait is introduced, which is used to move logic from
the callers of `collect_tokens` into the body of `collect_tokens`.
In addition to reducing duplication, this paves the way for PR #80689,
which needs to perform additional logic during token collection.
|
|
|
|
|
|
|
|
rustc_parse: Better spans for synthesized token streams
I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`.
r? `@Aaron1011`
|
|
Edit rustc_ast::tokenstream docs
Fix some punctuation and wording, and add intra-documentation links.
|
|
|
|
Fix some punctuation and wording, and add intra-documentation links.
|
|
(clippy::match_ref_pats)
|
|
- Adds optional default values to const generic parameters in the AST
and HIR
- Parses these optional default values
- Adds a `const_generics_defaults` feature gate
|
|
|
|
Implement edition-based macro :pat feature
This PR does two things:
1. Fixes the perf regression from https://github.com/rust-lang/rust/pull/80100#issuecomment-750893149
2. Implements `:pat2018` and `:pat2021` matchers, as described by `@joshtriplett` in https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090 behind the feature gate `edition_macro_pat`.
r? `@petrochenkov`
cc `@Mark-Simulacrum`
|
|
Edit rustc_ast::ast::FieldPat docs
Punctuation fixes.
|
|
|
|
Rollup of 13 pull requests
Successful merges:
- #79812 (Lint on redundant trailing semicolon after item)
- #80348 (remove redundant clones (clippy::redundant_clone))
- #80358 (Edit rustc_span documentation)
- #80457 (Add missing commas to `rustc_ast_pretty::pp` docs)
- #80461 (Add llvm-libunwind change to bootstrap CHANGELOG)
- #80464 (Use Option::map_or instead of open coding it)
- #80465 (Fix typo in ffi-pure.md)
- #80467 (More uses of the matches! macro)
- #80469 (Fix small typo in time comment)
- #80472 (Use sans-serif font for the "all items" page links)
- #80477 (Make forget intrinsic safe)
- #80482 (don't clone copy types)
- #80487 (don't redundantly repeat field names)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
use matches!() macro in more places
|
|
|
|
|
|
|
|
Add missing punctuation.
|
|
Punctuation fixes.
|
|
|
|
|
|
|
|
|