1
Fork 0

Foreign types are trivially drop

- Also rename a trivial_const_drop to match style of other functions in
  the util module.
- Also add a test for `const Drop` that doesn't depend on a `~const`
  bound.
- Also comment a bit why we remove the const bound during dropck impl
  check.
This commit is contained in:
Michael Goulet 2022-01-19 20:07:04 -08:00
parent 8547f5732c
commit b7e4433974
6 changed files with 31 additions and 17 deletions

View file

@ -932,7 +932,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Bound(..)
| ty::Param(_)
| ty::Placeholder(_)
| ty::Foreign(_)
| ty::Projection(_) => {
// We don't know if these are `~const Drop`, at least
// not structurally... so don't push a candidate.
@ -951,6 +950,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Never
| ty::Foreign(_)
| ty::Array(..)
| ty::Slice(_)
| ty::Closure(..)

View file

@ -1133,7 +1133,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Never => {}
| ty::Never
| ty::Foreign(_) => {}
// These types are built-in, so we can fast-track by registering
// nested predicates for their constituient type(s)