Skip to content

Commit 6891388

Browse files
x.py fmt after previous deignore
1 parent 48291a9 commit 6891388

File tree

42 files changed

+9637
-9795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9637
-9795
lines changed

src/libcore/iter/adapters/mod.rs

+456-267
Large diffs are not rendered by default.

src/libcore/iter/traits/iterator.rs

+257-145
Large diffs are not rendered by default.

src/libcore/tests/pattern.rs

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ impl From<Option<(usize, usize)>> for Step {
4242
}
4343
}
4444

45-
// ignore-tidy-linelength
46-
4745
// FIXME(Manishearth) these tests focus on single-character searching (CharSearcher)
4846
// and on next()/next_match(), not next_reject(). This is because
4947
// the memchr changes make next_match() for single chars complex, but next_reject()

src/librustc/hir/lowering.rs

+401-582
Large diffs are not rendered by default.

src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs

+61-55
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! Error Reporting for Anonymous Region Lifetime Errors
22
//! where both the regions are anonymous.
33
4+
use crate::hir::Node;
5+
use crate::hir::{Expr, ExprKind::Closure};
46
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
7+
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;
58
use crate::infer::SubregionOrigin;
69
use crate::ty::RegionKind;
7-
use crate::hir::{Expr, ExprKind::Closure};
8-
use crate::hir::Node;
910
use crate::util::common::ErrorReported;
10-
use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict;
1111

1212
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
1313
/// Print the error message for lifetime errors when binding escapes a closure.
@@ -36,69 +36,75 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
3636
/// ...because it cannot outlive this closure
3737
/// ```
3838
pub(super) fn try_report_outlives_closure(&self) -> Option<ErrorReported> {
39-
if let Some(SubSupConflict(_,
40-
origin,
41-
ref sub_origin,
42-
_,
43-
ref sup_origin,
44-
sup_region)) = self.error {
45-
39+
if let Some(SubSupConflict(_, origin, ref sub_origin, _, ref sup_origin, sup_region)) =
40+
self.error
41+
{
4642
// #45983: when trying to assign the contents of an argument to a binding outside of a
4743
// closure, provide a specific message pointing this out.
48-
if let (&SubregionOrigin::BindingTypeIsNotValidAtDecl(ref external_span),
49-
&RegionKind::ReFree(ref free_region)) = (&sub_origin, sup_region) {
44+
if let (
45+
&SubregionOrigin::BindingTypeIsNotValidAtDecl(ref external_span),
46+
&RegionKind::ReFree(ref free_region),
47+
) = (&sub_origin, sup_region)
48+
{
5049
let hir = &self.tcx().hir();
5150
if let Some(hir_id) = hir.as_local_hir_id(free_region.scope) {
52-
if let Node::Expr(Expr {
53-
kind: Closure(_, _, _, closure_span, None),
54-
..
55-
}) = hir.get(hir_id) {
51+
if let Node::Expr(Expr { kind: Closure(_, _, _, closure_span, None), .. }) =
52+
hir.get(hir_id)
53+
{
5654
let sup_sp = sup_origin.span();
5755
let origin_sp = origin.span();
5856
let mut err = self.tcx().sess.struct_span_err(
5957
sup_sp,
60-
"borrowed data cannot be stored outside of its closure");
58+
"borrowed data cannot be stored outside of its closure",
59+
);
6160
err.span_label(sup_sp, "cannot be stored outside of its closure");
6261
if origin_sp == sup_sp || origin_sp.contains(sup_sp) {
63-
// // sup_sp == origin.span():
64-
//
65-
// let mut x = None;
66-
// ----- borrowed data cannot be stored into here...
67-
// with_int(|y| x = Some(y));
68-
// --- ^ cannot be stored outside of its closure
69-
// |
70-
// ...because it cannot outlive this closure
71-
//
72-
// // origin.contains(&sup_sp):
73-
//
74-
// let mut f: Option<&u32> = None;
75-
// ----- borrowed data cannot be stored into here...
76-
// closure_expecting_bound(|x: &'x u32| {
77-
// ------------ ... because it cannot outlive this closure
78-
// f = Some(x);
79-
// ^ cannot be stored outside of its closure
80-
err.span_label(*external_span,
81-
"borrowed data cannot be stored into here...");
82-
err.span_label(*closure_span,
83-
"...because it cannot outlive this closure");
62+
// // sup_sp == origin.span():
63+
//
64+
// let mut x = None;
65+
// ----- borrowed data cannot be stored into here...
66+
// with_int(|y| x = Some(y));
67+
// --- ^ cannot be stored outside of its closure
68+
// |
69+
// ...because it cannot outlive this closure
70+
//
71+
// // origin.contains(&sup_sp):
72+
//
73+
// let mut f: Option<&u32> = None;
74+
// ----- borrowed data cannot be stored into here...
75+
// closure_expecting_bound(|x: &'x u32| {
76+
// ------------ ... because it cannot outlive this closure
77+
// f = Some(x);
78+
// ^ cannot be stored outside of its closure
79+
err.span_label(
80+
*external_span,
81+
"borrowed data cannot be stored into here...",
82+
);
83+
err.span_label(
84+
*closure_span,
85+
"...because it cannot outlive this closure",
86+
);
8487
} else {
85-
// FIXME: the wording for this case could be much improved
86-
//
87-
// let mut lines_to_use: Vec<&CrateId> = Vec::new();
88-
// - cannot infer an appropriate lifetime...
89-
// let push_id = |installed_id: &CrateId| {
90-
// ------- ------------------------ borrowed data cannot outlive this closure
91-
// |
92-
// ...so that variable is valid at time of its declaration
93-
// lines_to_use.push(installed_id);
94-
// ^^^^^^^^^^^^ cannot be stored outside of its closure
95-
err.span_label(origin_sp,
96-
"cannot infer an appropriate lifetime...");
97-
err.span_label(*external_span,
98-
"...so that variable is valid at time of its \
99-
declaration");
100-
err.span_label(*closure_span,
101-
"borrowed data cannot outlive this closure");
88+
// FIXME: the wording for this case could be much improved
89+
//
90+
// let mut lines_to_use: Vec<&CrateId> = Vec::new();
91+
// - cannot infer an appropriate lifetime...
92+
// let push_id = |installed_id: &CrateId| {
93+
// ------- ------------------------ borrowed data cannot outlive this closure
94+
// |
95+
// ...so that variable is valid at time of its declaration
96+
// lines_to_use.push(installed_id);
97+
// ^^^^^^^^^^^^ cannot be stored outside of its closure
98+
err.span_label(origin_sp, "cannot infer an appropriate lifetime...");
99+
err.span_label(
100+
*external_span,
101+
"...so that variable is valid at time of its \
102+
declaration",
103+
);
104+
err.span_label(
105+
*closure_span,
106+
"borrowed data cannot outlive this closure",
107+
);
102108
}
103109
err.emit();
104110
return Some(ErrorReported);

0 commit comments

Comments
 (0)