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 4 pull requests #112101

Closed
wants to merge 12 commits into from
Closed

Commits on May 26, 2023

  1. Configuration menu
    Copy the full SHA
    7f8846a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a0612d9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7f99c7d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b84c190 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2023

  1. Configuration menu
    Copy the full SHA
    f333932 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    17e3d1c View commit details
    Browse the repository at this point in the history

Commits on May 30, 2023

  1. Configuration menu
    Copy the full SHA
    000cd9b View commit details
    Browse the repository at this point in the history
  2. Don't typecheck suggested method call

    Only make the use-dot-operator-to-call-method suggestion, but do not
    double down and use the recovered type to perform method call
    typechecking as it will produce confusing diagnostics on the "fixed"
    code.
    jieyouxu committed May 30, 2023
    Configuration menu
    Copy the full SHA
    e11ffb6 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#107916 - reez12g:issue-107040, r=Amanieu

    fix comment on Allocator trait
    
    fixes rust-lang#107040
    Noratrieb committed May 30, 2023
    Configuration menu
    Copy the full SHA
    39ed4e2 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#111543 - Urgau:uplift_invalid_utf8_in_unche…

    …cked, r=WaffleLapkin
    
    Uplift `clippy::invalid_utf8_in_unchecked` lint
    
    This PR aims at uplifting the `clippy::invalid_utf8_in_unchecked` lint into two lints.
    
    ## `invalid_from_utf8_unchecked`
    
    (deny-by-default)
    
    The `invalid_from_utf8_unchecked` lint checks for calls to `std::str::from_utf8_unchecked` and `std::str::from_utf8_unchecked_mut` with an invalid UTF-8 literal.
    
    ### Example
    
    ```rust
    unsafe {
        std::str::from_utf8_unchecked(b"cl\x82ippy");
    }
    ```
    
    ### Explanation
    
    Creating such a `str` would result in undefined behavior as per documentation for `std::str::from_utf8_unchecked` and `std::str::from_utf8_unchecked_mut`.
    
    ## `invalid_from_utf8`
    
    (warn-by-default)
    
    The `invalid_from_utf8` lint checks for calls to `std::str::from_utf8` and `std::str::from_utf8_mut` with an invalid UTF-8 literal.
    
    ### Example
    
    ```rust
    std::str::from_utf8(b"ru\x82st");
    ```
    
    ### Explanation
    
    Trying to create such a `str` would always return an error as per documentation for `std::str::from_utf8` and `std::str::from_utf8_mut`.
    
    -----
    
    Mostly followed the instructions for uplifting a clippy lint described here: rust-lang#99696 (review)
    
    ```@rustbot``` label: +I-lang-nominated
    r? compiler
    
    -----
    
    For Clippy:
    
    changelog: Moves: Uplifted `clippy::invalid_utf8_in_unchecked` into rustc
    Noratrieb committed May 30, 2023
    Configuration menu
    Copy the full SHA
    8cec9ec View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#112064 - GuillaumeGomez:migrate-gui-test-co…

    …lor-9, r=notriddle
    
    Migrate GUI colors test to original CSS color format
    
    Follow-up of rust-lang#111459.
    
    The `browser-ui-test` update is a fix when converting the alpha value to hex format. More information [here](GuillaumeGomez/browser-UI-test#511).
    
    r? ```@notriddle```
    Noratrieb committed May 30, 2023
    Configuration menu
    Copy the full SHA
    f8cd0c7 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#112100 - jieyouxu:issue-106929, r=oli-obk

    Don't typecheck recovered method call from suggestion
    
    Only make the use-dot-operator-to-call-method suggestion, but do not double down and use the recovered type to perform method call typechecking as it will produce confusing diagnostics relevant for the *fixed* code.
    
    ### Code Sample
    
    ```rust
    struct Client;
    
    impl Client {
        fn post<T: std::ops::Add>(&self, _: T, _: T) {}
    }
    
    fn f() {
        let c = Client;
        post(c, ());
    }
    ```
    
    ### Before This PR
    
    ```
    error[[E0277]](https://doc.rust-lang.org/stable/error_codes/E0277.html): cannot add `()` to `()`
     --> src/lib.rs:9:5
      |
    9 |     post(c, ());
      |     ^^^^^^^^^^^ no implementation for `() + ()`
      |
      = help: the trait `Add` is not implemented for `()`
    note: required by a bound in `Client::post`
     --> src/lib.rs:4:16
      |
    4 |     fn post<T: std::ops::Add>(&self, _: T, _: T) {}
      |                ^^^^^^^^^^^^^ required by this bound in `Client::post`
    
    error[[E0061]](https://doc.rust-lang.org/stable/error_codes/E0061.html): this function takes 2 arguments but 1 argument was supplied
     --> src/lib.rs:9:5
      |
    9 |     post(c, ());
      |     ^^^^ an argument of type `()` is missing
      |
    note: method defined here
     --> src/lib.rs:4:8
      |
    4 |     fn post<T: std::ops::Add>(&self, _: T, _: T) {}
      |        ^^^^                   -----  ----  ----
    help: provide the argument
      |
    9 |     post((), ())(c, ());
      |         ++++++++
    
    error[[E0425]](https://doc.rust-lang.org/stable/error_codes/E0425.html): cannot find function `post` in this scope
     --> src/lib.rs:9:5
      |
    9 |     post(c, ());
      |     ^^^^ not found in this scope
      |
    help: use the `.` operator to call the method `post` on `&Client`
      |
    9 -     post(c, ());
    9 +     c.post(());
      |
    
    Some errors have detailed explanations: E0061, E0277, E0425.
    For more information about an error, try `rustc --explain E0061`.
    ```
    
    ### After This PR
    
    ```
    error[E0425]: cannot find function `post` in this scope
     --> tests/ui/typeck/issue-106929.rs:9:5
      |
    9 |     post(c, ());
      |     ^^^^ not found in this scope
      |
    help: use the `.` operator to call the method `post` on `&Client`
      |
    9 -     post(c, ());
    9 +     c.post(());
      |
    
    error: aborting due to previous error
    
    For more information about this error, try `rustc --explain E0425`.
    ```
    
    Fixes rust-lang#106929.
    Noratrieb committed May 30, 2023
    Configuration menu
    Copy the full SHA
    dd38206 View commit details
    Browse the repository at this point in the history