diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-04-25 18:55:12 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-04-27 13:41:53 +0100 |
commit | f1c6f7da67ff2417e9100e2d43c1571b482c9e82 (patch) | |
tree | 6aa60b8dc2f699f9a77214cfb6d51f12e95833a7 | |
parent | a24a14371b16c316a815a9440b1d960cd3f885dd (diff) | |
download | gcc-f1c6f7da67ff2417e9100e2d43c1571b482c9e82.zip gcc-f1c6f7da67ff2417e9100e2d43c1571b482c9e82.tar.gz gcc-f1c6f7da67ff2417e9100e2d43c1571b482c9e82.tar.bz2 |
When we resolve a Path to Self we cannot infer any substitions
In rust ParamTy represents type parameters and this works in this context
if we infer all parameters it breaks type checking here.
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-expr.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h index 5643ad6..5dafd64 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.h +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h @@ -811,8 +811,15 @@ public: else if (expr.get_num_segments () == 1) { Location locus = expr.get_segments ().back ().get_locus (); - if (tyseg->needs_generic_substitutions ()) - tyseg = SubstMapper::InferSubst (tyseg, locus); + + bool is_big_self + = expr.get_segments ().front ().get_segment ().as_string ().compare ( + "Self") + == 0; + if (!is_big_self && tyseg->needs_generic_substitutions ()) + { + tyseg = SubstMapper::InferSubst (tyseg, locus); + } infered = tyseg; return; |