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
While working on generic struct, I ran into the following error
20 | val:T::max_value(),
| ^^^^^^^^^ function or associated item not found in `T`
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `max_value`, perhaps you need to restrict type parameter `T` with it:
|
14 | impl<T: compiler_builtins::int::Int + Signed + Ord> Tree<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To reproduce this using the minimal example, I ran the code
fntest<T>(a:T) -> T{
a.max_value()}
I expected this to fail building and not suggest me to use compiler_builtins as i'm on rustc stable,.
Instead, this happened:
2 | T::max_value()
| ^^^^^^^^^ function or associated item not found in `T`
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `max_value`, perhaps you need to restrict type parameter `T` with it:
|
1 | fn test<T: compiler_builtins::int::Int>(a:T) -> T{
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
However when using nightly, it wouldn't suggest me compiler_builtins.
|
2 | T::max_value()
| ^^^^^^^^^ function or associated item not found in `T`
error: aborting due to previous error
The difference arise from the fact that this was already fixed in #72759 (it shouldn't be suggested in either case since it is an implementation detail of compiler builtins).
While working on generic struct, I ran into the following error
To reproduce this using the minimal example, I ran the code
I expected this to fail building and not suggest me to use compiler_builtins as i'm on rustc stable,.
Instead, this happened:
However when using nightly, it wouldn't suggest me compiler_builtins.
Meta
rustc --version --verbose
:rustc +nightly --version --verbose
:The text was updated successfully, but these errors were encountered: