2017-12-03 06:01:09 -06:00
|
|
|
// Copyright 2016 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.
|
|
|
|
|
2018-04-09 04:28:00 -05:00
|
|
|
// compile-flags:-Zborrowck=mir
|
2017-12-03 06:01:09 -06:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
|
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
|
|
|
|
where
|
|
|
|
T: Debug,
|
|
|
|
{
|
|
|
|
x
|
2018-04-09 04:28:00 -05:00
|
|
|
//~^ WARNING not reporting region error due to nll
|
2017-12-19 10:12:56 -06:00
|
|
|
//~| the parameter type `T` may not live long enough
|
2017-12-03 06:01:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
|
|
|
|
where
|
|
|
|
T: 'a + Debug,
|
|
|
|
{
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
|
|
|
where
|
|
|
|
T: 'b + Debug,
|
|
|
|
{
|
|
|
|
x
|
2018-04-09 04:28:00 -05:00
|
|
|
//~^ WARNING not reporting region error due to nll
|
2017-12-19 10:12:56 -06:00
|
|
|
//~| the parameter type `T` may not live long enough
|
2017-12-03 06:01:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
|
|
|
where
|
|
|
|
T: 'b + Debug,
|
|
|
|
'b: 'a,
|
|
|
|
{
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|