1
Fork 0

Rename OpaqueTyOrigin variants

This commit is contained in:
varkor 2019-08-02 00:09:38 +01:00
parent b4fe555796
commit 16033d1e58
3 changed files with 9 additions and 9 deletions

View file

@ -1763,7 +1763,7 @@ impl<'a> LoweringContext<'a> {
}, },
bounds: hir_bounds, bounds: hir_bounds,
impl_trait_fn: fn_def_id, impl_trait_fn: fn_def_id,
origin: hir::OpaqueTyOrigin::ReturnImplTrait, origin: hir::OpaqueTyOrigin::FnReturn,
}; };
trace!("exist ty from impl trait def-index: {:#?}", opaque_ty_def_index); trace!("exist ty from impl trait def-index: {:#?}", opaque_ty_def_index);
@ -3451,7 +3451,7 @@ impl<'a> LoweringContext<'a> {
bounds: self.lower_param_bounds(b, bounds: self.lower_param_bounds(b,
ImplTraitContext::OpaqueTy(None)), ImplTraitContext::OpaqueTy(None)),
impl_trait_fn: None, impl_trait_fn: None,
origin: hir::OpaqueTyOrigin::TraitAliasImplTrait, origin: hir::OpaqueTyOrigin::TypeAlias,
}, },
), ),
ItemKind::Enum(ref enum_definition, ref generics) => { ItemKind::Enum(ref enum_definition, ref generics) => {

View file

@ -1933,9 +1933,9 @@ pub struct OpaqueTy {
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum OpaqueTyOrigin { pub enum OpaqueTyOrigin {
/// `type Foo = impl Trait;` /// `type Foo = impl Trait;`
TraitAliasImplTrait, TypeAlias,
/// `-> impl Trait` /// `-> impl Trait`
ReturnImplTrait, FnReturn,
/// `async fn` /// `async fn`
AsyncFn, AsyncFn,
} }

View file

@ -495,8 +495,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
hir::OpaqueTyOrigin::AsyncFn => return false, hir::OpaqueTyOrigin::AsyncFn => return false,
// Otherwise, generate the label we'll use in the error message. // Otherwise, generate the label we'll use in the error message.
hir::OpaqueTyOrigin::TraitAliasImplTrait => "impl Trait", hir::OpaqueTyOrigin::TypeAlias => "impl Trait",
hir::OpaqueTyOrigin::ReturnImplTrait => "impl Trait", hir::OpaqueTyOrigin::FnReturn => "impl Trait",
}; };
let msg = format!("ambiguous lifetime bound in `{}`", context_name); let msg = format!("ambiguous lifetime bound in `{}`", context_name);
let mut err = self.tcx.sess.struct_span_err(span, &msg); let mut err = self.tcx.sess.struct_span_err(span, &msg);
@ -1052,7 +1052,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
origin, origin,
), ),
_ => { _ => {
(def_scope_default(), hir::OpaqueTyOrigin::TraitAliasImplTrait) (def_scope_default(), hir::OpaqueTyOrigin::TypeAlias)
} }
}, },
Some(Node::ImplItem(item)) => match item.node { Some(Node::ImplItem(item)) => match item.node {
@ -1062,10 +1062,10 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
self.parent_def_id, self.parent_def_id,
opaque_hir_id, opaque_hir_id,
), ),
hir::OpaqueTyOrigin::TraitAliasImplTrait, hir::OpaqueTyOrigin::TypeAlias,
), ),
_ => { _ => {
(def_scope_default(), hir::OpaqueTyOrigin::TraitAliasImplTrait) (def_scope_default(), hir::OpaqueTyOrigin::TypeAlias)
} }
}, },
_ => bug!( _ => bug!(