= TypeCoercionRules::TryCoerce (from.get_ty (), to.get_ty (), locus,
true /*allow-autoderef*/);
if (!possible_coercion.is_error ())
- return possible_coercion;
+ {
+ // given the attempt was ok we need to ensure we perform it so that any
+ // inference variables are unified correctly
+ return TypeCoercionRules::Coerce (from.get_ty (), to.get_ty (), locus,
+ true /*allow-autoderef*/);
+ }
// try the simple cast rules
auto simple_cast = cast_rules ();
}
} // namespace Resolver
-} // namespace Rust
\ No newline at end of file
+} // namespace Rust
--- /dev/null
+struct A<T> {
+ // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
+ f: *const T,
+}
+
+pub fn cast<T>(a: A<T>) {
+ let z = a.f as *const ();
+}