summaryrefslogtreecommitdiff
path: root/src/mir/from_hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-05-19 22:15:02 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-05-19 22:15:02 +0800
commitb48167dec0c1c05b463991a8db5a8db70a5ae604 (patch)
treeeadc95ab546a617d298fb3a16fb080e1bc4355e8 /src/mir/from_hir.cpp
parentdab5cf5462d8fce6d6fcaa1343df8f5f3b763b8a (diff)
downloadmrust-b48167dec0c1c05b463991a8db5a8db70a5ae604.tar.gz
All - Switch to using interned (de-duplicated) RcString-s instead of std::string for paths/identifiers
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r--src/mir/from_hir.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index b8549f8a..9e749811 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -51,7 +51,7 @@ namespace {
struct LoopDesc {
ScopeHandle scope;
- ::std::string label;
+ RcString label;
unsigned int cur;
unsigned int next;
::MIR::LValue res_value;
@@ -679,7 +679,7 @@ namespace {
target_block = &*it;
}
else {
- if( target_block->label != "" && target_block->label[0] == '#' ) {
+ if( target_block->label != "" && target_block->label.c_str()[0] == '#' ) {
TODO(node.span(), "Break within try block, want to break parent loop instead");
}
}
@@ -1952,7 +1952,7 @@ namespace {
{
m_builder.end_block(::MIR::Terminator::make_Call({
next_block, panic_block,
- res.clone(), ::MIR::CallTarget::make_Intrinsic({ "platform:"+gpath.m_path.m_components.back(), gpath.m_params.clone() }),
+ res.clone(), ::MIR::CallTarget::make_Intrinsic({ RcString(FMT("platform:" << gpath.m_path.m_components.back())), gpath.m_params.clone() }),
mv$(values)
}));
}
@@ -2054,8 +2054,8 @@ namespace {
const auto& val_ty = node.m_value->m_res_type;
unsigned int idx;
- if( '0' <= node.m_field[0] && node.m_field[0] <= '9' ) {
- ::std::stringstream(node.m_field) >> idx;
+ if( ::std::isdigit(node.m_field.c_str()[0]) ) {
+ ::std::stringstream(node.m_field.c_str()) >> idx;
m_builder.set_result( node.span(), ::MIR::LValue::make_Field({ box$(val), idx }) );
}
else if( const auto* bep = val_ty.m_data.as_Path().binding.opt_Struct() ) {