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,
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);
@ -3451,7 +3451,7 @@ impl<'a> LoweringContext<'a> {
bounds: self.lower_param_bounds(b,
ImplTraitContext::OpaqueTy(None)),
impl_trait_fn: None,
origin: hir::OpaqueTyOrigin::TraitAliasImplTrait,
origin: hir::OpaqueTyOrigin::TypeAlias,
},
),
ItemKind::Enum(ref enum_definition, ref generics) => {

View File

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

View File

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