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 #133152

Merged
merged 15 commits into from
Nov 18, 2024
Merged

Rollup of 7 pull requests #133152

merged 15 commits into from
Nov 18, 2024

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Nov 18, 2024

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

linyihai and others added 15 commits November 12, 2024 18:23
Fixes issue 133118.
This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more
useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut`
arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would
make it suggest a shared borrow for that argument.
Check `use<..>` in RPITIT for refinement

`#![feature(precise_capturing_in_traits)]` allows users to write `+ use<>` bounds on RPITITs to control what lifetimes are captured by the RPITIT.

Since RPITITs currently also warn for refinement in implementations, this PR extends that refinement check for cases where we *undercapture* in an implementation, since that may be indirectly "promising" a more relaxed outlives bound than the impl author intended.

For an opaque to be refining, we need to capture *fewer* parameters than those mentioned in the captured params of the trait. For example:

```
trait TypeParam<T> {
    fn test() -> impl Sized;
}
// Indirectly capturing a lifetime param through a type param substitution.
impl<'a> TypeParam<&'a ()> for i32 {
    fn test() -> impl Sized + use<> {}
    //~^ WARN impl trait in impl method captures fewer lifetimes than in trait
}
```

Since the opaque in the method (implicitly) captures `use<Self, T>`, and `Self = i32, T = &'a ()` in the impl, we must mention `'a` in our `use<..>` on the impl.

Tracking:
* rust-lang#130044
…-132924, r=chenyukang

add parentheses when unboxing suggestion needed

This PR tried to `add parentheses when unboxing suggestion needed`

Fixes rust-lang#132924
…ukang

Make rustc consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1`

Addresses rust-lang#123404 to allow test writers to specify `//@ rustc-env:RUSTC_BOOTSTRAP=-1` to have a given rustc consider itself a stable rustc. This is only intended for testing usages.

I did not use `RUSTC_BOOTSTRAP=0` because that can be confusing, i.e. one might think that means "not bootstrapping", but "forcing a given rustc to consider itself a stable compiler" is a different use case.

I also added a specific test to check `RUSTC_BOOTSTRAP`'s various values and how that interacts with rustc's stability story w.r.t. features and cli flags.

Noticed when trying to write a test for enabling ICE file dumping on stable.

Dunno if this needs a compiler FCP or MCP, but I can file an MCP or ask someone to start an FCP if needed. Note that `RUSTC_BOOTSTRAP` is a perma-unstable env var and has no stability guarantees (heh) whatsoever. This does not affect bootstrapping because bootstrap never sets `RUSTC_BOOTSTRAP=-1`. If someone does set that when bootstrapping, it is considered PEBKAC.

Accompanying dev-guide PR: rust-lang/rustc-dev-guide#2136

cc `@estebank` and `@rust-lang/wg-diagnostics` for FYI
`suggest_borrow_generic_arg`: instantiate clauses properly

This simplifies and fixes the way `suggest_borrow_generic_arg` instantiates callees' predicates when testing them to see if a moved argument can instead be borrowed. Previously, it would ICE if the moved argument's type included a region variable, since it was getting passed to a call of `EarlyBinder::instantiate`. This makes the instantiation much more straightforward, which also fixes the ICE.

Fixes rust-lang#133118

This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut` arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would make it suggest a shared borrow for that argument.
… r=GuillaumeGomez

rustdoc-search: add standalone trailing `::` test

Follow up for rust-lang#132569

r? `@GuillaumeGomez`
…er-errors

Diagnostics for let mut in item context

The diagnostics for `let` at the top level did not account for `let mut`, which [made the error unclear](https://users.rust-lang.org/t/create-a-vector-of-constants-outside-main/121251/1).

I've made the diagnostic always display a link to valid items. I've added dedicated help for `let mut` case that suggests using a `Mutex` (to steer novice users away from the `static mut` trap). Unfortunately, neither the Rust book, nor libstd docs have dedicated section listing all other types for interior-mutable `static`s.
Fixup some test directives

- A random comment had somehow been turned into an `//`@`` directive.
- More dubiously I also removed leading spaces from directives in 3 UI tests for consistency. These are the only rustc tests that use that formatting.

r? `@jieyouxu`
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Nov 18, 2024
@jhpratt
Copy link
Member Author

jhpratt commented Nov 18, 2024

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Nov 18, 2024

📌 Commit f6374b4 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2024
@bors
Copy link
Contributor

bors commented Nov 18, 2024

⌛ Testing commit f6374b4 with merge bf6adec...

@bors
Copy link
Contributor

bors commented Nov 18, 2024

☀️ Test successful - checks-actions
Approved by: jhpratt
Pushing bf6adec to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 18, 2024
@bors bors merged commit bf6adec into rust-lang:master Nov 18, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 18, 2024
@jhpratt jhpratt deleted the rollup-wkqs5ud branch November 18, 2024 07:24
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#132795 Check use<..> in RPITIT for refinement 0f3042be128c5c9a87a43b85435a8a2ac39a7cbc (link)
#132944 add parentheses when unboxing suggestion needed 4d354d46052638c871800f410d0eaf5baa822809 (link)
#132993 Make rustc consider itself a stable compiler when `RUSTC_BO… d8f0381a7f32601c8559eb98b1574f9f6ee6c8b2 (link)
#133130 suggest_borrow_generic_arg: instantiate clauses properly 41be736fa90dcadf90d12d4441c48eadec0b6288 (link)
#133133 rustdoc-search: add standalone trailing :: test 6aa053a0abb11511c91b03d0909f7946015306d2 (link)
#133143 Diagnostics for let mut in item context 4b43b5a7128ba0fb137603cfbff52fac9a2ac24b (link)
#133147 Fixup some test directives 292111356b02cec6aa802c37b8ff5863c9432bdb (link)

previous master: 3fb7e441ae

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bf6adec): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary 1.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [1.3%, 6.1%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-4.6%, -4.6%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 788.58s -> 791.022s (0.31%)
Artifact size: 335.03 MiB -> 335.04 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.