Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d6a3db5

Browse files
authoredFeb 22, 2025
Unrolled build for rust-lang#136458
Rollup merge of rust-lang#136458 - compiler-errors:fix-3, r=lcnr Do not deduplicate list of associated types provided by dyn principal ## Background The way that we handle a dyn trait type's projection bounds is very *structural* today. A dyn trait is represented as a list of `PolyExistentialPredicate`s, which in most cases will be a principal trait (like `Iterator`) and a list of projections (like `Item = u32`). Importantly, the list of projections comes from user-written associated type bounds on the type *and* from elaborating the projections from the principal's supertraits. For example, given a set of traits like: ```rust trait Foo<T> { type Assoc; } trait Bar<A, B>: Foo<A, Assoc = A> + Foo<B, Assoc = B> {} ``` For the type `dyn Bar<i32, u32>`, the list of projections will be something like `[Foo<i32>::Assoc = i32, Foo<u32>::Assoc = u32]`. We deduplicate these projections when they're identical, so for `dyn Bar<(), ()>` would be something like `[Foo<()>::Assoc = ()]`. ## Shortcomings 1: inference We face problems when we begin to mix this structural notion of projection bounds with inference and associated type normalization. For example, let's try calling a generic function that takes `dyn Bar<A, B>` with a value of type `dyn Bar<(), ()>`: ```rust trait Foo<T> { type Assoc; } trait Bar<A, B>: Foo<A, Assoc = A> + Foo<B, Assoc = B> {} fn call_bar<A, B>(_: &dyn Bar<A, B>) {} fn test(x: &dyn Bar<(), ()>) { call_bar(x); // ^ ERROR mismatched types } ``` ``` error[E0308]: mismatched types --> /home/mgx/test.rs:10:14 | 10 | call_bar(x); | -------- ^ expected trait `Bar<_, _>`, found trait `Bar<(), ()>` ``` What's going on here? Well, when calling `call_bar`, the generic signature `&dyn Bar<?A, ?B>` does not unify with `&dyn Bar<(), ()>` because the list of projections differ -- `[Foo<?A>::Assoc = ?A, Foo<?B>::Assoc = ?B]` vs `[Foo<()>::Assoc = ()]`. A simple solution to this may be to unify the principal traits first, then attempt to deduplicate them after inference. In this case, if we constrain `?A = ?B = ()`, then we would be able to deduplicate those projections in the first list. However, this idea is still pretty fragile, and it's not a complete solution. ## Shortcomings 2: normalization Consider a slightly modified example: ```rust //@ compile-flags: -Znext-solver trait Mirror { type Assoc; } impl<T> Mirror for T { type Assoc = T; } fn call_bar(_: &dyn Bar<(), <() as Mirror>::Assoc>) {} fn test(x: &dyn Bar<(), ()>) { call_bar(x); } ``` This fails in the new solver. In this example, we try to unify `dyn Bar<(), ()>` and `dyn Bar<(), <() as Mirror>::Assoc>`. We are faced with the same problem even though there are no inference variables, and making this work relies on eagerly and deeply normalizing all projections so that they can be structurally deduplicated. This is incompatible with how we handle associated types in the new trait solver, and while we could perhaps support it with some major gymnastics in the new solver, it suggests more fundamental shortcomings with how we deal with projection bounds in the new solver. ## Shortcomings 3: redundant projections Consider a final example: ```rust trait Foo { type Assoc; } trait Bar: Foo<Assoc = ()> {} fn call_bar1(_: &dyn Bar) {} fn call_bar2(_: &dyn Bar<Assoc = ()>) {} fn main() { let x: &dyn Bar<Assoc = _> = todo!(); call_bar1(x); //~^ ERROR mismatched types call_bar2(x); //~^ ERROR mismatched types } ``` In this case, we have a user-written associated type bound (`Assoc = _`) which overlaps the bound that comes from the supertrait projection of `Bar` (namely, `Foo<Assoc = ()>`). In a similar way to the two examples above, this causes us to have a projection list mismatch that the compiler is not able to deduplicate. ## Solution ### Do not deduplicate after elaborating projections when lowering `dyn` types The root cause of this issue has to do with mismatches of the deduplicated projection list before and after substitution or inference. This PR aims to avoid these issues by *never* deduplicating the projection list after elaborating the list of projections from the *identity* substituted principal trait ref. For example, ```rust trait Foo<T> { type Assoc; } trait Bar<A, B>: Foo<A, Assoc = A> + Foo<B, Assoc = B> {} ``` When computing the projections for `dyn Bar<(), ()>`, before this PR we'd elaborate `Bar<(), ()>` to find a (deduplicated) projection list of `[Foo<()>::Assoc = ()]`. After this PR, we take the principal trait and use its *identity* substitutions `Bar<A, B>` during elaboration, giving us projections `[Foo<A>::Assoc = A, Foo<B>::Assoc = B]`. Only after this elaboration do we substitute `A = (), B = ()` to get `[Foo<()>::Assoc = (), Foo<()>::Assoc = ()]`. This allows the type to be unified with the projections for `dyn Bar<?A, ?B>`, which are `[Foo<?A>::Assoc = ?A, Foo<?B>::Assoc = ?B]`. This helps us avoid shorcomings 1 noted above. ### Do not deduplicate projections when relating `dyn` types Similarly, we also do not call deduplicate when relating dyn types. This means that the list of projections does not differ depending on if the type has been normalized or not, which should avoid shortcomings 2 noted above. Following from the example above, when relating projection lists like `[Foo<()>::Assoc = (), Foo<()>::Assoc = ()]` and `[Foo<?A>::Assoc = ?A, Foo<?B>::Assoc = ?B]`, the latter won't be deduplicated to a list of length 1 which would immediately fail to relate to the latter which is a list of length 2. ### Implement proper precedence between supertrait and user-written projection bounds when lowering `dyn` types ```rust trait Foo { type Assoc; } trait Bar: Foo<Assoc = ()> {} ``` Given a type like `dyn Foo<Assoc = _>`, we used to previously include *both* the supertrait and user-written associated type bounds in the projection list, giving us `[Foo::Assoc = (), Foo::Assoc = _]`. This would never unify with `dyn Foo`. However, this PR implements a strategy which overwrites the supertrait associated type bound with the one provided by the user, giving us a projection list of `[Foo::Assoc = _]`. Why is this OK? Well, if a user wrote an associated type bound that is unsatisfiable (e.g. `dyn Bar<Assoc = i32>`) then the dyn type would never implement `Bar` or `Foo` anyways. If the user wrote something that is either structurally equal or equal modulo normalization to the supertrait bound, then it should be unaffected. And if the user wrote something that needs inference guidance (e.g. `dyn Bar<Assoc = _>`), then it'll be constrained when proving `dyn Bar<Assoc = _>: Bar`. Importantly, this differs from the strategy in rust-lang#133397, which preferred the *supertrait* bound and ignored the user-written bound. While that's also theoretically justifiable in its own way, it does lead to code which does not (and probably should not) compile either today or after this PR, like: ```rust trait IteratorOfUnit: Iterator<Item = ()> {} impl<T> IteratorOfUnit for T where T: Iterator<Item = ()> {} fn main() { let iter = [()].into_iter(); let iter: &dyn IteratorOfUnit<Item = i32> = &iter; } ``` ### Conclusion This is a far less invasive change compared to rust-lang#133397, and doesn't necessarily necessitate the addition of new lints or any breakage of existing code. While we could (and possibly should) eventually introduce lints to warn users of redundant or mismatched associated type bounds, we don't *need* to do so as part of fixing this unsoundness, which leads me to believe this is a much safer solution.
2 parents dc37ff8 + a2a0cfe commit d6a3db5

