Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 26 additions & 32 deletions src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
lifetime_to_bounds.entry(lifetime).or_default().extend(bounds);
}
WherePredicate::EqPredicate { lhs, rhs } => {
match &lhs {
&Type::QPath { name: ref left_name, ref self_type, ref trait_ } => {
match lhs {
Type::QPath { name: ref left_name, ref self_type, ref trait_ } => {
let ty = &*self_type;
match **trait_ {
Type::ResolvedPath {
Expand All @@ -580,36 +580,30 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
continue;
}

// FIXME: Remove this scope when NLL lands
{
let args = &mut new_trait_path
.segments
.last_mut()
.expect("segments were empty")
.args;

match args {
// Convert somethiung like '<T as Iterator::Item> = u8'
// to 'T: Iterator<Item=u8>'
&mut GenericArgs::AngleBracketed {
ref mut bindings,
..
} => {
bindings.push(TypeBinding {
name: left_name.clone(),
kind: TypeBindingKind::Equality { ty: rhs },
});
}
&mut GenericArgs::Parenthesized { .. } => {
existing_predicates.push(
WherePredicate::EqPredicate {
lhs: lhs.clone(),
rhs,
},
);
continue; // If something other than a Fn ends up
// with parenthesis, leave it alone
}
let args = &mut new_trait_path
.segments
.last_mut()
.expect("segments were empty")
.args;

match args {
// Convert somethiung like '<T as Iterator::Item> = u8'
// to 'T: Iterator<Item=u8>'
GenericArgs::AngleBracketed {
ref mut bindings, ..
} => {
bindings.push(TypeBinding {
name: left_name.clone(),
kind: TypeBindingKind::Equality { ty: rhs },
});
}
GenericArgs::Parenthesized { .. } => {
existing_predicates.push(WherePredicate::EqPredicate {
lhs: lhs.clone(),
rhs,
});
continue; // If something other than a Fn ends up
// with parenthesis, leave it alone
}
}

Expand Down