Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errors
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
This commit is contained in:
commit
574830f573
116 changed files with 668 additions and 609 deletions
|
@ -2270,16 +2270,16 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
|
||||
/// Given a `binding_span` of a binding within a use statement:
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore (illustrative)
|
||||
/// use foo::{a, b, c};
|
||||
/// ^
|
||||
/// // ^
|
||||
/// ```
|
||||
///
|
||||
/// then return the span until the next binding or the end of the statement:
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore (illustrative)
|
||||
/// use foo::{a, b, c};
|
||||
/// ^^^
|
||||
/// // ^^^
|
||||
/// ```
|
||||
fn find_span_of_binding_until_next_binding(
|
||||
sess: &Session,
|
||||
|
@ -2323,14 +2323,14 @@ fn find_span_of_binding_until_next_binding(
|
|||
/// Given a `binding_span`, return the span through to the comma or opening brace of the previous
|
||||
/// binding.
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore (illustrative)
|
||||
/// use foo::a::{a, b, c};
|
||||
/// ^^--- binding span
|
||||
/// |
|
||||
/// returned span
|
||||
/// // ^^--- binding span
|
||||
/// // |
|
||||
/// // returned span
|
||||
///
|
||||
/// use foo::{a, b, c};
|
||||
/// --- binding span
|
||||
/// // --- binding span
|
||||
/// ```
|
||||
fn extend_span_to_previous_binding(sess: &Session, binding_span: Span) -> Option<Span> {
|
||||
let source_map = sess.source_map();
|
||||
|
@ -2366,15 +2366,15 @@ fn extend_span_to_previous_binding(sess: &Session, binding_span: Span) -> Option
|
|||
/// Given a `use_span` of a binding within a use statement, returns the highlighted span and if
|
||||
/// it is a nested use tree.
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore (illustrative)
|
||||
/// use foo::a::{b, c};
|
||||
/// ^^^^^^^^^^ // false
|
||||
/// // ^^^^^^^^^^ -- false
|
||||
///
|
||||
/// use foo::{a, b, c};
|
||||
/// ^^^^^^^^^^ // true
|
||||
/// // ^^^^^^^^^^ -- true
|
||||
///
|
||||
/// use foo::{a, b::{c, d}};
|
||||
/// ^^^^^^^^^^^^^^^ // true
|
||||
/// // ^^^^^^^^^^^^^^^ -- true
|
||||
/// ```
|
||||
fn find_span_immediately_after_crate_name(
|
||||
sess: &Session,
|
||||
|
|
|
@ -401,7 +401,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
|||
/// The reason for this separate call is to resolve what would otherwise
|
||||
/// be a cycle. Consider this example:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```ignore UNSOLVED (maybe @jackh726 knows what lifetime parameter to give Sub)
|
||||
/// trait Base<'a> {
|
||||
/// type BaseItem;
|
||||
/// }
|
||||
|
@ -2546,7 +2546,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
/// Returns all the late-bound vars that come into scope from supertrait HRTBs, based on the
|
||||
/// associated type name and starting trait.
|
||||
/// For example, imagine we have
|
||||
/// ```rust
|
||||
/// ```ignore (illustrative)
|
||||
/// trait Foo<'a, 'b> {
|
||||
/// type As;
|
||||
/// }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue