prepass: remove unsafe, put strings on heap
actually caused spooky behavior resolves #5
This commit is contained in:
parent
109e030c71
commit
5ddbd728a8
1 changed files with 2 additions and 7 deletions
|
@ -603,7 +603,7 @@ impl<'s> PrePass<'s> {
|
|||
) -> Self {
|
||||
let mut link_definitions = Map::new();
|
||||
let mut headings: Vec<Heading> = Vec::new();
|
||||
let mut used_ids: Set<&str> = Set::new();
|
||||
let mut used_ids: Set<String> = Set::new();
|
||||
|
||||
let mut blocks = blocks.peekable();
|
||||
|
||||
|
@ -724,12 +724,7 @@ impl<'s> PrePass<'s> {
|
|||
}
|
||||
}
|
||||
|
||||
// SAFETY: used_ids is dropped before the id_auto strings in headings. even if
|
||||
// the strings move due to headings reallocating, the string data on the heap
|
||||
// will not move
|
||||
used_ids.insert(unsafe {
|
||||
std::mem::transmute::<&str, &'static str>(id_auto.as_ref())
|
||||
});
|
||||
used_ids.insert(id_auto.clone());
|
||||
headings.push(Heading {
|
||||
location: e.span.start as u32,
|
||||
id_auto,
|
||||
|
|
Loading…
Reference in a new issue