rust/tests/run-make/crate-loading
Esteban Küber 22bb4fe147 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.
2025-12-31 23:40:16 +00:00
..
dep-2-reexport.rs Detect cases where ? is applied on a type that could be coming from a different crate version than expected 2025-12-31 23:40:16 +00:00
dependency-1.rs Detect cases where ? is applied on a type that could be coming from a different crate version than expected 2025-12-31 23:40:16 +00:00
dependency-2.rs Detect cases where ? is applied on a type that could be coming from a different crate version than expected 2025-12-31 23:40:16 +00:00
multiple-dep-versions.rs Detect cases where ? is applied on a type that could be coming from a different crate version than expected 2025-12-31 23:40:16 +00:00
multiple-dep-versions.stderr Detect cases where ? is applied on a type that could be coming from a different crate version than expected 2025-12-31 23:40:16 +00:00
rmake.rs tests/run-make/crate-loading: Rename source files for clarity 2025-09-22 18:18:36 +02:00