Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metaloadfn] trait objects without an explicit dyn are deprecated #522

Open
TheAifam5 opened this issue Jun 17, 2020 · 2 comments
Open

[metaloadfn] trait objects without an explicit dyn are deprecated #522

TheAifam5 opened this issue Jun 17, 2020 · 2 comments

Comments

@TheAifam5
Copy link

TheAifam5 commented Jun 17, 2020

  |
9 |         fn metaloadfn(mut loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
  |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut(&str) -> *const __gl_imports::raw::c_void`

compiled with forbid(rust_2018_idioms)

@PutterBeanut
Copy link

PutterBeanut commented Mar 1, 2021

First off, this isn't a GL problem, it's a Rust problem. But for an explanation: when using a trait, they actually don't have a known size at compile time, so you use the dyn keyword allows Rust to say "okay okay, I'll trust you on this one," in which FnMut most likely is or implements a trait.

@Lokathor
Copy link

Lokathor commented Mar 1, 2021

FnMut is a trait. It doesn't implement a trait.

Also, the real answer to this is that "forbid the 2018 idioms" is not a useful thing to do. This crate will likely never move past 2015 edition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants