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
Here, we try to access a property cap on an object of type struct S.
Up to the 1.50 version, the error message was the following :
rror[E0609]: no field `cap` on type `S`
--> <source>:6:12
|
6 | dbg!(s.cap)
| ^^^ unknown field
|
= note: available fields are: `val`
However, since Rust 1.51 and onward, the diagnostic message changed to this:
rror[E0609]: no field `cap` on type `S`
--> <source>:6:12
|
6 | dbg!(s.cap)
| ^^^ unknown field
|
= note: available fields are: `val`
help: one of the expressions' fields has a field of the same name
|
6 | dbg!(s.val.vec.buf.cap)
| ^^^^^^^^^^^^
While there is indead a cap property on the RawVec struct, this can't be accessed like that, applying the compiler suggestion implies making the buf property of std::vec::Vec public, which is not possible.
The compiler should not look at non-pub properties when searching for properties with a matching name for diagnostic purposes.
The text was updated successfully, but these errors were encountered:
Lets consider the following code (playground) :
Here, we try to access a property
cap
on an object of typestruct S
.Up to the 1.50 version, the error message was the following :
However, since Rust 1.51 and onward, the diagnostic message changed to this:
While there is indead a
cap
property on theRawVec
struct, this can't be accessed like that, applying the compiler suggestion implies making thebuf
property ofstd::vec::Vec
public, which is not possible.The compiler should not look at non-
pub
properties when searching for properties with a matching name for diagnostic purposes.The text was updated successfully, but these errors were encountered: