This commit is contained in:
Andrew Cann 2017-01-21 16:03:28 +08:00
parent 5c90dd7978
commit 6a99573513

View File

@ -10,17 +10,24 @@
#![deny(resolve_trait_on_defaulted_unit)]
trait Deserialize {
fn deserialize() -> Result<Self, String>
trait Deserialize: Sized {
fn deserialize() -> Result<Self, String>;
}
impl Deserialize for () {
fn deserialize() -> Result<(), String> {
Ok(())
}
}
fn doit() -> Result<(), String> {
let _ = Deserialize::deserialize()?;
//~^ ERROR attempt to resolve a trait
//~^ ERROR code relies on type
//~| WARNING previously accepted
Ok(())
}
fn main() {
doit();
let _ = doit();
}