about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-09-10 18:56:08 +0530
committerGitHub <noreply@github.com>2022-09-10 18:56:08 +0530
commitf1412a665f6c3f04fba0f192d9de4c12d823f9f3 (patch)
treeb9c66defc18d3330e4f5bcca9f419feea739122d /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent33d54c4f737a99e8acdec1377fc0f105ad24635d (diff)
parent022e3fe550406c3fbdb64f241381bc14b1937cfb (diff)
downloadrust-f1412a665f6c3f04fba0f192d9de4c12d823f9f3.tar.gz
rust-f1412a665f6c3f04fba0f192d9de4c12d823f9f3.zip
Rollup merge of #101614 - compiler-errors:rpitit-eq, r=jackh726
Equate fn outputs when inferring RPITIT hidden types

When we are trying to infer the hidden types for RPITITs, we need to equate the output tys instead of just subtyping them. For example:

```rust
trait Foo { fn bar() -> impl Sized {} }

impl Foo for () { fn bar() -> &'static str { "" } }
```

If we just subtype the signatures `fn() -> &'static str <: fn() -> _#1t` (where `_#1t` is the variable we've used to infer `impl Sized`), we'll end up `&'static str <: _#1t`, which causes us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets fixed up to `ReEmpty`, and which is certainly not what we want.

I can't actually think of a way to make this fail to compile, because during borrowck we've already done the method probe, and so we just look at the `impl` method signature and see the `&'static str` any time we call `<() as Foo>::bar()`. But this _does_ cause the ICE [here](https://github.com/rust-lang/rust/pull/98559#issuecomment-1241891994) in `@jackh726's` "Remove ReEmpty" PR (#98559) to stop ICEing, because after that PR we were leaking unconstrained region variables into the typeck results.

r? types
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions