8000 Change opaque type syntax from `existential type` to type alias `impl Trait` by varkor · Pull Request #63180 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Change opaque type syntax from existential type to type alias impl Trait #63180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 3, 2019
Prev Previous commit
Next Next commit
Rename OpaqueTyOrigin variants
  • Loading branch information
varkor committed Aug 2, 2019
commit 16033d1e58d134d3f3932bd3ba9726deef24f4b1
4 changes: 2 additions & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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!(
Expand Down
0