- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
// tests/ui/suggestions/issue-71394-no-from-impl.rsCurrent output
error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
  --> $DIR/issue-71394-no-from-impl.rs:8:25
   |
LL |     let _: &[i8] = data.into();
   |                         ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
   |
   = help: the following other types implement trait `From<T>`:
             `[T; 10]` implements `From<(T, T, T, T, T, T, T, T, T, T)>`
             `[T; 11]` implements `From<(T, T, T, T, T, T, T, T, T, T, T)>`
             `[T; 12]` implements `From<(T, T, T, T, T, T, T, T, T, T, T, T)>`
             `[T; 1]` implements `From<(T,)>`
             `[T; 2]` implements `From<(T, T)>`
             `[T; 3]` implements `From<(T, T, T)>`
[...]Desired output
error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
  --> $DIR/issue-71394-no-from-impl.rs:8:25
   |
LL |     let _: &[i8] = data.into();
   |                         ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
   |
   = help: the following other types implement trait `From<T>`:
             `[T; 1]` implements `From<(T,)>`
             `[T; 2]` implements `From<(T, T)>`
             `[T; 3]` implements `From<(T, T, T)>`
[...]
             `[T; 10]` implements `From<(T, T, T, T, T, T, T, T, T, T)>`
             `[T; 11]` implements `From<(T, T, T, T, T, T, T, T, T, T, T)>`
             `[T; 12]` implements `From<(T, T, T, T, T, T, T, T, T, T, T, T)>`
[...]Rationale and extra context
The existing sorting displays 10, 11, 12, before it displays 1, 2, 3. Lower numbers should be sorted before higher numbers. In addition to sorting in a more semantically correct fashion, this would also present the user with less complex possibilities first.
Other cases
Rust Version
Git commit 7349f6b50359fd1f11738765b8deec5ee02d8710Anything else?
No response
Scripter17
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.