diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-05 01:53:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-05 01:53:32 +0200 |
| commit | 92e53f5cc9216f019bc732741d13086f29855dc1 (patch) | |
| tree | 68df1c5468cd96709148ffd4d43fbc2bff61f191 /compiler/rustc_codegen_gcc | |
| parent | 3bf33b9060065b69f22c50d0ec924eaf51da830a (diff) | |
| parent | b899251f2dfe3a9849f844418e0d11e2073c2423 (diff) | |
| download | rust-92e53f5cc9216f019bc732741d13086f29855dc1.tar.gz rust-92e53f5cc9216f019bc732741d13086f29855dc1.zip | |
Rollup merge of #95603 - compiler-errors:dyn-return, r=oli-obk
Fix late-bound ICE in `dyn` return type suggestion
This fixes the root-cause of the attached issues -- the root problem is that we're using the return type from a signature with late-bound instead of early-bound regions. The change on line 1087 (`let Some(liberated_sig) = typeck_results.liberated_fn_sigs().get(fn_hir_id) else { return false; };`) makes sure we're grabbing the _right_ return type for this suggestion to check the `dyn` predicates with.
Fixes #91801
Fixes #91803
This fix also includes some drive-by changes, specifically:
1. Don't suggest boxing when we have `-> dyn Trait` and are already returning `Box<T>` where `T: Trait` (before we always boxed the value).
2. Suggestion applies even when the return type is a type alias (e.g. `type Foo = dyn Trait`). This does cause the suggestion to expand to the aliased type, but I think it's still beneficial.
3. Split up the multipart suggestion because there's a 6-line max in the printed output...
I am open to splitting out the above changes, if we just want to fix the ICE first.
cc: ```@terrarier2111``` and #92289
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions
