-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Asking for a 'static bound when not needed #14901
Comments
cc @luqmana |
I don't think it is unneeded, but I'm not sure. |
Converting everything to 100% trait objects compiles: use std::io::{Reader,BufReader};
enum Wrapper<'a> {
WrapReader(&'a Reader)
}
trait Wrap<'a> {
fn wrap(self) -> Wrapper<'a>;
}
impl<'a> Wrap<'a> for &'a mut Reader {
fn wrap(self) -> Wrapper<'a> {
WrapReader(self)
}
}
fn doit<'a>(b: &'a [u8]) {
let mut r = BufReader::new(b);
(&mut r as &mut Reader).wrap();
}
pub fn main() {
let s = "zomg".to_string();
doit(s.as_slice().as_bytes());
println!("Zomg!");
} So it seems that the compile error, at least in the given example, is not a safety problem. |
cc me |
I've been working on a fix for this (and general cleanup of this issue). Unfortunately, I've put it on hold for #5527, it seems like this kind of thing keeps coming up though. |
I think the original error is legit, but there is no great way to fix it right now. I expect one to write something like |
Looks like this is fixed by #16453 |
Fixed by #18324 |
internal: Move flycheck and config errors to status notification cc rust-lang/rust-analyzer#14193
Repro:
Error:
The text was updated successfully, but these errors were encountered: