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 11 pull requests #120237

Closed
wants to merge 29 commits into from

Commits on Dec 20, 2023

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

Commits on Jan 10, 2024

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

Commits on Jan 13, 2024

  1. Refactor uses of objc_msgSend to no longer have clashing definitions

    This is very similar to what Apple's own headers encourage you to do (cast the function pointer before use instead of making new declarations).
    
    Additionally, I'm documenting a few of the memory management rules we're following, ensuring that the `args` function doesn't leak memory (if you wrap it in an autorelease pool).
    madsmtm committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    3b325bc View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2024

  1. revert temporary patch rust-lang#108288

    Signed-off-by: onur-ozkan <[email protected]>
    onur-ozkan committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    341f0a1 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. distribute actual stage of the compiled compiler

    By "actual" we refer to the uplifting logic where we may not compile the requested stage;
    instead, we uplift it from the previous stages. Which can lead to bootstrap failures in
    specific situations where we request stage X from other steps. However we may end up
    uplifting it from stage Y, causing the other stage to fail when attempting to link with
    stage X which was never actually built.
    
    Signed-off-by: onur-ozkan <[email protected]>
    onur-ozkan committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    8a461aa View commit details
    Browse the repository at this point in the history
  2. Add tests

    Nadrieril committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    12ebc3d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    753680a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0a9bb97 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

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

