Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/abi.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/abi.rs | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/crates/hir-ty/src/next_solver/abi.rs b/crates/hir-ty/src/next_solver/abi.rs index 1813abab86..3121d5631f 100644 --- a/crates/hir-ty/src/next_solver/abi.rs +++ b/crates/hir-ty/src/next_solver/abi.rs @@ -1,7 +1,10 @@ //! ABI-related things in the next-trait-solver. -use rustc_type_ir::{error::TypeError, relate::Relate}; - -use crate::FnAbi; +use rustc_abi::ExternAbi; +use rustc_ast_ir::visit::VisitorResult; +use rustc_type_ir::{ + FallibleTypeFolder, TypeFoldable, TypeFolder, TypeVisitable, TypeVisitor, error::TypeError, + relate::Relate, +}; use super::interner::DbInterner; @@ -40,9 +43,32 @@ impl<'db> rustc_type_ir::inherent::Safety<DbInterner<'db>> for Safety { Self::Safe => "", } } + + fn unsafe_mode() -> Self { + Safety::Unsafe + } +} + +impl<'db> TypeVisitable<DbInterner<'db>> for ExternAbi { + fn visit_with<V: TypeVisitor<DbInterner<'db>>>(&self, _visitor: &mut V) -> V::Result { + V::Result::output() + } +} + +impl<'db> TypeFoldable<DbInterner<'db>> for ExternAbi { + fn try_fold_with<F: FallibleTypeFolder<DbInterner<'db>>>( + self, + _folder: &mut F, + ) -> Result<Self, F::Error> { + Ok(self) + } + + fn fold_with<F: TypeFolder<DbInterner<'db>>>(self, _folder: &mut F) -> Self { + self + } } -impl<'db> Relate<DbInterner<'db>> for FnAbi { +impl<'db> Relate<DbInterner<'db>> for ExternAbi { fn relate<R: rustc_type_ir::relate::TypeRelation<DbInterner<'db>>>( _relation: &mut R, a: Self, @@ -55,13 +81,3 @@ impl<'db> Relate<DbInterner<'db>> for FnAbi { } } } - -impl<'db> rustc_type_ir::inherent::Abi<DbInterner<'db>> for FnAbi { - fn rust() -> Self { - FnAbi::Rust - } - - fn is_rust(self) -> bool { - matches!(self, FnAbi::Rust) - } -} |