diff options
| author | bors <bors@rust-lang.org> | 2024-10-23 08:41:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-23 08:41:24 +0000 |
| commit | ffd978b7bf4ccdc74fe6c1b048d253eb3f3aa341 (patch) | |
| tree | fadc38a418cdde21274c1baf06aebc5996c66589 /compiler/rustc_middle/src | |
| parent | 9abfcb49002b82f46ad66ceb0b26cee8be2dc658 (diff) | |
| parent | 00266eeaa5957f0dde0b17f2823fd4b4ea6996c2 (diff) | |
| download | rust-ffd978b7bf4ccdc74fe6c1b048d253eb3f3aa341.tar.gz rust-ffd978b7bf4ccdc74fe6c1b048d253eb3f3aa341.zip | |
Auto merge of #132044 - lcnr:no-relate-abi, r=compiler-errors
do not implement `Relate` for "boring" types and update some macros while we're at it. This means we don't have to implement `TypeVisitable` for them. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/error.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/relate.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 7 |
3 files changed, 5 insertions, 27 deletions
diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs index b02eff3bfd6..c49824bb418 100644 --- a/compiler/rustc_middle/src/ty/error.rs +++ b/compiler/rustc_middle/src/ty/error.rs @@ -35,9 +35,6 @@ impl<'tcx> TypeError<'tcx> { TypeError::CyclicTy(_) => "cyclic type of infinite size".into(), TypeError::CyclicConst(_) => "encountered a self-referencing constant".into(), TypeError::Mismatch => "types differ".into(), - TypeError::ConstnessMismatch(values) => { - format!("expected {} bound, found {} bound", values.expected, values.found).into() - } TypeError::PolarityMismatch(values) => { format!("expected {} polarity, found {} polarity", values.expected, values.found) .into() diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 4c7bcb1bf2e..504a3c8a6d8 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -1,7 +1,5 @@ use std::iter; -use rustc_hir as hir; -use rustc_target::spec::abi; pub use rustc_type_ir::relate::*; use crate::ty::error::{ExpectedFound, TypeError}; @@ -121,26 +119,6 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistentialPredicate< } } -impl<'tcx> Relate<TyCtxt<'tcx>> for hir::Safety { - fn relate<R: TypeRelation<TyCtxt<'tcx>>>( - _relation: &mut R, - a: hir::Safety, - b: hir::Safety, - ) -> RelateResult<'tcx, hir::Safety> { - if a != b { Err(TypeError::SafetyMismatch(ExpectedFound::new(true, a, b))) } else { Ok(a) } - } -} - -impl<'tcx> Relate<TyCtxt<'tcx>> for abi::Abi { - fn relate<R: TypeRelation<TyCtxt<'tcx>>>( - _relation: &mut R, - a: abi::Abi, - b: abi::Abi, - ) -> RelateResult<'tcx, abi::Abi> { - if a == b { Ok(a) } else { Err(TypeError::AbiMismatch(ExpectedFound::new(true, a, b))) } - } -} - impl<'tcx> Relate<TyCtxt<'tcx>> for ty::GenericArgsRef<'tcx> { fn relate<R: TypeRelation<TyCtxt<'tcx>>>( relation: &mut R, diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index cd9ff9b60d8..4872d8c89eb 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -264,8 +264,6 @@ TrivialTypeTraversalImpls! { // interners). TrivialTypeTraversalAndLiftImpls! { ::rustc_hir::def_id::DefId, - ::rustc_hir::Safety, - ::rustc_target::spec::abi::Abi, crate::ty::ClosureKind, crate::ty::ParamConst, crate::ty::ParamTy, @@ -276,6 +274,11 @@ TrivialTypeTraversalAndLiftImpls! { rustc_target::abi::Size, } +TrivialLiftImpls! { + ::rustc_hir::Safety, + ::rustc_target::spec::abi::Abi, +} + /////////////////////////////////////////////////////////////////////////// // Lift implementations |
