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
Misleading note message while trying to use a not object safe method on a trait object #103622
error: the `cast_with_callback` method cannot be invoked on a trait object
--> src/main.rs:34:19
|
5 | where Self: Sized;
| ----- this has a `Sized` requirement
...
34 | bar(pg_lookup.cast_with_callback(&|s| s))
| ^^^^^^^^^^^^^^^^^^
|
= note: you need `&dyn PgMetadataLookup` instead of `&mut dyn PgMetadataLookup`
Ideally the output should not include a not telling me to use &dyn PgMetadataLookup instead of a &mut dyn PgMetadataLookup as this is misleading. In addition following this suggestion only changes the note of the error message such that it now says "note: you need &mut dyn PgMetadataLookup instead of &dyn PgMetadataLookup" which is also wrong.
error: the `function` method cannot be invoked on a trait object
--> src/main.rs:12:35
|
4 | fn function(&mut self) where Self: Sized;
| ----- this has a `Sized` requirement
...
12 | (&mut Type as &mut dyn Trait).function();
| ^^^^^^^^
|
= note: you need `&dyn Trait` instead of `&mut dyn Trait`
Activity
WaffleLapkin commentedon Oct 31, 2022
MRE (playground):
Rollup merge of rust-lang#105491 - sulami:master, r=compiler-errors
Rollup merge of rust-lang#105491 - sulami:master, r=compiler-errors
Rollup merge of rust-lang#105491 - sulami:master, r=compiler-errors