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 7 pull requests #99439

Closed
wants to merge 14 commits into from

Commits on Jul 13, 2022

  1. docs: show how to stringify the output of Comamnd

    This documentation-only change clarifies how the user can get the
    string representation of the output of a command.
    
    The `stdout` and `stderr` members of `std::process::Output` from 
    `std::process::Command` return a Vec<u8>, which is not always what 
    the user wants.
    
    For simple cases like printing `stderr` iff the `std::process::ExitStatus`
    is non-zero, it's useful to get the string representation of this `Vec<u8>`.
    This can be done via `String::from_utf8_lossy`, but it's not clear that this
    is possible from the documentation without first searching the internet for
    an answer.
    
    Link to playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8189f65dc4b354a643311af2cea5b230
    beyarkay authored Jul 13, 2022
    Configuration menu
    Copy the full SHA
    988a7e7 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2022

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

Commits on Jul 18, 2022

  1. Fix debuginfo tests.

    This is needed for my Ubuntu 22.04 box due to a slight change in gdb
    output. The fix is similar to the fix in rust-lang#95063.
    nnethercote committed Jul 18, 2022
    Configuration menu
    Copy the full SHA
    13bf958 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c1c1abc View commit details
    Browse the repository at this point in the history
  3. Use span_bug for unexpected field projection type

    Improves the compiler error backtrace information, as shown in rust-lang#99363,
    by using `span_bug` instead of `bug`.
    
    New output:
    
    ```
    build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021
    error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection
      --> /tmp/test.rs:11:27
       |
    11 |         let Foo((a, b)) = foo;
       |                           ^^^
    
    thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9
    stack backtrace:
    ```
    
    (Remainder of output truncated.)
    Jordan McQueen authored and Jordan McQueen committed Jul 18, 2022
    Configuration menu
    Copy the full SHA
    38f090b View commit details
    Browse the repository at this point in the history
  4. Update invalid atomic ordering lint

    The restriction that success ordering must be at least as strong as its
    failure ordering in compare-exchange operations was lifted in rust-lang#98383.
    tmiasko committed Jul 18, 2022
    Configuration menu
    Copy the full SHA
    45afc21 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    454313f View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#99214 - beyarkay:patch-1, r=thomcc

    docs: show how to stringify the output of Command
    
    This documentation-only change clarifies how the user can get the string representation of the output of a command.
    
    The `stdout` and `stderr` members of `std::process::Output` from `std::process::Command` return a Vec<u8>, which is not always what the user wants.
    
    For simple cases like printing `stderr` iff the `std::process::ExitStatus` is non-zero, it's useful to get the string representation of this `Vec<u8>`. This can be done via `String::from_utf8_lossy`, but it's not clear that this is possible from the documentation without first searching the internet for an answer.
    
    Link to playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8189f65dc4b354a643311af2cea5b230
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    1abf43b View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#99335 - Dav1dde:fromstr-docs, r=JohnTitor

    Use split_once in FromStr docs
    
    Current implementation:
    
    ```rust
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
                                     .split(',')
                                     .collect();
    
            let x_fromstr = coords[0].parse::<i32>()?;
            let y_fromstr = coords[1].parse::<i32>()?;
    
            Ok(Point { x: x_fromstr, y: y_fromstr })
        }
    ```
    
    Creating the vector is not necessary, `split_once` does the job better.
    
    Alternatively we could also remove `trim_matches` with `strip_prefix` and `strip_suffix`:
    
    ```rust
            let (x, y) = s
                .strip_prefix('(')
                .and_then(|s| s.strip_suffix(')'))
                .and_then(|s| s.split_once(','))
                .unwrap();
    ```
    
    The question is how much 'correctness' is too much and distracts from the example. In a real implementation you would also not unwrap (or originally access the vector without bounds checks), but implementing a custom Error and adding a `From<ParseIntError>` and implementing the `Error` trait adds a lot of code to the example which is not relevant to the `FromStr` trait.
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    517a9a7 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#99384 - compiler-errors:issue-99375, r=oli-obk

    use body's param-env when checking if type needs drop
    
    The type comes from the body, so we should be using the body's param-env, as opposed to the ADT's param env, because we know less in the latter compared to the former.
    
    Fixes rust-lang#99375
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    ab0b75d View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#99392 - nnethercote:fix-debuginfo-tests, r=…

    …pnkfelix
    
    Fix debuginfo tests.
    
    This is needed for my Ubuntu 22.04 box due to a slight change in gdb
    output. The fix is similar to the fix in rust-lang#95063.
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    1b0dda4 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#99404 - jmqd:master, r=compiler-errors

    Use span_bug for unexpected field projection type
    
    Improves the compiler error backtrace information, as shown in rust-lang#99363,
    by using `span_bug` instead of `bug`.
    
    New output:
    
    ```
    build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021
    error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection
      --> /tmp/test.rs:11:27
       |
    11 |         let Foo((a, b)) = foo;
       |                           ^^^
    
    thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9
    stack backtrace:
    ```
    
    (Remainder of output truncated.)
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    c3a38b8 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#99410 - tmiasko:atomic-lint, r=fee1-dead

    Update invalid atomic ordering lint
    
    The restriction that success ordering must be at least as strong as its
    failure ordering in compare-exchange operations was lifted in rust-lang#98383.
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    8fc0b8d View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#99419 - yoshuawuyts:stabilize-task-ready, r…

    …=Mark-Simulacrum
    
    Stabilize `core::task::ready!`
    
    This stabilizes `core::task::ready!` for Rust 1.64. The FCP for stabilization was just completed here rust-lang#70922 (comment). Thanks!
    
    Closes rust-lang#70922
    
    cc/ `@rust-lang/libs-api`
    matthiaskrgr authored Jul 18, 2022
    Configuration menu
    Copy the full SHA
    f3816dd View commit details
    Browse the repository at this point in the history