| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r=GuillaumeGomez
fix ICE in rustdoc::invalid_html_tags
fixes https://github.com/rust-lang/rust/issues/146890
r? ```@GuillaumeGomez```
|
|
|
|
Co-authored-by: Anne Stijns <anstijns@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
previously, this lint did not distinguish between `<img` and `<img>`,
and since the latter should be accepted under html5,
the former was also accepted.
the parser now also handles multi-line tags and multi-line attributes.
|
|
Handle macros with multiple kinds, and improve errors
(I recommend reviewing this commit-by-commit.)
Switch to a bitflags `MacroKinds` to support macros with more than one kind
Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`.
Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds.
This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`.
Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes.
This allows detecting and report macro kind mismatches early, and more precisely, improving various error messages. In particular, this eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules.
Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors.
This also handles cases of forward-referenced attributes and cyclic attributes.
----
In this PR, I've minimally fixed up `rustdoc` so that it compiles and passes tests. This is just the minimal necessary fixes to handle the switch to `MacroKinds`, and it only works for macros that don't actually have multiple kinds. This will panic (with a `todo!`) if it encounters a macro with multiple kinds.
rustdoc needs further fixes to handle macros with multiple kinds, and to handle attributes and derive macros that aren't proc macros. I'd appreciate some help from a rustdoc expert on that.
----
r? ````````@petrochenkov````````
|
|
This makes the minimal fixes necessary for rustdoc to compile and pass
existing tests with the switch to `MacroKinds`. It only works for macros
that don't actually have multiple kinds, and will panic (with a `todo!`)
if it encounters a macro with multiple kinds.
rustdoc needs further fixes to handle macros with multiple kinds, and to
handle attributes and derive macros that aren't proc macros.
|
|
r=fmease,GuillaumeGomez
Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`
fixes rust-lang/rust#141866
|
|
|
|
|
|
lolbinarycat:rustdoc-intra-doc-link-warn-more-54191, r=GuillaumeGomez
get rid of some false negatives in rustdoc::broken_intra_doc_links
rustdoc will not try to do intra-doc linking if the "path" of a link looks too much like a "real url".
however, only inline links (`[text](url)`) can actually contain a url, other types of links (reference links, shortcut links) contain a *reference* which is later resolved to an actual url.
the "path" in this case cannot be a url, and therefore it should not be skipped due to looking like a url.
fixes https://github.com/rust-lang/rust/issues/54191
to minimize the number of false positives that will be introduced, the following heuristic is used:
If there's no backticks, be lenient revert to old behavior.
This is to prevent churn by linting on stuff that isn't meant to be a link.
only shortcut links have simple enough syntax that they
are likely to be written accidentlly, collapsed and reference links
need 4 metachars, and reference links will not usually use
backticks in the reference name.
therefore, only shortcut syntax gets the lenient behavior.
here's a truth table for how link kinds that cannot be urls are handled:
| | is shortcut link | not shortcut link |
|--------------|--------------------|-------------------|
| has backtick | never ignore | never ignore |
| no backtick | ignore if url-like | never ignore |
|
|
|
|
collapsed links and reference links have a pretty particular syntax,
it seems unlikely they would show up on accident.
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
|
|
this is in an effort to reduce the amount of code churn caused by
this lint triggering on text that was never meant to be a link.
a more principled hierustic for ignoring lints is not possible
without extensive changes, due to the lint emitting code
being so far away from the link collecting code,
and the fact that only the link collecting code
has access to details about how the link appears in the
unnormalized markdown.
|
|
rustdoc will not try to do intra-doc linking if the "path"
of a link looks too much like a "real url".
however, only inline links ([text](url)) can actually contain
a url, other types of links (reference links, shortcut links)
contain a *reference* which is later resolved to an actual url.
the "path" in this case cannot be a url, and therefore it should
not be skipped due to looking like a url.
Co-authored-by: Michael Howell <michael@notriddle.com>
|
|
|
|
|
|
|
|
from expansion
|
|
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
- rust-lang/rust#142491 (Rework #[cold] attribute parser)
- rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`)
- rust-lang/rust#142495 (Better template for `#[repr]` attributes)
- rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet)
- rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks)
- rust-lang/rust#142650 (Refactor Translator)
- rust-lang/rust#142713 (mbe: Refactor transcription)
- rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
Hir item kind field order
A follow-up to rust-lang/rust#141675.
r? `@fee1-dead`
|
|
|
|
Specifically `TyAlias`, `Enum`, `Struct`, `Union`. So the fields match
the textual order in the source code.
The interesting part of the change is in
`compiler/rustc_hir/src/hir.rs`. The rest is extremely mechanical
refactoring.
|
|
r=GuillaumeGomez
rustdoc: linking to a local proc macro no longer warns
fixes https://github.com/rust-lang/rust/issues/91274
tried to keep the fix general in case we ever have any other kind of item that occupies
multiple namespaces simultaniously.
|
|
fixes https://github.com/rust-lang/rust/issues/91274
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
|
|
r=GuillaumeGomez
Improve handling of rustdoc lints when used with raw doc fragments.
1. `rustdoc::bare_urls` no longer outputs incoherent suggestions if `source_span_for_markdown_range` returns None, instead outputting no suggestion
2. `source_span_for_markdown_range` has one more heuristic, so it will return `None` less often.
3. add ui test to make sure we don't emit nonsense suggestions.
fixes https://github.com/rust-lang/rust/issues/135851
|
|
1. rustdoc::bare_urls doesn't output
invalid suggestions if source_span_for_markdown_range
fails to find a span
2. source_span_for_markdown_range tries harder to
return a span by applying an additional diagnostic
fixes https://github.com/rust-lang/rust/issues/135851
|
|
It was added in #140052, but the subsequent changes in #140252 means it
is no longer necessary. (Indeed, `Ident`s cannot be empty any more.)
|
|
|
|
All uses have been removed. And it's nonsensical: an identifier by
definition has at least one char.
The commits adds an is-non-empty assertion to `Ident::new` to enforce
this, and converts some `Ident` constructions to use `Ident::new`.
Adding the assertion requires making `Ident::new` and
`Ident::with_dummy_span` non-const, which is no great loss.
The commit amends a couple of places that do path splitting to ensure no
empty identifiers are created.
|
|
Follow up https://github.com/rust-lang/rust/pull/127127
|
|
Stabilize flags for doctest cross compilation
This makes the following changes in preparation for supporting doctest cross-compiling in cargo:
- Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
- Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu).
- Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature.
These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127
The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored.
Closes https://github.com/rust-lang/rust/issues/64245
try-job: x86_64-msvc-1
|
|
|
|
Because all the other similar methods are on `AssocItem`.
|
|
GuillaumeGomez:rustdoc-hidden-stripper-improvement, r=camelid
Small code improvement in rustdoc hidden stripper
This is a very minor code improvement following https://github.com/rust-lang/rust/pull/137534. It doesn't change anything about the performance issue.
r? ```@notriddle```
|
|
|