// Copyright 2018 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. trait Deserialize<'de> {} trait DeserializeOwned: for<'de> Deserialize<'de> {} impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} // Based on this impl, `&'static str` only implements Deserialize<'static>. // It does not implement for<'de> Deserialize<'de>. impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} fn main() { // Then why does it implement DeserializeOwned? This compiles. fn assert_deserialize_owned() {} assert_deserialize_owned::<&'static str>(); //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied // It correctly does not implement for<'de> Deserialize<'de>. //fn assert_hrtb Deserialize<'de>>() {} //assert_hrtb::<&'static str>(); }