Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6069 #6073

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,9 @@ pub(crate) fn format_trait(

// FIXME(#2055): rustfmt fails to format when there are comments between trait bounds.
if !bounds.is_empty() {
let ident_hi = context
.snippet_provider
.span_after(item.span, item.ident.as_str());
// Retrieve *unnormalized* ident (See #6069)
let source_ident = context.snippet(item.ident.span);
let ident_hi = context.snippet_provider.span_after(item.span, source_ident);
let bound_hi = bounds.last().unwrap().span().hi();
let snippet = context.snippet(mk_sp(ident_hi, bound_hi));
if contains_comment(snippet) {
Expand Down
2 changes: 1 addition & 1 deletion tests/rustfmt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn rustfmt_emits_error_on_line_overflow_true() {
#[test]
#[allow(non_snake_case)]
fn dont_emit_ICE() {
let files = ["tests/target/issue_5728.rs", "tests/target/issue_5729.rs"];
let files = ["tests/target/issue_5728.rs", "tests/target/issue_5729.rs", "tests/target/issue_6069.rs"];

for file in files {
let args = [file];
Expand Down
3 changes: 3 additions & 0 deletions tests/target/issue_6069.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// `Foó` as written here ends with ASCII 6F `'o'` followed by `'\u{0301}'` COMBINING ACUTE ACCENT.
// The compiler normalizes that combination to NFC form, `'\u{00F3}'` LATIN SMALL LETTER O WITH ACUTE.
trait Foó: Bar {}
Jules-Bertholet marked this conversation as resolved.
Show resolved Hide resolved
Loading