diff options
| author | Michael Goulet <michael@errs.io> | 2022-01-19 20:07:04 -0800 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-01-19 20:07:04 -0800 |
| commit | b7e443397471062e5681ecefb6638577cefb9571 (patch) | |
| tree | 3f04c86244e49b76c558c75a4d58873b18c0021c /compiler/rustc_trait_selection/src/traits | |
| parent | 8547f5732c003080f940a23eaf3e2e9c052934ae (diff) | |
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.
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/confirmation.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 77db3bd2692..0099fba9200 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -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(..) diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 4c74627f3c6..3b6a4afafcf 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -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) |
