-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Local Default Bounds to assist Forget and other ?Trait.
#3783
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
base: master
Are you sure you want to change the base?
Conversation
|
Another drawback is that (similar to
One situation where it could cause friction is when dependencies do not support #![default_trait_bounds(?Forget)]
fn frobnicate(x: impl ToString) {
other_crate::frobnicate(x); // error: `Forget` bound not satisfied
}That said, I like this proposal and think that the benefits outweigh the drawbacks. Thank you! |
#t-lang > The destruction guarantee and linear types formulation @ 💬 I have found this RFC to lack a good justification for breaking Rust language ergonomics in this way. |
|
I suspect solving the "default" problem is not sufficient. We also need a way to switch modes within a module, which an effect-like system may be better suited for. This might imply something like a modifier syntax: |
|
@tmandry I'm not sure about the motivation. Can you please explain why do we need a way to switch modes within a module? This RFC is not 100% ultra-generic solution, but more like an attempt to give a specific solution to the specific problem. Do you suggest it will allow better backwards compatibility? |
This RFC proposes a mechanism for crates to define default bounds on generics. By specifying these defaults at the crate level we can reduce the need for verbose and repetitive
?Traitannotations while maintaining backward compatibility and enabling future language evolution.It is targeted at supporting migrations from default being
Traitto?Trait, whereTraitrepresents some assumption that is present everywhere but is not really exercised a lot, such asForget,size = strideetc. Features likeDynSized, as well asextern types, are out of the scope of this RFC, because it does not fit into this category.DynSizedis not retracting mostly unexercised assumptions in order to make it?DynSizedthe default.Primary use case is
Forgetmarker trait.Rendered
Pre-RFC thread