Repository: rust
Issue: Weird error message when pub crate is implemented on inner mod
Labels: A-diagnostics,T-compiler,C-bug,A-suggestion-diagnostics

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicate the bug.
-->
When an inner mod publicly re-exports function,enum or struct with the `pub(crate)` attribute a non-clear error is showed by cargo check and cargo build. 

consider a crate lib with the following tree:
```
tst/
    src/
     lib.rs
     tmod/
       mod.rs
Cargo.toml
```

where the lib.rs correctly declare the mod `tmod` as following:
```rust
// lib.rs
mod tmod;
```
and the mod.rs content is the following:
```rust
// mod.rs
pub use magic::magic;
pub use magic::Magic;
pub use magic::Emagic;

pub mod magic {
       pub(crate) fn magic() {}
       pub(crate) struct Magic;
       pub(crate) enum EMagic {}
}
```

I expected to see this happen:
I suppose that the correct behavior should be an error message showing me that the `(crate)` attribute is erroneously located on the inner mod and the `pub use` re-exporting lines of the mod.rs file have to be rewritten as `pub(crate) use ...`.
But I'm not sure about that, the [rust lang reference](https://doc.rust-lang.org/reference/visibility-and-privacy.html) doesn't cover this case, maybe even a successfully build should be fine.

Instead, this happened:
cargo check and cargo build both shows this unhelpful error:
```
error[E0364]: `magic` is private, and cannot be re-exported
 --> src/tmod/mod.rs:3:9
  |
3 | pub use magic::magic;
  |         ^^^^^^^^^^^^
  |
note: consider marking `magic` as `pub` in the imported module
 --> src/tmod/mod.rs:3:9
  |
3 | pub use magic::magic;
  |         ^^^^^^^^^^^^

error[E0364]: `Magic` is private, and cannot be re-exported
 --> src/tmod/mod.rs:4:9
  |
4 | pub use magic::Magic;
  |         ^^^^^^^^^^^^
  |
note: consider marking `Magic` as `pub` in the imported module
 --> src/tmod/mod.rs:4:9
  |
4 | pub use magic::Magic;
  |         ^^^^^^^^^^^^

error[E0365]: `EMagic` is private, and cannot be re-exported
 --> src/tmod/mod.rs:5:9
  |
5 | pub use magic::EMagic;
  |         ^^^^^^^^^^^^^ re-export of private `EMagic`
  |
  = note: consider declaring type or module `EMagic` with `pub`
```
note that changing the mod.rs file to publicly re-exports the inner mod items with (crate) attribute as follows:
```rust
pub(crate) use magic::magic;

pub mod magic {
       pub fn magic() {}
}
```
or even as follows:
```rust
pub(crate) use magic::magic;
pub mod magic {
       pub(crate) fn magic() {}
}
```
works fine and build the crate succefully.

### Meta
<!--
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.
-->
this happens on both stable and nigtly releases
`rustup show`
```
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/alex/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.41.0 (5e1a79984 2020-01-27)
```
`rustc --version --verbose`:
```
rustc 1.41.0 (5e1a79984 2020-01-27)
binary: rustc
commit-hash: 5e1a799842ba6ed4a57e91f7ab9435947482f7d8
commit-date: 2020-01-27
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0
```