Skip to content

Commit

Permalink
Check infinite recursion as soon as Display bound is known
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 8, 2024
1 parent 8a77dea commit f4d5c2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion impl/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ impl Display<'_> {
Trait::Display
}
};
infinite_recursive |= member == *"self" && bound == Trait::Display;
if let Some(&field) = member_index.get(&member) {
implied_bounds.insert((field, bound));
}
Expand All @@ -128,7 +129,6 @@ impl Display<'_> {
}
out += &formatvar.to_string();
let local = formatvar.to_local();
infinite_recursive |= member == *"self" && bound == Trait::Display;
if macro_named_args.insert(member) {
bindings.push((local, binding_value));
} else {
Expand Down

0 comments on commit f4d5c2a

Please sign in to comment.