summaryrefslogtreecommitdiff
path: root/src/hir_typeck
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-10-26 17:15:23 +0800
committerJohn Hodge <tpg@mutabah.net>2019-10-26 17:15:23 +0800
commit99904636d2e1e335238552cbb5b8b23dd06b7295 (patch)
tree5fd6470fb702b2a26253d380d47d5b6fd232607f /src/hir_typeck
parent7ca04e2d668fa44a1663158f844cb912e396cb32 (diff)
parentebd8edeb4f1861943cc82d310564b1f592e63272 (diff)
downloadmrust-99904636d2e1e335238552cbb5b8b23dd06b7295.tar.gz
Merge remote-tracking branch 'remotes/origin/master' into nightly-1.29
Diffstat (limited to 'src/hir_typeck')
-rw-r--r--src/hir_typeck/expr_cs.cpp8
-rw-r--r--src/hir_typeck/helpers.cpp4
2 files changed, 4 insertions, 8 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 10cb9407..8a374946 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -46,6 +46,7 @@ struct Context
class Revisitor
{
public:
+ virtual ~Revisitor() = default;
virtual const Span& span() const = 0;
virtual void fmt(::std::ostream& os) const = 0;
virtual bool revisit(Context& context, bool is_fallback) = 0;
@@ -6667,13 +6668,8 @@ namespace {
if( H::type_is_num(left) && H::type_is_num(right) ) {
DEBUG("- Magic inferrence link for binops on numerics");
context.equate_types(sp, res, left);
- const auto& right = context.get_type(v.params.m_types.at(0));
- context.equate_types_to_shadow(sp, right);
- }
- else
- {
- context.equate_types_to_shadow(sp, right);
}
+ context.equate_types_to_shadow(sp, /*right*/v.params.m_types.at(0)); // RHS, can't use `right` because it might be freed by the above equate.
}
else
{
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 08e817de..010df546 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -636,7 +636,7 @@ void HMTypeInferrence::set_ivar_to(unsigned int slot, ::HIR::TypeRef type)
}
else
#endif
- root_ivar.type = box$( mv$(type) );
+ root_ivar.type = box$( type );
}
this->mark_change();
@@ -1648,7 +1648,7 @@ bool TraitResolution::has_associated_type(const ::HIR::TypeRef& input) const
//TRACE_FUNCTION_F(input);
TU_MATCH(::HIR::TypeRef::Data, (input.m_data), (e),
(Infer,
- auto& ty = this->m_ivars.get_type(input);
+ const auto& ty = this->m_ivars.get_type(input);
if( ty != input ) {
return this->has_associated_type(ty);
}