-
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
Co-authored-by: kennytm <kennytm@gmail.com>
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! |
Co-authored-by: Jack Rickard <jack.rickard@outlook.com>
#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. |
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
?Trait
annotations while maintaining backward compatibility and enabling future language evolution.It is targeted at supporting migrations from default being
Trait
to?Trait
, whereTrait
represents some assumption that is present everywhere but is not really exercised a lot, such asForget
,size = stride
etc. Features likeDynSized
, as well asextern types
, are out of the scope of this RFC, because it does not fit into this category.DynSized
is not retracting mostly unexercised assumptions in order to make it?DynSized
the default.Primary use case is
Forget
marker trait.Rendered
Pre-RFC thread