1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Regression test for #41936. The coerce-unsized trait check in
12 // coherence was using subtyping, which triggered variance
13 // computation, which failed because it required type info for fields
14 // that had not (yet) been computed.
17 #![feature(coerce_unsized)]
19 use std::{marker,ops};
21 // Change the array to a non-array, and error disappears
22 // Adding a new field to the end keeps the error
23 struct LogDataBuf([u8;8]);
25 struct Aref<T: ?Sized>
27 // Inner structure triggers the error, removing the inner removes the message.
28 ptr: Box<ArefInner<T>>,
30 impl<T: ?Sized + marker::Unsize<U>, U: ?Sized> ops::CoerceUnsized<Aref<U>> for Aref<T> {}
32 struct ArefInner<T: ?Sized>
34 // Even with this field commented out, the error is raised.