You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Seemingly incorrect error for missing trait bounds on associated type #81162
A-diagnosticsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsA-trait-systemArea: Trait systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
fntest(){let data = read::<[f32;128]>("foo",128);}fnread<T>(fname:&str,dimension:usize) -> Vec<T>wherefor<'a>T:TryFrom<&'a[f32]>,for<'a> <TasTryFrom<&'a[f32]>>::Error: std::fmt::Debug,
I expected to see this happen: this should work, since [f32; N] implements TryFrom<&[f32]> with Error = TrySliceError and TrySliceError implements Debug.
error[E0277]: `<[f32;128]asTryFrom<&'a[f32]>>::Error` doesn't implement `Debug`
--> tests/foo.rs:7:16
|
7 | let data = read::<[f32;128]>("foo",128);
| ^^^^^^^^^^^^^^^^^^^^^^^^ `<[f32;128] as TryFrom<&'a[f32]>>::Error` cannot be formatted using `{:?}` because it doesn't implement `Debug`
...
10 | fn read<T>(fname:&str, dimension:usize) -> Vec<T>
| ---------- required by a bound in this
...
13 | for<'a> <TasTryFrom<&'a[f32]>>::Error: std::fmt::Debug,
| --------------- required by this bound in `read`
|
= help: the trait `for<'a> Debug` is not implemented for `<[f32;128]asTryFrom<&'a[f32]>>::Error`
A-diagnosticsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsA-trait-systemArea: Trait systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
Activity
estebank commentedon Jan 19, 2021
Note that not using
for<'a>makes the code compile, but doesn't have the same lifetime semantics.I think that the lifetime introduced in each bound is considered to be independent of each other, so they aren't unified.
estebank commentedon Nov 10, 2026
This now compiles.
zakrad commentedon Nov 11, 2026
@rustbot claim
Rollup merge of rust-lang#165824 - zakrad:hrtb-tryfrom-debug-81162, r…
Rollup merge of rust-lang#165824 - zakrad:hrtb-tryfrom-debug-81162, r…
Rollup merge of rust-lang#165824 - zakrad:hrtb-tryfrom-debug-81162, r…
Unrolled build for #165824 in rollup 165844
Rollup merge of #165824 - zakrad:hrtb-tryfrom-debug-81162, r=aerooneqq
Rollup merge of #165824 - zakrad:hrtb-tryfrom-debug-81162, r=aerooneqq