Skip to content

Conversation

RalfJung
Copy link
Member

No description provided.

bors and others added 30 commits January 9, 2023 11:59
Always permit ConstProp to exploit arithmetic identities

Fixes rust-lang/rust#72751

Initially, I thought I would need to enable operand propagation then do something else, but actually rust-lang/rust#74491 already has the fix for the issue in question! It looks like this optimization was put under MIR opt level 3 due to possible soundness/stability implications, then demoted further to MIR opt level 4 when MIR opt level 2 became associated with `--release`.

Perhaps in the past we were doing CTFE on optimized MIR? We aren't anymore, so this optimization has no stability implications.

r? `@oli-obk`
…oc, r=cuviper

Add example for iterator_flatten

Adds an Example to iterator_flatten
Fixes #82687
Enable atomic cas for bpf targets

It seems like LLVM now supports it.

https://reviews.llvm.org/D72184 - the PR in LLVM
Fix bad import suggestion with nested `use` tree

Fixes #105566
Fixes #105373

Ideally, we'd find some way to turn these into structured suggestions -- perhaps on a separate line as a different `use` statement, but I have no idea how to access the span for the whole `use` from this point in the import resolution code.
update test for inductive canonical cycles

the previous test always resulted in a cycle 😅 cc rust-lang/chalk#787.

I checked with #102713 and this is the only test which fails with that PR.

r? ``@jackh726``
Rollup of 9 pull requests

Successful merges:

 - #105034 (Add example for iterator_flatten)
 - #105708 (Enable atomic cas for bpf targets)
 - #106175 (Fix bad import suggestion with nested `use` tree)
 - #106204 (No need to take opaques in `check_type_bounds`)
 - #106387 (Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`")
 - #106636 (Accept old spelling of Fuchsia target triples)
 - #106639 (update Miri)
 - #106640 (update test for inductive canonical cycles)
 - #106647 (rustdoc: merge common CSS for `a`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
…uggestions, r=oli-obk

Consider return type when giving various method suggestions

1. Fix a bug in method probe where we weren't normalizing `xform_ret_ty` for non-`impl` method candidates. This shouldn't affect happy-path code, since we only use `xform_ret_ty` when probing methods for diagnostics (I think).
2. Pass the return type expectation down to `lookup_probe`/`probe_for_name` usages in diagnostics. Added a few UI tests to gate against bad suggestions.
3. Make a `FnCtxt::lookup_probe_for_diagnostic` which properly passes down `IsSuggestion(true)`. Should help suppress other weird notes in some corner cases.
Fix stack overflow in recursive AST walk in early lint

The src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs test case added to verify rust-lang/rust#74564 still crashes with a stack overflow on s390x-ibm-linux.

Symptom is a very deep recursion in compiler/rustc_lint/src/early.rs:
    fn visit_expr(&mut self, e: &'a ast::Expr) {
        self.with_lint_attrs(e.id, &e.attrs, |cx| {
            lint_callback!(cx, check_expr, e);
            ast_visit::walk_expr(cx, e);
        })
    }
(where walk_expr recursively calls back into visit_expr).  The crash happens at a nesting depth of over 17000 stack frames when using the default 8 MB stack size on s390x.

This patch fixes the problem by adding a ensure_sufficient_stack call to the with_lint_attrs routine (which also should take care of all the other mutually recursive visitors here).

Fixes part of rust-lang/rust#105383.
doc: rewrite doc for signed int::{carrying_add,borrowing_sub}

Reword the documentation for bigint helper methods, signed `int::{carrying_add,borrowing_sub}` (#85532).

This change is a follow-up to #101889, which was for the unsigned methods.
…dtolnay

Stabilize `::{core,std}::pin::pin!`

As discussed [over here](rust-lang/rust#93178 (comment)), it looks like a decent time to stabilize the `pin!` macro.

### Public API

```rust
// in module `core::pin`

/// API: `fn pin<T>($value: T) -> Pin<&'local mut T>`
pub macro pin($value:expr $(,)?) {
    …
}
```

  - Tracking issue: #93178

(now all this needs is an FCP by the proper team?)
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
…petrochenkov

Stabilize f16c_target_feature

Resolves rust-lang/stdarch#1234

Library PR for stabilizing corresponding intrinsics: rust-lang/stdarch#1366

See also #44839 tracking issue for target_feature
…er-errors

Tweak E0277 `&`-removal suggestions

Fix #64068, fix #84837.
Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch

Fixes #106516
Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`

This removes the need for <>><><><<>> dances and makes the code a bit nicer.

Not sure if `astconv` is the best name though, maybe someone has a better idea?
…rors

Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Harden the pre-tyctxt query system against accidental recomputation

While the current compiler has no issues where we `take` and then compute the query again, in rust-lang/rust#105462 I accidentally introduced such a case.

I also took the opportunity to remove `peek_mut`, which is only ever used for `global_tcx` to then invoke `enter`. I added an `enter` method directly on the query.
Support eager subdiagnostics again

See rust-lang/rust#104941 (comment)

I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
…vars, r=oli-obk

Handle inference variables in `CollectAllMismatches` correctly

1. Fix #106240
2. Treat int/float type variables correctly (see `src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs`), so we can point out things like "`Iterator::Item` changed to `{integer}` here"
Suggest making private tuple struct field public

Fix #52144.
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
Fix rendering 'const' in header for intrinsics

Fixes #99398
…oli-obk

Add `WaffleLapkin` to compiler reviewers

r? ``@wesleywiser``
Rollup of 6 pull requests

Successful merges:

 - #105806 (Support eager subdiagnostics again)
 - #106322 (Handle inference variables in `CollectAllMismatches` correctly)
 - #106579 (Suggest making private tuple struct field public)
 - #106714 (remove unreachable error code `E0490`)
 - #106751 (Fix rendering 'const' in header for intrinsics)
 - #106761 (Add `WaffleLapkin` to compiler reviewers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
…davidtwco

Migrate `rustc_lint` lint diagnostics

Part 2 of [Migrate `rustc_lint` errors to `SessionDiagnostic`](rust-lang/rust#100776)

r? `@davidtwco`

# TODO
- [x] Refactor some lints manually implementing `DecorateLint` to use `Option<Subdiagnostic>`.
- [x] Add `#[rustc_lint_diagnostics]` to lint functions in `context.rs`.
- [x] Migrate `hidden_unicode_codepoints.rs`.
- [x] Migrate `UnsafeCode` in `builtin.rs`.
- [x] Migrate the rest of `builtin.rs`.
@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Jan 13, 2023

📌 Commit b1ce7ad has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 13, 2023

⌛ Testing commit b1ce7ad with merge d781d30...

bors added a commit that referenced this pull request Jan 13, 2023
@bors
Copy link
Contributor

bors commented Jan 13, 2023

💔 Test failed - checks-actions

@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Jan 13, 2023

📌 Commit 5a267f8 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 13, 2023

⌛ Testing commit 5a267f8 with merge 73452b3...

@bors
Copy link
Contributor

bors commented Jan 13, 2023

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 73452b3 to master...

@bors bors merged commit 73452b3 into rust-lang:master Jan 13, 2023
@RalfJung RalfJung deleted the rustup branch January 13, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants