Remove region from adjustments
This commit is contained in:
parent
9f57edf2e2
commit
599ffab6cd
18 changed files with 65 additions and 64 deletions
|
@ -82,7 +82,7 @@ pub enum PointerCoercion {
|
|||
/// `Box<[i32]>` is an `Adjust::Unsize` with the target `Box<[i32]>`.
|
||||
#[derive(Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub struct Adjustment<'tcx> {
|
||||
pub kind: Adjust<'tcx>,
|
||||
pub kind: Adjust,
|
||||
pub target: Ty<'tcx>,
|
||||
}
|
||||
|
||||
|
@ -93,20 +93,20 @@ impl<'tcx> Adjustment<'tcx> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub enum Adjust<'tcx> {
|
||||
pub enum Adjust {
|
||||
/// Go from ! to any type.
|
||||
NeverToAny,
|
||||
|
||||
/// Dereference once, producing a place.
|
||||
Deref(Option<OverloadedDeref<'tcx>>),
|
||||
Deref(Option<OverloadedDeref>),
|
||||
|
||||
/// Take the address and produce either a `&` or `*` pointer.
|
||||
Borrow(AutoBorrow<'tcx>),
|
||||
Borrow(AutoBorrow),
|
||||
|
||||
Pointer(PointerCoercion),
|
||||
|
||||
/// Take a pinned reference and reborrow as a `Pin<&mut T>` or `Pin<&T>`.
|
||||
ReborrowPin(ty::Region<'tcx>, hir::Mutability),
|
||||
ReborrowPin(hir::Mutability),
|
||||
}
|
||||
|
||||
/// An overloaded autoderef step, representing a `Deref(Mut)::deref(_mut)`
|
||||
|
@ -115,17 +115,16 @@ pub enum Adjust<'tcx> {
|
|||
/// being those shared by both the receiver and the returned reference.
|
||||
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub struct OverloadedDeref<'tcx> {
|
||||
pub region: ty::Region<'tcx>,
|
||||
pub struct OverloadedDeref {
|
||||
pub mutbl: hir::Mutability,
|
||||
/// The `Span` associated with the field access or method call
|
||||
/// that triggered this overloaded deref.
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl<'tcx> OverloadedDeref<'tcx> {
|
||||
impl OverloadedDeref {
|
||||
/// Get the zst function item type for this method call.
|
||||
pub fn method_call(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> Ty<'tcx> {
|
||||
pub fn method_call<'tcx>(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> Ty<'tcx> {
|
||||
let trait_def_id = match self.mutbl {
|
||||
hir::Mutability::Not => tcx.require_lang_item(LangItem::Deref, None),
|
||||
hir::Mutability::Mut => tcx.require_lang_item(LangItem::DerefMut, None),
|
||||
|
@ -187,9 +186,9 @@ impl From<AutoBorrowMutability> for hir::Mutability {
|
|||
|
||||
#[derive(Copy, Clone, PartialEq, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub enum AutoBorrow<'tcx> {
|
||||
pub enum AutoBorrow {
|
||||
/// Converts from T to &T.
|
||||
Ref(ty::Region<'tcx>, AutoBorrowMutability),
|
||||
Ref(AutoBorrowMutability),
|
||||
|
||||
/// Converts from T to *T.
|
||||
RawPtr(hir::Mutability),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue