about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-03-19 06:57:28 +0100
committerGitHub <noreply@github.com>2020-03-19 06:57:28 +0100
commitffb3c2cb3d2081d295dab9ca38f3a5e1e13c863d (patch)
treee57d5f5db40badac99123f9f3bff6fde2115c436 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parentfddbee64ac6d5ba461c8bdfdf72757dda1d35d8f (diff)
parentbc8ff3fe8e8cebc9e4855aaf44c19c887f8f4be4 (diff)
downloadrust-ffb3c2cb3d2081d295dab9ca38f3a5e1e13c863d.tar.gz
rust-ffb3c2cb3d2081d295dab9ca38f3a5e1e13c863d.zip
Rollup merge of #69036 - eddyb:monoshim, r=nikomatsakis
rustc: don't resolve Instances which would produce malformed shims.

There are some `InstanceDef` variants (shims and drop "glue") which contain a `Ty`, and that `Ty` is used in generating the shim MIR. But if that `Ty` mentions any generic parameters, the generated shim would refer to them (but they won't match the `Substs` of the `Instance`), or worse, generating the shim would fail because not enough of the type is known.

Ideally we would always produce a "skeleton" of the type, e.g. `(_, _)` for dropping any tuples with two elements, or `Vec<_>` for dropping any `Vec` value, but that's a lot of work, and they would still not match the `Substs` of the `Instance` as it exists today, so `Instance` would probably need to change.

By making `Instance::resolve` return `None` in the still-generic cases, we get behavior similar to specialization, where a default can only be used if there are no more generic parameters which would allow a more specialized `impl` to match.

<hr/>

This was found while testing the MIR inliner with #68965, because it was trying to inline shims.

cc @rust-lang/wg-mir-opt
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions