1e79870770
particular to treat an AutoUnsize as as kind of "instantaneous" borrow of the value being unsized. This prevents us from feeding uninitialized data. This caused a problem for the eager reborrow of comparison traits, because that wound up introducing a "double AutoRef", which was not being thoroughly checked before but turned out not to type check. Fortunately, we can just remove that "eager reborrow" as it is no longer needed now that `PartialEq` doesn't force both LHS and RHS to have the same type (and even if we did have this problem, the better way would be to lean on introducing a common supertype).
21 lines
767 B
Rust
21 lines
767 B
Rust
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
// Variation on `borrowck-use-uninitialized-in-cast` in which we do a
|
|
// trait cast from an uninitialized source. Issue #20791.
|
|
|
|
trait Foo { fn dummy(&self) { } }
|
|
impl Foo for i32 { }
|
|
|
|
fn main() {
|
|
let x: &i32;
|
|
let y = x as *const Foo; //~ ERROR use of possibly uninitialized variable: `*x`
|
|
}
|