X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Ftraits%2Ferror_reporting.rs;h=367a7eacdfcaf50dd4e61a592f163f65a79e82ad;hb=0d883cb8f82ec5d99f63d03bd43c6fc87d96aeef;hp=0e63ef666c75a02b2a9449a259982eaa8cba2ae9;hpb=e8ca35e63dda82a8b5fa8eb72cf3e490a5794a46;p=rust.git diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 0e63ef666c7..367a7eacdfc 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -418,9 +418,7 @@ fn on_unimplemented_note( Some(format!("[{}]", self.tcx.type_of(def.did).to_string())), )); let tcx = self.tcx; - if let Some(len) = len.val.try_to_scalar().and_then(|scalar| { - scalar.to_usize(&tcx).ok() - }) { + if let Some(len) = len.assert_usize(tcx) { flags.push(( "_Self".to_owned(), Some(format!("[{}; {}]", self.tcx.type_of(def.did).to_string(), len)), @@ -449,7 +447,7 @@ fn find_similar_impl_candidates(&self, { let simp = fast_reject::simplify_type(self.tcx, trait_ref.skip_binder().self_ty(), - true,); + true); let all_impls = self.tcx.all_impls(trait_ref.def_id()); match simp { @@ -728,12 +726,9 @@ pub fn report_selection_error(&self, } ty::Predicate::RegionOutlives(ref predicate) => { - let predicate = self.resolve_type_vars_if_possible(predicate); - let err = self.region_outlives_predicate(&obligation.cause, - &predicate).err().unwrap(); - struct_span_err!(self.tcx.sess, span, E0279, - "the requirement `{}` is not satisfied (`{}`)", - predicate, err) + // These errors should show up as region + // inference failures. + panic!("region outlives {:?} failed", predicate); } ty::Predicate::Projection(..) | ty::Predicate::TypeOutlives(..) => { @@ -1449,15 +1444,15 @@ fn note_obligation_cause_code(&self, match *cause_code { ObligationCauseCode::ExprAssignable | ObligationCauseCode::MatchExpressionArm { .. } | - ObligationCauseCode::IfExpression | + ObligationCauseCode::MatchExpressionArmPattern { .. } | + ObligationCauseCode::IfExpression { .. } | ObligationCauseCode::IfExpressionWithNoElse | ObligationCauseCode::MainFunctionType | ObligationCauseCode::StartFunctionType | ObligationCauseCode::IntrinsicType | ObligationCauseCode::MethodReceiver | ObligationCauseCode::ReturnNoExpression | - ObligationCauseCode::MiscObligation => { - } + ObligationCauseCode::MiscObligation => {} ObligationCauseCode::SliceOrArrayElem => { err.note("slice and array elements must have `Sized` type"); }