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 8f681d8

Browse files
committedFeb 23, 2023
When encountering &SmallImplCopy < &SmallImplCopy, suggest copying
When encountering a binary operation for two `T: Copy` where `T` is as small as a 64bit pointer, suggest dereferencing the expressions so the binary operation is inlined. Mitigate the effects of #105259, particularly when match ergonomics is involved.
1 parent fdbc432 commit 8f681d8

File tree

51 files changed

+372
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+372
-69
lines changed
 

‎compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ impl PartialEq for Nonterminal {
894894
fn eq(&self, rhs: &Self) -> bool {
895895
match (self, rhs) {
896896
(NtIdent(ident_lhs, is_raw_lhs), NtIdent(ident_rhs, is_raw_rhs)) => {
897-
ident_lhs == ident_rhs && is_raw_lhs == is_raw_rhs
897+
ident_lhs == ident_rhs && *is_raw_lhs == *is_raw_rhs
898898
}
899899
(NtLifetime(ident_lhs), NtLifetime(ident_rhs)) => ident_lhs == ident_rhs,
900900
// FIXME: Assume that all "complex" nonterminal are not equal, we can't compare them

‎compiler/rustc_ast/src/tokenstream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl TokenTree {
6565
match (self, other) {
6666
(TokenTree::Token(token, _), TokenTree::Token(token2, _)) => token.kind == token2.kind,
6767
(TokenTree::Delimited(_, delim, tts), TokenTree::Delimited(_, delim2, tts2)) => {
68-
delim == delim2 && tts.eq_unspanned(tts2)
68+
*delim == *delim2 && tts.eq_unspanned(tts2)
6969
}
7070
_ => false,
7171
}

0 commit comments

Comments
 (0)
Please sign in to comment.