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

Rollup of 9 pull requests #101318

Merged
merged 47 commits into from
Sep 2, 2022
Merged

Rollup of 9 pull requests #101318

merged 47 commits into from
Sep 2, 2022

Commits on May 29, 2022

  1. Add let_underscore_drop lint.

    This lint checks for statements similar to `let _ = foo`, where `foo` is
    a type that implements `Drop`. These types of let statements cause the
    expression in them to be dropped immediately, instead of at the end of
    the scope. Such behavior can be surprizing, especially if you are
    relying on the value to be dropped at the end of the scope. Instead, the
    binding should be an underscore prefixed name (like `_unused`) or the
    value should explicitly be passed to `std::mem::drop()` if the value
    really should be dropped immediately.
    a2aaron committed May 29, 2022
    Configuration menu
    Copy the full SHA
    821b32b View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2022

  1. Add let_underscore_lock lint.

    Similar to `let_underscore_drop`, this lint checks for statements similar
    to `let _ = foo`, where `foo` is a lock guard. These types of let
    statements are especially problematic because the lock gets released
    immediately, instead of at the end of the scope. This behavior is almost
    always the wrong thing.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    ad7587f View commit details
    Browse the repository at this point in the history
  2. Add let_underscore_must_use lint.

    Similar to `let_underscore_drop`, this lint checks for statements similar
    to `let _ = foo`, where `foo` is an expression marked `must_use`.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    758a9fd View commit details
    Browse the repository at this point in the history
  3. Move let_underscore tests to their own subfolder.

    This was done to pass `tidy`.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    36b6309 View commit details
    Browse the repository at this point in the history
  4. Allow let_underscore_drop and let_underscore_must_use by default.

    These lints are very noisy and are allow-by-default in clippy anyways.
    Hence, setting them to allow-by-default here makes more sense than
    warning constantly on these cases.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    ae2ac3b View commit details
    Browse the repository at this point in the history
  5. Show code suggestions in let_undescore lint messages.

    This commit uses `span_suggestion_verbose` to add what specific code
    changes can be done as suggested by the lint--in this case, either binding
    the expression to an unused variable or using `std::mem::drop` to drop
    the value explicitly.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    eba6c78 View commit details
    Browse the repository at this point in the history
  6. Set let_underscore_lock to Deny by default.

    Clippy sets this lint to Deny by default, and it having the lint be Deny
    is useful for when we test the lint against a Crater run.
    a2aaron committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    6b179e3 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a7e2b3e View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2022

  1. Configuration menu
    Copy the full SHA
    7e485bf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1421cff View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    30e8adb View commit details
    Browse the repository at this point in the history
  4. Bail out early if the type does not has a trivial Drop implementation.

    If the type has a trivial Drop implementation, then it is probably irrelevant
    that the type was dropped immediately, since nothing important
    happens on drop. Hence, we can bail out early instead of doing some
    expensive checks.
    a2aaron committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    e6b6678 View commit details
    Browse the repository at this point in the history
  5. Use diagnostic items instead of hard coded paths for `let_underscore_…

    …lock`
    
    Using diagnostic items avoids having to update the paths if the guard
    types ever get moved around for some reason. Additionally, it also greatly
    simplifies the `is_sync_lock` check.
    a2aaron committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    6342b58 View commit details
    Browse the repository at this point in the history
  6. Use check-pass instead of run-pass

    We don't actually care about running these programs, only checking the
    warnings they generate.
    a2aaron committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    11663b1 View commit details
    Browse the repository at this point in the history
  7. Remove let_underscore_must_use

    The `let_underscore_must_use` lint was really only added because clippy
    included it, but it doesn't actually seem very useful.
    a2aaron committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    b5b5b54 View commit details
    Browse the repository at this point in the history
  8. Add diagnostic items to MutexGuard and RwLock Guards

    I forgot to add the diagnostic to the actual types in `std` earlier.
    a2aaron committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    321a598 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    211feb1 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2022

  1. Use multipart_suggestion to create an applicable suggestion.

    The "consider explicitly droping" can now suggest a machine applicable
    suggestion now.
    a2aaron committed Jun 9, 2022
    Configuration menu
    Copy the full SHA
    cdf6606 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2022

  1. Reword suggestion messages.

    a2aaron committed Jun 11, 2022
    Configuration menu
    Copy the full SHA
    7237e86 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b040666 View commit details
    Browse the repository at this point in the history
  3. Make let_underscore_drop Deny by default.

    This is done so that we can check the noisiness of this lint in a Crater
    run. Note that when I built the compiler, I actually encountered lots of
    places where this lint will trigger and fail compilation, so I had to
    also set `RUSTFLAGS_NOT_BOOSTRAP` to `-A let_underscore_drop` when
    compiling to prevent that.
    a2aaron committed Jun 11, 2022
    Configuration menu
    Copy the full SHA
    8807c2d View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2022

  1. Re-allow let_underscore_drop by default.

    This lint is way way too noisy to have it be `Deny` by default.
    a2aaron committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    a9095ff View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2022

  1. Explain why let-underscoring a lock guard is incorrect.

    Currently, the let_underscore_lock lint simply tells what is wrong, but
    not why it is wrong. We fix this by using a `MultiSpan` to explain
    specifically that doing `let _ = ` immediately drops the lock guard
    because it does not assign the lock guard to a binding.
    a2aaron committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    a9f1b7b View commit details
    Browse the repository at this point in the history
  2. Fix imports.

    I'm not really sure why this is nessecary to do, but the checks on the
    PR do not seem to work if do not do this.
    a2aaron committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    d355ec9 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2022

  1. Configuration menu
    Copy the full SHA
    76c90c3 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2022

  1. Support eager and lazy methods for providing references and values

    There are times where computing a value may be cheap, or where
    computing a reference may be expensive, so this fills out the
    possibilities.
    shepmaster committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    38de102 View commit details
    Browse the repository at this point in the history
  2. Add `Provider::{would_be_satisfied_by_value_of,would_be_satisfied_by_…

    …ref_of}`
    
    While the `provide_*` methods already short-circuit when a value has
    been provided, there are times where an expensive computation is
    needed to determine if the `provide_*` method can even be called.
    shepmaster committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    260ec93 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2022

  1. access_levels.rs refactor

    Bryanskiy committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    1080467 View commit details
    Browse the repository at this point in the history
  2. add TestReachabilityVisitor

    Bryanskiy committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    0111fb0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1171697 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2022

  1. Configuration menu
    Copy the full SHA
    f5857d5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7dc186f View commit details
    Browse the repository at this point in the history
  3. rustc_target: Refactor internal linker flavors slightly

    Remove one unstable user-facing linker flavor (l4-bender)
    petrochenkov committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    a0e21ff View commit details
    Browse the repository at this point in the history
  4. Revert parts of "use derive proc macro to impl SessionDiagnostic"

    This reverts parts of commit ac638c1.
    
    During rebase, this commit accidentally reverted unrelated changes to
    the subdiagnostic derive (those allowing multipart_suggestions to be
    derived). This commit reverts all changes to the subdiagnostic code made
    in ac638c1, the next commit will reintroduce the actually intended
    changes.
    Xiretza committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    9df75ee View commit details
    Browse the repository at this point in the history
  5. Allow deriving multiple subdiagnostics using one SessionSubdiagnostic

    This reimplements ac638c1, which had to be reverted in the previous
    commit because it contains a rebase accident that itself reverted
    significant unrelated changes to SessionSubdiagnostic.
    Xiretza committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    d9b874c View commit details
    Browse the repository at this point in the history
  6. rustdoc: remove unused CSS #main-content > .since

    This rule was added (actually, it was called `#main > .since` back then) with
    cdca084 and you can see an example of the
    bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html>
    by looking at the `1.0.0` version marker.
    
    However, a5a2f2b changed it so that
    `<span class="since">` is always placed in an out-of-band wrapper, so it's
    never nested directly below `#main` / `#main-content` any more.
    notriddle committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    096efc2 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2022

  1. Configuration menu
    Copy the full SHA
    1cd2863 View commit details
    Browse the repository at this point in the history
  2. Simplify MIR opt tests

    This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These
    tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due
    to having excessively strong opinions over *how* a piece of code should be optimized.
    
    Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for
    code where we want to track what the result of the net result of the optimization pipeline's output
    is.
    JakobDegen committed Sep 2, 2022
    Configuration menu
    Copy the full SHA
    e5d60af View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#97739 - a2aaron:let_underscore, r=estebank

    Uplift the `let_underscore` lints from clippy into rustc.
    
    This PR resolves rust-lang#97241.
    
    This PR adds three lints from clippy--`let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use`, which are meant to capture likely-incorrect uses of `let _ = ...` bindings (in particular, doing this on a type with a non-trivial `Drop` causes the `Drop` to occur immediately, instead of at the end of the scope. For a type like `MutexGuard`, this effectively releases the lock immediately, which is almost certainly the wrong behavior)
    
    In porting the lints from clippy I had to copy over a bunch of utility functions from `clippy_util` that these lints also relied upon. Is that the right approach?
    
    Note that I've set the `must_use` and `drop` lints to Allow by default and set `lock` to Deny by default (this matches the same settings that clippy has). In talking with `@estebank` he informed me to do a Crater run (I am not sure what type of Crater run to request here--I think it's just "check only"?)
    
    On the linked issue, there's some discussion about using `must_use` and `Drop` together as a heuristic for when to warn--I did not implement this yet.
    
    r? `@estebank`
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    07f43a1 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#99583 - shepmaster:provider-plus-plus, r=yaahc

    Add additional methods to the Demand type
    
    This adds on to the original tracking issue rust-lang#96024
    
    r? `````@yaahc`````
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    0e82dc9 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#100147 - Bryanskiy:private-in-public, r=pet…

    …rochenkov
    
    optimization of access level table construction
    
    Refactoring which was mentioned in rust-lang#87487
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    1aaf9ae View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#100552 - petrochenkov:flavorcompat, r=lqd

    rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors
    
    I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (rust-lang#96827).
    This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.)
    
    The second commit does some light refactoring of internal linker flavors (applies changes from petrochenkov@53eca42 that don't require mass-editing target specs).
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    edf79cb View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#100827 - JakobDegen:better-tests, r=wesleyw…

    …iser
    
    Simplify MIR opt tests
    
    This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized.
    
    Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the end to end effect of the optimization pipeline on the example code is.
    
    r? `````@wesleywiser`````
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    203526e View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#101166 - GuillaumeGomez:error-index-mdbook,…

    … r=notriddle
    
    Generate error index with mdbook instead of raw HTML pages
    
    This is a follow-up of rust-lang#100922.
    
    This comes from a remark from ````@estebank```` who said that the search was a nice thing on the previous version and that it wasn't possible anymore. An easy way to come around this limitation was to use `mdbook`, which is what I did here.
    
    Now some explanations on the code. I'll explain how I developed this and why I reached this solution. First I did it very basically by simply setting the source directory and the output directory, generated a `SUMMARY.md` manually which listed all error codes and that was it. Two problems arose from this:
     1. A lot of new HTML files were generated at the top level
     2. An `index.html` file was generated at the top-level (the summary in short).
    
    So for `1.`, it's not great to have too many files at the top-level as it could create file conflicts more easily. And for `2.`, this is actually a huge issue because <doc.rust-lang.org> generates an `index.html` file with a links to a few different resources, so it should never be overwritten. <s>Unfortunately, `mdbook` **always** generates an `index.html` file so the only solution I could see (except for sending them a contribution, I'll maybe do that later) was to temporaly move a potentially existing `index.html` file and then puts it back once done. For this last part, to ensure that we don't return *before* it has been put back, I wrapped the `mdbook` generation code inside `render_html_inner` which is called from `render_html` which in turn handle the "save" of `index.html`.</s>
    
    EDIT: `mdbook` completely deletes ALL the content in the target directory so I instead generate into a sub directory and then I move the files to the real target directory.
    
    To keep compatibility with the old version, I also put the `<script>` ````@notriddle```` nicely provided in the previous PR only into the `error-index.html` file to prevent unneeded repetition. I didn't use `mdbook` `additional-js` option because the JS is included at the end of all HTML files, which we don't want for two reasons:
     1. It's slow.
     2. We only want it to be run in `error-index.html` (even if we also ensure in the JS itself too!).
    
    <s>Now the last part: why we generate the summary twice. We actually generate it once to tell `mdbook` what the book will look like and a second time because a create a new chapter content which will actually list all the error codes (with the updated paths).</s>
    
    EDIT: I removed the need for two summaries.
    
    You can test it [here](https://rustdoc.crud.net/imperio/error-index-mdbook/error-index.html).
    
    r? ````@notriddle````
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    68d3cfa View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#101294 - Xiretza:fix-100844-accident, r=dav…

    …idtwco
    
    Fix rust-lang#100844 rebase accident
    
    This undoes the rebase accident in rust-lang#100844, which accidentally caused rust-lang#100970 to be reverted.
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    4c1b6b5 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#101298 - notriddle:notriddle/rustdoc-main-s…

    …ince, r=GuillaumeGomez
    
    rustdoc: remove unused CSS `#main-content > .since`
    
    This rule was added (actually, it was called `#main > .since` back then) with cdca084 and you can see an example of the bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html> by looking at the `1.0.0` version marker.
    
    However, a5a2f2b changed it so that `<span class="since">` is always placed in an out-of-band wrapper, so it's never nested directly below `#main` / `#main-content` any more.
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    3880925 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#101304 - jyn514:jnelson/tag-query-system, r…

    …=Dylan-DPC
    
    Add autolabels for `A-query-system`
    
    r? `@cjgillot`
    GuillaumeGomez authored Sep 2, 2022
    Configuration menu
    Copy the full SHA
    138121a View commit details
    Browse the repository at this point in the history