Repository: rust
Issue: Module shadowing a crate is indistinguishable in diagnostics
Labels: A-diagnostics,A-resolve,T-compiler,D-papercut

Given the following code ([link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=54ced179014048a858e5c13c7dd7b0bd)):

```rust
mod std {
    pub mod cmp {
        pub fn max(
            x: impl ::std::fmt::Display,
            y: impl ::std::fmt::Display
        ) -> String
        {
            crate::maxwell(x, y)
        }
    }
}

fn main() {
    println!("Hello World");
    println!("{:?}", std::cmp::max(1, 2));
    println!("{:?}", std::cmp::min(1, 2));
    println!("{:?}", std::cmp::missing(1, 2));
}

pub fn maxwell(
    x: impl ::std::fmt::Display,
    y: impl ::std::fmt::Display,
    ) -> String
{
    format!("\
Bang! Bang! Maxwell's silver hammer\n\
Came down upon {}\n\
Clang! Clang! Maxwell's silver hammer\n\
Made sure that {}\n\
", x, y)
}
```

The current output is:

```
error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find function `min` in module `std::cmp`
  [--> src/main.rs:16:32
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)   |
16 |     println!("{:?}", std::cmp::min(1, 2));
   |                                ^^^ not found in `std::cmp`
   |
help: consider importing one of these items
   |
1  | [use core::cmp::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use itertools::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use nalgebra::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use pin_utils::core_reexport::cmp::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
     and 1 other candidate

error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find function `missing` in module `std::cmp`
  [--> src/main.rs:17:32
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)   |
17 |     println!("{:?}", std::cmp::missing(1, 2));
   |                                ^^^^^^^ not found in `std::cmp`

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

<!-- The following is not always necessary. -->
Ideally the output should look like:

```
error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find function `min` in module `std::cmp`
  [--> src/main.rs:16:32
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)   |
16 |     println!("{:?}", std::cmp::min(1, 2));
   |                                ^^^ not found in `std::cmp`
   |
help: the `mod std` locally defined on line 1 shadows the crate `std` that provides `std::cmp::min`.
help: to refer to the definition in crate `std`, you can rewrite this invocation as:
16 |     println!("{:?}", ::std::cmp::min(1, 2));  
   |
help: consider importing one of these items
   |
1  | [use core::cmp::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use itertools::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use nalgebra::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
1  | [use pin_utils::core_reexport::cmp::min;](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)
   |
     and 1 other candidate

error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find function `missing` in module `std::cmp`
  [--> src/main.rs:17:32
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)   |
17 |     println!("{:?}", std::cmp::missing(1, 2));
   |                                ^^^^^^^ not found in `std::cmp`

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

<!--
If the problem is not self-explanatory, please provide a rationale for the
change.
-->

<!--
If dramatically different output is caused by small changes, consider also
adding them here.

If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions. The output might also be
different depending on the Edition.
-->


<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":null}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->