Rollup merge of #118660 - cuviper:alloc_str, r=petrochenkov
rustc_arena: add `alloc_str` Two places called `from_utf8_unchecked` for strings from `alloc_slice`, and one's SAFETY comment said this was for lack of `alloc_str` -- so let's just add that instead!
This commit is contained in:
commit
cf78a79020
3 changed files with 24 additions and 8 deletions
|
@ -2614,9 +2614,7 @@ pub struct SymbolName<'tcx> {
|
|||
|
||||
impl<'tcx> SymbolName<'tcx> {
|
||||
pub fn new(tcx: TyCtxt<'tcx>, name: &str) -> SymbolName<'tcx> {
|
||||
SymbolName {
|
||||
name: unsafe { str::from_utf8_unchecked(tcx.arena.alloc_slice(name.as_bytes())) },
|
||||
}
|
||||
SymbolName { name: tcx.arena.alloc_str(name) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue