-
Notifications
You must be signed in to change notification settings - Fork 13.3k
The signature of Path::strip_prefix is bizarrely overconstrained #48390
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
Comments
This would be a breaking change since you can’t pass |
@vitalyd: You've said a similar thing before on users, but I still don't see the argument. Looking back at the thread now I see you responded to my request for clarification:
But even with this clarification I cannot see the issue. It seems to me I can call an fn foo<R: Read>(r: R) { }
fn bar<R: Read + ?Sized>(r: &mut R) { foo(r) } // ok Notice I did not form the |
Okay. Wait. I see something. It's an insanely subtle distinction, but it's there: Only the
...but this doesn't apply to |
Right - for the Thinking about the |
Make signature of Path::strip_prefix accept non-references I did this a while back but didn't submit a PR. Might as well see what happens. Fixes #48390. **Note: This has the potential to cause regressions in type inference.** However, in order for code to break, it would need to be relying on the signature to determine that a type is `&_`, while still being able to figure out what the `_` is. I'm having a hard time imagining such a scenario in real code.
This can clearly be generalized to
Implementation.
(Note: Like many similar attempts to "generalize" function signatures, this is a potentially breaking change due to potential regressions in type inference)
The text was updated successfully, but these errors were encountered: