diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-07-15 11:58:51 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-07-15 14:38:00 +1000 |
| commit | a1b8540390bb9bf9861757ef9f3703f140d6f73a (patch) | |
| tree | 10c62ef8e0eefae9696ee0e427b4941c83a907d3 /src/librustc_codegen_ssa | |
| parent | 7c4d431c067308ae79b902fe0d0e7b9c6958d0e9 (diff) | |
Undo the `const_str` changes from the previous commit.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 7 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/consts.rs | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 0ec46b515b4..7116bb8c925 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -16,7 +16,7 @@ use rustc_middle::mir; use rustc_middle::mir::interpret::{AllocId, ConstValue, Pointer, Scalar}; use rustc_middle::mir::AssertKind; use rustc_middle::ty::layout::{FnAbiExt, HasTyCtxt}; -use rustc_middle::ty::{self, Instance, SymbolName, Ty, TypeFoldable}; +use rustc_middle::ty::{self, Instance, Ty, TypeFoldable}; use rustc_span::source_map::Span; use rustc_span::{sym, Symbol}; use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode}; @@ -423,7 +423,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (lang_items::PanicBoundsCheckFnLangItem, vec![index, len, location]) } _ => { - let msg = bx.const_str(SymbolName::new(bx.tcx(), msg.description())); + let msg_str = Symbol::intern(msg.description()); + let msg = bx.const_str(msg_str); // It's `pub fn panic(expr: &str)`, with the wide reference being passed // as two arguments, and `#[track_caller]` adds an implicit third argument. (lang_items::PanicFnLangItem, vec![msg.0, msg.1, location]) @@ -486,7 +487,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } else { format!("attempted to leave type `{}` uninitialized, which is invalid", ty) }; - let msg = bx.const_str(SymbolName::new(bx.tcx(), &msg_str)); + let msg = bx.const_str(Symbol::intern(&msg_str)); let location = self.get_caller_location(bx, span).immediate(); // Obtain the panic entry point. diff --git a/src/librustc_codegen_ssa/traits/consts.rs b/src/librustc_codegen_ssa/traits/consts.rs index e4c1e100626..6b58dea794b 100644 --- a/src/librustc_codegen_ssa/traits/consts.rs +++ b/src/librustc_codegen_ssa/traits/consts.rs @@ -2,7 +2,7 @@ use super::BackendTypes; use crate::mir::place::PlaceRef; use rustc_middle::mir::interpret::{Allocation, Scalar}; use rustc_middle::ty::layout::TyAndLayout; -use rustc_middle::ty::SymbolName; +use rustc_span::Symbol; use rustc_target::abi::{self, Size}; pub trait ConstMethods<'tcx>: BackendTypes { @@ -20,7 +20,7 @@ pub trait ConstMethods<'tcx>: BackendTypes { fn const_u8(&self, i: u8) -> Self::Value; fn const_real(&self, t: Self::Type, val: f64) -> Self::Value; - fn const_str(&self, s: SymbolName<'tcx>) -> (Self::Value, Self::Value); + fn const_str(&self, s: Symbol) -> (Self::Value, Self::Value); fn const_struct(&self, elts: &[Self::Value], packed: bool) -> Self::Value; fn const_to_opt_uint(&self, v: Self::Value) -> Option<u64>; |
