Repository: rust
Issue: internal compiler error when inferring `_` type for Associated Type bound
Labels: I-ICE,A-associated-items,P-high,T-compiler,regression-from-stable-to-stable,C-bug,glacier,S-bug-has-test,T-types,A-trait-objects

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->
Rust compiler error for simple code like this:

### Code

[playaround](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1059ed9242a9b0abf87e052667a17085)
```Rust
trait Database: Restriction<Inner = u32> {}

trait Restriction {
    type Inner;
}

struct Test {}

impl Database for Test {}
impl Restriction for Test {
    type Inner = u32;
}

fn main() {
    let t = Test {};
    let x: &dyn Database<Inner = _> = &t;
}
```


### 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.
-->

`rustc --version --verbose`:
```
rustc 1.48.0 (7eac88abb 2020-11-16)
binary: rustc
commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4
commit-date: 2020-11-16
host: x86_64-apple-darwin
release: 1.48.0
LLVM version: 11.0
```

### Error output

```
   Compiling aaaa v0.1.0 (/Users/dudu/tmp/aaaa)
warning: trait objects without an explicit `dyn` are deprecated
  --> src/main.rs:16:13
   |
16 |     let x: &Database<Inner = _> = &t;
   |             ^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Database<Inner = _>`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

warning: unused variable: `x`
  --> src/main.rs:16:9
   |
16 |     let x: &Database<Inner = _> = &t;
   |         ^ help: if this is intentional, prefix it with an underscore: `_x`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: Error finalizing incremental compilation session directory `/Users/dudu/tmp/aaaa/target/debug/incremental/aaaa-3t9641te2lvvd/s-ftkew3bbem-6oinlz-working`: No such file or directory (os error 2)

warning: 3 warnings emitted

error: internal compiler error: broken MIR in DefId(0:10 ~ aaaa[fab6]::main) (CanonicalUserTypeAnnotation { user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Region(U0) }], value: Ty(&dyn Database<Inner = ^1_1, Inner = u32>) }, span: src/main.rs:16:12: 16:32 (#0), inferred_ty: &dyn Database<Inner = u32, Inner = u32> }): bad user type (&dyn Database<Inner = _, Inner = u32> = &dyn Database<Inner = u32, Inner = u32>): NoSolution
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:258:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0 (7eac88abb 2020-11-16) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: could not compile `aaaa`

To learn more, run the command again with --verbose.
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
<backtrace>
```

</p>
</details>



<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

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

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