Stop special casing top level TAIT

This commit is contained in:
Matthew Jasper 2020-05-10 11:57:58 +01:00
parent d77e86142f
commit 4e49e67c44
44 changed files with 326 additions and 427 deletions

View File

@ -1858,15 +1858,6 @@ impl TyKind {
pub fn is_unit(&self) -> bool {
if let TyKind::Tup(ref tys) = *self { tys.is_empty() } else { false }
}
/// HACK(type_alias_impl_trait, Centril): A temporary crutch used
/// in lowering to avoid making larger changes there and beyond.
pub fn opaque_top_hack(&self) -> Option<&GenericBounds> {
match self {
Self::ImplTrait(_, bounds) => Some(bounds),
_ => None,
}
}
}
/// Syntax used to declare a trait object.

View File

@ -1,5 +1,5 @@
use super::{AnonymousLifetimeMode, LoweringContext, ParamMode};
use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor};
use super::{ImplTraitContext, ImplTraitPosition};
use crate::Arena;
use rustc_ast::ast::*;
@ -165,13 +165,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
ItemKind::MacroDef(..) => SmallVec::new(),
ItemKind::Fn(..) | ItemKind::Impl { of_trait: None, .. } => smallvec![i.id],
ItemKind::Static(ref ty, ..) | ItemKind::Const(_, ref ty, ..) => {
let mut ids = smallvec![i.id];
if self.sess.features_untracked().impl_trait_in_bindings {
ImplTraitTypeIdVisitor { ids: &mut ids }.visit_ty(ty);
}
ids
}
_ => smallvec![i.id],
};
@ -292,23 +285,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
ItemKind::Mod(ref m) => hir::ItemKind::Mod(self.lower_mod(m)),
ItemKind::ForeignMod(ref nm) => hir::ItemKind::ForeignMod(self.lower_foreign_mod(nm)),
ItemKind::GlobalAsm(ref ga) => hir::ItemKind::GlobalAsm(self.lower_global_asm(ga)),
ItemKind::TyAlias(_, ref gen, _, Some(ref ty)) => match ty.kind.opaque_top_hack() {
None => {
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
let generics = self.lower_generics(gen, ImplTraitContext::disallowed());
hir::ItemKind::TyAlias(ty, generics)
}
Some(bounds) => {
let ctx = || ImplTraitContext::OpaqueTy(None, hir::OpaqueTyOrigin::Misc);
let ty = hir::OpaqueTy {
generics: self.lower_generics(gen, ctx()),
bounds: self.lower_param_bounds(bounds, ctx()),
impl_trait_fn: None,
origin: hir::OpaqueTyOrigin::TypeAlias,
};
hir::ItemKind::OpaqueTy(ty)
}
},
ItemKind::TyAlias(_, ref gen, _, Some(ref ty)) => {
let ty =
self.lower_ty(ty, ImplTraitContext::OpaqueTy(None, hir::OpaqueTyOrigin::Misc));
let generics = self.lower_generics(gen, ImplTraitContext::disallowed());
hir::ItemKind::TyAlias(ty, generics)
}
ItemKind::TyAlias(_, ref generics, _, None) => {
let ty = self.arena.alloc(self.ty(span, hir::TyKind::Err));
let generics = self.lower_generics(generics, ImplTraitContext::disallowed());
@ -844,16 +826,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
let ty = self.arena.alloc(self.ty(i.span, hir::TyKind::Err));
hir::ImplItemKind::TyAlias(ty)
}
Some(ty) => match ty.kind.opaque_top_hack() {
None => {
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
hir::ImplItemKind::TyAlias(ty)
}
Some(bs) => {
let bs = self.lower_param_bounds(bs, ImplTraitContext::disallowed());
hir::ImplItemKind::OpaqueTy(bs)
}
},
Some(ty) => {
let ty = self.lower_ty(
ty,
ImplTraitContext::OpaqueTy(None, hir::OpaqueTyOrigin::Misc),
);
hir::ImplItemKind::TyAlias(ty)
}
};
(generics, kind)
}
@ -887,12 +866,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
defaultness,
kind: match &i.kind {
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
AssocItemKind::TyAlias(.., ty) => {
match ty.as_deref().and_then(|ty| ty.kind.opaque_top_hack()) {
None => hir::AssocItemKind::Type,
Some(_) => hir::AssocItemKind::OpaqueTy,
}
}
AssocItemKind::TyAlias(..) => hir::AssocItemKind::Type,
AssocItemKind::Fn(_, sig, ..) => {
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
}

View File

@ -1371,8 +1371,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let hir_bounds = self.with_hir_id_owner(opaque_ty_node_id, lower_bounds);
let (lifetimes, lifetime_defs) =
self.lifetimes_from_impl_trait_bounds(opaque_ty_node_id, opaque_ty_def_id, &hir_bounds);
let (lifetimes, lifetime_defs): (&[_], &[_]) = if fn_def_id.is_some() {
self.lifetimes_from_impl_trait_bounds(opaque_ty_node_id, opaque_ty_def_id, &hir_bounds)
} else {
// Non return-position impl trait captures all of the lifetimes of
// the parent item.
(&[], &[])
};
debug!("lower_opaque_impl_trait: lifetimes={:#?}", lifetimes,);

View File

@ -1102,6 +1102,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
hir::ItemKind::TyAlias(ref ty, ref generics) => (&*ty, generics),
_ => return,
};
if let hir::TyKind::Def(..) = ty.kind {
// Bounds are respected for `type X = impl Trait`
return;
}
let mut suggested_changing_assoc_types = false;
// There must not be a where clause
if !type_alias_generics.where_clause.predicates.is_empty() {

View File

@ -672,6 +672,8 @@ impl<'hir> Map<'hir> {
if let Node::Item(Item {
kind:
ItemKind::Fn(..)
| ItemKind::Const(..)
| ItemKind::Static(..)
| ItemKind::Mod(..)
| ItemKind::Enum(..)
| ItemKind::Struct(..)
@ -700,11 +702,7 @@ impl<'hir> Map<'hir> {
return CRATE_HIR_ID;
}
match self.get(scope) {
Node::Item(Item {
kind: ItemKind::OpaqueTy(OpaqueTy { impl_trait_fn: None, .. }),
..
})
| Node::Block(_) => {}
Node::Block(_) => {}
_ => break,
}
}

View File

@ -27,8 +27,7 @@ impl ItemLikeVisitor<'tcx> for LayoutTest<'tcx> {
ItemKind::TyAlias(..)
| ItemKind::Enum(..)
| ItemKind::Struct(..)
| ItemKind::Union(..)
| ItemKind::OpaqueTy(..) => {
| ItemKind::Union(..) => {
for attr in self.tcx.get_attrs(item_def_id.to_def_id()).iter() {
if attr.check_name(sym::rustc_layout) {
self.dump_layout_of(item_def_id, item, attr);
@ -83,9 +82,11 @@ impl LayoutTest<'tcx> {
}
sym::debug => {
let normalized_ty =
self.tcx.normalize_erasing_regions(param_env.with_reveal_all(), ty);
self.tcx.sess.span_err(
item.span,
&format!("layout_of({:?}) = {:#?}", ty, *ty_layout),
&format!("layout_of({:?}) = {:#?}", normalized_ty, *ty_layout),
);
}

View File

@ -746,12 +746,11 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
}
// These items live in the type namespace.
ItemKind::TyAlias(_, _, _, ref ty) => {
let def_kind = match ty.as_deref().and_then(|ty| ty.kind.opaque_top_hack()) {
None => DefKind::TyAlias,
Some(_) => DefKind::OpaqueTy,
};
let res = Res::Def(def_kind, self.r.definitions.local_def_id(item.id).to_def_id());
ItemKind::TyAlias(..) => {
let res = Res::Def(
DefKind::TyAlias,
self.r.definitions.local_def_id(item.id).to_def_id(),
);
self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion));
}

View File

@ -396,15 +396,12 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
let scope = Scope::Elision { elide: Elide::Exact(Region::Static), s: ROOT_SCOPE };
self.with(scope, |_, this| intravisit::walk_item(this, item));
}
hir::ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn: Some(_), .. }) => {
// Currently opaque type declarations are just generated from `impl Trait`
// items. Doing anything on this node is irrelevant, as we currently don't need
// it.
hir::ItemKind::OpaqueTy(hir::OpaqueTy { .. }) => {
// Opaque types are visited when we visit the `TyKind::Def`, so
// that they have the lifetimes from their parent opaque_ty in
// scope.
}
hir::ItemKind::TyAlias(_, ref generics)
| hir::ItemKind::OpaqueTy(hir::OpaqueTy {
impl_trait_fn: None, ref generics, ..
})
| hir::ItemKind::Enum(_, ref generics)
| hir::ItemKind::Struct(_, ref generics)
| hir::ItemKind::Union(_, ref generics)
@ -563,17 +560,22 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
// `type MyAnonTy<'b> = impl MyTrait<'b>;`
// ^ ^ this gets resolved in the scope of
// the opaque_ty generics
let (generics, bounds) = match self.tcx.hir().expect_item(item_id.id).kind {
let opaque_ty = self.tcx.hir().expect_item(item_id.id);
let (generics, bounds) = match opaque_ty.kind {
// Named opaque `impl Trait` types are reached via `TyKind::Path`.
// This arm is for `impl Trait` in the types of statics, constants and locals.
hir::ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn: None, .. }) => {
intravisit::walk_ty(self, ty);
intravisit::walk_item(this, opaque_ty);
return;
}
// RPIT (return position impl trait)
hir::ItemKind::OpaqueTy(hir::OpaqueTy { ref generics, bounds, .. }) => {
(generics, bounds)
}
hir::ItemKind::OpaqueTy(hir::OpaqueTy {
impl_trait_fn: Some(_),
ref generics,
bounds,
..
}) => (generics, bounds),
ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i),
};
@ -2667,8 +2669,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
// going to make a fresh name, so we cannot
// necessarily replace a single-use lifetime with
// `'_`.
Scope::Elision { elide: Elide::Exact(_), .. } => break false,
Scope::Elision { elide: Elide::Error(_), .. } => break false,
Scope::Elision {
elide: Elide::Exact(_) | Elide::Error(_) | Elide::Forbid, ..
} => break false,
Scope::ObjectLifetimeDefault { s, .. } => scope = s,
}

