rust/tests/ui/traits/next-solver/dont-coerce-infer-to-dyn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
352 B
Rust
Raw Normal View History

2023-12-14 12:11:28 +00:00
//@ compile-flags: -Znext-solver
2023-07-31 15:53:31 +00:00
//@ check-pass
use std::fmt::Display;
use std::rc::Rc;
fn mk<T: ?Sized>(t: Option<&T>) -> Rc<T> {
todo!()
}
fn main() {
let mut x = None;
let y = mk(x);
// Don't treat the line below as a unsize coercion `Rc<?0> ~> Rc<dyn Display>`
let z: Rc<dyn Display> = y;
x = Some(&1 as &dyn Display);
}