Auto merge of #147235 - matthiaskrgr:rollup-a0es1x9, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#146593 (Allow specifying multiple bounds for same associated item, except in trait objects) - rust-lang/rust#147177 ([DebugInfo] Fix MSVC tuple child creation) - rust-lang/rust#147195 (iter repeat: add tests for new count and last behavior) - rust-lang/rust#147202 (Swap order of `resolve_coroutine_interiors` and `handle_opaque_type_uses`) - rust-lang/rust#147204 (Refactor ArrayWindows to use a slice) - rust-lang/rust#147219 (Add proper error handling for closure in impl) - rust-lang/rust#147226 (include `outer_inclusive_binder` of pattern types) - rust-lang/rust#147230 (Fix typo in 'unfulfilled_lint_expectation' to plural) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
An associated type value was specified more than once.
|
An associated item was specified more than once in a trait object.
|
||||||
|
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
@@ -7,21 +7,15 @@ trait FooTrait {}
|
|||||||
trait BarTrait {}
|
trait BarTrait {}
|
||||||
|
|
||||||
// error: associated type `Item` in trait `Iterator` is specified twice
|
// error: associated type `Item` in trait `Iterator` is specified twice
|
||||||
struct Foo<T: Iterator<Item: FooTrait, Item: BarTrait>> { f: T }
|
type Foo = dyn Iterator<Item = u32, Item = u32>;
|
||||||
```
|
```
|
||||||
|
|
||||||
`Item` in trait `Iterator` cannot be specified multiple times for struct `Foo`.
|
To fix this, remove the duplicate specifier:
|
||||||
To fix this, create a new trait that is a combination of the desired traits and
|
|
||||||
specify the associated type with the new trait.
|
|
||||||
|
|
||||||
Corrected example:
|
Corrected example:
|
||||||
|
|
||||||
```
|
```
|
||||||
trait FooTrait {}
|
type Foo = dyn Iterator<Item = u32>; // ok!
|
||||||
trait BarTrait {}
|
|
||||||
trait FooBarTrait: FooTrait + BarTrait {}
|
|
||||||
|
|
||||||
struct Foo<T: Iterator<Item: FooBarTrait>> { f: T } // ok!
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information about associated types, see [the book][bk-at]. For more
|
For more information about associated types, see [the book][bk-at]. For more
|
||||||
|
|||||||
@@ -195,11 +195,10 @@ impl<'tcx> InherentCollect<'tcx> {
|
|||||||
| ty::Closure(..)
|
| ty::Closure(..)
|
||||||
| ty::CoroutineClosure(..)
|
| ty::CoroutineClosure(..)
|
||||||
| ty::Coroutine(..)
|
| ty::Coroutine(..)
|
||||||
| ty::CoroutineWitness(..)
|
| ty::CoroutineWitness(..) => {
|
||||||
| ty::Alias(ty::Free, _)
|
Err(self.tcx.dcx().delayed_bug("cannot define inherent `impl` for closure types"))
|
||||||
| ty::Bound(..)
|
}
|
||||||
| ty::Placeholder(_)
|
ty::Alias(ty::Free, _) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) => {
|
||||||
| ty::Infer(_) => {
|
|
||||||
bug!("unexpected impl self type of impl: {:?} {:?}", id, self_ty);
|
bug!("unexpected impl self type of impl: {:?} {:?}", id, self_ty);
|
||||||
}
|
}
|
||||||
// We could bail out here, but that will silence other useful errors.
|
// We could bail out here, but that will silence other useful errors.
|
||||||
|
|||||||
@@ -230,10 +230,12 @@ pub(crate) fn orphan_check_impl(
|
|||||||
ty::Closure(..)
|
ty::Closure(..)
|
||||||
| ty::CoroutineClosure(..)
|
| ty::CoroutineClosure(..)
|
||||||
| ty::Coroutine(..)
|
| ty::Coroutine(..)
|
||||||
| ty::CoroutineWitness(..)
|
| ty::CoroutineWitness(..) => {
|
||||||
| ty::Bound(..)
|
return Err(tcx
|
||||||
| ty::Placeholder(..)
|
.dcx()
|
||||||
| ty::Infer(..) => {
|
.delayed_bug("cannot define inherent `impl` for closure types"));
|
||||||
|
}
|
||||||
|
ty::Bound(..) | ty::Placeholder(..) | ty::Infer(..) => {
|
||||||
let sp = tcx.def_span(impl_def_id);
|
let sp = tcx.def_span(impl_def_id);
|
||||||
span_bug!(sp, "weird self type for autotrait impl")
|
span_bug!(sp, "weird self type for autotrait impl")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use tracing::{debug, instrument};
|
|||||||
|
|
||||||
use super::ItemCtxt;
|
use super::ItemCtxt;
|
||||||
use super::predicates_of::assert_only_contains_predicates_from;
|
use super::predicates_of::assert_only_contains_predicates_from;
|
||||||
use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter};
|
use crate::hir_ty_lowering::{HirTyLowerer, OverlappingAsssocItemConstraints, PredicateFilter};
|
||||||
|
|
||||||
/// For associated types we include both bounds written on the type
|
/// For associated types we include both bounds written on the type
|
||||||
/// (`type X: Trait`) and predicates from the trait: `where Self::X: Trait`.
|
/// (`type X: Trait`) and predicates from the trait: `where Self::X: Trait`.
|
||||||
@@ -37,7 +37,14 @@ fn associated_type_bounds<'tcx>(
|
|||||||
|
|
||||||
let icx = ItemCtxt::new(tcx, assoc_item_def_id);
|
let icx = ItemCtxt::new(tcx, assoc_item_def_id);
|
||||||
let mut bounds = Vec::new();
|
let mut bounds = Vec::new();
|
||||||
icx.lowerer().lower_bounds(item_ty, hir_bounds, &mut bounds, ty::List::empty(), filter);
|
icx.lowerer().lower_bounds(
|
||||||
|
item_ty,
|
||||||
|
hir_bounds,
|
||||||
|
&mut bounds,
|
||||||
|
ty::List::empty(),
|
||||||
|
filter,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
|
);
|
||||||
|
|
||||||
match filter {
|
match filter {
|
||||||
PredicateFilter::All
|
PredicateFilter::All
|
||||||
@@ -347,7 +354,14 @@ fn opaque_type_bounds<'tcx>(
|
|||||||
ty::print::with_reduced_queries!({
|
ty::print::with_reduced_queries!({
|
||||||
let icx = ItemCtxt::new(tcx, opaque_def_id);
|
let icx = ItemCtxt::new(tcx, opaque_def_id);
|
||||||
let mut bounds = Vec::new();
|
let mut bounds = Vec::new();
|
||||||
icx.lowerer().lower_bounds(item_ty, hir_bounds, &mut bounds, ty::List::empty(), filter);
|
icx.lowerer().lower_bounds(
|
||||||
|
item_ty,
|
||||||
|
hir_bounds,
|
||||||
|
&mut bounds,
|
||||||
|
ty::List::empty(),
|
||||||
|
filter,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
|
);
|
||||||
// Implicit bounds are added to opaque types unless a `?Trait` bound is found
|
// Implicit bounds are added to opaque types unless a `?Trait` bound is found
|
||||||
match filter {
|
match filter {
|
||||||
PredicateFilter::All
|
PredicateFilter::All
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ use super::item_bounds::explicit_item_bounds_with_filter;
|
|||||||
use crate::collect::ItemCtxt;
|
use crate::collect::ItemCtxt;
|
||||||
use crate::constrained_generic_params as cgp;
|
use crate::constrained_generic_params as cgp;
|
||||||
use crate::delegation::inherit_predicates_for_delegation_item;
|
use crate::delegation::inherit_predicates_for_delegation_item;
|
||||||
use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter, RegionInferReason};
|
use crate::hir_ty_lowering::{
|
||||||
|
HirTyLowerer, OverlappingAsssocItemConstraints, PredicateFilter, RegionInferReason,
|
||||||
|
};
|
||||||
|
|
||||||
/// Returns a list of all type predicates (explicit and implicit) for the definition with
|
/// Returns a list of all type predicates (explicit and implicit) for the definition with
|
||||||
/// ID `def_id`. This includes all predicates returned by `explicit_predicates_of`, plus
|
/// ID `def_id`. This includes all predicates returned by `explicit_predicates_of`, plus
|
||||||
@@ -187,6 +189,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
ty::List::empty(),
|
ty::List::empty(),
|
||||||
PredicateFilter::All,
|
PredicateFilter::All,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
icx.lowerer().add_sizedness_bounds(
|
icx.lowerer().add_sizedness_bounds(
|
||||||
&mut bounds,
|
&mut bounds,
|
||||||
@@ -289,6 +292,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
bound_vars,
|
bound_vars,
|
||||||
PredicateFilter::All,
|
PredicateFilter::All,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
predicates.extend(bounds);
|
predicates.extend(bounds);
|
||||||
}
|
}
|
||||||
@@ -659,7 +663,14 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
|
|||||||
|
|
||||||
let self_param_ty = tcx.types.self_param;
|
let self_param_ty = tcx.types.self_param;
|
||||||
let mut bounds = Vec::new();
|
let mut bounds = Vec::new();
|
||||||
icx.lowerer().lower_bounds(self_param_ty, superbounds, &mut bounds, ty::List::empty(), filter);
|
icx.lowerer().lower_bounds(
|
||||||
|
self_param_ty,
|
||||||
|
superbounds,
|
||||||
|
&mut bounds,
|
||||||
|
ty::List::empty(),
|
||||||
|
filter,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
|
);
|
||||||
match filter {
|
match filter {
|
||||||
PredicateFilter::All
|
PredicateFilter::All
|
||||||
| PredicateFilter::SelfOnly
|
| PredicateFilter::SelfOnly
|
||||||
@@ -984,6 +995,7 @@ impl<'tcx> ItemCtxt<'tcx> {
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
bound_vars,
|
bound_vars,
|
||||||
filter,
|
filter,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1063,6 +1075,7 @@ pub(super) fn const_conditions<'tcx>(
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
bound_vars,
|
bound_vars,
|
||||||
PredicateFilter::ConstIfConst,
|
PredicateFilter::ConstIfConst,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@@ -1083,6 +1096,7 @@ pub(super) fn const_conditions<'tcx>(
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
ty::List::empty(),
|
ty::List::empty(),
|
||||||
PredicateFilter::ConstIfConst,
|
PredicateFilter::ConstIfConst,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ use tracing::{debug, instrument};
|
|||||||
use super::errors::GenericsArgsErrExtend;
|
use super::errors::GenericsArgsErrExtend;
|
||||||
use crate::errors;
|
use crate::errors;
|
||||||
use crate::hir_ty_lowering::{
|
use crate::hir_ty_lowering::{
|
||||||
AssocItemQSelf, FeedConstTy, HirTyLowerer, PredicateFilter, RegionInferReason,
|
AssocItemQSelf, FeedConstTy, HirTyLowerer, OverlappingAsssocItemConstraints, PredicateFilter,
|
||||||
|
RegionInferReason,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
@@ -338,6 +339,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
||||||
bound_vars: &'tcx ty::List<ty::BoundVariableKind>,
|
bound_vars: &'tcx ty::List<ty::BoundVariableKind>,
|
||||||
predicate_filter: PredicateFilter,
|
predicate_filter: PredicateFilter,
|
||||||
|
overlapping_assoc_constraints: OverlappingAsssocItemConstraints,
|
||||||
) where
|
) where
|
||||||
'tcx: 'hir,
|
'tcx: 'hir,
|
||||||
{
|
{
|
||||||
@@ -362,6 +364,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
param_ty,
|
param_ty,
|
||||||
bounds,
|
bounds,
|
||||||
predicate_filter,
|
predicate_filter,
|
||||||
|
overlapping_assoc_constraints,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
hir::GenericBound::Outlives(lifetime) => {
|
hir::GenericBound::Outlives(lifetime) => {
|
||||||
@@ -402,7 +405,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
constraint: &hir::AssocItemConstraint<'tcx>,
|
constraint: &hir::AssocItemConstraint<'tcx>,
|
||||||
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
||||||
duplicates: &mut FxIndexMap<DefId, Span>,
|
duplicates: Option<&mut FxIndexMap<DefId, Span>>,
|
||||||
path_span: Span,
|
path_span: Span,
|
||||||
predicate_filter: PredicateFilter,
|
predicate_filter: PredicateFilter,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
@@ -458,17 +461,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
)
|
)
|
||||||
.expect("failed to find associated item");
|
.expect("failed to find associated item");
|
||||||
|
|
||||||
duplicates
|
if let Some(duplicates) = duplicates {
|
||||||
.entry(assoc_item.def_id)
|
duplicates
|
||||||
.and_modify(|prev_span| {
|
.entry(assoc_item.def_id)
|
||||||
self.dcx().emit_err(errors::ValueOfAssociatedStructAlreadySpecified {
|
.and_modify(|prev_span| {
|
||||||
span: constraint.span,
|
self.dcx().emit_err(errors::ValueOfAssociatedStructAlreadySpecified {
|
||||||
prev_span: *prev_span,
|
span: constraint.span,
|
||||||
item_name: constraint.ident,
|
prev_span: *prev_span,
|
||||||
def_path: tcx.def_path_str(assoc_item.container_id(tcx)),
|
item_name: constraint.ident,
|
||||||
});
|
def_path: tcx.def_path_str(assoc_item.container_id(tcx)),
|
||||||
})
|
});
|
||||||
.or_insert(constraint.span);
|
})
|
||||||
|
.or_insert(constraint.span);
|
||||||
|
}
|
||||||
|
|
||||||
let projection_term = if let ty::AssocTag::Fn = assoc_tag {
|
let projection_term = if let ty::AssocTag::Fn = assoc_tag {
|
||||||
let bound_vars = tcx.late_bound_vars(constraint.hir_id);
|
let bound_vars = tcx.late_bound_vars(constraint.hir_id);
|
||||||
@@ -600,6 +605,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
bounds,
|
bounds,
|
||||||
projection_ty.bound_vars(),
|
projection_ty.bound_vars(),
|
||||||
predicate_filter,
|
predicate_filter,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PredicateFilter::SelfOnly
|
PredicateFilter::SelfOnly
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ use tracing::{debug, instrument};
|
|||||||
|
|
||||||
use super::HirTyLowerer;
|
use super::HirTyLowerer;
|
||||||
use crate::errors::SelfInTypeAlias;
|
use crate::errors::SelfInTypeAlias;
|
||||||
use crate::hir_ty_lowering::{GenericArgCountMismatch, PredicateFilter, RegionInferReason};
|
use crate::hir_ty_lowering::{
|
||||||
|
GenericArgCountMismatch, OverlappingAsssocItemConstraints, PredicateFilter, RegionInferReason,
|
||||||
|
};
|
||||||
|
|
||||||
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
/// Lower a trait object type from the HIR to our internal notion of a type.
|
/// Lower a trait object type from the HIR to our internal notion of a type.
|
||||||
@@ -60,6 +62,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
dummy_self,
|
dummy_self,
|
||||||
&mut user_written_bounds,
|
&mut user_written_bounds,
|
||||||
PredicateFilter::SelfOnly,
|
PredicateFilter::SelfOnly,
|
||||||
|
OverlappingAsssocItemConstraints::Forbidden,
|
||||||
);
|
);
|
||||||
if let Err(GenericArgCountMismatch { invalid_args, .. }) = result.correct {
|
if let Err(GenericArgCountMismatch { invalid_args, .. }) = result.correct {
|
||||||
potential_assoc_types.extend(invalid_args);
|
potential_assoc_types.extend(invalid_args);
|
||||||
@@ -157,10 +160,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
self.dcx()
|
self.dcx()
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
span,
|
span,
|
||||||
format!(
|
format!("conflicting associated type bounds for `{item}`"),
|
||||||
"conflicting associated type bounds for `{item}` when \
|
|
||||||
expanding trait alias"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.with_span_label(
|
.with_span_label(
|
||||||
old_proj_span,
|
old_proj_span,
|
||||||
|
|||||||
@@ -332,6 +332,15 @@ pub(crate) enum GenericArgPosition {
|
|||||||
MethodCall,
|
MethodCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether to allow duplicate associated iten constraints in a trait ref, e.g.
|
||||||
|
/// `Trait<Assoc = Ty, Assoc = Ty>`. This is forbidden in `dyn Trait<...>`
|
||||||
|
/// but allowed everywhere else.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub(crate) enum OverlappingAsssocItemConstraints {
|
||||||
|
Allowed,
|
||||||
|
Forbidden,
|
||||||
|
}
|
||||||
|
|
||||||
/// A marker denoting that the generic arguments that were
|
/// A marker denoting that the generic arguments that were
|
||||||
/// provided did not match the respective generic parameters.
|
/// provided did not match the respective generic parameters.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -752,6 +761,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
self_ty: Ty<'tcx>,
|
self_ty: Ty<'tcx>,
|
||||||
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
|
||||||
predicate_filter: PredicateFilter,
|
predicate_filter: PredicateFilter,
|
||||||
|
overlapping_assoc_item_constraints: OverlappingAsssocItemConstraints,
|
||||||
) -> GenericArgCountResult {
|
) -> GenericArgCountResult {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
|
||||||
@@ -908,7 +918,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dup_constraints = FxIndexMap::default();
|
let mut dup_constraints = (overlapping_assoc_item_constraints
|
||||||
|
== OverlappingAsssocItemConstraints::Forbidden)
|
||||||
|
.then_some(FxIndexMap::default());
|
||||||
|
|
||||||
for constraint in trait_segment.args().constraints {
|
for constraint in trait_segment.args().constraints {
|
||||||
// Don't register any associated item constraints for negative bounds,
|
// Don't register any associated item constraints for negative bounds,
|
||||||
// since we should have emitted an error for them earlier, and they
|
// since we should have emitted an error for them earlier, and they
|
||||||
@@ -927,7 +940,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
poly_trait_ref,
|
poly_trait_ref,
|
||||||
constraint,
|
constraint,
|
||||||
bounds,
|
bounds,
|
||||||
&mut dup_constraints,
|
dup_constraints.as_mut(),
|
||||||
constraint.span,
|
constraint.span,
|
||||||
predicate_filter,
|
predicate_filter,
|
||||||
);
|
);
|
||||||
@@ -2484,6 +2497,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||||||
&mut bounds,
|
&mut bounds,
|
||||||
ty::List::empty(),
|
ty::List::empty(),
|
||||||
PredicateFilter::All,
|
PredicateFilter::All,
|
||||||
|
OverlappingAsssocItemConstraints::Allowed,
|
||||||
);
|
);
|
||||||
self.add_sizedness_bounds(
|
self.add_sizedness_bounds(
|
||||||
&mut bounds,
|
&mut bounds,
|
||||||
|
|||||||
@@ -611,19 +611,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
typeck_results.rvalue_scopes = rvalue_scopes;
|
typeck_results.rvalue_scopes = rvalue_scopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unify the inference variables corresponding to coroutine witnesses, and save all the
|
/// Drain all obligations that are stalled on coroutines defined in this body.
|
||||||
/// predicates that were stalled on those inference variables.
|
|
||||||
///
|
|
||||||
/// This process allows to conservatively save all predicates that do depend on the coroutine
|
|
||||||
/// interior types, for later processing by `check_coroutine_obligations`.
|
|
||||||
///
|
|
||||||
/// We must not attempt to select obligations after this method has run, or risk query cycle
|
|
||||||
/// ICE.
|
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub(crate) fn resolve_coroutine_interiors(&self) {
|
pub(crate) fn drain_stalled_coroutine_obligations(&self) {
|
||||||
// Try selecting all obligations that are not blocked on inference variables.
|
// Make as much inference progress as possible before
|
||||||
// Once we start unifying coroutine witnesses, trying to select obligations on them will
|
// draining the stalled coroutine obligations as this may
|
||||||
// trigger query cycle ICEs, as doing so requires MIR.
|
// change obligations from being stalled on infer vars to
|
||||||
|
// being stalled on a coroutine.
|
||||||
self.select_obligations_where_possible(|_| {});
|
self.select_obligations_where_possible(|_| {});
|
||||||
|
|
||||||
let ty::TypingMode::Analysis { defining_opaque_types_and_generators } = self.typing_mode()
|
let ty::TypingMode::Analysis { defining_opaque_types_and_generators } = self.typing_mode()
|
||||||
|
|||||||
@@ -243,18 +243,15 @@ fn typeck_with_inspect<'tcx>(
|
|||||||
|
|
||||||
debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
|
debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
|
||||||
|
|
||||||
// This must be the last thing before `report_ambiguity_errors`.
|
|
||||||
fcx.resolve_coroutine_interiors();
|
|
||||||
|
|
||||||
debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
|
|
||||||
|
|
||||||
// We need to handle opaque types before emitting ambiguity errors as applying
|
// We need to handle opaque types before emitting ambiguity errors as applying
|
||||||
// defining uses may guide type inference.
|
// defining uses may guide type inference.
|
||||||
if fcx.next_trait_solver() {
|
if fcx.next_trait_solver() {
|
||||||
fcx.handle_opaque_type_uses_next();
|
fcx.handle_opaque_type_uses_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
fcx.select_obligations_where_possible(|_| {});
|
// This must be the last thing before `report_ambiguity_errors` below except `select_obligations_where_possible`.
|
||||||
|
// So don't put anything after this.
|
||||||
|
fcx.drain_stalled_coroutine_obligations();
|
||||||
if fcx.infcx.tainted_by_errors().is_none() {
|
if fcx.infcx.tainted_by_errors().is_none() {
|
||||||
fcx.report_ambiguity_errors();
|
fcx.report_ambiguity_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,6 +347,7 @@ impl<I: Interner> FlagComputation<I> {
|
|||||||
|
|
||||||
fn add_ty_pat(&mut self, pat: <I as Interner>::Pat) {
|
fn add_ty_pat(&mut self, pat: <I as Interner>::Pat) {
|
||||||
self.add_flags(pat.flags());
|
self.add_flags(pat.flags());
|
||||||
|
self.add_exclusive_binder(pat.outer_exclusive_binder());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_predicate(&mut self, binder: ty::Binder<I, ty::PredicateKind<I>>) {
|
fn add_predicate(&mut self, binder: ty::Binder<I, ty::PredicateKind<I>>) {
|
||||||
|
|||||||
@@ -2203,16 +2203,13 @@ unsafe impl<T> Sync for ChunksExactMut<'_, T> where T: Sync {}
|
|||||||
#[unstable(feature = "array_windows", issue = "75027")]
|
#[unstable(feature = "array_windows", issue = "75027")]
|
||||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||||
pub struct ArrayWindows<'a, T: 'a, const N: usize> {
|
pub struct ArrayWindows<'a, T: 'a, const N: usize> {
|
||||||
slice_head: *const T,
|
v: &'a [T],
|
||||||
num: usize,
|
|
||||||
marker: PhantomData<&'a [T; N]>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: 'a, const N: usize> ArrayWindows<'a, T, N> {
|
impl<'a, T: 'a, const N: usize> ArrayWindows<'a, T, N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(super) const fn new(slice: &'a [T]) -> Self {
|
pub(super) const fn new(slice: &'a [T]) -> Self {
|
||||||
let num_windows = slice.len().saturating_sub(N - 1);
|
Self { v: slice }
|
||||||
Self { slice_head: slice.as_ptr(), num: num_windows, marker: PhantomData }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2222,49 +2219,34 @@ impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N> {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
if self.num == 0 {
|
let ret = self.v.first_chunk();
|
||||||
return None;
|
if ret.is_some() {
|
||||||
|
self.v = &self.v[1..];
|
||||||
}
|
}
|
||||||
// SAFETY:
|
ret
|
||||||
// This is safe because it's indexing into a slice guaranteed to be length > N.
|
|
||||||
let ret = unsafe { &*self.slice_head.cast::<[T; N]>() };
|
|
||||||
// SAFETY: Guaranteed that there are at least 1 item remaining otherwise
|
|
||||||
// earlier branch would've been hit
|
|
||||||
self.slice_head = unsafe { self.slice_head.add(1) };
|
|
||||||
|
|
||||||
self.num -= 1;
|
|
||||||
Some(ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
(self.num, Some(self.num))
|
let size = self.v.len().saturating_sub(N - 1);
|
||||||
|
(size, Some(size))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn count(self) -> usize {
|
fn count(self) -> usize {
|
||||||
self.num
|
self.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||||
if self.num <= n {
|
let idx = n.min(self.v.len());
|
||||||
self.num = 0;
|
self.v = &self.v[idx..];
|
||||||
return None;
|
self.next()
|
||||||
}
|
|
||||||
// SAFETY:
|
|
||||||
// This is safe because it's indexing into a slice guaranteed to be length > N.
|
|
||||||
let ret = unsafe { &*self.slice_head.add(n).cast::<[T; N]>() };
|
|
||||||
// SAFETY: Guaranteed that there are at least n items remaining
|
|
||||||
self.slice_head = unsafe { self.slice_head.add(n + 1) };
|
|
||||||
|
|
||||||
self.num -= n + 1;
|
|
||||||
Some(ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn last(mut self) -> Option<Self::Item> {
|
fn last(self) -> Option<Self::Item> {
|
||||||
self.nth(self.num.checked_sub(1)?)
|
self.v.last_chunk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2272,32 +2254,25 @@ impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N> {
|
|||||||
impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N> {
|
impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next_back(&mut self) -> Option<&'a [T; N]> {
|
fn next_back(&mut self) -> Option<&'a [T; N]> {
|
||||||
if self.num == 0 {
|
let ret = self.v.last_chunk();
|
||||||
return None;
|
if ret.is_some() {
|
||||||
|
self.v = &self.v[..self.v.len() - 1];
|
||||||
}
|
}
|
||||||
// SAFETY: Guaranteed that there are n items remaining, n-1 for 0-indexing.
|
ret
|
||||||
let ret = unsafe { &*self.slice_head.add(self.num - 1).cast::<[T; N]>() };
|
|
||||||
self.num -= 1;
|
|
||||||
Some(ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn nth_back(&mut self, n: usize) -> Option<&'a [T; N]> {
|
fn nth_back(&mut self, n: usize) -> Option<&'a [T; N]> {
|
||||||
if self.num <= n {
|
let idx = self.v.len().saturating_sub(n);
|
||||||
self.num = 0;
|
self.v = &self.v[..idx];
|
||||||
return None;
|
self.next_back()
|
||||||
}
|
|
||||||
// SAFETY: Guaranteed that there are n items remaining, n-1 for 0-indexing.
|
|
||||||
let ret = unsafe { &*self.slice_head.add(self.num - (n + 1)).cast::<[T; N]>() };
|
|
||||||
self.num -= n + 1;
|
|
||||||
Some(ret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "array_windows", issue = "75027")]
|
#[unstable(feature = "array_windows", issue = "75027")]
|
||||||
impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'_, T, N> {
|
impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'_, T, N> {
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
self.num == 0
|
self.v.len() < N
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ fn test_repeat_take_collect() {
|
|||||||
assert_eq!(v, vec![42, 42, 42]);
|
assert_eq!(v, vec![42, 42, 42]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic = "iterator is infinite"]
|
||||||
|
fn test_repeat_count() {
|
||||||
|
repeat(42).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_repeat_last() {
|
||||||
|
assert_eq!(repeat(42).last(), Some(42));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_repeat_with() {
|
fn test_repeat_with() {
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ talk about later in this section.
|
|||||||
|
|
||||||
Sometimes, it can be helpful to suppress lints, but at the same time ensure that
|
Sometimes, it can be helpful to suppress lints, but at the same time ensure that
|
||||||
the code in question still emits them. The 'expect' level does exactly this. If
|
the code in question still emits them. The 'expect' level does exactly this. If
|
||||||
the lint in question is not emitted, the `unfulfilled_lint_expectation` lint
|
the lint in question is not emitted, the `unfulfilled_lint_expectations` lint
|
||||||
triggers on the `expect` attribute, notifying you that the expectation is no
|
triggers on the `expect` attribute, notifying you that the expectation is no
|
||||||
longer fulfilled.
|
longer fulfilled.
|
||||||
|
|
||||||
|
|||||||
@@ -761,7 +761,8 @@ class MSVCTupleSyntheticProvider:
|
|||||||
|
|
||||||
def get_child_at_index(self, index: int) -> SBValue:
|
def get_child_at_index(self, index: int) -> SBValue:
|
||||||
child: SBValue = self.valobj.GetChildAtIndex(index)
|
child: SBValue = self.valobj.GetChildAtIndex(index)
|
||||||
return child.CreateChildAtOffset(str(index), 0, child.GetType())
|
offset = self.valobj.GetType().GetFieldAtIndex(index).byte_offset
|
||||||
|
return self.valobj.CreateChildAtOffset(str(index), offset, child.GetType())
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
pass
|
pass
|
||||||
@@ -772,7 +773,7 @@ class MSVCTupleSyntheticProvider:
|
|||||||
def get_type_name(self) -> str:
|
def get_type_name(self) -> str:
|
||||||
name = self.valobj.GetTypeName()
|
name = self.valobj.GetTypeName()
|
||||||
# remove "tuple$<" and ">", str.removeprefix and str.removesuffix require python 3.9+
|
# remove "tuple$<" and ">", str.removeprefix and str.removesuffix require python 3.9+
|
||||||
name = name[7:-1]
|
name = name[7:-1].strip()
|
||||||
return "(" + name + ")"
|
return "(" + name + ")"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
114
tests/ui/associated-type-bounds/duplicate-bound-err.rs
Normal file
114
tests/ui/associated-type-bounds/duplicate-bound-err.rs
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
//@ edition: 2024
|
||||||
|
|
||||||
|
#![feature(associated_const_equality, type_alias_impl_trait, return_type_notation)]
|
||||||
|
#![allow(refining_impl_trait_internal)]
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
|
fn rpit1() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
iter::empty()
|
||||||
|
//~^ ERROR type annotations needed
|
||||||
|
}
|
||||||
|
fn rpit2() -> impl Iterator<Item: Copy, Item: Copy> {
|
||||||
|
iter::empty()
|
||||||
|
//~^ ERROR type annotations needed
|
||||||
|
}
|
||||||
|
fn rpit3() -> impl Iterator<Item: 'static, Item: 'static> {
|
||||||
|
iter::empty()
|
||||||
|
//~^ ERROR type annotations needed
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tait1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
type Tait2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
type Tait3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
|
||||||
|
type Tait4 = impl Iterator<Item: Copy, Item: Send>;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
type Tait5 = impl Iterator<Item: Copy, Item: Copy>;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
type Tait6 = impl Iterator<Item: 'static, Item: 'static>;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
|
||||||
|
fn mismatch() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
//~^ ERROR [E0277]
|
||||||
|
iter::empty::<*const ()>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mismatch_2() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
//~^ ERROR [E0277]
|
||||||
|
iter::empty::<String>()
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
|
type Gat<T>;
|
||||||
|
|
||||||
|
const ASSOC: i32;
|
||||||
|
|
||||||
|
fn foo() -> impl Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Trait for () {
|
||||||
|
type Gat<T> = ();
|
||||||
|
|
||||||
|
const ASSOC: i32 = 3;
|
||||||
|
|
||||||
|
fn foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Trait for u32 {
|
||||||
|
type Gat<T> = ();
|
||||||
|
|
||||||
|
const ASSOC: i32 = 4;
|
||||||
|
|
||||||
|
fn foo() -> u32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {}
|
||||||
|
|
||||||
|
fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {}
|
||||||
|
|
||||||
|
fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {}
|
||||||
|
|
||||||
|
type MustFail = dyn Iterator<Item = i32, Item = u32>;
|
||||||
|
//~^ ERROR [E0719]
|
||||||
|
//~| ERROR conflicting associated type bounds
|
||||||
|
|
||||||
|
trait Trait2 {
|
||||||
|
const ASSOC: u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>;
|
||||||
|
//~^ ERROR [E0719]
|
||||||
|
//~| ERROR conflicting associated type bounds
|
||||||
|
|
||||||
|
type MustFail3 = dyn Iterator<Item = i32, Item = i32>;
|
||||||
|
//~^ ERROR [E0719]
|
||||||
|
|
||||||
|
type MustFail4 = dyn Trait2<ASSOC = 3u32, ASSOC = 3u32>;
|
||||||
|
//~^ ERROR [E0719]
|
||||||
|
|
||||||
|
trait Trait3 {
|
||||||
|
fn foo() -> impl Iterator<Item = i32, Item = u32>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Trait3 for () {
|
||||||
|
fn foo() -> impl Iterator<Item = i32, Item = u32> {
|
||||||
|
//~^ ERROR[E0271]
|
||||||
|
//~| ERROR[E0271]
|
||||||
|
[2u32].into_iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
uncallable(iter::empty::<u32>()); //~ ERROR [E0271]
|
||||||
|
uncallable(iter::empty::<i32>()); //~ ERROR [E0271]
|
||||||
|
uncallable_const(()); //~ ERROR [E0271]
|
||||||
|
uncallable_const(4u32); //~ ERROR [E0271]
|
||||||
|
uncallable_rtn(()); //~ ERROR [E0271]
|
||||||
|
uncallable_rtn(17u32); //~ ERROR [E0271]
|
||||||
|
}
|
||||||
268
tests/ui/associated-type-bounds/duplicate-bound-err.stderr
Normal file
268
tests/ui/associated-type-bounds/duplicate-bound-err.stderr
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/duplicate-bound-err.rs:9:5
|
||||||
|
|
|
||||||
|
LL | iter::empty()
|
||||||
|
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
||||||
|
|
|
||||||
|
help: consider specifying the generic argument
|
||||||
|
|
|
||||||
|
LL | iter::empty::<T>()
|
||||||
|
| +++++
|
||||||
|
|
||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/duplicate-bound-err.rs:13:5
|
||||||
|
|
|
||||||
|
LL | iter::empty()
|
||||||
|
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
||||||
|
|
|
||||||
|
help: consider specifying the generic argument
|
||||||
|
|
|
||||||
|
LL | iter::empty::<T>()
|
||||||
|
| +++++
|
||||||
|
|
||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/duplicate-bound-err.rs:17:5
|
||||||
|
|
|
||||||
|
LL | iter::empty()
|
||||||
|
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
||||||
|
|
|
||||||
|
help: consider specifying the generic argument
|
||||||
|
|
|
||||||
|
LL | iter::empty::<T>()
|
||||||
|
| +++++
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:21:51
|
||||||
|
|
|
||||||
|
LL | type Tait1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait1` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:23:51
|
||||||
|
|
|
||||||
|
LL | type Tait2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait2` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:25:57
|
||||||
|
|
|
||||||
|
LL | type Tait3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait3` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:28:14
|
||||||
|
|
|
||||||
|
LL | type Tait4 = impl Iterator<Item: Copy, Item: Send>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait4` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:30:14
|
||||||
|
|
|
||||||
|
LL | type Tait5 = impl Iterator<Item: Copy, Item: Copy>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait5` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/duplicate-bound-err.rs:32:14
|
||||||
|
|
|
||||||
|
LL | type Tait6 = impl Iterator<Item: 'static, Item: 'static>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `Tait6` must be used in combination with a concrete type within the same crate
|
||||||
|
|
||||||
|
error[E0277]: `*const ()` cannot be sent between threads safely
|
||||||
|
--> $DIR/duplicate-bound-err.rs:35:18
|
||||||
|
|
|
||||||
|
LL | fn mismatch() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
||||||
|
LL |
|
||||||
|
LL | iter::empty::<*const ()>()
|
||||||
|
| -------------------------- return type was inferred to be `std::iter::Empty<*const ()>` here
|
||||||
|
|
|
||||||
|
= help: the trait `Send` is not implemented for `*const ()`
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `String: Copy` is not satisfied
|
||||||
|
--> $DIR/duplicate-bound-err.rs:40:20
|
||||||
|
|
|
||||||
|
LL | fn mismatch_2() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
||||||
|
LL |
|
||||||
|
LL | iter::empty::<String>()
|
||||||
|
| ----------------------- return type was inferred to be `std::iter::Empty<String>` here
|
||||||
|
|
||||||
|
error[E0271]: expected `IntoIter<u32, 1>` to be an iterator that yields `i32`, but it yields `u32`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:100:17
|
||||||
|
|
|
||||||
|
LL | fn foo() -> impl Iterator<Item = i32, Item = u32> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
|
||||||
|
...
|
||||||
|
LL | [2u32].into_iter()
|
||||||
|
| ------------------ return type was inferred to be `std::array::IntoIter<u32, 1>` here
|
||||||
|
|
||||||
|
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||||
|
--> $DIR/duplicate-bound-err.rs:77:42
|
||||||
|
|
|
||||||
|
LL | type MustFail = dyn Iterator<Item = i32, Item = u32>;
|
||||||
|
| ---------- ^^^^^^^^^^ re-bound here
|
||||||
|
| |
|
||||||
|
| `Item` bound here first
|
||||||
|
|
||||||
|
error: conflicting associated type bounds for `Item`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:77:17
|
||||||
|
|
|
||||||
|
LL | type MustFail = dyn Iterator<Item = i32, Item = u32>;
|
||||||
|
| ^^^^^^^^^^^^^----------^^----------^
|
||||||
|
| | |
|
||||||
|
| | `Item` is specified to be `u32` here
|
||||||
|
| `Item` is specified to be `i32` here
|
||||||
|
|
||||||
|
error[E0719]: the value of the associated type `ASSOC` in trait `Trait2` is already specified
|
||||||
|
--> $DIR/duplicate-bound-err.rs:85:43
|
||||||
|
|
|
||||||
|
LL | type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>;
|
||||||
|
| ------------ ^^^^^^^^^^^^ re-bound here
|
||||||
|
| |
|
||||||
|
| `ASSOC` bound here first
|
||||||
|
|
||||||
|
error: conflicting associated type bounds for `ASSOC`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:85:18
|
||||||
|
|
|
||||||
|
LL | type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>;
|
||||||
|
| ^^^^^^^^^^^------------^^------------^
|
||||||
|
| | |
|
||||||
|
| | `ASSOC` is specified to be `4` here
|
||||||
|
| `ASSOC` is specified to be `3` here
|
||||||
|
|
||||||
|
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||||
|
--> $DIR/duplicate-bound-err.rs:89:43
|
||||||
|
|
|
||||||
|
LL | type MustFail3 = dyn Iterator<Item = i32, Item = i32>;
|
||||||
|
| ---------- ^^^^^^^^^^ re-bound here
|
||||||
|
| |
|
||||||
|
| `Item` bound here first
|
||||||
|
|
||||||
|
error[E0719]: the value of the associated type `ASSOC` in trait `Trait2` is already specified
|
||||||
|
--> $DIR/duplicate-bound-err.rs:92:43
|
||||||
|
|
|
||||||
|
LL | type MustFail4 = dyn Trait2<ASSOC = 3u32, ASSOC = 3u32>;
|
||||||
|
| ------------ ^^^^^^^^^^^^ re-bound here
|
||||||
|
| |
|
||||||
|
| `ASSOC` bound here first
|
||||||
|
|
||||||
|
error[E0271]: expected `impl Iterator<Item = u32>` to be an iterator that yields `i32`, but it yields `u32`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:100:17
|
||||||
|
|
|
||||||
|
LL | fn foo() -> impl Iterator<Item = i32, Item = u32> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
|
||||||
|
|
|
||||||
|
note: required by a bound in `Trait3::foo::{anon_assoc#0}`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:96:31
|
||||||
|
|
|
||||||
|
LL | fn foo() -> impl Iterator<Item = i32, Item = u32>;
|
||||||
|
| ^^^^^^^^^^ required by this bound in `Trait3::foo::{anon_assoc#0}`
|
||||||
|
|
||||||
|
error[E0271]: expected `Empty<u32>` to be an iterator that yields `i32`, but it yields `u32`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:108:16
|
||||||
|
|
|
||||||
|
LL | uncallable(iter::empty::<u32>());
|
||||||
|
| ---------- ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
note: required by a bound in `uncallable`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:71:32
|
||||||
|
|
|
||||||
|
LL | fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {}
|
||||||
|
| ^^^^^^^^^^ required by this bound in `uncallable`
|
||||||
|
|
||||||
|
error[E0271]: expected `Empty<i32>` to be an iterator that yields `u32`, but it yields `i32`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:109:16
|
||||||
|
|
|
||||||
|
LL | uncallable(iter::empty::<i32>());
|
||||||
|
| ---------- ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
note: required by a bound in `uncallable`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:71:44
|
||||||
|
|
|
||||||
|
LL | fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {}
|
||||||
|
| ^^^^^^^^^^ required by this bound in `uncallable`
|
||||||
|
|
||||||
|
error[E0271]: type mismatch resolving `<() as Trait>::ASSOC == 4`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:110:22
|
||||||
|
|
|
||||||
|
LL | uncallable_const(());
|
||||||
|
| ---------------- ^^ expected `4`, found `3`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= note: expected constant `4`
|
||||||
|
found constant `3`
|
||||||
|
note: required by a bound in `uncallable_const`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:73:46
|
||||||
|
|
|
||||||
|
LL | fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {}
|
||||||
|
| ^^^^^^^^^ required by this bound in `uncallable_const`
|
||||||
|
|
||||||
|
error[E0271]: type mismatch resolving `<u32 as Trait>::ASSOC == 3`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:111:22
|
||||||
|
|
|
||||||
|
LL | uncallable_const(4u32);
|
||||||
|
| ---------------- ^^^^ expected `3`, found `4`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= note: expected constant `3`
|
||||||
|
found constant `4`
|
||||||
|
note: required by a bound in `uncallable_const`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:73:35
|
||||||
|
|
|
||||||
|
LL | fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {}
|
||||||
|
| ^^^^^^^^^ required by this bound in `uncallable_const`
|
||||||
|
|
||||||
|
error[E0271]: type mismatch resolving `<() as Trait>::ASSOC == 4`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:112:20
|
||||||
|
|
|
||||||
|
LL | uncallable_rtn(());
|
||||||
|
| -------------- ^^ expected `4`, found `3`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= note: expected constant `4`
|
||||||
|
found constant `3`
|
||||||
|
note: required by a bound in `uncallable_rtn`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:75:75
|
||||||
|
|
|
||||||
|
LL | fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {}
|
||||||
|
| ^^^^^^^^^ required by this bound in `uncallable_rtn`
|
||||||
|
|
||||||
|
error[E0271]: type mismatch resolving `<u32 as Trait>::ASSOC == 3`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:113:20
|
||||||
|
|
|
||||||
|
LL | uncallable_rtn(17u32);
|
||||||
|
| -------------- ^^^^^ expected `3`, found `4`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= note: expected constant `3`
|
||||||
|
found constant `4`
|
||||||
|
note: required by a bound in `uncallable_rtn`
|
||||||
|
--> $DIR/duplicate-bound-err.rs:75:48
|
||||||
|
|
|
||||||
|
LL | fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {}
|
||||||
|
| ^^^^^^^^^ required by this bound in `uncallable_rtn`
|
||||||
|
|
||||||
|
error: aborting due to 25 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0271, E0277, E0282, E0719.
|
||||||
|
For more information about an error, try `rustc --explain E0271`.
|
||||||
240
tests/ui/associated-type-bounds/duplicate-bound.rs
Normal file
240
tests/ui/associated-type-bounds/duplicate-bound.rs
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
//@ edition: 2024
|
||||||
|
//@ run-pass
|
||||||
|
|
||||||
|
#![feature(associated_const_equality, return_type_notation)]
|
||||||
|
#![allow(dead_code, refining_impl_trait_internal, type_alias_bounds)]
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
use std::mem::ManuallyDrop;
|
||||||
|
|
||||||
|
struct Si1<T: Iterator<Item: Copy, Item: Send>> {
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
struct Si2<T: Iterator<Item: Copy, Item: Copy>> {
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
struct Si3<T: Iterator<Item: 'static, Item: 'static>> {
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
struct Sw1<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
struct Sw2<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
struct Sw3<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Ei1<T: Iterator<Item: Copy, Item: Send>> {
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
enum Ei2<T: Iterator<Item: Copy, Item: Copy>> {
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
enum Ei3<T: Iterator<Item: 'static, Item: 'static>> {
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
enum Ew1<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
enum Ew2<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
enum Ew3<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
V(T),
|
||||||
|
}
|
||||||
|
|
||||||
|
union Ui1<T: Iterator<Item: Copy, Item: Send>> {
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
union Ui2<T: Iterator<Item: Copy, Item: Copy>> {
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
union Ui3<T: Iterator<Item: 'static, Item: 'static>> {
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
union Uw1<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
union Uw2<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
union Uw3<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
f: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fi1<T: Iterator<Item: Copy, Item: Send>>() {}
|
||||||
|
fn fi2<T: Iterator<Item: Copy, Item: Copy>>() {}
|
||||||
|
fn fi3<T: Iterator<Item: 'static, Item: 'static>>() {}
|
||||||
|
fn fw1<T>()
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
fn fw2<T>()
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
fn fw3<T>()
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rpit1() -> impl Iterator<Item: Copy, Item: Send> {
|
||||||
|
iter::empty::<u32>()
|
||||||
|
}
|
||||||
|
fn rpit2() -> impl Iterator<Item: Copy, Item: Copy> {
|
||||||
|
iter::empty::<u32>()
|
||||||
|
}
|
||||||
|
fn rpit3() -> impl Iterator<Item: 'static, Item: 'static> {
|
||||||
|
iter::empty::<u32>()
|
||||||
|
}
|
||||||
|
fn apit1(_: impl Iterator<Item: Copy, Item: Send>) {}
|
||||||
|
fn apit2(_: impl Iterator<Item: Copy, Item: Copy>) {}
|
||||||
|
fn apit3(_: impl Iterator<Item: 'static, Item: 'static>) {}
|
||||||
|
|
||||||
|
type Tait1<T: Iterator<Item: Copy, Item: Send>> = T;
|
||||||
|
type Tait2<T: Iterator<Item: Copy, Item: Copy>> = T;
|
||||||
|
type Tait3<T: Iterator<Item: 'static, Item: 'static>> = T;
|
||||||
|
type Taw1<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
= T;
|
||||||
|
type Taw2<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
= T;
|
||||||
|
type Taw3<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
= T;
|
||||||
|
|
||||||
|
trait Tri1<T: Iterator<Item: Copy, Item: Send>> {}
|
||||||
|
trait Tri2<T: Iterator<Item: Copy, Item: Copy>> {}
|
||||||
|
trait Tri3<T: Iterator<Item: 'static, Item: 'static>> {}
|
||||||
|
trait Trs1: Iterator<Item: Copy, Item: Send> {}
|
||||||
|
trait Trs2: Iterator<Item: Copy, Item: Copy> {}
|
||||||
|
trait Trs3: Iterator<Item: 'static, Item: 'static> {}
|
||||||
|
trait Trw1<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Trw2<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Trw3<T>
|
||||||
|
where
|
||||||
|
T: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Trsw1
|
||||||
|
where
|
||||||
|
Self: Iterator<Item: Copy, Item: Send>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Trsw2
|
||||||
|
where
|
||||||
|
Self: Iterator<Item: Copy, Item: Copy>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Trsw3
|
||||||
|
where
|
||||||
|
Self: Iterator<Item: 'static, Item: 'static>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
trait Tra1 {
|
||||||
|
type A: Iterator<Item: Copy, Item: Send>;
|
||||||
|
}
|
||||||
|
trait Tra2 {
|
||||||
|
type A: Iterator<Item: Copy, Item: Copy>;
|
||||||
|
}
|
||||||
|
trait Tra3 {
|
||||||
|
type A: Iterator<Item: 'static, Item: 'static>;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
|
type Gat<T>;
|
||||||
|
|
||||||
|
const ASSOC: i32;
|
||||||
|
|
||||||
|
fn foo() -> impl Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Trait for () {
|
||||||
|
type Gat<T> = ();
|
||||||
|
|
||||||
|
const ASSOC: i32 = 3;
|
||||||
|
|
||||||
|
fn foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Subtrait: Trait<Gat<u32> = u32, Gat<u64> = u64> {}
|
||||||
|
|
||||||
|
fn f<T: Trait<Gat<i32> = (), Gat<i64> = ()>>() {
|
||||||
|
let _: T::Gat<i32> = ();
|
||||||
|
let _: T::Gat<i64> = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn g<T: Trait<Gat<i32> = (), Gat<i64> = &'static str>>() {
|
||||||
|
let _: T::Gat<i32> = ();
|
||||||
|
let _: T::Gat<i64> = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {}
|
||||||
|
|
||||||
|
fn callable(_: impl Iterator<Item = i32, Item = i32>) {}
|
||||||
|
|
||||||
|
fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {}
|
||||||
|
|
||||||
|
fn callable_const(_: impl Trait<ASSOC = 3, ASSOC = 3>) {}
|
||||||
|
|
||||||
|
fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {}
|
||||||
|
|
||||||
|
fn callable_rtn(_: impl Trait<foo(..): Send, foo(..): Send, foo(..): Eq>) {}
|
||||||
|
|
||||||
|
trait Trait2 {
|
||||||
|
const ASSOC: u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Trait3 {
|
||||||
|
fn foo() -> impl Iterator<Item = i32, Item = u32>;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
callable(iter::empty::<i32>());
|
||||||
|
callable_const(());
|
||||||
|
callable_rtn(());
|
||||||
|
}
|
||||||
@@ -1,278 +0,0 @@
|
|||||||
#![feature(type_alias_impl_trait)]
|
|
||||||
|
|
||||||
use std::iter;
|
|
||||||
use std::mem::ManuallyDrop;
|
|
||||||
|
|
||||||
struct SI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
struct SW1<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
struct SW2<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
struct SW3<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: T,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum EI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
enum EW1<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
enum EW2<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
enum EW3<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
V(T),
|
|
||||||
}
|
|
||||||
|
|
||||||
union UI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
union UI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
union UI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
union UW1<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
union UW2<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
union UW3<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
f: ManuallyDrop<T>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
fn FW1<T>()
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
fn FW2<T>()
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
fn FW3<T>()
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
iter::empty()
|
|
||||||
//~^ ERROR type annotations needed
|
|
||||||
}
|
|
||||||
fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
iter::empty()
|
|
||||||
//~^ ERROR type annotations needed
|
|
||||||
}
|
|
||||||
fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
iter::empty()
|
|
||||||
//~^ ERROR type annotations needed
|
|
||||||
}
|
|
||||||
fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
|
|
||||||
type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
type TAW1<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
= T;
|
|
||||||
type TAW2<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
= T;
|
|
||||||
type TAW3<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
= T;
|
|
||||||
|
|
||||||
type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR unconstrained opaque type
|
|
||||||
|
|
||||||
trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRS1: Iterator<Item: Copy, Item: Send> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRS2: Iterator<Item: Copy, Item: Copy> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRS3: Iterator<Item: 'static, Item: 'static> {}
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
trait TRW1<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRW2<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRW3<T>
|
|
||||||
where
|
|
||||||
T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRSW1
|
|
||||||
where
|
|
||||||
Self: Iterator<Item: Copy, Item: Send>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRSW2
|
|
||||||
where
|
|
||||||
Self: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRSW3
|
|
||||||
where
|
|
||||||
Self: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
{
|
|
||||||
}
|
|
||||||
trait TRA1 {
|
|
||||||
type A: Iterator<Item: Copy, Item: Send>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
}
|
|
||||||
trait TRA2 {
|
|
||||||
type A: Iterator<Item: Copy, Item: Copy>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
}
|
|
||||||
trait TRA3 {
|
|
||||||
type A: Iterator<Item: 'static, Item: 'static>;
|
|
||||||
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {}
|
|
||||||
@@ -1,751 +0,0 @@
|
|||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:6:36
|
|
||||||
|
|
|
||||||
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:10:36
|
|
||||||
|
|
|
||||||
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:14:39
|
|
||||||
|
|
|
||||||
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:20:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:27:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:34:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:40:34
|
|
||||||
|
|
|
||||||
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:44:34
|
|
||||||
|
|
|
||||||
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:48:37
|
|
||||||
|
|
|
||||||
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:54:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:61:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:68:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:74:35
|
|
||||||
|
|
|
||||||
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:78:35
|
|
||||||
|
|
|
||||||
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:82:38
|
|
||||||
|
|
|
||||||
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:88:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:95:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:102:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:108:32
|
|
||||||
|
|
|
||||||
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:110:32
|
|
||||||
|
|
|
||||||
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:112:35
|
|
||||||
|
|
|
||||||
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:116:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:122:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:128:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:133:42
|
|
||||||
|
|
|
||||||
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:139:42
|
|
||||||
|
|
|
||||||
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:145:45
|
|
||||||
|
|
|
||||||
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:151:40
|
|
||||||
|
|
|
||||||
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:153:40
|
|
||||||
|
|
|
||||||
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:155:43
|
|
||||||
|
|
|
||||||
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:158:35
|
|
||||||
|
|
|
||||||
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:160:35
|
|
||||||
|
|
|
||||||
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:162:38
|
|
||||||
|
|
|
||||||
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:166:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:171:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:176:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:180:36
|
|
||||||
|
|
|
||||||
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:183:36
|
|
||||||
|
|
|
||||||
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:186:39
|
|
||||||
|
|
|
||||||
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:202:36
|
|
||||||
|
|
|
||||||
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:204:36
|
|
||||||
|
|
|
||||||
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:206:39
|
|
||||||
|
|
|
||||||
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:208:34
|
|
||||||
|
|
|
||||||
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:208:34
|
|
||||||
|
|
|
||||||
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:208:34
|
|
||||||
|
|
|
||||||
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:212:34
|
|
||||||
|
|
|
||||||
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:212:34
|
|
||||||
|
|
|
||||||
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:212:34
|
|
||||||
|
|
|
||||||
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:216:37
|
|
||||||
|
|
|
||||||
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:216:37
|
|
||||||
|
|
|
||||||
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:216:37
|
|
||||||
|
|
|
||||||
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:222:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:228:29
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:234:32
|
|
||||||
|
|
|
||||||
LL | T: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:240:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:240:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:240:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Send>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:248:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:248:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:248:32
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: Copy, Item: Copy>,
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:256:35
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:256:35
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:256:35
|
|
||||||
|
|
|
||||||
LL | Self: Iterator<Item: 'static, Item: 'static>,
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:263:34
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: Copy, Item: Send>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:263:34
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: Copy, Item: Send>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:268:34
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: Copy, Item: Copy>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:268:34
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: Copy, Item: Copy>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:273:37
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: 'static, Item: 'static>;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:273:37
|
|
||||||
|
|
|
||||||
LL | type A: Iterator<Item: 'static, Item: 'static>;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:133:42
|
|
||||||
|
|
|
||||||
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
|
||||||
--> $DIR/duplicate.rs:136:5
|
|
||||||
|
|
|
||||||
LL | iter::empty()
|
|
||||||
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
|
||||||
|
|
|
||||||
help: consider specifying the generic argument
|
|
||||||
|
|
|
||||||
LL | iter::empty::<T>()
|
|
||||||
| +++++
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:139:42
|
|
||||||
|
|
|
||||||
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
|
||||||
--> $DIR/duplicate.rs:142:5
|
|
||||||
|
|
|
||||||
LL | iter::empty()
|
|
||||||
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
|
||||||
|
|
|
||||||
help: consider specifying the generic argument
|
|
||||||
|
|
|
||||||
LL | iter::empty::<T>()
|
|
||||||
| +++++
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:145:45
|
|
||||||
|
|
|
||||||
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
|
||||||
--> $DIR/duplicate.rs:148:5
|
|
||||||
|
|
|
||||||
LL | iter::empty()
|
|
||||||
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
|
||||||
|
|
|
||||||
help: consider specifying the generic argument
|
|
||||||
|
|
|
||||||
LL | iter::empty::<T>()
|
|
||||||
| +++++
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:180:51
|
|
||||||
|
|
|
||||||
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI1` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:183:51
|
|
||||||
|
|
|
||||||
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI2` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:186:57
|
|
||||||
|
|
|
||||||
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI3` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:189:14
|
|
||||||
|
|
|
||||||
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI4` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:189:40
|
|
||||||
|
|
|
||||||
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:189:40
|
|
||||||
|
|
|
||||||
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:193:14
|
|
||||||
|
|
|
||||||
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI5` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:193:40
|
|
||||||
|
|
|
||||||
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:193:40
|
|
||||||
|
|
|
||||||
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: unconstrained opaque type
|
|
||||||
--> $DIR/duplicate.rs:197:14
|
|
||||||
|
|
|
||||||
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ETAI6` must be used in combination with a concrete type within the same crate
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:197:43
|
|
||||||
|
|
|
||||||
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/duplicate.rs:197:43
|
|
||||||
|
|
|
||||||
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
|
|
||||||
| ------------- ^^^^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: aborting due to 87 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0282, E0719.
|
|
||||||
For more information about an error, try `rustc --explain E0282`.
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
error: conflicting associated type bounds for `Item` when expanding trait alias
|
error: conflicting associated type bounds for `Item`
|
||||||
--> $DIR/associated-types-overridden-binding-2.rs:6:13
|
--> $DIR/associated-types-overridden-binding-2.rs:6:13
|
||||||
|
|
|
|
||||||
LL | trait I32Iterator = Iterator<Item = i32>;
|
LL | trait I32Iterator = Iterator<Item = i32>;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ note: required by a bound in `I32Iterator`
|
|||||||
LL | trait I32Iterator = Iterator<Item = i32>;
|
LL | trait I32Iterator = Iterator<Item = i32>;
|
||||||
| ^^^^^^^^^^ required by this bound in `I32Iterator`
|
| ^^^^^^^^^^ required by this bound in `I32Iterator`
|
||||||
|
|
||||||
error: conflicting associated type bounds for `Item` when expanding trait alias
|
error: conflicting associated type bounds for `Item`
|
||||||
--> $DIR/associated-types-overridden-binding.rs:10:13
|
--> $DIR/associated-types-overridden-binding.rs:10:13
|
||||||
|
|
|
|
||||||
LL | trait I32Iterator = Iterator<Item = i32>;
|
LL | trait I32Iterator = Iterator<Item = i32>;
|
||||||
|
|||||||
7
tests/ui/closures/impl-closure-147146.rs
Normal file
7
tests/ui/closures/impl-closure-147146.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
impl typeof(|| {}) {}
|
||||||
|
//~^ ERROR `typeof` is a reserved keyword but unimplemented
|
||||||
|
|
||||||
|
unsafe impl Send for typeof(|| {}) {}
|
||||||
|
//~^ ERROR `typeof` is a reserved keyword but unimplemented
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
15
tests/ui/closures/impl-closure-147146.stderr
Normal file
15
tests/ui/closures/impl-closure-147146.stderr
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
error[E0516]: `typeof` is a reserved keyword but unimplemented
|
||||||
|
--> $DIR/impl-closure-147146.rs:1:6
|
||||||
|
|
|
||||||
|
LL | impl typeof(|| {}) {}
|
||||||
|
| ^^^^^^^^^^^^^ reserved keyword
|
||||||
|
|
||||||
|
error[E0516]: `typeof` is a reserved keyword but unimplemented
|
||||||
|
--> $DIR/impl-closure-147146.rs:4:22
|
||||||
|
|
|
||||||
|
LL | unsafe impl Send for typeof(|| {}) {}
|
||||||
|
| ^^^^^^^^^^^^^ reserved keyword
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0516`.
|
||||||
15
tests/ui/coroutine/handle_opaques_before_coroutines.rs
Normal file
15
tests/ui/coroutine/handle_opaques_before_coroutines.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/239
|
||||||
|
//@edition: 2024
|
||||||
|
//@ check-pass
|
||||||
|
//@ revisions: current next
|
||||||
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||||
|
//@[next] compile-flags: -Znext-solver
|
||||||
|
|
||||||
|
fn foo<'a>() -> impl Send {
|
||||||
|
if false {
|
||||||
|
foo();
|
||||||
|
}
|
||||||
|
async {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
trait Foo: Iterator<Item = i32, Item = i32> {}
|
|
||||||
//~^ ERROR is already specified
|
|
||||||
//~| ERROR is already specified
|
|
||||||
//~| ERROR is already specified
|
|
||||||
|
|
||||||
type Unit = ();
|
type Unit = ();
|
||||||
|
|
||||||
fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
||||||
|
|||||||
@@ -1,33 +1,5 @@
|
|||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||||
--> $DIR/E0719.rs:1:33
|
--> $DIR/E0719.rs:3:42
|
||||||
|
|
|
||||||
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/E0719.rs:1:33
|
|
||||||
|
|
|
||||||
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/E0719.rs:1:33
|
|
||||||
|
|
|
||||||
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
|
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
|
||||||
| |
|
|
||||||
| `Item` bound here first
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
|
||||||
--> $DIR/E0719.rs:8:42
|
|
||||||
|
|
|
|
||||||
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
||||||
| --------- ^^^^^^^^^^^ re-bound here
|
| --------- ^^^^^^^^^^^ re-bound here
|
||||||
@@ -35,13 +7,13 @@ LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
|||||||
| `Item` bound here first
|
| `Item` bound here first
|
||||||
|
|
||||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||||
--> $DIR/E0719.rs:14:38
|
--> $DIR/E0719.rs:9:38
|
||||||
|
|
|
|
||||||
LL | let _: &dyn Iterator<Item = i32, Item = i32>;
|
LL | let _: &dyn Iterator<Item = i32, Item = i32>;
|
||||||
| ---------- ^^^^^^^^^^ re-bound here
|
| ---------- ^^^^^^^^^^ re-bound here
|
||||||
| |
|
| |
|
||||||
| `Item` bound here first
|
| `Item` bound here first
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0719`.
|
For more information about this error, try `rustc --explain E0719`.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
//@ check-pass
|
//@ check-pass
|
||||||
|
//@ revisions: current next
|
||||||
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||||
|
//@[next] compile-flags: -Znext-solver
|
||||||
|
|
||||||
#![feature(pattern_types, generic_pattern_types, pattern_type_macro)]
|
#![feature(pattern_types, generic_pattern_types, pattern_type_macro)]
|
||||||
#![expect(incomplete_features)]
|
#![expect(incomplete_features)]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
--> $DIR/transmute.rs:20:14
|
--> $DIR/transmute.rs:23:14
|
||||||
|
|
|
|
||||||
LL | unsafe { std::mem::transmute(x) }
|
LL | unsafe { std::mem::transmute(x) }
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
@@ -8,7 +8,7 @@ LL | unsafe { std::mem::transmute(x) }
|
|||||||
= note: target type: `u32` (32 bits)
|
= note: target type: `u32` (32 bits)
|
||||||
|
|
||||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
--> $DIR/transmute.rs:28:14
|
--> $DIR/transmute.rs:31:14
|
||||||
|
|
|
|
||||||
LL | unsafe { std::mem::transmute(x) }
|
LL | unsafe { std::mem::transmute(x) }
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
21
tests/ui/type/pattern_types/transmute.next.stderr
Normal file
21
tests/ui/type/pattern_types/transmute.next.stderr
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
|
--> $DIR/transmute.rs:23:14
|
||||||
|
|
|
||||||
|
LL | unsafe { std::mem::transmute(x) }
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
|
||||||
|
= note: target type: `u32` (32 bits)
|
||||||
|
|
||||||
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
|
--> $DIR/transmute.rs:31:14
|
||||||
|
|
|
||||||
|
LL | unsafe { std::mem::transmute(x) }
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
|
||||||
|
= note: target type: `Option<u32>` (64 bits)
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0512`.
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
//@ revisions: current next
|
||||||
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||||
|
//@[next] compile-flags: -Znext-solver
|
||||||
#![feature(pattern_types, pattern_type_macro, generic_pattern_types)]
|
#![feature(pattern_types, pattern_type_macro, generic_pattern_types)]
|
||||||
#![expect(incomplete_features)]
|
#![expect(incomplete_features)]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user