Skip to content

Commit

Permalink
x.py fmt after previous deignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Dec 24, 2019
1 parent 48291a9 commit 6891388
Show file tree
Hide file tree
Showing 42 changed files with 9,637 additions and 9,795 deletions.
723 changes: 456 additions & 267 deletions src/libcore/iter/adapters/mod.rs

Large diffs are not rendered by default.

402 changes: 257 additions & 145 deletions src/libcore/iter/traits/iterator.rs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/libcore/tests/pattern.rs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ impl From<Option<(usize, usize)>> for Step {
} }
} }


// ignore-tidy-linelength

// FIXME(Manishearth) these tests focus on single-character searching (CharSearcher) // FIXME(Manishearth) these tests focus on single-character searching (CharSearcher)
// and on next()/next_match(), not next_reject(). This is because // and on next()/next_match(), not next_reject(). This is because
// the memchr changes make next_match() for single chars complex, but next_reject() // the memchr changes make next_match() for single chars complex, but next_reject()
Expand Down
983 changes: 401 additions & 582 deletions src/librustc/hir/lowering.rs

Large diffs are not rendered by default.

Original file line number Original file line Diff line number Diff line change
@@ -1,13 +1,13 @@
//! Error Reporting for Anonymous Region Lifetime Errors //! Error Reporting for Anonymous Region Lifetime Errors
//! where both the regions are anonymous. //! where both the regions are anonymous.


use crate::hir::Node;
use crate::hir::{Expr, ExprKind::Closure};
use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;
use crate::infer::SubregionOrigin; use crate::infer::SubregionOrigin;
use crate::ty::RegionKind; use crate::ty::RegionKind;
use crate::hir::{Expr, ExprKind::Closure};
use crate::hir::Node;
use crate::util::common::ErrorReported; use crate::util::common::ErrorReported;
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;


impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when binding escapes a closure. /// Print the error message for lifetime errors when binding escapes a closure.
Expand Down Expand Up @@ -36,69 +36,75 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// ...because it cannot outlive this closure /// ...because it cannot outlive this closure
/// ``` /// ```
pub(super) fn try_report_outlives_closure(&self) -> Option<ErrorReported> { pub(super) fn try_report_outlives_closure(&self) -> Option<ErrorReported> {
if let Some(SubSupConflict(_, if let Some(SubSupConflict(_, origin, ref sub_origin, _, ref sup_origin, sup_region)) =
origin, self.error
ref sub_origin, {
_,
ref sup_origin,
sup_region)) = self.error {

// #45983: when trying to assign the contents of an argument to a binding outside of a // #45983: when trying to assign the contents of an argument to a binding outside of a
// closure, provide a specific message pointing this out. // closure, provide a specific message pointing this out.
if let (&SubregionOrigin::BindingTypeIsNotValidAtDecl(ref external_span), if let (
&RegionKind::ReFree(ref free_region)) = (&sub_origin, sup_region) { &SubregionOrigin::BindingTypeIsNotValidAtDecl(ref external_span),
&RegionKind::ReFree(ref free_region),
) = (&sub_origin, sup_region)
{
let hir = &self.tcx().hir(); let hir = &self.tcx().hir();
if let Some(hir_id) = hir.as_local_hir_id(free_region.scope) { if let Some(hir_id) = hir.as_local_hir_id(free_region.scope) {
if let Node::Expr(Expr { if let Node::Expr(Expr { kind: Closure(_, _, _, closure_span, None), .. }) =
kind: Closure(_, _, _, closure_span, None), hir.get(hir_id)
.. {
}) = hir.get(hir_id) {
let sup_sp = sup_origin.span(); let sup_sp = sup_origin.span();
let origin_sp = origin.span(); let origin_sp = origin.span();
let mut err = self.tcx().sess.struct_span_err( let mut err = self.tcx().sess.struct_span_err(
sup_sp, sup_sp,
"borrowed data cannot be stored outside of its closure"); "borrowed data cannot be stored outside of its closure",
);
err.span_label(sup_sp, "cannot be stored outside of its closure"); err.span_label(sup_sp, "cannot be stored outside of its closure");
if origin_sp == sup_sp || origin_sp.contains(sup_sp) { if origin_sp == sup_sp || origin_sp.contains(sup_sp) {
// // sup_sp == origin.span(): // // sup_sp == origin.span():
// //
// let mut x = None; // let mut x = None;
// ----- borrowed data cannot be stored into here... // ----- borrowed data cannot be stored into here...
// with_int(|y| x = Some(y)); // with_int(|y| x = Some(y));
// --- ^ cannot be stored outside of its closure // --- ^ cannot be stored outside of its closure
// | // |
// ...because it cannot outlive this closure // ...because it cannot outlive this closure
// //
// // origin.contains(&sup_sp): // // origin.contains(&sup_sp):
// //
// let mut f: Option<&u32> = None; // let mut f: Option<&u32> = None;
// ----- borrowed data cannot be stored into here... // ----- borrowed data cannot be stored into here...
// closure_expecting_bound(|x: &'x u32| { // closure_expecting_bound(|x: &'x u32| {
// ------------ ... because it cannot outlive this closure // ------------ ... because it cannot outlive this closure
// f = Some(x); // f = Some(x);
// ^ cannot be stored outside of its closure // ^ cannot be stored outside of its closure
err.span_label(*external_span, err.span_label(
"borrowed data cannot be stored into here..."); *external_span,
err.span_label(*closure_span, "borrowed data cannot be stored into here...",
"...because it cannot outlive this closure"); );
err.span_label(
*closure_span,
"...because it cannot outlive this closure",
);
} else { } else {
// FIXME: the wording for this case could be much improved // FIXME: the wording for this case could be much improved
// //
// let mut lines_to_use: Vec<&CrateId> = Vec::new(); // let mut lines_to_use: Vec<&CrateId> = Vec::new();
// - cannot infer an appropriate lifetime... // - cannot infer an appropriate lifetime...
// let push_id = |installed_id: &CrateId| { // let push_id = |installed_id: &CrateId| {
// ------- ------------------------ borrowed data cannot outlive this closure // ------- ------------------------ borrowed data cannot outlive this closure
// | // |
// ...so that variable is valid at time of its declaration // ...so that variable is valid at time of its declaration
// lines_to_use.push(installed_id); // lines_to_use.push(installed_id);
// ^^^^^^^^^^^^ cannot be stored outside of its closure // ^^^^^^^^^^^^ cannot be stored outside of its closure
err.span_label(origin_sp, err.span_label(origin_sp, "cannot infer an appropriate lifetime...");
"cannot infer an appropriate lifetime..."); err.span_label(
err.span_label(*external_span, *external_span,
"...so that variable is valid at time of its \ "...so that variable is valid at time of its \
declaration"); declaration",
err.span_label(*closure_span, );
"borrowed data cannot outlive this closure"); err.span_label(
*closure_span,
"borrowed data cannot outlive this closure",
);
} }
err.emit(); err.emit();
return Some(ErrorReported); return Some(ErrorReported);
Expand Down
Loading

0 comments on commit 6891388

Please sign in to comment.