19 files changed

+297
-118
lines changed
 

‎compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs

+99-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1+
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
22
use rustc_errors::codes::*;
33
use rustc_errors::struct_span_code_err;
44
use rustc_hir as hir;
@@ -58,9 +58,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
5858
}
5959
}
6060

61-
let (trait_bounds, mut projection_bounds) =
61+
let (elaborated_trait_bounds, elaborated_projection_bounds) =
6262
traits::expand_trait_aliases(tcx, user_written_bounds.iter().copied());
63-
let (regular_traits, mut auto_traits): (Vec<_>, Vec<_>) = trait_bounds
63+
let (regular_traits, mut auto_traits): (Vec<_>, Vec<_>) = elaborated_trait_bounds
6464
.into_iter()
6565
.partition(|(trait_ref, _)| !tcx.trait_is_auto(trait_ref.def_id()));
6666

@@ -103,37 +103,89 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
103103
}
104104
}
105105

106+
// Map the projection bounds onto a key that makes it easy to remove redundant
107+
// bounds that are constrained by supertraits of the principal def id.
108+
//
109+
// Also make sure we detect conflicting bounds from expanding a trait alias and
110+
// also specifying it manually, like:
111+
// ```
112+
// type Alias = Trait<Assoc = i32>;
113+
// let _: &dyn Alias<Assoc = u32> = /* ... */;
114+
// ```
115+
let mut projection_bounds = FxIndexMap::default();
116+
for (proj, proj_span) in elaborated_projection_bounds {
117+
let key = (
118+
proj.skip_binder().projection_term.def_id,
119+
tcx.anonymize_bound_vars(
120+
proj.map_bound(|proj| proj.projection_term.trait_ref(tcx)),
121+
),
122+
);
123+
if let Some((old_proj, old_proj_span)) =
124+
projection_bounds.insert(key, (proj, proj_span))
125+
&& tcx.anonymize_bound_vars(proj) != tcx.anonymize_bound_vars(old_proj)
126+
{
127+
let item = tcx.item_name(proj.item_def_id());
128+
self.dcx()
129+
.struct_span_err(
130+
span,
131+
format!(
132+
"conflicting associated type bounds for `{item}` when \
133+
expanding trait alias"
134+
),
135+
)
136+
.with_span_label(
137+
old_proj_span,
138+
format!("`{item}` is specified to be `{}` here", old_proj.term()),
139+
)
140+
.with_span_label(
141+
proj_span,
142+
format!("`{item}` is specified to be `{}` here", proj.term()),
143+
)
144+
.emit();
145+
}
146+
}
147+
106148
let principal_trait = regular_traits.into_iter().next();
107149

