Don't count variants/fields/consts/associated types in doc-coverage doc examples
Fixes#75714.
I think I'll need to update the equivalent lint too. Creating an issue for that!
r? @jyn514
Split `astconv.rs` into its own submodule
Fixes#67418
This changed induced a few changes across the Type checker, but only there. Mostly, it was just renaming `Self::` into something else to call specific methods from a subtrait instead of having a 2500+ lines one.
I split up the `astconv.rs` file into its own module. This way, directives such as
```rust
use crate::astconv::AstConv;
```
are still valid, and doing
```rust
use crate::astconv::{AstConv, AstConvGeneric};
```
is possible
(instead of having two modules, one named `astconv_generic.rs` for example and `astconv.rs`)
I'm not entirely sure that the name `AstConvGeneric` is a good one. However, only methods related to lifetimes or generics have been moved over to this module. Sorry about the large diff.
I'd be very happy to make any correction you deem necessary.
r? @oli-obk
Move to intra-doc links for /library/core/src/intrinsics.rs
Helps with #75080.
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issues:
* The following f32 and f64 primitive methods cannot be resolved:
f32/f64::powi
f32/f64::sqrt
f32/f64::sin
f32/f64::cos
f32/f64::powf
f32/f64::exp
f32/f64::exp2
f32/f64::ln
f32/f64::log2
f32/f64::log10
f32/f64::mul_add
f32/f64::abs
f32/f64::copysign
f32/f64::floor
f32/f64::ceil
f32/f64::trunc
f32/f64::round
* Links from core to std:
[`std::pointer::*`]
[`std::process::abort`]
[`from_raw_parts`]
[`Vec::append`]
* Links with anchors?
I provided a separate commit that replaced links with anchors by intra-doc links.
Here the anchor location information gets lost, so its questionable whether to
actually replace those links.
Fixes clippy::redundant_static_lifetimes and clippy::toplevel_ref_arg
I also replaced some .expect("") calls with .unwrap()s since there was no message passed by the .expect() anyway.
enable align_to tests in Miri
With https://github.com/rust-lang/miri/issues/1074 resolved, we can enable these tests in Miri.
I also tweaked the test sized to get reasonable execution times with decent test coverage.
To separate the astconv.rs file, I split it into its own module with a
subtrait called GenericAstConv. This subtrait handles methods related to
generics, be it types or lifetimes.
typeck: Add bounds module and Bounds struct
bounds: Run fmt, add documentation
generic_astconv: Add subtrait GenericAstConv
Some methods of AstConv deal exclusively with Generics. Therefore, it
makes sense to have them in their own trait. Some other methods from
AstConv might be added to it later
generic_astconv: Add more methods from AstConv
Add check_generic_arg_count_for_call() and check_generic_arg_count()
astconv: Add module for clarity
generic: Rename GenericAstConv -> AstConvGeneric
generic: add more methods to AstConvGeneric
astconv: Remove AstConvGeneric trait, add impl dyn AstConv in other
module
astconv: Add errors module to handle AstConv complaints
fmt: format code in astconv/
astconv: Remove old file
astconv: Fix visibility on GenericArgPosition
astconv: Fix visibility on GenericArgPosition
astconv: Fix function visibility on other originally private functions
Fix RFC-1014 test
Use two printlns when testing that writing to a closed stdout does not
panic. Otherwise the test is ineffective, since the current implementation
silently ignores the error during first println regardless.
clarify documentation of remove_dir errors
remove_dir will error if the path doesn't exist or isn't a directory.
It's useful to clarify that this is "remove dir or fail" not "remove dir
if it exists".
I don't think this belongs in the title. "Removes an existing, empty
directory" is strangely worded-- there's no such thing as a non-existing
directory. Better to just say explicitly it will return an error.
Move doc comment parsing to rustc_lexer
Plain comments are trivia, while doc comments are not, so it feels
like this belongs to the rustc_lexer.
The specific reason to do this is the desire to use rustc_lexer in
rustdoc for syntax highlighting, without duplicating "is this a doc
comment?" logic there.
r? @ghost
Capture tokens for Pat used in macro_rules! argument
This extends PR #73293 to handle patterns (Pat). Unlike expressions,
patterns do not support custom attributes, so we only need to capture
tokens during macro_rules! argument parsing.