add a test case
dont duplicate error codes choose unlikely error code specify error pattern in test
This commit is contained in:
parent
ba1efa3b61
commit
c021e5303f
4 changed files with 31 additions and 7 deletions
|
@ -4676,8 +4676,8 @@ register_diagnostics! {
|
|||
E0588, // packed struct cannot transitively contain a `[repr(align)]` struct
|
||||
E0592, // duplicate definitions with name `{}`
|
||||
// E0613, // Removed (merged with E0609)
|
||||
E0640, // infer outlives
|
||||
E0627, // yield statement outside of generator literal
|
||||
E0632, // cannot provide explicit type parameters when `impl Trait` is used in
|
||||
// argument position.
|
||||
E0628, // infer outlives
|
||||
}
|
||||
|
|
|
@ -305,6 +305,11 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
|
|||
|
||||
})?;
|
||||
|
||||
tcx.sess.track_errors(|| {
|
||||
time(time_passes, "outlives testing", ||
|
||||
outlives::test::test_inferred_outlives(tcx));
|
||||
})?;
|
||||
|
||||
tcx.sess.track_errors(|| {
|
||||
time(time_passes, "impl wf inference", ||
|
||||
impl_wf_check::impl_wf_check(tcx));
|
||||
|
@ -320,11 +325,6 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
|
|||
variance::test::test_variance(tcx));
|
||||
})?;
|
||||
|
||||
tcx.sess.track_errors(|| {
|
||||
time(time_passes, "outlives testing", ||
|
||||
outlives::test::test_inferred_outlives(tcx));
|
||||
})?;
|
||||
|
||||
time(time_passes, "wf checking", || check::check_wf_new(tcx))?;
|
||||
|
||||
time(time_passes, "item-types checking", || check::check_item_types(tcx))?;
|
||||
|
|
|
@ -30,7 +30,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> {
|
|||
let inferred_outlives_of = self.tcx.inferred_outlives_of(item_def_id);
|
||||
span_err!(self.tcx.sess,
|
||||
item.span,
|
||||
E0628,
|
||||
E0640,
|
||||
"{:?}",
|
||||
inferred_outlives_of);
|
||||
}
|
||||
|
|
24
src/test/compile-fail/outlives-associated-types.rs
Normal file
24
src/test/compile-fail/outlives-associated-types.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
// Test that the outlives computation runs for now...
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
//todo add all the test cases
|
||||
// https://github.com/rust-lang/rfcs/blob/master/text/2093-infer-outlives.md#example-1-a-reference
|
||||
|
||||
#[rustc_outlives]
|
||||
struct Direct<'a, T> {
|
||||
// inferred: `T: 'a`
|
||||
field: &'a T //~ ERROR generic reference may outlive the data it points to
|
||||
}
|
||||
|
||||
fn main() { }
|
Loading…
Add table
Add a link
Reference in a new issue