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 20 pull requests #138079

Closed

Conversation

compiler-errors
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

arlosi and others added 30 commits February 20, 2025 11:47
Instead, we adopt the position that introducing an `unsafe` field
itself carries a safety invariant: that if you assign an invariant
to that field weaker than what the field's destructor requires,
you must ensure that field is in a droppable state in your
destructor.

See:
- rust-lang/rfcs#3458 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/unsafe.20fields.20RFC/near/502113897
…s doc(hidden)

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.

```
error[E0575]: expected associated type, found associated function `Trait::method`
  --> $DIR/bad-inputs-and-output.rs:31:36
   |
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
   |
help: you might have meant to use the return type notation syntax
   |
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
   |
```
At first glance, the extra casework seems pointless and needlessly
error-prone. Clarify that there is a reason for it being there.
This is error-prone. Explicitly write down which cases don't need
anything substituted. Turn the `OpaqueType` case, which currently
seems to be unreachable, into a `bug!`.
…gillot

Remove `MaybeForgetReturn` suggestion

rust-lang#115196 implemented a suggestion to add a missing `return` when there is an ambiguity error, when that ambiguity error could be constrained by the return type of the function.

I initially reviewed it and thought it could be useful; however, looking back at that code now, I feel like it's a bit too much of a hack to be worth keeping around in typeck, especially given how rare it's expected to fire in practice. This is especially true because it depends on `StashKey::MaybeForgetReturn`, which is only stashed when we have *Sized* obligation ambiguity errors. Let's remove it for now.

I'd like to note that it's basically impossible to get this suggestion to apply in its current state except for what I'd consider somewhat artificial examples, involving no generic trait bounds. For example, it's not triggered for:

```rust
struct W<T>(T);

fn bar<T: Default>() -> W<T> { todo!() }

fn foo() -> W<i32> {
    if true {
        bar();
    }
    W(0)
}
```

Nor is it triggered for:

```
fn foo() -> i32 {
    if true {
        Default::default();
    }
    0
}
```

It's basically only triggered iff there's only one ambiguity error on the type, which is `Sized`.

Generally, suggesting something that affects control flow is a pretty dramatic suggestion; therefore, both the accuracy and precision of this diagnostic should be pretty high.

One other, somewhat unrelated observation is that this might be using stashed diagnostics incorrectly (or at least unnecessarily). Stashed diagnostics are used when error detection is fragmented over several major stages of the compiler, like a parse or resolver error which later can be recovered in typeck. However, this one is a bit different since it is fully handled within typeck -- perhaps that suggests that if this were to be reimplemented, it wouldn't need to be so complicated of an implementation.
Undeprecate env::home_dir

rust-lang#132515 fixed the implementation of `env::home_dir`, but didn't remove the deprecation.

Based on [this comment](rust-lang#132515 (comment)), libs-api decided to undeprecate in the next release. Let's do that!

cc rust-lang#132650
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Mar 6, 2025
…compiler-errors

Rollup of 20 pull requests

Successful merges:

 - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion)
 - rust-lang#137327 (Undeprecate env::home_dir)
 - rust-lang#137358 (Match Ergonomics 2024: add context and examples to the unstable book)
 - rust-lang#137502 (Don't include global asm in `mir_keys`, fix error body synthesis)
 - rust-lang#137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden))
 - rust-lang#137565 (Try to point of macro expansion from resolver and method errors if it involves macro var)
 - rust-lang#137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck)
 - rust-lang#137643 (Add DWARF test case for non-C-like `repr128` enums)
 - rust-lang#137744 (Re-add `Clone`-derive on `Thir`)
 - rust-lang#137758 (fix usage of ty decl macro fragments in attributes)
 - rust-lang#137764 (Ensure that negative auto impls are always applicable)
 - rust-lang#137772 (Fix char count in `Display` for `ByteStr`)
 - rust-lang#137798 (ci: use ubuntu 24 on arm large runner)
 - rust-lang#137802 (miri native-call support: all previously exposed provenance is accessible to the callee)
 - rust-lang#137805 (adjust Layout debug printing to match the internal field name)
 - rust-lang#137808 (Do not require that unsafe fields lack drop glue)
 - rust-lang#137820 (Clarify why InhabitedPredicate::instantiate_opt exists)
 - rust-lang#137825 (Provide more context on resolve error caused from incorrect RTN)
 - rust-lang#137868 (Add minimal platform support documentation for powerpc-unknown-linux-gnuspe)
 - rust-lang#137910 (Improve error message for `AsyncFn` trait failure for RPIT)

r? `@ghost`
`@rustbot` modify labels: rollup
@tgross35
Copy link
Contributor

tgross35 commented Mar 6, 2025

@bors
Copy link
Contributor

bors commented Mar 6, 2025

⌛ Testing commit 5601e60 with merge e1e166f...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 6, 2025
…mpiler-errors

Rollup of 20 pull requests

Successful merges:

 - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion)
 - rust-lang#137327 (Undeprecate env::home_dir)
 - rust-lang#137358 (Match Ergonomics 2024: add context and examples to the unstable book)
 - rust-lang#137502 (Don't include global asm in `mir_keys`, fix error body synthesis)
 - rust-lang#137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden))
 - rust-lang#137565 (Try to point of macro expansion from resolver and method errors if it involves macro var)
 - rust-lang#137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck)
 - rust-lang#137643 (Add DWARF test case for non-C-like `repr128` enums)
 - rust-lang#137744 (Re-add `Clone`-derive on `Thir`)
 - rust-lang#137758 (fix usage of ty decl macro fragments in attributes)
 - rust-lang#137764 (Ensure that negative auto impls are always applicable)
 - rust-lang#137772 (Fix char count in `Display` for `ByteStr`)
 - rust-lang#137798 (ci: use ubuntu 24 on arm large runner)
 - rust-lang#137802 (miri native-call support: all previously exposed provenance is accessible to the callee)
 - rust-lang#137805 (adjust Layout debug printing to match the internal field name)
 - rust-lang#137808 (Do not require that unsafe fields lack drop glue)
 - rust-lang#137820 (Clarify why InhabitedPredicate::instantiate_opt exists)
 - rust-lang#137825 (Provide more context on resolve error caused from incorrect RTN)
 - rust-lang#137868 (Add minimal platform support documentation for powerpc-unknown-linux-gnuspe)
 - rust-lang#137910 (Improve error message for `AsyncFn` trait failure for RPIT)

r? `@ghost`
`@rustbot` modify labels: rollup
@tgross35
Copy link
Contributor

tgross35 commented Mar 6, 2025

Looks like no luck yet

@bors r- retry

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 6, 2025
@tgross35
Copy link
Contributor

tgross35 commented Mar 6, 2025

@bors r=compiler-errors p=9

@bors
Copy link
Contributor

bors commented Mar 6, 2025

📌 Commit 5601e60 has been approved by compiler-errors

It is now in the queue for this repository.

@klensy
Copy link
Contributor

klensy commented Mar 6, 2025

#137327 r+ unticked?

@tgross35
Copy link
Contributor

tgross35 commented Mar 6, 2025

#137327 r+ unticked?

Looks like Mark just raced with bors when adding the labels, updated

@Kobzol
Copy link
Contributor

Kobzol commented Mar 6, 2025

@bors treeclosed-

@bors
Copy link
Contributor

bors commented Mar 6, 2025

⌛ Testing commit 5601e60 with merge 60c2a48...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 6, 2025
…mpiler-errors

Rollup of 20 pull requests

Successful merges:

 - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion)
 - rust-lang#137327 (Undeprecate env::home_dir)
 - rust-lang#137358 (Match Ergonomics 2024: add context and examples to the unstable book)
 - rust-lang#137502 (Don't include global asm in `mir_keys`, fix error body synthesis)
 - rust-lang#137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden))
 - rust-lang#137565 (Try to point of macro expansion from resolver and method errors if it involves macro var)
 - rust-lang#137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck)
 - rust-lang#137643 (Add DWARF test case for non-C-like `repr128` enums)
 - rust-lang#137744 (Re-add `Clone`-derive on `Thir`)
 - rust-lang#137758 (fix usage of ty decl macro fragments in attributes)
 - rust-lang#137764 (Ensure that negative auto impls are always applicable)
 - rust-lang#137772 (Fix char count in `Display` for `ByteStr`)
 - rust-lang#137798 (ci: use ubuntu 24 on arm large runner)
 - rust-lang#137802 (miri native-call support: all previously exposed provenance is accessible to the callee)
 - rust-lang#137805 (adjust Layout debug printing to match the internal field name)
 - rust-lang#137808 (Do not require that unsafe fields lack drop glue)
 - rust-lang#137820 (Clarify why InhabitedPredicate::instantiate_opt exists)
 - rust-lang#137825 (Provide more context on resolve error caused from incorrect RTN)
 - rust-lang#137868 (Add minimal platform support documentation for powerpc-unknown-linux-gnuspe)
 - rust-lang#137910 (Improve error message for `AsyncFn` trait failure for RPIT)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-apple-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/abi/stack-probes-lto.rs#x64 ... ok
test [ui] tests/ui/asm/fail-const-eval-issue-121099.rs ... ok
test [ui] tests/ui/asm/generic_const_simd_vec_len.rs ... ok
test [ui] tests/ui/asm/empty_global_asm.rs ... ok
test [ui] tests/ui/asm/global-asm-isnt-really-a-mir-body.rs#instrument ... ignored, only executed when the operating system is linux
test [ui] tests/ui/asm/global-asm-isnt-really-a-mir-body.rs#emit_mir ... ok
test [ui] tests/ui/asm/generic-const.rs ... ok
test [ui] tests/ui/asm/ice-bad-err-span-in-template-129503.rs ... ok
test [ui] tests/ui/asm/inline-asm-with-lifetimes.rs#bad ... ok
test [ui] tests/ui/asm/global-asm-with-lifetimes.rs ... ok
---
failures:

---- [ui] tests/ui/asm/global-asm-isnt-really-a-mir-body.rs#cfi stdout ----

error in revision `cfi`: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/work/rust/rust/vendor" "--sysroot" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2" "--target=x86_64-apple-darwin" "--cfg" "cfi" "--check-cfg" "cfg(test,FALSE,emit_mir,instrument,cfi)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--out-dir" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/asm/global-asm-isnt-really-a-mir-body.cfi" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/Users/runner/work/rust/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "-Zsanitizer=cfi" "-Ccodegen-units=1" "-Clto" "-Ctarget-feature=-crt-static" "-Clink-dead-code=true"
--- stderr -------------------------------
error: unsupported symbol modifier in branch relocation
   |
note: instantiated into assembly here
note: instantiated into assembly here
  --> <inline asm>:1:2
   |
LL |     jmp __ZN33global_asm_isnt_really_a_mir_body3foo17h707f9499955d7fe1E.cfi@plt

error: unsupported symbol modifier in branch relocation
   |
note: instantiated into assembly here
note: instantiated into assembly here
  --> <inline asm>:5:1
   |
LL | jmp __ZN33global_asm_isnt_really_a_mir_body4main17hb4202cc6ae625cbdE.cfi@plt

error: aborting due to 2 previous errors
------------------------------------------

@bors
Copy link
Contributor

bors commented Mar 6, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc rollup A PR which is a rollup 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-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.