Skip to content

Rollup of 8 pull requests #93409

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 27 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

fee1-dead and others added 27 commits December 29, 2021 15:10
Just happened to notice this in passing
… r=oli-obk

More informative error message for E0015

Helps with rust-lang#92380
…=camelid

Suggest tuple-parentheses for enum variants

This follows on from rust-lang#86493 / rust-lang#86481, making the parentheses suggestion. To summarise, given the following code:

```rust
fn f() -> Option<(i32, i8)> {
    Some(1, 2)
}
```

The current output is:

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |     |
  |     expected 1 argument

error: aborting due to previous error

For more information about this error, try `rustc --explain E0061`.
```

With this change, `rustc` will now suggest parentheses when:
- The callee is expecting a single tuple argument
- The number of arguments passed matches the element count in the above tuple
- The arguments' types match the tuple's fields

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |
help: use parentheses to construct a tuple
  |
2 |     Some((1, 2))
  |          +    +
```
…mpl, r=joshtriplett

Unimpl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}<$t> for Saturating<$t>

Tracking issue rust-lang#92354

Analog to 9648b31 rust-lang#93208 reduce `saturating_int_assign_impl` (rust-lang#93208) to:

```rust
let mut value = Saturating(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
```

See rust-lang#93208 (comment)
…1-dead

Add note suggesting that predicate may be satisfied, but is not `const`

Not sure if we should be printing this in addition to, or perhaps _instead_ of the help message:
```
help: the trait `~const Add` is not implemented for `NonConstAdd`
```

Also added `ParamEnv::is_const` and `PolyTraitPredicate::is_const_if_const` and, in a separate commit, used those in other places instead of `== hir::Constness::Const`, etc.

r? `@fee1-dead`
…oli-obk

Do not register infer var for GAT projection in RPIT

Fixes rust-lang#93340

r? `@oli-obk`
…, r=Mark-Simulacrum

rustbuild: Fix compiletest warning when building outside of root.

This fixes a warning that would happen when passing arguments to compiletest (like `x.py test src/test/ui`) when running `x.py` outside of the root source directory. For example, the CI builders do this, which causes a confusing warning message. This also fixes it so that passing a full path works (like `x.py test src/test/ui/hello.rs`) in the same scenario (previously it would just ignore the `hello.rs` part).
…ywiser

Fix a typo from rust-lang#92899

Just happened to notice this in passing
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jan 28, 2022
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Collaborator

bors commented Jan 28, 2022

📌 Commit a7d5966 has been approved by matthiaskrgr

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 28, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_const_eval v0.0.0 (/checkout/compiler/rustc_const_eval)
    Checking rustc_ty_utils v0.0.0 (/checkout/compiler/rustc_ty_utils)
    Checking rustc_traits v0.0.0 (/checkout/compiler/rustc_traits)
    Checking rustc_mir_build v0.0.0 (/checkout/compiler/rustc_mir_build)
error[E0423]: expected function, tuple struct or tuple variant, found struct `ops::FnCallNonConst`
   --> compiler/rustc_const_eval/src/transform/check_consts/check.rs:834:47
    |
834 |   ...                   self.check_op(ops::FnCallNonConst(None));
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `ops::FnCallNonConst { caller: val, callee: val, substs: val, span: val, from_hir_call: val }`
   ::: compiler/rustc_const_eval/src/transform/check_consts/ops.rs:85:1
    |
    |
85  | / pub struct FnCallNonConst<'tcx> {
86  | |     pub caller: DefId,
87  | |     pub callee: DefId,
88  | |     pub substs: SubstsRef<'tcx>,
89  | |     pub span: Span,
90  | |     pub from_hir_call: bool,
91  | | }
    | |_- `ops::FnCallNonConst` defined here
For more information about this error, try `rustc --explain E0423`.
error: could not compile `rustc_const_eval` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

@matthiaskrgr matthiaskrgr deleted the rollup-2d07evi branch February 13, 2022 00:53
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.