108-
let mut needed_associated_types = FxIndexSet::default();
109-
if let Some((principal_trait, spans)) = &principal_trait {
110-
let pred: ty::Predicate<'tcx> = (*principal_trait).upcast(tcx);
111-
for ClauseWithSupertraitSpan { pred, supertrait_span } in traits::elaborate(
150+
let mut needed_associated_types = vec![];
151+
if let Some((principal_trait, ref spans)) = principal_trait {
152+
let principal_trait = principal_trait.map_bound(|trait_pred| {
153+
assert_eq!(trait_pred.polarity, ty::PredicatePolarity::Positive);
154+
trait_pred.trait_ref
155+
});
156+
157+
for ClauseWithSupertraitSpan { clause, supertrait_span } in traits::elaborate(
112158
tcx,
113-
[ClauseWithSupertraitSpan::new(pred, *spans.last().unwrap())],
159+
[ClauseWithSupertraitSpan::new(
160+
ty::TraitRef::identity(tcx, principal_trait.def_id()).upcast(tcx),
161+
*spans.last().unwrap(),
162+
)],
114163
)
115164
.filter_only_self()
116165
{
117-
debug!("observing object predicate `{pred:?}`");
166+
let clause = clause.instantiate_supertrait(tcx, principal_trait);
167+
debug!("observing object predicate `{clause:?}`");
118168

119-
let bound_predicate = pred.kind();
169+
let bound_predicate = clause.kind();
120170
match bound_predicate.skip_binder() {
121-
ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
171+
ty::ClauseKind::Trait(pred) => {
122172
// FIXME(negative_bounds): Handle this correctly...
123173
let trait_ref =
124174
tcx.anonymize_bound_vars(bound_predicate.rebind(pred.trait_ref));
125175
needed_associated_types.extend(
126-
tcx.associated_items(trait_ref.def_id())
176+
tcx.associated_items(pred.trait_ref.def_id)
127177
.in_definition_order()
178+
// We only care about associated types.
128179
.filter(|item| item.kind == ty::AssocKind::Type)
180+
// No RPITITs -- even with `async_fn_in_dyn_trait`, they are implicit.
129181
.filter(|item| !item.is_impl_trait_in_trait())
130182
// If the associated type has a `where Self: Sized` bound,
131183
// we do not need to constrain the associated type.
132184
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
133185
.map(|item| (item.def_id, trait_ref)),
134186
);
135187
}
136-
ty::PredicateKind::Clause(ty::ClauseKind::Projection(pred)) => {
188+
ty::ClauseKind::Projection(pred) => {
137189
let pred = bound_predicate.rebind(pred);
138190
// A `Self` within the original bound will be instantiated with a
139191
// `trait_object_dummy_self`, so check for that.
@@ -161,8 +213,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
161213
// `dyn MyTrait<MyOutput = X, Output = X>`, which is uglier but works. See
162214
// the discussion in #56288 for alternatives.
163215
if !references_self {
164-
// Include projections defined on supertraits.
165-
projection_bounds.push((pred, supertrait_span));
216+
let key = (
217+
pred.skip_binder().projection_term.def_id,
218+
tcx.anonymize_bound_vars(
219+
pred.map_bound(|proj| proj.projection_term.trait_ref(tcx)),
220+
),
221+
);
222+
if !projection_bounds.contains_key(&key) {
223+
projection_bounds.insert(key, (pred, supertrait_span));
224+
}
166225
}
167226

168227
self.check_elaborated_projection_mentions_input_lifetimes(
@@ -182,12 +241,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
182241
// types that we expect to be provided by the user, so the following loop
183242
// removes all the associated types that have a corresponding `Projection`
184243
// clause, either from expanding trait aliases or written by the user.
185-
for &(projection_bound, span) in &projection_bounds {
244+
for &(projection_bound, span) in projection_bounds.values() {
186245
let def_id = projection_bound.item_def_id();
187-
let trait_ref = tcx.anonymize_bound_vars(
188-
projection_bound.map_bound(|p| p.projection_term.trait_ref(tcx)),
189-
);
190-
needed_associated_types.swap_remove(&(def_id, trait_ref));
191246
if tcx.generics_require_sized_self(def_id) {
192247
tcx.emit_node_span_lint(
193248
UNUSED_ASSOCIATED_TYPE_BOUNDS,
@@ -198,9 +253,22 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
198253
}
199254
}
200255

256+
let mut missing_assoc_types = FxIndexSet::default();
257+
let projection_bounds: Vec<_> = needed_associated_types
258+
.into_iter()
259+
.filter_map(|key| {
260+
if let Some(assoc) = projection_bounds.get(&key) {
261+
Some(*assoc)
262+
} else {
263+
missing_assoc_types.insert(key);
264+
None
265+
}
266+
})
267+
.collect();
268+
201269
if let Err(guar) = self.check_for_required_assoc_tys(
202270
principal_trait.as_ref().map_or(smallvec![], |(_, spans)| spans.clone()),
203-
needed_associated_types,
271+
missing_assoc_types,
204272
potential_assoc_types,
205273
hir_bounds,
206274
) {
@@ -266,7 +334,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
266334
})
267335
});
268336

269-
let existential_projections = projection_bounds.iter().map(|(bound, _)| {
337+
let existential_projections = projection_bounds.into_iter().map(|(bound, _)| {
270338
bound.map_bound(|mut b| {
271339
assert_eq!(b.projection_term.self_ty(), dummy_self);
272340

@@ -291,12 +359,16 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
291359
})
292360
});
293361

294-
let auto_trait_predicates = auto_traits.into_iter().map(|(trait_pred, _)| {
295-
assert_eq!(trait_pred.polarity(), ty::PredicatePolarity::Positive);
296-
assert_eq!(trait_pred.self_ty().skip_binder(), dummy_self);
362+
let mut auto_trait_predicates: Vec<_> = auto_traits
363+
.into_iter()
364+
.map(|(trait_pred, _)| {
365+
assert_eq!(trait_pred.polarity(), ty::PredicatePolarity::Positive);
366+
assert_eq!(trait_pred.self_ty().skip_binder(), dummy_self);
297367

298-
ty::Binder::dummy(ty::ExistentialPredicate::AutoTrait(trait_pred.def_id()))
299-
});
368+
ty::Binder::dummy(ty::ExistentialPredicate::AutoTrait(trait_pred.def_id()))
369+
})
370+
.collect();
371+
auto_trait_predicates.dedup();
300372

301373
// N.b. principal, projections, auto traits
302374
// FIXME: This is actually wrong with multiple principals in regards to symbol mangling
@@ -306,7 +378,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
306378
.chain(auto_trait_predicates)
307379
.collect::<SmallVec<[_; 8]>>();
308380
v.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
309-
v.dedup();
310381
let existential_predicates = tcx.mk_poly_existential_predicates(&v);
311382

312383
// Use explicitly-specified region bound, unless the bound is missing.

‎compiler/rustc_middle/src/ty/relate.rs

+7-14
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,14 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistentialPredicate<
7979
b: Self,
8080
) -> RelateResult<'tcx, Self> {
8181
let tcx = relation.cx();
82-
83-
// FIXME: this is wasteful, but want to do a perf run to see how slow it is.
84-
// We need to perform this deduplication as we sometimes generate duplicate projections
85-
// in `a`.
86-
let mut a_v: Vec<_> = a.into_iter().collect();
87-
let mut b_v: Vec<_> = b.into_iter().collect();
88-
a_v.dedup();
89-
b_v.dedup();
90-
if a_v.len() != b_v.len() {
82+
// Fast path for when the auto traits do not match, or if the principals
83+
// are from different traits and therefore the projections definitely don't
84+
// match up.
85+
if a.len() != b.len() {
9186
return Err(TypeError::ExistentialMismatch(ExpectedFound::new(a, b)));
9287
}
93-
94-
let v = iter::zip(a_v, b_v).map(|(ep_a, ep_b)| {
95-
match (ep_a.skip_binder(), ep_b.skip_binder()) {
88+
let v =
89+
iter::zip(a, b).map(|(ep_a, ep_b)| match (ep_a.skip_binder(), ep_b.skip_binder()) {
9690
(ty::ExistentialPredicate::Trait(a), ty::ExistentialPredicate::Trait(b)) => {
9791
Ok(ep_a.rebind(ty::ExistentialPredicate::Trait(
9892
relation.relate(ep_a.rebind(a), ep_b.rebind(b))?.skip_binder(),
@@ -109,8 +103,7 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistentialPredicate<
109103
ty::ExistentialPredicate::AutoTrait(b),
110104
) if a == b => Ok(ep_a.rebind(ty::ExistentialPredicate::AutoTrait(a))),
111105
_ => Err(TypeError::ExistentialMismatch(ExpectedFound::new(a, b))),
112-
}
113-
});
106+
});
114107
tcx.mk_poly_existential_predicates_from_iter(v)
115108
}
116109
}

‎compiler/rustc_middle/src/ty/sty.rs

+29-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, extension
1818
use rustc_span::{DUMMY_SP, Span, Symbol, sym};
1919
use rustc_type_ir::TyKind::*;
2020
use rustc_type_ir::visit::TypeVisitableExt;
21-
use rustc_type_ir::{self as ir, BoundVar, CollectAndApply, DynKind};
21+
use rustc_type_ir::{self as ir, BoundVar, CollectAndApply, DynKind, elaborate};
2222
use tracing::instrument;
2323
use ty::util::{AsyncDropGlueMorphology, IntTypeExt};
2424

@@ -720,6 +720,34 @@ impl<'tcx> Ty<'tcx> {
720720
reg: ty::Region<'tcx>,
721721
repr: DynKind,
722722
) -> Ty<'tcx> {
723+
if cfg!(debug_assertions) {
724+
let projection_count = obj.projection_bounds().count();
725+
let expected_count: usize = obj
726+
.principal_def_id()
727+
.into_iter()
728+
.flat_map(|principal_def_id| {
729+
// NOTE: This should agree with `needed_associated_types` in
730+
// dyn trait lowering, or else we'll have ICEs.
731+
elaborate::supertraits(
732+
tcx,
733+
ty::Binder::dummy(ty::TraitRef::identity(tcx, principal_def_id)),
734+
)
735+
.map(|principal| {
736+
tcx.associated_items(principal.def_id())
737+
.in_definition_order()
738+
.filter(|item| item.kind == ty::AssocKind::Type)
739+
.filter(|item| !item.is_impl_trait_in_trait())
740+
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
741+
.count()
742+
})
743+
})
744+
.sum();
745+
assert_eq!(
746+
projection_count, expected_count,
747+
"expected {obj:?} to have {expected_count} projections, \
748+
but it has {projection_count}"
749+
);
750+
}
723751
Ty::new(tcx, Dynamic(obj, reg, repr))
724752
}
725753

‎compiler/rustc_type_ir/src/elaborate.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,22 @@ pub trait Elaboratable<I: Interner> {
4444
}
4545

4646
pub struct ClauseWithSupertraitSpan<I: Interner> {
47-
pub pred: I::Predicate,
47+
pub clause: I::Clause,
4848
// Span of the supertrait predicatae that lead to this clause.
4949
pub supertrait_span: I::Span,
5050
}
5151
impl<I: Interner> ClauseWithSupertraitSpan<I> {
52-
pub fn new(pred: I::Predicate, span: I::Span) -> Self {
53-
ClauseWithSupertraitSpan { pred, supertrait_span: span }
52+
pub fn new(clause: I::Clause, span: I::Span) -> Self {
53+
ClauseWithSupertraitSpan { clause, supertrait_span: span }
5454
}
5555
}
5656
impl<I: Interner> Elaboratable<I> for ClauseWithSupertraitSpan<I> {
5757
fn predicate(&self) -> <I as Interner>::Predicate {
58-
self.pred
58+
self.clause.as_predicate()
5959
}
6060

6161
fn child(&self, clause: <I as Interner>::Clause) -> Self {
62-
ClauseWithSupertraitSpan {
63-
pred: clause.as_predicate(),
64-
supertrait_span: self.supertrait_span,
65-
}
62+
ClauseWithSupertraitSpan { clause, supertrait_span: self.supertrait_span }
6663
}
6764

6865
fn child_with_derived_cause(
@@ -72,7 +69,7 @@ impl<I: Interner> Elaboratable<I> for ClauseWithSupertraitSpan<I> {
7269
_parent_trait_pred: crate::Binder<I, crate::TraitPredicate<I>>,
7370
_index: usize,
7471
) -> Self {
75-
ClauseWithSupertraitSpan { pred: clause.as_predicate(), supertrait_span }
72+
ClauseWithSupertraitSpan { clause, supertrait_span }
7673
}
7774
}
7875

‎tests/crashes/125957.rs

-20
This file was deleted.

‎tests/crashes/132330.rs

-28
This file was deleted.

‎tests/ui/associated-types/associated-types-overridden-binding-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ trait I32Iterator = Iterator<Item = i32>;
44

55
fn main() {
66
let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
7-
//~^ ERROR expected `IntoIter<u32>` to be an iterator that yields `i32`, but it yields `u32`
7+
//~^ ERROR conflicting associated type bounds
88
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.