Borrow checker bug? Indexing into a hashset that contains 'static items using a value that is not 'static does not return expected type
The Rust Programming Language Forum
Borrow checker bug? Indexing into a hashset that contains 'static items using a value that is not 'static does not return expected type
x is a HashSet that contains leaked slices of Foo's. The strings inside Foo are also leaked. (ignore the fact that i don't insert any values into the set, that doesn't matter for this compile error); I expect that the returned type of x.get to be Option<& &'static [Foo<'static>]> no matter what is borrowed type is. But the borrow checker seems to be agree? use std::collections::HashSet; #[derive(Copy, Clone, PartialEq, Eq, Hash)] struct Foo<'a> { inner: &'a str } fn main () { let x: H...
0 comments
No comments yet.