Skip to content

Conversation

@matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Jan 3, 2026

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

estebank and others added 9 commits December 31, 2025 23:40
… a different crate version than expected

```
error[E0277]: `?` couldn't convert the error to `dependency::Error`
  --> replaced
   |
LL | fn main() -> Result<(), Error> {
   |              ----------------- expected `dependency::Error` because of this
...
LL |     Err(Error2)?;
   |     -----------^ the trait `From<Error2>` is not implemented for `dependency::Error`
   |     |
   |     this can't be annotated with `?` because it has type `Result<_, Error2>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
help: the trait `From<Error2>` is not implemented for `dependency::Error`
      but trait `From<()>` is implemented for it
  --> replaced
   |
LL | impl From<()> for Error {
   | ^^^^^^^^^^^^^^^^^^^^^^^
   = help: for that trait implementation, expected `()`, found `Error2`
   = note: there are multiple different versions of crate `dependency` in the dependency graph
   = help: you can use `cargo tree` to explore your dependency tree
```

The existing checks rely on having access to the actual types/traits that diverged to detect they are called the same, come from different crates with the same name. The new check is less specific, merely looking to see if the crate name the involved type belongs has multiple crates.
The `forbid_generic` field in `Res::SelfTyAlias` is no longer needed.
The check for generic `Self` types in anonymous constants is now handled
by `check_param_uses_if_mcg` in HIR type lowering, making this field
redundant.

This removes:
- The `forbid_generic` field from `Res::SelfTyAlias`
- The hack in `rustc_resolve` that set `forbid_generic: true` when
encountering `Self` in constant items
- Related pattern matching and field propagation code
…jieyouxu

Detect cases where `?` is applied on a type that could be coming from a different crate version than expected

```
error[E0277]: `?` couldn't convert the error to `dependency::Error`
  --> replaced
   |
LL | fn main() -> Result<(), Error> {
   |              ----------------- expected `dependency::Error` because of this
...
LL |     Err(Error2)?;
   |     -----------^ the trait `From<Error2>` is not implemented for `dependency::Error`
   |     |
   |     this can't be annotated with `?` because it has type `Result<_, Error2>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
help: the trait `From<Error2>` is not implemented for `dependency::Error`
      but trait `From<()>` is implemented for it
  --> replaced
   |
LL | impl From<()> for Error {
   | ^^^^^^^^^^^^^^^^^^^^^^^
   = help: for that trait implementation, expected `()`, found `Error2`
   = note: there are multiple different versions of crate `dependency` in the dependency graph
   = help: you can use `cargo tree` to explore your dependency tree
```

The existing checks rely on having access to the actual types/traits that diverged to detect they are called the same, come from different crates with the same name. The new check is less specific, merely looking to see if the crate name the involved type belongs has multiple crates.

CC rust-lang#78552.
Removed confusing diagnostics note for trait required for `?` operator use

- **test: modified `bad-question-mark-on-trait-objects` to match expected behavior**
- **removed confusing message from diagnostics**

fixes [rust-lang#150527](rust-lang#150527)
…neric-field, r=camelid,BoxyUwU

Remove unneeded `forbid_generic` field from `Res::SelfTyAlias`

Following rust-lang#150519, the `forbid_generic` field in `Res::SelfTyAlias` is no longer needed and can be removed.

- Remove the `forbid_generic: bool` field from `Res::SelfTyAlias`
- Simplify the ConstantItem rib handling in `rustc_resolve` - no longer need to mutate res to set `forbid_generic: true`
- Update all pattern matches and constructors of `SelfTyAlias`

Closes rust-lang#150579

r? `@camelid`
…n, r=jieyouxu

triagebot: Add a mention for `dec2flt`, `flt2dec`, and `fmt/num.rs`
@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-run-make Area: port run-make Makefiles to rmake.rs 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. rollup A PR which is a rollup labels Jan 3, 2026
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jan 3, 2026

📌 Commit f45b9c9 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 Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-run-make Area: port run-make Makefiles to rmake.rs 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.

7 participants