Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run everybody_loops for rustdoc; instead ignore resolution errors #73566

Merged
merged 24 commits into from
Jul 16, 2020

Commits on Jul 15, 2020

  1. Initialize default providers only once

    This avoids copying a new `Providers` struct for each downstream crate
    that wants to use it.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    f6764c4 View commit details
    Browse the repository at this point in the history
  2. Don't run everybody_loops for rustdoc

    Instead, ignore resolution errors that occur in item bodies.
    
    The reason this can't ignore item bodies altogether is because
    `const fn` could be used in generic types, for example `[T; f()]`
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    a5275ff View commit details
    Browse the repository at this point in the history
  3. Don't run analysis pass in rustdoc

    - Explicitly check for missing docs
    - Don't run any lints except those we explicitly specified
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    b3187aa View commit details
    Browse the repository at this point in the history
  4. Add an option not to report resolution errors for rustdoc

    - Remove unnecessary `should_loop` variable
    - Report errors for trait implementations
    
    These should give resolution errors because they are visible outside the
    current scope. Without these errors, rustdoc will give ICEs:
    
    ```
    thread 'rustc' panicked at 'attempted .def_id() on invalid res: Err', /home/joshua/src/rust/src/libstd/macros.rs:16:9
      15: rustc_hir::def::Res<Id>::def_id
                 at /home/joshua/src/rust/src/librustc_hir/def.rs:382
      16: rustdoc::clean::utils::register_res
                 at src/librustdoc/clean/utils.rs:627
      17: rustdoc::clean::utils::resolve_type
                 at src/librustdoc/clean/utils.rs:587
    ```
    
    - Add much more extensive tests
      + fn -> impl -> fn
      + fn -> impl -> fn -> macro
      + errors in function parameters
      + errors in trait bounds
      + errors in the type implementing the trait
      + unknown bounds for the type
      + unknown types in function bodies
      + errors generated by macros
    
    - Use explicit state instead of trying to reconstruct it from random info
    - Use an enum instead of a boolean
    - Add example of ignored error
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    1b8accb View commit details
    Browse the repository at this point in the history
  5. Add rustdoc tests from rust-lang#72088

    ecstatic-morse authored and jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    14a8707 View commit details
    Browse the repository at this point in the history
  6. Don't ICE on errors in function returning impl trait

    Instead, report the error.
    
    This emits the errors on-demand, without special-casing `impl Trait`, so
    it should catch all ICEs of this kind, including ones that haven't been
    found yet.
    
    Since the error is emitted during type-checking there is less info about
    the error; see comments in the code for details.
    
    - Add test case for -> impl Trait
    - Add test for impl trait with alias
    - Move EmitIgnoredResolutionErrors to rustdoc
    
    This makes `fn typeck_item_bodies` public, which is not desired behavior.
    That change should be removed once
    rust-lang#74070 is merged.
    
    - Don't visit nested closures twice
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    768d6a4 View commit details
    Browse the repository at this point in the history
  7. Recurse into function bodies, but don't typeck closures

    Previously, rustdoc would issue a delay_span_bug ICE on the following code:
    
    ```rust
    pub fn a() -> impl Fn() -> u32 {
        || content::doesnt::matter()
    }
    ```
    
    This wasn't picked up earlier because having `type Alias = impl Trait;`
    in the same module caused _all closures_ to be typechecked, even if they
    wouldn't normally. Additionally, if _any_ error was emitted, no
    delay_span_bug would be emitted. So as part of this commit all of the
    tests were separated out into different files.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    a93bcc9 View commit details
    Browse the repository at this point in the history
  8. Add test case for rust-lang#65863

    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    d010443 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cf844d2 View commit details
    Browse the repository at this point in the history
  10. Avoid unnecessary enum

    Just use a boolean instead.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    0cbc1cd View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3576f5d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    bbe4971 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    2f29e69 View commit details
    Browse the repository at this point in the history
  14. Use tcx as the only context for visitor

    Previously two different parts of the context had to be passed
    separately; there were two sources of truth.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    763d373 View commit details
    Browse the repository at this point in the history
  15. Remove unnecessary lifetime parameter

    TyCtxt is a reference type and so can be passed by value.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    0759a55 View commit details
    Browse the repository at this point in the history
  16. --bless

    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    2d0e8e2 View commit details
    Browse the repository at this point in the history
  17. Don't ICE on infinitely recursive types

    `evaluate_obligation` can only be run on types that are already valid.
    So rustdoc still has to run typeck even though it doesn't care about the
    result.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    02a24c8 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    4c88070 View commit details
    Browse the repository at this point in the history
  19. Fix comment

    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    b2ff0e7 View commit details
    Browse the repository at this point in the history
  20. EMPTY_MAP -> EMPTY_SET

    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    ac9157b View commit details
    Browse the repository at this point in the history
  21. Address review comments

    - Move static variables into the innermost scope in which they are used
    - Clean up comments
    - Remove external_providers; rename local_providers -> providers
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    6eec9fb View commit details
    Browse the repository at this point in the history
  22. Catch errors for any new item, not just trait implementations

    This matches the previous behavior of everybody_loops and is also more
    consistent than special-casing impls.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    e117b47 View commit details
    Browse the repository at this point in the history
  23. Use the default providers in rustc_interface instead of adding our own

    This avoids duplicating the same struct twice.
    jyn514 committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    281ca13 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

  1. Remove unused lazy_static

    jyn514 committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    631b2b9 View commit details
    Browse the repository at this point in the history