about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-01-19 20:07:04 -0800
committerMichael Goulet <michael@errs.io>2022-01-19 20:07:04 -0800
commitb7e443397471062e5681ecefb6638577cefb9571 (patch)
tree3f04c86244e49b76c558c75a4d58873b18c0021c /compiler/rustc_trait_selection/src/traits
parent8547f5732c003080f940a23eaf3e2e9c052934ae (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.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs3
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)