On Paths such as: mem::size_of<T>() we always specified to infer the
generics which is not always the case and can cause stay inference
variables.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): remove infer call
(TypeCheckExpr::resolve_root_path): only infer when we need to
gcc/testsuite/ChangeLog:
* rust/compile/sizeof-stray-infer-var-bug.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
if (tyseg->get_kind () == TyTy::TypeKind::ERROR)
return;
- if (tyseg->needs_generic_substitutions ())
- {
- tyseg = SubstMapper::InferSubst (tyseg, expr.get_locus ());
- }
-
bool fully_resolved = offset == expr.get_segments ().size ();
if (fully_resolved)
{
if (lookup->get_kind () == TyTy::TypeKind::ERROR)
return new TyTy::ErrorType (expr.get_mappings ().get_hirid ());
}
+ else if (lookup->needs_generic_substitutions ())
+ {
+ lookup = SubstMapper::InferSubst (lookup, expr.get_locus ());
+ }
*root_resolved_node_id = ref_node_id;
*offset = *offset + 1;
--- /dev/null
+mod mem {
+ extern "rust-intrinsic" {
+ pub fn size_of<T>() -> usize;
+ }
+}
+
+mod ptr {
+
+ pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
+ let x = x as *mut T;
+ let y = y as *mut T;
+ let len = mem::size_of::<T>() * count;
+ }
+}