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

Merged
merged 27 commits into from
Dec 12, 2023
Merged

Rollup of 9 pull requests #118881

merged 27 commits into from
Dec 12, 2023

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

ehuss and others added 27 commits November 14, 2023 19:36
There has been some confusion about how to choose these variants, or
what the procedure is for handling future-incompatible errors. Hopefully
this helps provide some more information on how these work.
When we encounter a function with a return type that has an anonymous
lifetime with no argument to borrow from, besides suggesting the
`'static` lifetime we now also suggest changing the arguments to be
borrows or changing the return type to be an owned type.

```
error[E0106]: missing lifetime specifier
  --> $DIR/variadic-ffi-6.rs:7:6
   |
LL | ) -> &usize {
   |      ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
LL | ) -> &'static usize {
   |       +++++++
help: instead, you are more likely to want to change one of the arguments to be borrowed...
   |
LL |     x: &usize,
   |        +
help: ...or alternatively, to want to return an owned value
   |
LL - ) -> &usize {
LL + ) -> usize {
   |
```

Fix rust-lang#85843.
When encountering
```rust
fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { /* */ }
```
Suggest
```rust
fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { /* */ }
```
Attribute values must be literals. The error you get when that doesn't
hold is pretty bad, e.g.:
```
unexpected expression: 1 + 1
```
You also get the same error if the attribute value is a literal, but an
invalid literal, e.g.:
```
unexpected expression: "foo"suffix
```

This commit does two things.
- Changes the error message to "attribute value must be a literal",
  which gives a better idea of what the problem is and how to fix it. It
  also no longer prints the invalid expression, because the carets below
  highlight it anyway.
- Separates the "not a literal" case from the "invalid literal" case.
  Which means invalid literals now get the specific error at the literal
  level, rather than at the attribute level.
The `c === "="` was redundant when `isSeparatorCharacter` already
checks that.

The function `isStopCharacter` and `isEndCharacter` functions
did exactly the same thing and have synonymous names.
There doesn't seem much point in having both.
Stop allowing `rustc::potential_query_instability` on all of
`rustc_codegen_llvm` and instead allow it on a case-by-case basis. In
this case, both instances are safe to allow.
CGU tests require CGU code to be exercised. We can't merely do "cargo
check" on these tests.
…or_non_unevaluated_const, r=BoxyUwU

dont ICE when ConstKind::Expr for is_const_evaluatable

The problem is that we are not handling ConstKind::Expr inside report_not_const_evaluatable_error

Fixes [rust-lang#114151]
On borrow return type, suggest borrowing from arg or owned return type

When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type.

```
error[E0106]: missing lifetime specifier
  --> $DIR/variadic-ffi-6.rs:7:6
   |
LL | ) -> &usize {
   |      ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
LL | ) -> &'static usize {
   |       +++++++
help: instead, you are more likely to want to change one of the arguments to be borrowed...
   |
LL |     x: &usize,
   |        +
help: ...or alternatively, to want to return an owned value
   |
LL - ) -> &usize {
LL + ) -> usize {
   |
```

Fix rust-lang#85843.
…eywiser

Clarify how to choose a FutureIncompatibilityReason variant.

There has been some confusion about how to choose these variants, or what the procedure is for handling future-incompatible errors. Hopefully this helps provide some more information on how these work.
…e-error, r=compiler-errors,petrochenkov

Improve an error involving attribute values.

Attribute values must be literals. The error you get when that doesn't hold is pretty bad, e.g.:
```
unexpected expression: 1 + 1
```
You also get the same error if the attribute value is a literal, but an invalid literal, e.g.:
```
unexpected expression: "foo"suffix
```

This commit does two things.
- Changes the error message to "attribute value must be a literal", which gives a better idea of what the problem is and how to fix it. It also no longer prints the invalid expression, because the carets below highlight it anyway.
- Separates the "not a literal" case from the "invalid literal" case. Which means invalid literals now get the specific error at the literal level, rather than at the attribute level.

r? `@compiler-errors`
…uillaumeGomez

rustdoc-search: clean up parser

The `c === "="` was redundant when `isSeparatorCharacter` already checks that.

The function `isStopCharacter` and `isEndCharacter` functions did exactly the same thing and have synonymous names. There doesn't seem much point in having both.
…x, r=petrochenkov

rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint

Stop allowing `rustc::potential_query_instability` on all of `rustc_codegen_llvm` and instead allow it on a case-by-case basis if it is safe to do so. In this case, all 2 instances are safe to allow.

Part of rust-lang#84447 which is E-help-wanted.
llvm-wrapper: adapt for LLVM API change

LLVM commit llvm/llvm-project@f09cf34 (old) moved some functions to a different header. It looks we were getting it transitively in PassWrapper, and something in LLVM recently removed it from the set of transitively available headers, so include it directly:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24416#018c5de6-b9c9-4b22-9473-6070d99dcfa7/233-537

r? `@nikic`
…terns-parsing, r=petrochenkov

Correctly gate the parsing of match arms without body

rust-lang#118527 accidentally allowed the following to parse on stable:
```rust
match Some(0) {
    None => { foo(); }
    #[cfg(FALSE)]
    Some(_)
}
```

This fixes that oversight. The way I choose which error to emit is the best I could think of, I'm open if you know a better way.

r? `@petrochenkov` since you're the one who noticed
tests: CGU tests require build-pass, not check-pass (remove FIXME)

CGU tests require CGU code to be exercised. We can't merely do "cargo check" on these tests.

Part of rust-lang#62277
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 12, 2023
@rustbot rustbot added 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 Dec 12, 2023
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=9

@bors
Copy link
Contributor

bors commented Dec 12, 2023

📌 Commit 010f301 has been approved by matthiaskrgr

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 Dec 12, 2023
@bors
Copy link
Contributor

bors commented Dec 12, 2023

⌛ Testing commit 010f301 with merge 028b6d1...

@bors
Copy link
Contributor

bors commented Dec 12, 2023

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 028b6d1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 12, 2023
@bors bors merged commit 028b6d1 into rust-lang:master Dec 12, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 12, 2023
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#116740 dont ICE when ConstKind::Expr for is_const_evaluatable 03369d7ee010d863d1f63044974e2e23c8793d26 (link)
#117914 On borrow return type, suggest borrowing from arg or owned … f9c6bbf85f420269fe6cd54393212ebbcffabe7c (link)
#117927 Clarify how to choose a FutureIncompatibilityReason variant. a110f234f5a7f996ede2b0e058591b60eee178e4 (link)
#118855 Improve an error involving attribute values. c6f37678afd0fefd53e001461d42c3dca57165c5 (link)
#118856 rustdoc-search: clean up parser 1cddbbc2ceb2806b22291d3f1de0062faea4e490 (link)
#118865 rustc_codegen_llvm: Enforce `rustc::potential_query_instabi… 8ce5b3bd9c425033d6d7ec0963e443aa5005b46e (link)
#118866 llvm-wrapper: adapt for LLVM API change 08c2861e338bb4c01bd50757ebe432a200865452 (link)
#118868 Correctly gate the parsing of match arms without body 3485b66ce1c0caeae6e0b366cb74907e5ce609fa (link)
#118877 tests: CGU tests require build-pass, not check-pass (remove… 996b15aab8be62e663ba8fcd5d936f38ee4c97c4 (link)

previous master: 835ed0021e

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 (028b6d1): 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)

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

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: 672.534s -> 673.638s (0.16%)
Artifact size: 312.27 MiB -> 312.34 MiB (0.02%)

@matthiaskrgr matthiaskrgr deleted the rollup-0rl3tir branch March 16, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.