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
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)
// and on next()/next_match(), not next_reject(). This is because
// 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.

@@ -1,13 +1,13 @@
//! Error Reporting for Anonymous Region Lifetime Errors
//! 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::lexical_region_resolve::RegionResolutionError::SubSupConflict;
use crate::infer::SubregionOrigin;
use crate::ty::RegionKind;
use crate::hir::{Expr, ExprKind::Closure};
use crate::hir::Node;
use crate::util::common::ErrorReported;
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;

impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// 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
/// ```
pub(super) fn try_report_outlives_closure(&self) -> Option<ErrorReported> {
if let Some(SubSupConflict(_,
origin,
ref sub_origin,
_,
ref sup_origin,
sup_region)) = self.error {

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

0 comments on commit 6891388

Please sign in to comment.