-
Notifications
You must be signed in to change notification settings - Fork 124
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
Self: 'static
bound gets mistakenly applied to references
#335
Comments
Hmm, that does seem like an annoying bug. Just double checking: is it also happening when using the 1.0.0-beta.6 release of derive_more? |
Trying on
Expanding the macro manually I believe it's coming from this line: type Error = ::derive_more::TryIntoError<Foo>; |
Okay, so I took a quick look at this as part of my attempt to finally get ready to release 1.0.0 The error you get on on 1.0.0-beta.6 is a regression from 0.99, and #384 fixes that one. The original issue you reported is not as easy to solve though (although possible to solve). The reason this happens is because we blindly copy all the constraints from the type definition to the trait implementation. This is normally fine, even in case of The way to fix this in |
In the following code, the
Self: 'static
bound gets copied to the derived implTryFrom<&mut Foo<V>> for (&mut Wrapper<V>) where Self: 'static
, which changes the bound fromFoo<V>: 'static
to&mut Foo<V>: 'static
.And the resulting build fails with
https://www.rustexplorer.com/b#LyoKW2RlcGVuZGVuY2llc10KZGVyaXZlX21vcmUgPSAiKiIKKi8KCnVzZSBkZXJpdmVfbW9yZTsKCiNbZGVyaXZlKERlYnVnKV0KcHViIHN0cnVjdCBXcmFwcGVyPFY+KFYpOwoKI1tkZXJpdmUoZGVyaXZlX21vcmU6OlRyeUludG8pXQojW3RyeV9pbnRvKHJlZiwgcmVmX211dCldCnB1YiBlbnVtIEZvbzxWPiB3aGVyZSBTZWxmOiAnc3RhdGljIHsgIC8vIFRoaXMgbGluZSBmYWlscwovLyBwdWIgZW51bSBGb288Vj4gd2hlcmUgRm9vPFY+OiAnc3RhdGljIHsgIC8vIFRoaXMgbGluZSBzdWNjZWVkcywgYWZ0ZXIgZXhwbGljaXRseSBjaGFuZ2luZyBgU2VsZmAgdG8gYEZvbzxWPmAKICAgIFYoV3JhcHBlcjxWPiksCn0KCmZuIG1haW4oKSB7CiAgICBsZXQgeCA9IEZvbzo6PHU4Pjo6VihXcmFwcGVyKDIpKTsKICAgIGxldCB1OHJlZjogJldyYXBwZXI8dTg+ID0gKCZ4KS50cnlfaW50bygpLnVud3JhcCgpOwogICAgcHJpbnRsbiEoInt1OHJlZjo/fSIpOwp9
The text was updated successfully, but these errors were encountered: