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 9 pull requests #128253

Merged
merged 30 commits into from
Jul 27, 2024
Merged

Rollup of 9 pull requests #128253

merged 30 commits into from
Jul 27, 2024

Commits on Jul 4, 2024

  1. stabilize const_int_from_str

    Skgland committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    c90b6b8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eb799cf View commit details
    Browse the repository at this point in the history
  3. fix tests after rebase

    Skgland committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    f99df29 View commit details
    Browse the repository at this point in the history
  4. bless tests

    Skgland committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    404519a View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. rustdoc: change title of search results

    the current title is too similar to that of the page for
    std::result::Result, which is a problem both for
    navigating to the Result docs via browser autocomplete, and for
    being able to tell which tab is which when the width of tabs is
    small.
    binarycat committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    370fcce View commit details
    Browse the repository at this point in the history
  2. use double quotes

    binarycat committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    587b64e View commit details
    Browse the repository at this point in the history
  3. Invert early exit conditions in collect_tokens_trailing_token.

    This has been bugging me for a while. I find complex "if any of these
    are true" conditions easier to think about than complex "if all of these
    are true" conditions, because you can stop as soon as one is true.
    nnethercote committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    caee195 View commit details
    Browse the repository at this point in the history
  4. Inline and remove AttrWrapper::is_complete.

    It has a single call site. This change makes the two `needs_collect`
    conditions more similar to each other, and therefore easier to
    understand.
    nnethercote committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    4288edb View commit details
    Browse the repository at this point in the history
  5. Move is_complete to the module that uses it.

    And make it non-`pub`.
    nnethercote committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    3d363c3 View commit details
    Browse the repository at this point in the history
  6. Invert the sense of is_complete and rename it as needs_tokens.

    I have always found `is_complete` an unhelpful name. The new name (and
    inverted sense) fits in better with the conditions at its call sites.
    nnethercote committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    e631b1e View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Don't include inner attribute ranges in CaptureState.

    The current code is this:
    ```
    self.capture_state.replace_ranges.push((start_pos..end_pos, Some(target)));
    self.capture_state.replace_ranges.extend(inner_attr_replace_ranges);
    ```
    What's not obvious is that every range in `inner_attr_replace_ranges`
    must be a strict sub-range of `start_pos..end_pos`. Which means, in
    `LazyAttrTokenStreamImpl::to_attr_token_stream`, they will be done
    first, and then the `start_pos..end_pos` replacement will just overwrite
    them. So they aren't needed.
    nnethercote committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    a560810 View commit details
    Browse the repository at this point in the history
  2. Fix a comment.

    Imagine you have replace ranges (2..20,X) and (5..15,Y), and these tokens:
    ```
    a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x
    ```
    If we replace (5..15,Y) first, then (2..20,X) we get this sequence
    ```
    a,b,c,d,e,Y,_,_,_,_,_,_,_,_,_,p,q,r,s,t,u,v,w,x
    a,b,X,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,u,v,w,x
    ```
    which is what we want.
    
    If we do it in the other order, we get this:
    ```
    a,b,X,_,_,_,_,_,_,_,_,_,_,_,_,p,q,r,s,t,u,v,w,x
    a,b,X,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_,u,v,w,x
    ```
    which is wrong. So it's true that we need the `.rev()` but the comment
    is wrong about why.
    nnethercote committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    6e87858 View commit details
    Browse the repository at this point in the history
  3. Tweak a loop.

    A fully imperative style is easier to read than a half-iterator,
    half-imperative style. Also, rename `inner_attr` as `attr` because it
    might be an outer attribute.
    nnethercote committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    6ea2da5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    55d37ae View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    33b98bf View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    114e0dc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    33dd288 View commit details
    Browse the repository at this point in the history
  8. Improve error message for extern "C" unsafe fn()

    This was handled correctly already for `extern unsafe fn()`.
    
    Co-authored-by: Folkert <folkert@folkertdev.nl>
    tdittr and folkertdev committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    3fdc991 View commit details
    Browse the repository at this point in the history
  9. Fix docs

    harryscholes committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    130ce49 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d565605 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5a9959f View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#124941 - Skgland:stabilize-const-int-from-s…

    …tr, r=dtolnay
    
    Stabilize const `{integer}::from_str_radix` i.e. `const_int_from_str`
    
    This PR stabilizes the feature `const_int_from_str`.
    
    - ACP Issue: rust-lang/libs-team#74
    - Implementation PR: rust-lang#99322
    - Part of Tracking Issue: rust-lang#59133
    
    API Change Diff:
    
    ```diff
    impl {integer} {
    - pub       fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>;
    + pub const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>;
    }
    
    impl ParseIntError {
    - pub       fn kind(&self) -> &IntErrorKind;
    + pub const fn kind(&self) -> &IntErrorKind;
    }
    ```
    This makes it easier to parse integers at compile-time, e.g.
    the example from the Tracking Issue:
    
    ```rust
    env!("SOMETHING").parse::<usize>().unwrap()
    ```
    
    could now be achived  with
    
    ```rust
    match usize::from_str_radix(env!("SOMETHING"), 10) {
      Ok(val) => val,
      Err(err) => panic!("Invalid value for SOMETHING environment variable."),
    }
    ```
    
    rather than having to depend on a library that implements or manually implement the parsing at compile-time.
    
    ---
    
    Checklist based on [Libs Stabilization Guide - When there's const involved](https://std-dev-guide.rust-lang.org/development/stabilization.html#when-theres-const-involved)
    
    I am treating this as a [partial stabilization](https://std-dev-guide.rust-lang.org/development/stabilization.html#partial-stabilizations) as it shares a tracking issue (and is rather small), so directly opening the partial stabilization PR for the subset (feature `const_int_from_str`) being stabilized.
    
    - [x] ping Constant Evaluation WG
    - [x] no unsafe involved
    - [x] no `#[allow_internal_unstable]`
    - [ ] usage of `intrinsic::const_eval_select` rust-lang#124625 in `from_str_radix_assert` to change the error message between compile-time and run-time
    - [ ] [rust-labg/libs-api FCP](rust-lang#124941 (comment))
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    86721a4 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#128201 - compiler-errors:closure-clone, r=o…

    …li-obk
    
    Implement `Copy`/`Clone` for async closures
    
    We can do so in the same cases that regular closures do.
    
    For the purposes of cloning, coroutine-closures are actually precisely the same as regular closures, specifically in the aspect that `Clone` impls care about which is the upvars. The only difference b/w coroutine-closures and regular closures is the type that they *return*, but this type has not been *created* yet, so we don't really have a problem.
    
    IDK why I didn't add this impl initially -- I went back and forth a bit on the internal representation for coroutine-closures before settling on a design which largely models regular closures. Previous (not published) iterations of coroutine-closures used to be represented as a special (read: cursed) kind of coroutine, which would probably suffer from the pitfalls that coroutines have that oli mentioned below in rust-lang#128201 (comment).
    
    r? oli-obk
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    bd18f88 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#128210 - lolbinarycat:rustdoc-search-title,…

    … r=notriddle,GuillaumeGomez
    
    rustdoc: change title of search results
    
    the current title is too similar to that of the page for std::result::Result, which is a problem both for
    navigating to the Result docs via browser autocomplete, and for being able to tell which tab is which when the width of tabs is small.
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    7195b80 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#128223 - nnethercote:refactor-collect_token…

    …s, r=petrochenkov
    
    Refactor complex conditions in `collect_tokens_trailing_token`
    
    More readability improvements for this complicated function.
    
    r? ````@petrochenkov````
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    553a64f View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#128224 - nnethercote:fewer-replace_ranges, …

    …r=petrochenkov
    
    Remove unnecessary range replacements
    
    This PR removes an unnecessary range replacement in `collect_tokens_trailing_token`, and does a couple of other small cleanups.
    
    r? ````@petrochenkov````
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    af52be2 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#128226 - oli-obk:option_vs_empty_slice, r=p…

    …etrochenkov
    
    Remove redundant option that was just encoding that a slice was empty
    
    There is already a sanity check ensuring we don't put empty attribute lists into the HIR:
    
    https://github.com/rust-lang/rust/blob/6ef11b81c2c02c3c4b7556d1991a98572fe9af87/compiler/rustc_ast_lowering/src/lib.rs#L661-L667
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    f1cf2f5 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#128227 - Kobzol:ci-unrolled-perf-build-matr…

    …ix, r=tgross35
    
    CI: do not respect custom try jobs for unrolled perf builds
    
    Before this PR, if a pull request merged in a rollup had some `try-job` annotations, the unrolled perf builds were running the custom try jobs instead of the default job, which was wrong.
    
    Found out [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/try-perf.20jobs.20respect.20try-job.20annotations).
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    f9209ae View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#128229 - tdittr:unsafe-extern-abi-error, r=…

    …compiler-errors
    
    Improve `extern "<abi>" unsafe fn()` error message
    
    These errors were already reported in rust-lang#87217, and fixed by rust-lang#87235 but missed the case of an explicit ABI.
    
    This PR does not cover multiple keywords like `extern "C" pub const unsafe fn()`, but I don't know what a good way to cover this  would be. It also seems rarer than `extern "C" unsafe` which I saw happen a few times in workshops.
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    7eaf747 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#128235 - harryscholes:fix-iterator-filter-d…

    …ocs, r=tgross35
    
    Fix `Iterator::filter` docs
    
    Small fix to add code formatting around `Iterator::filter` `true` return type
    tgross35 committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    8385f3b View commit details
    Browse the repository at this point in the history