Commits on Jan 21, 2024

  1. Configuration menu
    Copy the full SHA
    fc75a4e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f52b88e View commit details
    Browse the repository at this point in the history
  3. Add test of thread_local containing multiline const block

    Before making thread_local accept statements inside the const block,
    this test would fail to compile as follows:
    
        error: no rules expected the token `let`
           --> library/std/tests/thread.rs:26:13
            |
        26  |             let value = 1;
            |             ^^^ no rules expected this token in macro call
            |
        note: while trying to match meta-variable `$init:expr`
           --> library/std/src/thread/local.rs:189:69
            |
        189 |     ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = const { $init:expr }; $($rest:tt)*) => (
            |                                                                     ^^^^^^^^^^
    dtolnay committed Jan 21, 2024
    Configuration menu
    Copy the full SHA
    c43344e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b58a8a9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7ee5f3a View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2024

  1. Configuration menu
    Copy the full SHA
    981e8b4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b93ae21 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5297433 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9454b51 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#117910 - madsmtm:msg-send-no-clashing, r=th…

    …omcc
    
    Refactor uses of `objc_msgSend` to no longer have clashing definitions
    
    This is very similar to what Apple's own headers encourage you to do (cast the function pointer before use instead of making new declarations).
    
    Additionally, I'm documenting a few of the memory management rules we're following, ensuring that the `args` function doesn't leak memory (if you wrap it in an autorelease pool).
    
    Motivation is to avoid issues with clashing definitions, like described in rust-lang#12707 (comment) and rust-lang#46188 (comment), CC `@bjorn3.`
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    299c0fb View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#118639 - fmease:deny-features-in-stable-rus…

    …tc-crates, r=WaffleLapkin
    
    Undeprecate lint `unstable_features` and make use of it in the compiler
    
    See also rust-lang#117937.
    
    r? compiler
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    f1d9c1a View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#119801 - zachs18:zachs18-patch-1, r=steffah…

    …n,Nilstrieb
    
    Fix deallocation with wrong allocator in (A)Rc::from_box_in
    
    Deallocate the `Box` with the original allocator (via `&A`), not `Global`.
    
    Fixes rust-lang#119749
    
    <details> <summary>Example code with error and Miri output</summary>
    
    (Note that this UB is not observable on stable, because the only usable allocator on stable is `Global` anyway.)
    
    Code ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=96193c2c6a1912d7f669fbbe39174b09)):
    
    ```rs
    #![feature(allocator_api)]
    use std::alloc::System;
    
    // uncomment one of these
    use std::rc::Rc;
    //use std::sync::Arc as Rc;
    
    fn main() {
        let x: Box<[u32], System> = Box::new_in([1,2,3], System);
        let _: Rc<[u32], System> = Rc::from(x);
    }
    ```
    
    Miri output:
    
    ```rs
    error: Undefined Behavior: deallocating alloc904, which is C heap memory, using Rust heap deallocation operation
       --> /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:117:14
        |
    117 |     unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating alloc904, which is C heap memory, using Rust heap deallocation operation
        |
        = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
        = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
        = note: BACKTRACE:
        = note: inside `std::alloc::dealloc` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:117:14: 117:64
        = note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:254:22: 254:51
        = note: inside `<std::boxed::Box<std::mem::ManuallyDrop<[u32]>> as std::ops::Drop>::drop` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1244:17: 1244:66
        = note: inside `std::ptr::drop_in_place::<std::boxed::Box<std::mem::ManuallyDrop<[u32]>>> - shim(Some(std::boxed::Box<std::mem::ManuallyDrop<[u32]>>))` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:507:1: 507:56
        = note: inside `std::mem::drop::<std::boxed::Box<std::mem::ManuallyDrop<[u32]>>>` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:992:24: 992:25
        = note: inside `std::rc::Rc::<[u32], std::alloc::System>::from_box_in` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/rc.rs:1928:13: 1928:22
        = note: inside `<std::rc::Rc<[u32], std::alloc::System> as std::convert::From<std::boxed::Box<[u32], std::alloc::System>>>::from` at /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/rc.rs:2504:9: 2504:27
    note: inside `main`
       --> src/main.rs:10:32
        |
    10  |     let _: Rc<[u32], System> = Rc::from(x);
        |                                ^^^^^^^^^^^
    
    note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
    
    error: aborting due to 1 previous error
    ```
    
    </details>
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    aac7ea7 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#120058 - onur-ozkan:compiler-assemble, r=Ma…

    …rk-Simulacrum
    
    bootstrap: improvements for compiler builds
    
    Reverted rust-lang#108288 and applied a proper fix with the following commit.
    
    r? ``@Mark-Simulacrum``
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    7b6311b View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#120059 - oli-obk:const_arg_type_mismatch, r…

    …=compiler-errors
    
    Make generic const type mismatches not hide trait impls from the trait solver
    
    pulled out of rust-lang#119895
    
    It does improve diagnostics somewhat, but also causes some extraneous diagnostics in potentially misleading order.
    
    The issue was that a const type mismatch, instead of reporting an error, would silently poison the constant, only for that information to be thrown away and the impl to be treated as "not matching". In rust-lang#119895 this would cause ICEs as well as errors on impls stating that the impl needs to exist for itself to be valid.
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    071938a View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#120097 - Nadrieril:consistent_unreachable_s…

    …ubpats, r=compiler-errors
    
    Report unreachable subpatterns consistently
    
    We weren't reporting unreachable subpatterns in function arguments and `let` expressions. This wasn't very important, but never patterns make it more relevant: a user might write `let (Ok(x) | Err(!)) = ...` in a case where `let Ok(x) = ...` is accepted, so we should report the `Err(!)` as redundant.
    
    r? ``@compiler-errors``
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    64cea92 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#120137 - compiler-errors:validate-aggregate…

    …s, r=nnethercote
    
    Validate AggregateKind types in MIR
    
    Would have helped me catch some bugs when writing shims for async closures
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    7902c69 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#120164 - trevyn:is_downgradable, r=compiler…

    …-errors
    
    `maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe`
    
    rust-lang#119752 leveraged and overloaded `is_object_safe` to prevent an ICE, but accurate object safety information is needed for precise suggestions. This separates out `is_downgradable`, used for the ICE prevention, and `is_object_safe`, which returns to its original meaning.
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    dc4234d View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#120181 - dtolnay:tlconst, r=thomcc

    Allow any `const` expression blocks in `thread_local!`
    
    This PR contains a rebase of the macro change from rust-lang#116392, together with adding a test under library/std/tests.
    
    Testing this feature by making the documentation's example code needlessly more complicated was not appropriate as pointed out in rust-lang#116392 (review).
    
    Without the macro change, this new test would fail to build as follows:
    
    ```console
    error: no rules expected the token `let`
       --> library/std/tests/thread.rs:26:13
        |
    26  |             let value = 1;
        |             ^^^ no rules expected this token in macro call
        |
    note: while trying to match meta-variable `$init:expr`
       --> library/std/src/thread/local.rs:189:69
        |
    189 |     ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = const { $init:expr }; $($rest:tt)*) => (
        |                                                                     ^^^^^^^^^^
    ```
    
    Closes rust-lang#116392.
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    a71e49c View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#120204 - azhogin:azhogin/collapse_debuginfo…

    …_for_builtin, r=petrochenkov
    
    Builtin macros effectively have implicit #[collapse_debuginfo(yes)]
    
    If collapse_debuginfo attribute for builtin macro is not specified explicitly, it will be effectively set to `#[collapse_debuginfo(yes)]`.
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    3423853 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#120218 - compiler-errors:parse_macro_arg, r…

    …=calebcartwright,ytmimi
    
    rustfmt: Check that a token can begin a nonterminal kind before parsing it as a macro arg
    
    r? `@ytmimi` and/or `@calebcartwright`
    cc `@fmease`
    
    I'm putting this on r-l/rust since it should fix the nightly rustfmt version. If you don't care about having this regression until the next rustfmt->rust sync, then I can move that PR over to r-l/rustfmt.
    
    ---
    
    > Any idea why the formatting would have changed [from rust-lang#119099]?
    
    **Copied over explanation:**
    
    This has to do with the weirdness of the way that `parse_macro_arg` works. Unlike parsing nonterminal args in a macro-by-example, it eagerly tries, for example, to parse a type without checking that the beginning token may begin a type:
    
    https://github.com/rust-lang/rustfmt/blob/bf967319e258acb9b1648a952bba52665eceaf52/src/parse/macros/mod.rs#L54
    
    Contrast this to the nonterminal parsing code, which first checks that the nonterminal may begin with a given token:
    
    https://github.com/rust-lang/rust/blob/ef71f1047e04438181d7cb925a833e2ada6ab390/compiler/rustc_parse/src/parser/nonterminal.rs#L47
    
    In rust-lang#119099, `@fmease` implemented a change so that `const Tr` would be parsed as `dyn const Tr` (a trait object to a const trait) in edition 2015.
    
    This is okay for the purposes of macros, because he explicitly made sure that `const` did not get added to the list of tokens that may begin a `:ty` nonterminal kind: rust-lang#119099 (comment)
    
    However, since rustfmt is not so careful about eagerly parsing macro args before checking that they're legal in macro position, this changed the way that the string of tokens is being parsed into macro args.
    matthiaskrgr authored Jan 22, 2024
    Configuration menu
    Copy the full SHA
    e153296 View commit details
    Browse the repository at this point in the history