Correct merge errors, broken tests
This commit is contained in:
parent
4a0469e3d7
commit
ef5c439fb0
6 changed files with 47 additions and 9 deletions
|
|
@ -686,7 +686,7 @@ impl FnCtxt {
|
|||
result::Err(RegionError {
|
||||
msg: {
|
||||
fmt!("named region `%s` not in scope here",
|
||||
bound_region_to_str(self.tcx(), br))
|
||||
bound_region_ptr_to_str(self.tcx(), br))
|
||||
},
|
||||
replacement: {
|
||||
self.infcx().next_region_var(
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ time of error detection.
|
|||
|
||||
*/
|
||||
|
||||
use core::prelude::*;
|
||||
use std::prelude::*;
|
||||
use middle::ty;
|
||||
use middle::ty::Region;
|
||||
use middle::typeck::infer;
|
||||
|
|
@ -80,10 +80,46 @@ use syntax::opt_vec::OptVec;
|
|||
use util::ppaux::UserString;
|
||||
use util::ppaux::note_and_explain_region;
|
||||
|
||||
impl InferCtxt {
|
||||
pub trait ErrorReporting {
|
||||
pub fn report_region_errors(@mut self,
|
||||
errors: &OptVec<RegionResolutionError>);
|
||||
|
||||
pub fn report_and_explain_type_error(@mut self,
|
||||
trace: TypeTrace,
|
||||
terr: &ty::type_err);
|
||||
|
||||
fn values_str(@mut self, values: &ValuePairs) -> Option<~str>;
|
||||
|
||||
fn expected_found_str<T:UserString+Resolvable>(
|
||||
@mut self,
|
||||
exp_found: &ty::expected_found<T>)
|
||||
-> Option<~str>;
|
||||
|
||||
fn report_concrete_failure(@mut self,
|
||||
origin: SubregionOrigin,
|
||||
sub: Region,
|
||||
sup: Region);
|
||||
|
||||
fn report_sub_sup_conflict(@mut self,
|
||||
var_origin: RegionVariableOrigin,
|
||||
sub_origin: SubregionOrigin,
|
||||
sub_region: Region,
|
||||
sup_origin: SubregionOrigin,
|
||||
sup_region: Region);
|
||||
|
||||
fn report_sup_sup_conflict(@mut self,
|
||||
var_origin: RegionVariableOrigin,
|
||||
origin1: SubregionOrigin,
|
||||
region1: Region,
|
||||
origin2: SubregionOrigin,
|
||||
region2: Region);
|
||||
}
|
||||
|
||||
|
||||
impl ErrorReporting for InferCtxt {
|
||||
pub fn report_region_errors(@mut self,
|
||||
errors: &OptVec<RegionResolutionError>) {
|
||||
for errors.each |error| {
|
||||
for errors.iter().advance |error| {
|
||||
match *error {
|
||||
ConcreteFailure(origin, sub, sup) => {
|
||||
self.report_concrete_failure(origin, sub, sup);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ use middle::typeck::infer::sub::Sub;
|
|||
use middle::typeck::infer::lub::Lub;
|
||||
use middle::typeck::infer::to_str::InferStr;
|
||||
use middle::typeck::infer::unify::{ValsAndBindings, Root};
|
||||
use middle::typeck::infer::error_reporting::ErrorReporting;
|
||||
use middle::typeck::isr_alist;
|
||||
use util::common::indent;
|
||||
use util::ppaux::{bound_region_to_str, ty_to_str, trait_ref_to_str, Repr,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ mod doc;
|
|||
enum Constraint {
|
||||
ConstrainVarSubVar(RegionVid, RegionVid),
|
||||
ConstrainRegSubVar(Region, RegionVid),
|
||||
ConstrainVarSubReg(RegionVid, Region)
|
||||
ConstrainVarSubReg(RegionVid, Region),
|
||||
ConstrainRegSubReg(Region, Region),
|
||||
}
|
||||
|
||||
#[deriving(Eq, IterBytes)]
|
||||
|
|
@ -454,7 +455,7 @@ impl RegionVarBindings {
|
|||
{
|
||||
let mut result_set = result_set;
|
||||
if r == r1 { // Clearly, this is potentially inefficient.
|
||||
if !result_set.iter().any_(|x| x == r2) {
|
||||
if !result_set.iter().any_(|x| *x == r2) {
|
||||
result_set.push(r2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ impl Repr for @ast::pat {
|
|||
|
||||
impl Repr for ty::bound_region {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
bound_region_to_str(tcx, *self)
|
||||
bound_region_ptr_to_str(tcx, *self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ struct an_enum<'self>(&'self int);
|
|||
struct a_class<'self> { x:&'self int }
|
||||
|
||||
fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
|
||||
return e; //~ ERROR mismatched types: expected `an_enum<'b> ` but found `an_enum<'a> `
|
||||
return e; //~ ERROR mismatched types: expected `an_enum<'b>` but found `an_enum<'a>`
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
}
|
||||
|
||||
fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
|
||||
return e; //~ ERROR mismatched types: expected `a_class<'b> ` but found `a_class<'a> `
|
||||
return e; //~ ERROR mismatched types: expected `a_class<'b>` but found `a_class<'a>`
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue