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 12 pull requests #78245

Closed
wants to merge 49 commits into from

Commits on Sep 27, 2020

  1. Link to "Contributing to Rust" rather than "Getting Started".

    Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that the GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file.
    
    When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific the linked section can be changed.
    
    In the meantime this prevents leading first time contributors into a confusing cul de sac.
    follower committed Sep 27, 2020
    Configuration menu
    Copy the full SHA
    a7bd6c4 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2020

  1. Join map operators

    Signed-off-by: wcampbell <wcampbell1995@gmail.com>
    wcampbell0x2a committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    a93f58f View commit details
    Browse the repository at this point in the history
  2. Use is_ok() instead of empty Ok(_)

    Signed-off-by: wcampbell <wcampbell1995@gmail.com>
    wcampbell0x2a committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    964a5ac View commit details
    Browse the repository at this point in the history
  3. Avoid extraneous space between visibility kw and ident for statics

    Today, given a static like `static mut FOO: usize = 1`, rustdoc would
    emit `static mut  FOO: usize = 1`, as it emits both the mutability kw
    with a space and reserves a space after the mutability kw. This patch
    fixes that misformatting.
    
    This patch also adds some tests for emit of other statics, as I could
    not find an existing test devoted to statics.
    ayazhafiz committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    abfbd1b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e60072f View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2020

  1. Configuration menu
    Copy the full SHA
    000ec5e View commit details
    Browse the repository at this point in the history
  2. Following rust-lang#74010 by converting some newer cases of backticke…

    …d O notations to be italicized
    ryan-scott-dev committed Oct 15, 2020
    Configuration menu
    Copy the full SHA
    8446d94 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2020

  1. Add some tests

    Nadrieril committed Oct 18, 2020
    Configuration menu
    Copy the full SHA
    3b37d94 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bb81110 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c3d0445 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    99852e0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3708c86 View commit details
    Browse the repository at this point in the history
  6. Fix comment

    Nadrieril committed Oct 18, 2020
    Configuration menu
    Copy the full SHA
    f504e9a View commit details
    Browse the repository at this point in the history
  7. Handle ranges of float consistently

    This deconfuses the comparison of floats, that currently mixed ranges
    and non-ranges.
    Nadrieril committed Oct 18, 2020
    Configuration menu
    Copy the full SHA
    aa41720 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d1a784e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    da0ba2f View commit details
    Browse the repository at this point in the history
  10. Add comment

    Nadrieril committed Oct 18, 2020
    Configuration menu
    Copy the full SHA
    c4ae6c2 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2020

  1. Throw core::panic!("message") as &str instead of String.

    This makes it consistent with std::panic!("message"), which also throws
    a &str, not a String.
    m-ou-se committed Oct 19, 2020
    Configuration menu
    Copy the full SHA
    2780e35 View commit details
    Browse the repository at this point in the history
  2. Fix ui test for updated core::panic behaviour.

    It now throws a &str instead of a String.
    m-ou-se committed Oct 19, 2020
    Configuration menu
    Copy the full SHA
    9890217 View commit details
    Browse the repository at this point in the history
  3. Avoid panic_bounds_check in fmt::write.

    Writing any fmt::Arguments would trigger the inclusion of usize
    formatting and padding code in the resulting binary, because indexing
    used in fmt::write would generate code using panic_bounds_check, which
    prints the index and length.
    
    These bounds checks are not necessary, as fmt::Arguments never contains
    any out-of-bounds indexes.
    
    This change replaces them with unsafe get_unchecked, to reduce the
    amount of generated code, which is especially important for embedded
    targets.
    m-ou-se committed Oct 19, 2020
    Configuration menu
    Copy the full SHA
    d80f127 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5bfd3e7 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2020

  1. Configuration menu
    Copy the full SHA
    ea24395 View commit details
    Browse the repository at this point in the history
  2. Sync LLVM submodule if it has been initialized

    Since having enabled the download-ci-llvm option,
    and having rebased on top of f05b47c,
    I've noticed that I had to update the llvm-project
    submodule manually if it was checked out.
    Orignally, the submodule update logic was
    introduced to reduce the friction for contributors
    to manage the submodules, or in other words, to prevent
    getting PRs that have unwanted submodule rollbacks
    because the contributors didn't run git submodule update.
    
    This commit adds logic to ensure there is no inadvertent
    LLVM submodule rollback in a PR if download-ci-llvm
    (or llvm-config) is enabled. It will detect whether the
    llvm-project submodule is initialized, and if so, update
    it in any case. If it is not initialized, behaviour is
    kept to not do any update/initialization.
    
    An alternative to the chosen implementation would
    be to not pass the --init command line arg to
    `git submodule update` for the src/llvm-project
    submodule. This would show a confusing error message
    however on all builds with an uninitialized repo.
    We could pass the --silent param, but we still want
    it to print something if it is initialized and has
    to update something.
    So we just do a manual check for whether the
    submodule is initialized.
    est31 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    5948e62 View commit details
    Browse the repository at this point in the history
  3. Add test to check for fmt::write bloat.

    It checks that fmt::write by itself doesn't pull in any panicking or
    or display code.
    m-ou-se committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    356d5b5 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2020

  1. [mir-opt] Allow debuginfo to be generated for a constant or a Place

    Prior to this commit, debuginfo was always generated by mapping a name
    to a Place. This has the side-effect that `SimplifyLocals` cannot remove
    locals that are only used for debuginfo because their other uses have
    been const-propagated.
    
    To allow these locals to be removed, we now allow debuginfo to point to
    a constant value. The `ConstProp` pass detects when debuginfo points to
    a local with a known constant value and replaces it with the value. This
    allows the later `SimplifyLocals` pass to remove the local.
    wesleywiser committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    52640f2 View commit details
    Browse the repository at this point in the history
  2. Add a test for rust-lang#53708

    This issue was accidentally fixed recently, probably by rust-lang#70743
    Nadrieril committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    3519411 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    faf8710 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    484d9eb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e0b6111 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2020

  1. Fix clippy tests

    varkor committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    683db31 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    954b5a8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f8842b9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    83abed9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5bef429 View commit details
    Browse the repository at this point in the history
  6. Bless tests

    spastorino committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    5656a41 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4f7ffbf View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7130127 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#73210 - wesleywiser:consts_in_debuginfo, r=…

    …oli-obk
    
    [mir-opt] Allow debuginfo to be generated for a constant or a Place
    
    Prior to this commit, debuginfo was always generated by mapping a name
    to a Place. This has the side-effect that `SimplifyLocals` cannot remove
    locals that are only used for debuginfo because their other uses have
    been const-propagated.
    
    To allow these locals to be removed, we now allow debuginfo to point to
    a constant value. The `ConstProp` pass detects when debuginfo points to
    a local with a known constant value and replaces it with the value. This
    allows the later `SimplifyLocals` pass to remove the local.
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    d7695cb View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#77268 - follower:patch-3, r=jyn514

    Link to "Contributing to Rust" rather than "Getting Started".
    
    Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that:
    
     * The GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file.
    
     * The "Bug Report" section _seems_ to restrict itself to if "a compiler error message [told] you to come here".
    
     * The previous content of `CONTRIBUTING.md` now lives in the "Contributing to Rust" chapter.
    
    When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific, the choice of linked chapter could be updated.
    
    In the meantime this prevents leading first time contributors into a confusing cul de sac.
    
    _[I wasn't planning to make a PR for this until discussion in rust-lang#77215 concluded but the discovery that the "first issue" pop-up also links to this document IMO makes it a higher priority to make the link useful sooner rather than later.]_
    
    Related issues:
    
     * rust-lang#77215
    
     * rust-lang/rustc-dev-guide#775 (comment)
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    ff817fa View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#77488 - varkor:repr128-incomplete_features,…

    … r=jonas-schievink
    
    Mark `repr128` as `incomplete_features`
    
    As mentioned in rust-lang#56071 and noticed in rust-lang#77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it.
    
    Closes rust-lang#77457.
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    84b134c View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#77918 - wcampbell0x2a:cleanup-network-tests…

    …, r=m-ou-se
    
    Cleanup network tests
    
    Some cleanup for network related tests
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    23aff01 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#77920 - ayazhafiz:i/mut-ident-spacing, r=jy…

    …n514
    
    Avoid extraneous space between visibility kw and ident for statics
    
    Today, given a static like `static mut FOO: usize = 1`, rustdoc would
    emit `static mut  FOO: usize = 1`, as it emits both the mutability kw
    with a space and reserves a space after the mutability kw. This patch
    fixes that misformatting.
    
    This patch also adds some tests for emit of other statics, as I could
    not find an existing test devoted to statics.
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    2f6a53f View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#77969 - ryan-scott-dev:bigo-notation-consis…

    …tency, r=m-ou-se
    
    Doc formating consistency between slice sort and sort_unstable, and big O notation consistency
    
    Updated documentation for slice sorting methods to be consistent between stable and unstable versions, which just ended up being minor formatting differences.
    
    I also went through and updated any doc comments with big O notation to be consistent with rust-lang#74010 by italicizing them rather than having them in a code block.
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    c09b7e3 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#78069 - fusion-engineering-forks:core-const…

    …-panic-str, r=RalfJung
    
    Fix const core::panic!(non_literal_str).
    
    Invocations of `core::panic!(x)` where `x` is not a string literal expand to `panic!("{}", x)`, which is not understood by the const panic logic right now. This adds `panic_str` as a lang item, and modifies the const eval implementation to hook into this item as well.
    
    This fixes the issue mentioned here: rust-lang#51999 (comment)
    
    r? @RalfJung
    
    @rustbot modify labels: +A-const-eval
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    dc30e64 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#78072 - Nadrieril:cleanup-constant-matching…

    …, r=varkor
    
    Cleanup constant matching in exhaustiveness checking
    
    This supercedes rust-lang#77390. I made the `Opaque` constructor work.
    I have opened two issues rust-lang#78071 and rust-lang#78057 from the discussion we had on the previous PR. They are not regressions nor directly related to the current PR so I thought we'd deal with them separately.
    
    I left a FIXME somewhere because I didn't know how to compare string constants for equality. There might even be some unicode things that need to happen there. In the meantime I preserved previous behavior.
    
    EDIT: I accidentally fixed rust-lang#78071
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    f4780a9 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#78116 - spastorino:inline-const-in-range-pa…

    …t, r=petrochenkov
    
    Make inline const work in range patterns
    
    Fixes rust-lang#78108 which is a follow up of rust-lang#77124
    
    r? @petrochenkov
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    84f1f54 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#78119 - fusion-engineering-forks:panic-use-…

    …as-str, r=Amanieu
    
    Throw core::panic!("message") as &str instead of String.
    
    This makes `core::panic!("message")` consistent with `std::panic!("message")`, which throws a `&str` and not a `String`.
    
    This also makes any other panics from `core::panicking::panic` result in a `&str` rather than a `String`, which includes compiler-generated panics such as the panics generated for `mem::zeroed()`.
    
    ---
    
    Demonstration:
    
    ```rust
    use std::panic;
    use std::any::Any;
    
    fn main() {
        panic::set_hook(Box::new(|panic_info| check(panic_info.payload())));
    
        check(&*panic::catch_unwind(|| core::panic!("core")).unwrap_err());
        check(&*panic::catch_unwind(|| std::panic!("std")).unwrap_err());
    }
    
    fn check(msg: &(dyn Any + Send)) {
        if let Some(s) = msg.downcast_ref::<String>() {
            println!("Got a String: {:?}", s);
        } else if let Some(s) = msg.downcast_ref::<&str>() {
            println!("Got a &str: {:?}", s);
        }
    }
    ```
    
    Before:
    ```
    Got a String: "core"
    Got a String: "core"
    Got a &str: "std"
    Got a &str: "std"
    ```
    
    After:
    ```
    Got a &str: "core"
    Got a &str: "core"
    Got a &str: "std"
    Got a &str: "std"
    ```
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    76bcc7c View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#78122 - fusion-engineering-forks:fmt-write-…

    …bounds-check, r=dtolnay
    
    Avoid panic_bounds_check in fmt::write.
    
    Writing any fmt::Arguments would trigger the inclusion of usize formatting and padding code in the resulting binary, because indexing used in fmt::write would generate code using panic_bounds_check, which prints the index and length.
    
    These bounds checks are not necessary, as fmt::Arguments never contains any out-of-bounds indexes.
    
    This change replaces them with unsafe get_unchecked, to reduce the amount of generated code, which is especially important for embedded targets.
    
    ---
    
    Demonstration of the size of and the symbols in a 'hello world' no_std binary:
    
    <details>
    <summary>Source code</summary>
    
    ```rust
    #![feature(lang_items)]
    #![feature(start)]
    #![no_std]
    
    use core::fmt;
    use core::fmt::Write;
    
    #[link(name = "c")]
    extern "C" {
        #[allow(improper_ctypes)]
        fn write(fd: i32, s: &str) -> isize;
        fn exit(code: i32) -> !;
    }
    
    struct Stdout;
    
    impl fmt::Write for Stdout {
        fn write_str(&mut self, s: &str) -> fmt::Result {
            unsafe { write(1, s) };
            Ok(())
        }
    }
    
    #[start]
    fn main(_argc: isize, _argv: *const *const u8) -> isize {
        let _ = writeln!(Stdout, "Hello World");
        0
    }
    
    #[lang = "eh_personality"]
    fn eh_personality() {}
    
    #[panic_handler]
    fn panic(_: &core::panic::PanicInfo) -> ! {
        unsafe { exit(1) };
    }
    ```
    </details>
    
    Before:
    ```
       text	   data	    bss	    dec	    hex	filename
       6059	    736	      8	   6803	   1a93	before
    ```
    ```
    0000000000001e00 T <T as core::any::Any>::type_id
    0000000000003dd0 D core::fmt::num::DEC_DIGITS_LUT
    0000000000001ce0 T core::fmt::num::imp::<impl core::fmt::Display for u64>::fmt
    0000000000001ce0 T core::fmt::num::imp::<impl core::fmt::Display for usize>::fmt
    0000000000001370 T core::fmt::write
    0000000000001b30 t core::fmt::Formatter::pad_integral::write_prefix
    0000000000001660 T core::fmt::Formatter::pad_integral
    0000000000001350 T core::ops::function::FnOnce::call_once
    0000000000001b80 t core::ptr::drop_in_place
    0000000000001120 t core::ptr::drop_in_place
    0000000000001c50 t core::iter::adapters::zip::Zip<A,B>::new
    0000000000001c90 t core::iter::adapters::zip::Zip<A,B>::new
    0000000000001b90 T core::panicking::panic_bounds_check
    0000000000001c10 T core::panicking::panic_fmt
    0000000000001130 t <&mut W as core::fmt::Write>::write_char
    0000000000001200 t <&mut W as core::fmt::Write>::write_fmt
    0000000000001250 t <&mut W as core::fmt::Write>::write_str
    ```
    
    After:
    ```
       text	   data	    bss	    dec	    hex	filename
       3068	    600	      8	   3676	    e5c	after
    ```
    ```
    0000000000001360 T core::fmt::write
    0000000000001340 T core::ops::function::FnOnce::call_once
    0000000000001120 t core::ptr::drop_in_place
    0000000000001620 t core::iter::adapters::zip::Zip<A,B>::new
    0000000000001660 t core::iter::adapters::zip::Zip<A,B>::new
    0000000000001130 t <&mut W as core::fmt::Write>::write_char
    0000000000001200 t <&mut W as core::fmt::Write>::write_fmt
    0000000000001250 t <&mut W as core::fmt::Write>::write_str
    ```
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    4914ef8 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#78153 - est31:downloaded_llvm_maybe_sync, r…

    …=Mark-Simulacrum
    
    Sync LLVM submodule if it has been initialized
    
    Since having enabled the download-ci-llvm option,
    and having rebased on top of rust-lang#76864,
    I've noticed that I had to update the llvm-project
    submodule manually if it was checked out.
    Orignally, the submodule update logic was
    introduced to reduce the friction for contributors
    to manage the submodules, or in other words, to prevent
    getting PRs that have unwanted submodule rollbacks
    because the contributors didn't run git submodule update.
    
    This commit adds logic to ensure there is no inadvertent
    LLVM submodule rollback in a PR if download-ci-llvm
    (or llvm-config) is enabled. It will detect whether the
    llvm-project submodule is initialized, and if so, update
    it in any case. If it is not initialized, behaviour is
    kept to not do any update/initialization.
    
    An alternative to the chosen implementation would
    be to not pass the --init command line arg to
    `git submodule update` for the src/llvm-project
    submodule. This would show a confusing error message
    however on all builds with an uninitialized repo.
    We could pass the --silent param, but we still want
    it to print something if it is initialized and has
    to update something.
    So we just do a manual check for whether the
    submodule is initialized.
    Dylan-DPC committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    e4dc50e View commit details
    Browse the repository at this point in the history