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 15 pull requests #129809

Merged
merged 34 commits into from
Aug 31, 2024
Merged

Rollup of 15 pull requests #129809

merged 34 commits into from
Aug 31, 2024

Commits on Aug 15, 2024

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

Commits on Aug 24, 2024

  1. Configuration menu
    Copy the full SHA
    42a901a View commit details
    Browse the repository at this point in the history
  2. Deny wasm_c_abi lint to nudge the last 25%

    This shouldn't affect projects indirectly depending on wasm-bindgen
    because cargo passes `--cap-lints=allow` when building dependencies.
    workingjubilee committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    af05882 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2024

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

Commits on Aug 27, 2024

  1. Bump backtrace to rust-lang/backtrace@fc37b22

    It should be 0.3.74~ish.
    
    This should help with backtraces on Android, QNX NTO 7.0, and Windows.
    workingjubilee committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    0763a3a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a1c36c6 View commit details
    Browse the repository at this point in the history
  3. linker: Better support alternative static library naming on MSVC

    Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
    petrochenkov committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    05bd36d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ac8f132 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    ee05de8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    83de14c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1eb4cb4 View commit details
    Browse the repository at this point in the history
  4. allow BufReader::peek to be called on unsized types

    binarycat committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    ae6f8a7 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2024

  1. Configuration menu
    Copy the full SHA
    9200452 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e20a888 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    de34a91 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8c798c8 View commit details
    Browse the repository at this point in the history
  5. wasi: Fix sleeping for Duration::MAX

    This commit fixes an assert in the WASI-specific implementation of
    thread sleep to ensure that sleeping for a very large period of time
    blocks instead of panicking. This can come up when testing programs that
    sleep "forever", for example.
    alexcrichton committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    c824c1a View commit details
    Browse the repository at this point in the history
  6. Try latest backtrace

    workingjubilee committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    518b41c View commit details
    Browse the repository at this point in the history
  7. Remove Option<!> return types.

    Several compiler functions have `Option<!>` for their return type.
    That's odd. The only valid return value is `None`, so why is this type
    used?
    
    Because it lets you write certain patterns slightly more concisely. E.g.
    if you have these common patterns:
    ```
        let Some(a) = f() else { return };
        let Ok(b) = g() else { return };
    ```
    you can shorten them to these:
    ```
        let a = f()?;
        let b = g().ok()?;
    ```
    Huh.
    
    An `Option` return type typically designates success/failure. How should
    I interpret the type signature of a function that always returns (i.e.
    doesn't panic), does useful work (modifying `&mut` arguments), and yet
    only ever fails? This idiom subverts the type system for a cute
    syntactic trick.
    
    Furthermore, returning `Option<!>` from a function F makes things
    syntactically more convenient within F, but makes things worse at F's
    callsites. The callsites can themselves use `?` with F but should not,
    because they will get an unconditional early return, which is almost
    certainly not desirable. Instead the return value should be ignored.
    (Note that some of callsites of `process_operand`, `process_immedate`,
    `process_assign` actually do use `?`, though the early return doesn't
    matter in these cases because nothing of significance comes after those
    calls. Ugh.)
    
    When I first saw this pattern I had no idea how to interpret it, and it
    took me several minutes of close reading to understand everything I've
    written above. I even started a Zulip thread about it to make sure I
    understood it properly. "Save a few characters by introducing types so
    weird that compiler devs have to discuss it on Zulip" feels like a bad
    trade-off to me. This commit replaces all the `Option<!>` return values
    and uses `else`/`return` (or something similar) to replace the relevant
    `?` uses. The result is slightly more verbose but much easier to
    understand.
    nnethercote committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    fa4f892 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2024

  1. Rollup merge of rust-lang#120221 - compiler-errors:statements-are-not…

    …-patterns, r=nnethercote
    
    Don't make statement nonterminals match pattern nonterminals
    
    Right now, the heuristic we use to check if a token may begin a pattern nonterminal falls back to `may_be_ident`:
    https://github.com/rust-lang/rust/blob/ef71f1047e04438181d7cb925a833e2ada6ab390/compiler/rustc_parse/src/parser/nonterminal.rs#L21-L37
    
    This has the unfortunate side effect that a `stmt` nonterminal eagerly matches against a `pat` nonterminal, leading to a parse error:
    ```rust
    macro_rules! m {
        ($pat:pat) => {};
        ($stmt:stmt) => {};
    }
    
    macro_rules! m2 {
        ($stmt:stmt) => {
            m! { $stmt }
        };
    }
    
    m2! { let x = 1 }
    ```
    
    This PR fixes it by more accurately reflecting the set of nonterminals that may begin a pattern nonterminal.
    
    As a side-effect, I modified `Token::can_begin_pattern` to work correctly and used that in `Parser::nonterminal_may_begin_with`.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1fd0c71 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#126183 - Folyd:search-core, r=GuillaumeGome…

    …z,notriddle
    
    Separate core search logic with search ui
    
    Currenty, the `search.js` mixed with UI/DOM manipulation codes and search logic codes, I propose to extract the search logic to a class for following benefits:
    
    - Clean code. Separation of DOM manipulation and search logic can lead better code maintainability and easy code testings.
    - Easy share the search logic for third party to utilize the search function, such as [Rust Search Extension](https://rust.extension.sh), https://query.rs.
    
    This PR added a new class called `DocSearch`, which mainly expose following methods:
    
    ```js
    class DocSearch {
    	// Dependency inject searchIndex, rootPath and searchState
    	constructor(rawSearchIndex, rootPath, searchState) {
    		// build search index...
    	}
    
    	static parseQuery(userQuery) {
    	}
    
    	async execQuery(parsedQuery, filterCrates, currentCrate) {
    	}
    }
    ```
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1f0292b View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#129123 - aDotInTheVoid:rustdoc-json-self, r…

    …=fmease
    
    rustdoc-json: Add test for `Self` type
    
    Inspired by rust-lang#128471, the rustdoc-json suite had no tests in place for the `Self` type. This PR adds one.
    
    I've also manually checked locally that this test passes on 29e9248, confirming that adding `clean::Type::SelfTy` didn't change the JSON output. (potentially adding a self type to json (insead of (ab)using generic) is tracked in rust-lang#128522)
    
    Updates rust-lang#81359
    
    r? ````````@fmease````````
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    defc245 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#129366 - petrochenkov:libsearch, r=jieyouxu

    linker: Synchronize native library search in rustc and linker
    
    Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs.
    
    This unblocks rust-lang#123436.
    
    try-job: x86_64-msvc
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9f3ce40 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#129527 - compiler-errors:lint-nit, r=Nadrieril

    Don't use `TyKind` in a lint
    
    Allows us to remove an inherent method from `TyKind` from the type ir crate.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    2a321e1 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#129534 - workingjubilee:ratchet-wasm-c-abi-…

    …fcw-to-deny, r=daxpedda,alexcrichton
    
    Deny `wasm_c_abi` lint to nudge the last 25%
    
    This shouldn't affect projects indirectly depending on wasm-bindgen because cargo passes `--cap-lints=allow` when building dependencies.
    
    The motivation is that the ecosystem has mostly taken up the versions of wasm-bindgen that are compatible in general, but ~25% or so of recent downloads remain on lower versions. However, this change might still be unnecessarily disruptive. I mostly propose it as a discussion point.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    8f35a4f View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#129640 - saethlin:unignore-android-in-alloc…

    …, r=tgross35
    
    Re-enable android tests/benches in alloc/core
    
    This is basically a revert of rust-lang#73729. These tests better work on android now; it's been 4 years and we don't use dlmalloc on that target anymore.
    
    And I've validated that they should pass now with a try-build :)
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    385ffae View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#129642 - workingjubilee:bump-backtrace-fc37…

    …b22, r=workingjubilee
    
    Bump backtrace to 0.3.74~ish
    
    Commit: rust-lang/backtrace-rs@230570f
    
    This should help with backtraces on Android, QNX NTO 7.0, and Windows.
    It addresses a case of backtrace incurring undefined behavior on Android.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    fbf74df View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#129675 - lolbinarycat:bufreader_peek_unsize…

    …d, r=workingjubilee
    
    allow BufReader::peek to be called on unsized types
    
    rust-lang#128405
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    10fb626 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#129723 - compiler-errors:extern-providers, …

    …r=lcnr
    
    Simplify some extern providers
    
    Simplifies some extern crate providers:
    1. Generalize the `ProcessQueryValue` identity impl to work on non-`Option` types.
    2. Allow `ProcessQueryValue` to wrap its output in an `EarlyBinder`, to simplify `explicit_item_bounds`/`explicit_item_super_predicates`.
    3. Use `{ table }` and friends more when possible.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9510beb View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#129724 - nnethercote:rm-Option-bang, r=fee1…

    …-dead
    
    Remove `Option<!>` return types.
    
    Several compiler functions have `Option<!>` for their return type. That's odd. The only valid return value is `None`, so why is this type used?
    
    Because it lets you write certain patterns slightly more concisely. E.g. if you have these common patterns:
    ```
        let Some(a) = f() else { return };
        let Ok(b) = g() else { return };
    ```
    you can shorten them to these:
    ```
        let a = f()?;
        let b = g().ok()?;
    ```
    Huh.
    
    An `Option` return type typically designates success/failure. How should I interpret the type signature of a function that always returns (i.e. doesn't panic), does useful work (modifying `&mut` arguments), and yet only ever fails? This idiom subverts the type system for a cute syntactic trick.
    
    Furthermore, returning `Option<!>` from a function F makes things syntactically more convenient within F, but makes things worse at F's callsites. The callsites can themselves use `?` with F but should not, because they will get an unconditional early return, which is almost certainly not desirable. Instead the return value should be ignored. (Note that some of callsites of `process_operand`, `process_immedate`, `process_assign` actually do use `?`, though the early return doesn't matter in these cases because nothing of significance comes after those calls. Ugh.)
    
    When I first saw this pattern I had no idea how to interpret it, and it took me several minutes of close reading to understand everything I've written above. I even started a Zulip thread about it to make sure I understood it properly. "Save a few characters by introducing types so weird that compiler devs have to discuss it on Zulip" feels like a bad trade-off to me. This commit replaces all the `Option<!>` return values and uses `else`/`return` (or something similar) to replace the relevant `?` uses. The result is slightly more verbose but much easier to understand.
    
    r? ``````@cjgillot``````
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    4418552 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#129725 - compiler-errors:predicates-of, r=f…

    …mease
    
    Stop using `ty::GenericPredicates` for non-predicates_of queries
    
    `GenericPredicates` is a struct of several parts: A list of of an item's own predicates, and a parent def id (and some effects related stuff, but ignore that since it's kinda irrelevant). When instantiating these generic predicates, it calls `predicates_of` on the parent and instantiates its predicates, and appends the item's own instantiated predicates too:
    
    https://github.com/rust-lang/rust/blob/acb4e8b6251f1d8da36f08e7a70fa23fc581839e/compiler/rustc_middle/src/ty/generics.rs#L407-L413
    
    Notice how this should result in a recursive set of calls to `predicates_of`... However, `GenericPredicates` is *also* misused by a bunch of *other* queries as a convenient way of passing around a list of predicates. For these queries, we don't ever set the parent def id of the `GenericPredicates`, but if we did, then this would be very easy to mistakenly call `predicates_of` instead of some other intended parent query.
    
    Given that footgun, and the fact that we don't ever even *use* the parent def id in the `GenericPredicates` returned from queries like `explicit_super_predicates_of`, It really has no benefit over just returning `&'tcx [(Clause<'tcx>, Span)]`.
    
    This PR additionally opts to wrap the results of `EarlyBinder`, as we've tended to use that in the return type of these kinds of queries to properly convey that the user has params to deal with, and it also gives a convenient way of iterating over a slice of things after instantiating.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    5f10a99 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#129731 - ferrocene:x-test-compiler, r=onur-…

    …ozkan
    
    Allow running `./x.py test compiler`
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    6c8b07f View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#129751 - RalfJung:interpret-visit-field-ord…

    …er, r=compiler-errors
    
    interpret/visitor: make memory order iteration slightly more efficient
    
    Finally I know enough about RPIT to write this iterator signature correctly. :D
    
    This means memory-order iteration now needs an allocation, but it avoids quadratic complexity (where it has to do a linear scan n times to find the n-th field in memory order), so that seems like a win overall. The changed code only affects Miri; the rustc changes are NOPs.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    a59c1a4 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#129754 - alexcrichton:fix-wasi-long-sleep, …

    …r=workingjubilee
    
    wasi: Fix sleeping for `Duration::MAX`
    
    This commit fixes an assert in the WASI-specific implementation of thread sleep to ensure that sleeping for a very large period of time blocks instead of panicking. This can come up when testing programs that sleep "forever", for example.
    
    I'll note that I haven't included a test for this since it's sort of difficult to test. I've tested this locally though that long sleeps do indeed block and short sleeps still only sleep for a short amount of time.
    matthiaskrgr committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    25e3b66 View commit details
    Browse the repository at this point in the history