View File

@ -133,9 +133,9 @@ pub trait InferCtxtExt<'tcx> {
fn generate_member_constraint(
&self,
concrete_ty: Ty<'tcx>,
opaque_type_generics: &ty::Generics,
opaque_defn: &OpaqueTypeDecl<'tcx>,
opaque_type_def_id: DefId,
first_own_region_index: usize,
);
/*private*/
@ -405,7 +405,16 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
debug!("constrain_opaque_type: concrete_ty={:?}", concrete_ty);
let opaque_type_generics = tcx.generics_of(def_id);
let first_own_region = match opaque_defn.origin {
hir::OpaqueTyOrigin::FnReturn | hir::OpaqueTyOrigin::AsyncFn => {
// For these opaque types, only the item's own lifetime
// parameters are considered.
tcx.generics_of(def_id).parent_count
}
// These opaque type inherit all lifetime parameters from their
// parent.
hir::OpaqueTyOrigin::Misc => 0,
};
let span = tcx.def_span(def_id);
@ -427,12 +436,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
});
}
if let GenerateMemberConstraints::IfNoStaticBound = mode {
self.generate_member_constraint(
concrete_ty,
opaque_type_generics,
opaque_defn,
def_id,
);
self.generate_member_constraint(concrete_ty, opaque_defn, def_id, first_own_region);
}
return;
}
@ -445,29 +449,27 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// `['a]` for the first impl trait and `'b` for the
// second.
let mut least_region = None;
for param in &opaque_type_generics.params {
match param.kind {
GenericParamDefKind::Lifetime => {}
_ => continue,
}
// Get the value supplied for this region from the substs.
let subst_arg = opaque_defn.substs.region_at(param.index as usize);
for subst_arg in &opaque_defn.substs[first_own_region..] {
let subst_region = match subst_arg.unpack() {
GenericArgKind::Lifetime(r) => r,
GenericArgKind::Type(_) | GenericArgKind::Const(_) => continue,
};
// Compute the least upper bound of it with the other regions.
debug!("constrain_opaque_types: least_region={:?}", least_region);
debug!("constrain_opaque_types: subst_arg={:?}", subst_arg);
debug!("constrain_opaque_types: subst_region={:?}", subst_region);
match least_region {
None => least_region = Some(subst_arg),
None => least_region = Some(subst_region),
Some(lr) => {
if free_region_relations.sub_free_regions(self.tcx, lr, subst_arg) {
if free_region_relations.sub_free_regions(self.tcx, lr, subst_region) {
// keep the current least region
} else if free_region_relations.sub_free_regions(self.tcx, subst_arg, lr) {
// switch to `subst_arg`
least_region = Some(subst_arg);
} else if free_region_relations.sub_free_regions(self.tcx, subst_region, lr) {
// switch to `subst_region`
least_region = Some(subst_region);
} else {
// There are two regions (`lr` and
// `subst_arg`) which are not relatable. We
// `subst_region`) which are not relatable. We
// can't find a best choice. Therefore,
// instead of creating a single bound like
// `'r: 'a` (which is our preferred choice),
@ -476,13 +478,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// regions that appear in the impl trait.
// For now, enforce a feature gate outside of async functions.
self.member_constraint_feature_gate(opaque_defn, def_id, lr, subst_arg);
self.member_constraint_feature_gate(opaque_defn, def_id, lr, subst_region);
return self.generate_member_constraint(
concrete_ty,
opaque_type_generics,
opaque_defn,
def_id,
first_own_region,
);
}
}
@ -494,12 +496,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
if let GenerateMemberConstraints::IfNoStaticBound = mode {
if least_region != tcx.lifetimes.re_static {
self.generate_member_constraint(
concrete_ty,
opaque_type_generics,
opaque_defn,
def_id,
);
self.generate_member_constraint(concrete_ty, opaque_defn, def_id, first_own_region);
}
}
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {
@ -518,22 +515,20 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
fn generate_member_constraint(
&self,
concrete_ty: Ty<'tcx>,
opaque_type_generics: &ty::Generics,
opaque_defn: &OpaqueTypeDecl<'tcx>,
opaque_type_def_id: DefId,
first_own_region: usize,
) {
// Create the set of choice regions: each region in the hidden
// type can be equal to any of the region parameters of the
// opaque type definition.
let choice_regions: Lrc<Vec<ty::Region<'tcx>>> = Lrc::new(
opaque_type_generics
.params
opaque_defn.substs[first_own_region..]
.iter()
.filter(|param| match param.kind {
GenericParamDefKind::Lifetime => true,
GenericParamDefKind::Type { .. } | GenericParamDefKind::Const => false,
.filter_map(|arg| match arg.unpack() {
GenericArgKind::Lifetime(r) => Some(r),
GenericArgKind::Type(_) | GenericArgKind::Const(_) => None,
})
.map(|param| opaque_defn.substs.region_at(param.index as usize))
.chain(std::iter::once(self.tcx.lifetimes.re_static))
.collect(),
);

View File

@ -2839,8 +2839,26 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
self.res_to_ty(opt_self_ty, path, false)
}
hir::TyKind::Def(item_id, ref lifetimes) => {
let did = tcx.hir().local_def_id(item_id.id);
self.impl_trait_ty_to_ty(did.to_def_id(), lifetimes)
let opaque_ty = tcx.hir().expect_item(item_id.id);
let def_id = tcx.hir().local_def_id(item_id.id).to_def_id();
match opaque_ty.kind {
// RPIT (return position impl trait)
// Only lifetimes mentioned in the impl Trait predicate are
// captured by the opaque type, so the lifetime parameters
// from the parent item need to be replaced with `'static`.
hir::ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn: Some(_), .. }) => {
self.impl_trait_ty_to_ty(def_id, lifetimes)
}
// This arm is for `impl Trait` in the types of statics,
// constants, locals and type aliases. These capture all
// parent lifetimes, so they can use their identity subst.
hir::ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn: None, .. }) => {
let substs = InternalSubsts::identity_for_item(tcx, def_id);
tcx.mk_opaque(def_id, substs)
}
ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i),
}
}
hir::TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => {
debug!("ast_ty_to_ty: qself={:?} segment={:?}", qself, segment);

View File

@ -460,7 +460,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
let mut skip_add = false;
if let ty::Opaque(defin_ty_def_id, _substs) = definition_ty.kind {
if let hir::OpaqueTyOrigin::TypeAlias = opaque_defn.origin {
if let hir::OpaqueTyOrigin::Misc = opaque_defn.origin {
if def_id == defin_ty_def_id {
debug!(
"skipping adding concrete definition for opaque type {:?} {:?}",

View File

@ -1202,22 +1202,11 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn, .. }) => {
impl_trait_fn.or_else(|| {
let parent_id = tcx.hir().get_parent_item(hir_id);
if parent_id != hir_id && parent_id != CRATE_HIR_ID {
assert!(parent_id != hir_id && parent_id != CRATE_HIR_ID);
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
// If this 'impl Trait' is nested inside another 'impl Trait'
// (e.g. `impl Foo<MyType = impl Bar<A>>`), we need to use the 'parent'
// 'impl Trait' for its generic parameters, since we can reference them
// from the 'child' 'impl Trait'
if let Node::Item(hir::Item { kind: ItemKind::OpaqueTy(..), .. }) =
tcx.hir().get(parent_id)
{
// Opaque types are always nested within another item, and
// inherit the generics of the item.
Some(tcx.hir().local_def_id(parent_id).to_def_id())
} else {
None
}
} else {
None
}
})
}
_ => None,

View File

@ -108,18 +108,12 @@ type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
//~| ERROR could not find defining uses
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
//~^ ERROR the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified [E0719]
//~| ERROR could not find defining uses

View File

@ -223,30 +223,6 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:62:42
|
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { iter::empty() }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:64:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { iter::empty() }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:66:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { iter::empty() }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:75:39
|
@ -367,12 +343,6 @@ LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:108:1
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:108:36
|
@ -381,14 +351,38 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:113:1
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:62:42
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { iter::empty() }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:113:36
--> $DIR/duplicate.rs:64:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { iter::empty() }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:66:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { iter::empty() }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:108:51
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:111:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -396,13 +390,13 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:118:1
--> $DIR/duplicate.rs:111:51
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:118:39
--> $DIR/duplicate.rs:114:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -410,13 +404,19 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:123:1
--> $DIR/duplicate.rs:114:57
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:117:14
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:123:40
--> $DIR/duplicate.rs:117:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -424,13 +424,13 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:128:1
--> $DIR/duplicate.rs:122:14
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:128:40
--> $DIR/duplicate.rs:122:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -438,13 +438,13 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:133:1
--> $DIR/duplicate.rs:127:14
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:133:43
--> $DIR/duplicate.rs:127:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -452,7 +452,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:139:36
--> $DIR/duplicate.rs:133:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -460,7 +460,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:141:36
--> $DIR/duplicate.rs:135:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -468,7 +468,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:143:39
--> $DIR/duplicate.rs:137:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -476,7 +476,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:145:34
--> $DIR/duplicate.rs:139:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -484,7 +484,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:147:34
--> $DIR/duplicate.rs:141:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -492,7 +492,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:149:37
--> $DIR/duplicate.rs:143:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -500,7 +500,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:151:45
--> $DIR/duplicate.rs:145:45
|
LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -508,7 +508,7 @@ LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:153:45
--> $DIR/duplicate.rs:147:45
|
LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -516,7 +516,7 @@ LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:155:48
--> $DIR/duplicate.rs:149:48
|
LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -524,7 +524,7 @@ LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:157:46
--> $DIR/duplicate.rs:151:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -532,7 +532,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:157:46
--> $DIR/duplicate.rs:151:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -540,7 +540,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:160:46
--> $DIR/duplicate.rs:154:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -548,7 +548,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:160:46
--> $DIR/duplicate.rs:154:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -556,7 +556,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:163:49
--> $DIR/duplicate.rs:157:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -564,7 +564,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:163:49
--> $DIR/duplicate.rs:157:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -572,7 +572,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:166:43
--> $DIR/duplicate.rs:160:43
|
LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -580,7 +580,7 @@ LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:168:43
--> $DIR/duplicate.rs:162:43
|
LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -588,7 +588,7 @@ LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:170:46
--> $DIR/duplicate.rs:164:46
|
LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -596,7 +596,7 @@ LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:173:40
--> $DIR/duplicate.rs:167:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -604,7 +604,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:177:44
--> $DIR/duplicate.rs:171:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here
@ -612,7 +612,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:181:43
--> $DIR/duplicate.rs:175:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -620,113 +620,77 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:108:24
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:108:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:113:24
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:113:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:118:24
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:118:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:123:28
--> $DIR/duplicate.rs:117:28
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:123:40
--> $DIR/duplicate.rs:117:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:128:28
--> $DIR/duplicate.rs:122:28
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:128:40
--> $DIR/duplicate.rs:122:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:133:28
--> $DIR/duplicate.rs:127:28
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:133:43
--> $DIR/duplicate.rs:127:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:173:28
--> $DIR/duplicate.rs:167:28
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:173:40
--> $DIR/duplicate.rs:167:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:177:32
--> $DIR/duplicate.rs:171:32
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:177:44
--> $DIR/duplicate.rs:171:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:181:28
--> $DIR/duplicate.rs:175:28
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/duplicate.rs:181:43
--> $DIR/duplicate.rs:175:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^
error: aborting due to 96 previous errors; 1 warning emitted
error: aborting due to 90 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0719`.

View File

@ -9,10 +9,14 @@ trait Bar {
impl Bar for () {
type Baa = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
fn define() -> Self::Baa { 0 }
fn define() -> Self::Baa {
0
}
}
fn define() -> Foo { 0 }
fn define() -> Foo {
0
}
trait TraitWithDefault {
type Assoc = impl Debug;
@ -26,20 +30,20 @@ type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
fn define_multiple() -> NestedFree {
(vec![true], 0u8, 0i32..1)
}
impl Bar for u8 {
type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
//~^ ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` in type aliases is unstable
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
//~| ERROR `impl Trait` not allowed outside of function
fn define() -> Self::Baa { (vec![true], 0u8, 0i32..1) }
fn define() -> Self::Baa {
(vec![true], 0u8, 0i32..1)
}
}
fn main() {}

View File

@ -17,7 +17,7 @@ LL | type Baa = impl Debug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: associated type defaults are unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:5
--> $DIR/feature-gate-type_alias_impl_trait.rs:22:5
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -26,7 +26,7 @@ LL | type Assoc = impl Debug;
= help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
--> $DIR/feature-gate-type_alias_impl_trait.rs:22:18
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^
@ -35,7 +35,7 @@ LL | type Assoc = impl Debug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:24
--> $DIR/feature-gate-type_alias_impl_trait.rs:28:24
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
@ -44,7 +44,7 @@ LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl D
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:37
--> $DIR/feature-gate-type_alias_impl_trait.rs:28:37
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
@ -53,7 +53,7 @@ LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl D
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:49
--> $DIR/feature-gate-type_alias_impl_trait.rs:28:49
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -62,7 +62,7 @@ LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl D
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:70
--> $DIR/feature-gate-type_alias_impl_trait.rs:28:70
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
@ -71,84 +71,48 @@ LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl D
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:21
--> $DIR/feature-gate-type_alias_impl_trait.rs:39:21
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
| ^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:34
--> $DIR/feature-gate-type_alias_impl_trait.rs:39:34
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
| ^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:46
--> $DIR/feature-gate-type_alias_impl_trait.rs:39:46
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:67
--> $DIR/feature-gate-type_alias_impl_trait.rs:39:67
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
| ^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:18:18
--> $DIR/feature-gate-type_alias_impl_trait.rs:22:18
|
LL | type Assoc = impl Debug;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:24
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:37
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:24:49
|
LL | type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:21
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:34
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-type_alias_impl_trait.rs:34:46
|
LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 19 previous errors
error: aborting due to 13 previous errors
Some errors have detailed explanations: E0562, E0658.
For more information about an error, try `rustc --explain E0562`.

View File

@ -2,22 +2,24 @@
// the purposes of coherence checking
#![feature(type_alias_impl_trait)]
trait OpaqueTrait { }
impl<T> OpaqueTrait for T { }
trait OpaqueTrait {}
impl<T> OpaqueTrait for T {}
type OpaqueType = impl OpaqueTrait;
fn mk_opaque() -> OpaqueType { () }
fn mk_opaque() -> OpaqueType {
()
}
#[derive(Debug)]
struct D<T>(T);
trait AnotherTrait { }
impl<T: Send> AnotherTrait for T { }
trait AnotherTrait {}
impl<T: Send> AnotherTrait for T {}
// This is in error, because we cannot assume that `OpaqueType: !Send`.
// (We treat opaque types as "foreign types" that could grow more impls
// in the future.)
impl AnotherTrait for D<OpaqueType> {
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`
}
fn main() {}

View File

@ -1,11 +1,11 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`:
--> $DIR/auto-trait.rs:19:1
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`:
--> $DIR/auto-trait.rs:21:1
|
LL | impl<T: Send> AnotherTrait for T { }
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<impl OpaqueTrait>`
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0277]: the trait bound `S: std::marker::Copy` is not satisfied in `(S, T)`
--> $DIR/issue-55872-1.rs:12:5
--> $DIR/issue-55872-1.rs:12:14
|
LL | type E = impl Copy;
| ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S`
| ^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S`
|
= note: required because it appears within the type `(S, T)`
= note: the return type of a function must have a statically known size
@ -12,10 +12,10 @@ LL | impl<S: Default + std::marker::Copy> Bar for S {
| ^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T)`
--> $DIR/issue-55872-1.rs:12:5
--> $DIR/issue-55872-1.rs:12:14
|
LL | type E = impl Copy;
| ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T`
| ^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T`
|
= note: required because it appears within the type `(S, T)`
= note: the return type of a function must have a statically known size

View File

@ -1,8 +1,8 @@
error[E0277]: the trait bound `impl std::future::Future: std::marker::Copy` is not satisfied
--> $DIR/issue-55872-2.rs:13:5
--> $DIR/issue-55872-2.rs:13:14
|
LL | type E = impl Copy;
| ^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `impl std::future::Future`
| ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `impl std::future::Future`
|
= note: the return type of a function must have a statically known size

View File

@ -2,21 +2,22 @@
// other trait
#![feature(type_alias_impl_trait)]
trait OpaqueTrait { }
impl<T> OpaqueTrait for T { }
trait OpaqueTrait {}
impl<T> OpaqueTrait for T {}
type OpaqueType = impl OpaqueTrait;
fn mk_opaque() -> OpaqueType { () }
fn mk_opaque() -> OpaqueType {
()
}
#[derive(Debug)]
struct D<T>(T);
trait AnotherTrait { }
impl<T: std::fmt::Debug> AnotherTrait for T { }
trait AnotherTrait {}
impl<T: std::fmt::Debug> AnotherTrait for T {}
// This is in error, because we cannot assume that `OpaqueType: !Debug`
impl AnotherTrait for D<OpaqueType> {
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`
}
fn main() {}

View File

@ -1,13 +1,13 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`:
--> $DIR/negative-reasoning.rs:18:1
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`:
--> $DIR/negative-reasoning.rs:19:1
|
LL | impl<T: std::fmt::Debug> AnotherTrait for T { }
LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
| ------------------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<impl OpaqueTrait>`
|
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `impl OpaqueTrait` in future versions
error: aborting due to previous error

View File

@ -256,16 +256,16 @@ LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
error: could not find defining uses
--> $DIR/where-allowed.rs:155:1
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not find defining uses
--> $DIR/where-allowed.rs:119:5
--> $DIR/where-allowed.rs:119:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^
error: could not find defining uses
--> $DIR/where-allowed.rs:155:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
error: aborting due to 42 previous errors

View File

@ -10,5 +10,5 @@ extern crate std;
trait Animal { }
fn main() {
pub type ServeFut = impl Animal;
pub type ServeFut = /*impl Trait*/;
}

View File

@ -62,10 +62,10 @@ LL | type U = impl Trait;
| -------------------- not a function or closure
error: could not find defining uses
--> $DIR/inline-trait-and-foreign-items.rs:26:5
--> $DIR/inline-trait-and-foreign-items.rs:26:14
|
LL | type U = impl Trait;
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^
error: aborting due to 6 previous errors; 2 warnings emitted

View File

@ -1,5 +1,4 @@
#![feature(type_alias_impl_trait)]
#![deny(improper_ctypes)]
type A = impl Fn();
@ -10,7 +9,7 @@ pub fn ret_closure() -> A {
extern "C" {
pub fn a(_: A);
//~^ ERROR `extern` block uses type `A`, which is not FFI-safe
//~^ ERROR `extern` block uses type `impl std::ops::Fn<()>`, which is not FFI-safe
}
fn main() {}

View File

@ -1,11 +1,11 @@
error: `extern` block uses type `A`, which is not FFI-safe
--> $DIR/opaque-ty-ffi-unsafe.rs:12:17
error: `extern` block uses type `impl std::ops::Fn<()>`, which is not FFI-safe
--> $DIR/opaque-ty-ffi-unsafe.rs:11:17
|
LL | pub fn a(_: A);
| ^ not FFI-safe
|
note: the lint level is defined here
--> $DIR/opaque-ty-ffi-unsafe.rs:3:9
--> $DIR/opaque-ty-ffi-unsafe.rs:2:9
|
LL | #![deny(improper_ctypes)]
| ^^^^^^^^^^^^^^^

View File

@ -9,7 +9,9 @@ mod m {
trait PrivTr {}
impl PrivTr for Priv {}
pub trait PubTrAux1<T> {}
pub trait PubTrAux2 { type A; }
pub trait PubTrAux2 {
type A;
}
impl<T> PubTrAux1<T> for u8 {}
impl PubTrAux2 for u8 {
type A = Priv;
@ -41,8 +43,9 @@ mod m {
type Exist = impl PrivTr;
//~^ ERROR private trait `m::PrivTr` in public interface
//~| ERROR private trait `m::PrivTr` in public interface
fn infer_exist() -> Self::Exist { Priv }
fn infer_exist() -> Self::Exist {
Priv
}
}
}

View File

@ -1,5 +1,5 @@
error[E0446]: private type `m::Priv` in public interface
--> $DIR/private-in-public-assoc-ty.rs:15:9
--> $DIR/private-in-public-assoc-ty.rs:17:9
|
LL | struct Priv;
| - `m::Priv` declared as private
@ -8,7 +8,7 @@ LL | type A = Priv;
| ^^^^^^^^^^^^^^ can't leak private type
warning: private trait `m::PrivTr` in public interface (error E0445)
--> $DIR/private-in-public-assoc-ty.rs:21:5
--> $DIR/private-in-public-assoc-ty.rs:23:5
|
LL | / pub trait PubTr {
LL | |
@ -24,7 +24,7 @@ LL | | }
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
warning: private type `m::Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:21:5
--> $DIR/private-in-public-assoc-ty.rs:23:5
|
LL | / pub trait PubTr {
LL | |
@ -39,7 +39,7 @@ LL | | }
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
warning: private type `m::Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:21:5
--> $DIR/private-in-public-assoc-ty.rs:23:5
|
LL | / pub trait PubTr {
LL | |
@ -54,7 +54,7 @@ LL | | }
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
error[E0446]: private type `m::Priv` in public interface
--> $DIR/private-in-public-assoc-ty.rs:32:9
--> $DIR/private-in-public-assoc-ty.rs:34:9
|
LL | struct Priv;
| - `m::Priv` declared as private
@ -63,7 +63,7 @@ LL | type Alias4 = Priv;
| ^^^^^^^^^^^^^^^^^^^ can't leak private type
error[E0446]: private type `m::Priv` in public interface
--> $DIR/private-in-public-assoc-ty.rs:39:9
--> $DIR/private-in-public-assoc-ty.rs:41:9
|
LL | struct Priv;
| - `m::Priv` declared as private
@ -72,7 +72,7 @@ LL | type Alias1 = Priv;
| ^^^^^^^^^^^^^^^^^^^ can't leak private type
error[E0445]: private trait `m::PrivTr` in public interface
--> $DIR/private-in-public-assoc-ty.rs:42:9
--> $DIR/private-in-public-assoc-ty.rs:44:9
|
LL | trait PrivTr {}
| - `m::PrivTr` declared as private
@ -80,16 +80,7 @@ LL | trait PrivTr {}
LL | type Exist = impl PrivTr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
error[E0445]: private trait `m::PrivTr` in public interface
--> $DIR/private-in-public-assoc-ty.rs:42:9
|
LL | trait PrivTr {}
| - `m::PrivTr` declared as private
...
LL | type Exist = impl PrivTr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
error: aborting due to 5 previous errors; 3 warnings emitted
error: aborting due to 4 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0445, E0446.
For more information about an error, try `rustc --explain E0445`.

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/issue-68621.rs:14:5
--> $DIR/issue-68621.rs:14:19
|
LL | type Future = impl Trait;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: TraitWithAssoc` is not satisfied
--> $DIR/bound_reduction2.rs:10:1
--> $DIR/bound_reduction2.rs:10:15
|
LL | type Foo<V> = impl Trait<V>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitWithAssoc` is not implemented for `T`
| ^^^^^^^^^^^^^ the trait `TraitWithAssoc` is not implemented for `T`
|
help: consider further restricting this bound
|

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/declared_but_never_defined.rs:6:1
--> $DIR/declared_but_never_defined.rs:6:12
|
LL | type Bar = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/declared_but_not_defined_in_scope.rs:7:5
--> $DIR/declared_but_not_defined_in_scope.rs:7:20
|
LL | pub type Boo = impl ::std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -13,16 +13,16 @@ LL | let z: i32 = x;
| expected due to this
...
LL | type WrongGeneric<T> = impl 'static;
| ------------------------------------ the found opaque type
| ------------ the found opaque type
|
= note: expected type `i32`
found opaque type `WrongGeneric::<&{integer}>`
found opaque type `impl Sized`
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:9:1
--> $DIR/generic_type_does_not_live_long_enough.rs:9:24
|
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
...
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
| - help: consider adding an explicit lifetime bound...: `T: 'static`

View File

@ -5,10 +5,10 @@ LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^^^^^^
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/generic_underconstrained.rs:6:1
--> $DIR/generic_underconstrained.rs:6:35
|
LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
| ^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
= note: the return type of a function must have a statically known size
help: consider restricting type parameter `T`

View File

@ -11,10 +11,10 @@ LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^
error[E0277]: `U` doesn't implement `std::fmt::Debug`
--> $DIR/generic_underconstrained2.rs:5:1
--> $DIR/generic_underconstrained2.rs:5:45
|
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
| ^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
...
LL | 5u32
| ---- this returned value is of type `u32`
@ -27,10 +27,10 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| ^^^^^^^^^^^^^^^^^
error[E0277]: `V` doesn't implement `std::fmt::Debug`
--> $DIR/generic_underconstrained2.rs:14:1
--> $DIR/generic_underconstrained2.rs:14:46
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
| ^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
...
LL | 5u32
| ---- this returned value is of type `u32`

View File

@ -1,8 +1,8 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/issue-57611-trait-alias.rs:17:5
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `for<'r> fn(&'r X) -> _`
| ^^^^^^^^^^^^^^^^^^^^ expected signature of `for<'r> fn(&'r X) -> _`
...
LL | |x| x
| ----- found signature of `fn(_) -> _`
@ -10,10 +10,10 @@ LL | |x| x
= note: the return type of a function must have a statically known size
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-57611-trait-alias.rs:21:9: 21:14] as std::ops::FnOnce<(&'r X,)>>::Output == &'r X`
--> $DIR/issue-57611-trait-alias.rs:17:5
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter, found concrete lifetime
| ^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter, found concrete lifetime
|
= note: the return type of a function must have a statically known size

View File

@ -8,20 +8,20 @@ LL | type Item = impl Bug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0277]: the trait bound `(): Bug` is not satisfied
--> $DIR/issue-60371.rs:8:5
--> $DIR/issue-60371.rs:8:17
|
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
| ^^^^^^^^ the trait `Bug` is not implemented for `()`
|
= help: the following implementations were found:
<&() as Bug>
= note: the return type of a function must have a statically known size
error: could not find defining uses
--> $DIR/issue-60371.rs:8:5
--> $DIR/issue-60371.rs:8:17
|
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,10 +1,10 @@
error[E0271]: type mismatch resolving `<[closure@$DIR/issue-63279.rs:8:5: 8:28] as std::ops::FnOnce<()>>::Output == ()`
--> $DIR/issue-63279.rs:5:1
--> $DIR/issue-63279.rs:5:16
|
LL | type Closure = impl FnOnce();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found `()`
| ^^^^^^^^^^^^^ expected opaque type, found `()`
|
= note: expected opaque type `Closure`
= note: expected opaque type `impl std::ops::FnOnce<()>`
found unit type `()`
= note: the return type of a function must have a statically known size

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/never_reveal_concrete_type.rs:13:27
|
LL | type NoReveal = impl std::fmt::Debug;
| ------------------------------------- the found opaque type
| -------------------- the found opaque type
...
LL | let _: &'static str = x;
| ------------ ^ expected `&str`, found opaque type
@ -10,9 +10,9 @@ LL | let _: &'static str = x;
| expected due to this
|
= note: expected reference `&'static str`
found opaque type `NoReveal`
found opaque type `impl std::fmt::Debug`
error[E0605]: non-primitive cast: `NoReveal` as `&'static str`
error[E0605]: non-primitive cast: `impl std::fmt::Debug` as `&'static str`
--> $DIR/never_reveal_concrete_type.rs:14:13
|
LL | let _ = x as &'static str;

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/no_inferrable_concrete_type.rs:6:1
--> $DIR/no_inferrable_concrete_type.rs:6:12
|
LL | type Foo = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/no_revealing_outside_defining_module.rs:15:19
|
LL | pub type Boo = impl ::std::fmt::Debug;
| -------------------------------------- the found opaque type
| ---------------------- the found opaque type
...
LL | let _: &str = bomp();
| ---- ^^^^^^ expected `&str`, found opaque type
@ -10,20 +10,20 @@ LL | let _: &str = bomp();
| expected due to this
|
= note: expected reference `&str`
found opaque type `Boo`
found opaque type `impl std::fmt::Debug`
error[E0308]: mismatched types
--> $DIR/no_revealing_outside_defining_module.rs:19:5
|
LL | pub type Boo = impl ::std::fmt::Debug;
| -------------------------------------- the expected opaque type
| ---------------------- the expected opaque type
...
LL | fn bomp() -> boo::Boo {
| -------- expected `Boo` because of return type
| -------- expected `impl std::fmt::Debug` because of return type
LL | ""
| ^^ expected opaque type, found `&str`
|
= note: expected opaque type `Boo`
= note: expected opaque type `impl std::fmt::Debug`
found reference `&'static str`
error: aborting due to 2 previous errors

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/type-alias-impl-trait-with-cycle-error.rs:3:1
--> $DIR/type-alias-impl-trait-with-cycle-error.rs:3:12
|
LL | type Foo = impl Fn() -> Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/type-alias-impl-trait-with-cycle-error2.rs:7:1
--> $DIR/type-alias-impl-trait-with-cycle-error2.rs:7:12
|
LL | type Foo = impl Bar<Foo, Item = Foo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error