mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
add a test case
dont duplicate error codes choose unlikely error code specify error pattern in test
This commit is contained in:
@@ -4676,8 +4676,8 @@ pub fn method(&self) {} // It's now public.
|
||||
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 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
|
||||
let inferred_outlives_of = self.tcx.inferred_outlives_of(item_def_id);
|
||||
span_err!(self.tcx.sess,
|
||||
item.span,
|
||||
E0628,
|
||||
E0640,
|
||||
"{:?}",
|
||||
inferred_outlives_of);
|
||||
}
|
||||
|
||||
@@ -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() { }
|
||||
Reference in New Issue
Block a user