1
Fork 0

librustc: Remove cross-borrowing of Box<T> to &T from the language,

except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]
This commit is contained in:
Patrick Walton 2014-07-07 16:35:15 -07:00
parent ca24abd4d2
commit de70d76373
72 changed files with 206 additions and 204 deletions

View file

@ -954,7 +954,9 @@ impl<'a> MethodDef<'a> {
// expressions for referencing every field of every
// Self arg, assuming all are instances of VariantK.
// Build up code associated with such a case.
let substructure = EnumMatching(index, variant, field_tuples);
let substructure = EnumMatching(index,
&*variant,
field_tuples);
let arm_expr = self.call_substructure_method(
cx, trait_, type_ident, self_args, nonself_args,
&substructure);