Skip to content

Commit 405e830

Browse files
committed
---
yaml --- r: 275912 b: refs/heads/borrowck-snippet c: 2f10704 h: refs/heads/master
1 parent c6c1c5b commit 405e830

File tree

26 files changed

+172
-261
lines changed

26 files changed

+172
-261
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ refs/tags/1.5.0: d8027afc009e55fb07776831094a13b1b64b6305
3939
refs/tags/1.6.0: 4fe6048e8dd100ec1c61a020d01f75046b42e818
4040
refs/tags/1.7.0: 2d2a9311cbe05eb47960489259e1e9408062c863
4141
refs/tags/1.8.0: 6bef00072dbaa86da9dc73b09f926cf67c696b39
42-
refs/heads/borrowck-snippet: 5e538faa6524d66feed1a9fdf222c274d00ab1e7
42+
refs/heads/borrowck-snippet: 2f10704b18d1d8242f688c38d423afc5dfaddadc

branches/borrowck-snippet/src/librustc/infer/error_reporting.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
682682
E0309,
683683
"{} may not live long enough",
684684
labeled_user_string);
685-
err.fileline_help(origin.span(),
686-
&format!("consider adding an explicit lifetime bound `{}: {}`...",
687-
bound_kind,
688-
sub));
685+
err.help(&format!("consider adding an explicit lifetime bound `{}: {}`...",
686+
bound_kind,
687+
sub));
689688
err
690689
}
691690

@@ -696,10 +695,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
696695
E0310,
697696
"{} may not live long enough",
698697
labeled_user_string);
699-
err.fileline_help(origin.span(),
700-
&format!("consider adding an explicit lifetime \
701-
bound `{}: 'static`...",
702-
bound_kind));
698+
err.help(&format!("consider adding an explicit lifetime \
699+
bound `{}: 'static`...",
700+
bound_kind));
703701
err
704702
}
705703

@@ -710,9 +708,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
710708
E0311,
711709
"{} may not live long enough",
712710
labeled_user_string);
713-
err.fileline_help(origin.span(),
714-
&format!("consider adding an explicit lifetime bound for `{}`",
715-
bound_kind));
711+
err.help(&format!("consider adding an explicit lifetime bound for `{}`",
712+
bound_kind));
716713
self.tcx.note_and_explain_region(
717714
&mut err,
718715
&format!("{} must be valid for ", labeled_user_string),

branches/borrowck-snippet/src/librustc/lint/context.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,13 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
456456
it will become a hard error in a future release!");
457457
let citation = format!("for more information, see {}",
458458
future_incompatible.reference);
459-
if let Some(sp) = span {
460-
err.fileline_warn(sp, &explanation);
461-
err.fileline_note(sp, &citation);
462-
} else {
463-
err.warn(&explanation);
464-
err.note(&citation);
465-
}
459+
err.warn(&explanation);
460+
err.note(&citation);
466461
}
467462

468463
if let Some(span) = def {
469-
err.span_note(span, "lint level defined here");
464+
let explanation = "lint level defined here";
465+
err = err.span_label(span, &explanation);
470466
}
471467

472468
err
@@ -542,7 +538,7 @@ pub trait LintContext: Sized {
542538
let mut err = self.lookup(lint, Some(span), msg);
543539
if self.current_level(lint) != Level::Allow {
544540
if note_span == span {
545-
err.fileline_note(note_span, note);
541+
err.note(note);
546542
} else {
547543
err.span_note(note_span, note);
548544
}

branches/borrowck-snippet/src/librustc/traits/error_reporting.rs

Lines changed: 56 additions & 109 deletions
Large diffs are not rendered by default.

branches/borrowck-snippet/src/librustc_borrowck/borrowck/gather_loans/move_error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ fn note_move_destination(err: &mut DiagnosticBuilder,
167167
err.span_note(
168168
move_to_span,
169169
"attempting to move value to here");
170-
err.fileline_help(
171-
move_to_span,
170+
err.help(
172171
&format!("to prevent the move, \
173172
use `ref {0}` or `ref mut {0}` to capture value by \
174173
reference",

branches/borrowck-snippet/src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
912912
};
913913

914914
if is_closure {
915-
err.fileline_help(span,
916-
"closures behind references must be called via `&mut`");
915+
err.help("closures behind references must be called via `&mut`");
917916
}
918917
err.emit();
919918
}

branches/borrowck-snippet/src/librustc_const_eval/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
255255
"pattern binding `{}` is named the same as one \
256256
of the variants of the type `{}`",
257257
ident.node, ty_path);
258-
fileline_help!(err, p.span,
258+
help!(err,
259259
"if you meant to match on a variant, \
260260
consider making the path in the pattern qualified: `{}::{}`",
261261
ty_path, ident.node);

branches/borrowck-snippet/src/librustc_lint/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ impl LateLintPass for UnconditionalRecursion {
764764
for call in &self_call_spans {
765765
db.span_note(*call, "recursive call site");
766766
}
767-
db.fileline_help(sp, "a `loop` may express intention \
768-
better if this is on purpose");
767+
db.help("a `loop` may express intention \
768+
better if this is on purpose");
769769
}
770770
db.emit();
771771
}

branches/borrowck-snippet/src/librustc_metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ impl<'a> CrateReader<'a> {
268268
crate_rustc_version
269269
.as_ref().map(|s| &**s)
270270
.unwrap_or("an old version of rustc"));
271-
err.fileline_help(span, "consider removing the compiled binaries and recompiling \
272-
with your current version of rustc");
271+
err.help("consider removing the compiled binaries and recompiling \
272+
with your current version of rustc");
273273
err.emit();
274274
}
275275
}

branches/borrowck-snippet/src/librustc_metadata/loader.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -346,39 +346,33 @@ impl<'a> Context<'a> {
346346
if !self.rejected_via_triple.is_empty() {
347347
let mismatches = self.rejected_via_triple.iter();
348348
for (i, &CrateMismatch{ ref path, ref got }) in mismatches.enumerate() {
349-
err.fileline_note(self.span,
350-
&format!("crate `{}`, path #{}, triple {}: {}",
351-
self.ident, i+1, got, path.display()));
349+
err.note(&format!("crate `{}`, path #{}, triple {}: {}",
350+
self.ident, i+1, got, path.display()));
352351
}
353352
}
354353
if !self.rejected_via_hash.is_empty() {
355-
err.span_note(self.span, "perhaps this crate needs \
356-
to be recompiled?");
354+
err.note("perhaps this crate needs to be recompiled?");
357355
let mismatches = self.rejected_via_hash.iter();
358356
for (i, &CrateMismatch{ ref path, .. }) in mismatches.enumerate() {
359-
err.fileline_note(self.span,
360-
&format!("crate `{}` path #{}: {}",
361-
self.ident, i+1, path.display()));
357+
err.note(&format!("crate `{}` path #{}: {}",
358+
self.ident, i+1, path.display()));
362359
}
363360
match self.root {
364361
&None => {}
365362
&Some(ref r) => {
366363
for (i, path) in r.paths().iter().enumerate() {
367-
err.fileline_note(self.span,
368-
&format!("crate `{}` path #{}: {}",
369-
r.ident, i+1, path.display()));
364+
err.note(&format!("crate `{}` path #{}: {}",
365+
r.ident, i+1, path.display()));
370366
}
371367
}
372368
}
373369
}
374370
if !self.rejected_via_kind.is_empty() {
375-
err.fileline_help(self.span, "please recompile this crate using \
376-
--crate-type lib");
371+
err.help("please recompile this crate using --crate-type lib");
377372
let mismatches = self.rejected_via_kind.iter();
378373
for (i, &CrateMismatch { ref path, .. }) in mismatches.enumerate() {
379-
err.fileline_note(self.span,
380-
&format!("crate `{}` path #{}: {}",
381-
self.ident, i+1, path.display()));
374+
err.note(&format!("crate `{}` path #{}: {}",
375+
self.ident, i+1, path.display()));
382376
}
383377
}
384378

branches/borrowck-snippet/src/librustc_passes/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
196196
let mut err = self.tcx.sess.struct_span_err(
197197
expr.span,
198198
"const fns are an unstable feature");
199-
fileline_help!(
199+
help!(
200200
&mut err,
201-
expr.span,
202201
"in Nightly builds, add `#![feature(const_fn)]` to the crate \
203202
attributes to enable");
204203
err.emit();

branches/borrowck-snippet/src/librustc_resolve/lib.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
256256
E0405,
257257
"trait `{}` is not in scope",
258258
name);
259-
show_candidates(&mut err, span, &candidates);
259+
show_candidates(&mut err, &candidates);
260260
err
261261
}
262262
ResolutionError::UndeclaredAssociatedType => {
@@ -324,7 +324,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
324324
"{} `{}` is undefined or not in scope",
325325
kind,
326326
name);
327-
show_candidates(&mut err, span, &candidates);
327+
show_candidates(&mut err, &candidates);
328328
err
329329
}
330330
ResolutionError::DeclarationShadowsEnumVariantOrUnitLikeStruct(name) => {
@@ -466,7 +466,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
466466
}
467467

468468
if !help_msg.is_empty() {
469-
err.fileline_help(span, &help_msg);
469+
err.help(&help_msg);
470470
}
471471
}
472472
}
@@ -1844,8 +1844,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
18441844

18451845
// If it's a typedef, give a note
18461846
if let Def::TyAlias(did) = path_res.base_def {
1847-
err.fileline_note(trait_path.span,
1848-
"`type` aliases cannot be used for traits");
1847+
err.note("`type` aliases cannot be used for traits");
18491848
if let Some(sp) = self.ast_map.span_if_local(did) {
18501849
err.span_note(sp, "type defined here");
18511850
}
@@ -3003,7 +3002,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30033002
let msg = format!("did you mean to write: `{} {{ /* fields */ }}`?",
30043003
path_name);
30053004
if self.emit_errors {
3006-
err.fileline_help(expr.span, &msg);
3005+
err.help(&msg);
30073006
} else {
30083007
err.span_help(expr.span, &msg);
30093008
}
@@ -3045,7 +3044,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30453044
path_name);
30463045

30473046
if self.emit_errors {
3048-
err.fileline_help(expr.span, &msg);
3047+
err.help(&msg);
30493048
} else {
30503049
err.span_help(expr.span, &msg);
30513050
}
@@ -3533,7 +3532,6 @@ fn path_names_to_string(path: &Path, depth: usize) -> String {
35333532
/// entities with that name in all crates. This method allows outputting the
35343533
/// results of this search in a programmer-friendly way
35353534
fn show_candidates(session: &mut DiagnosticBuilder,
3536-
span: syntax::codemap::Span,
35373535
candidates: &SuggestedCandidates) {
35383536

35393537
let paths = &candidates.candidates;
@@ -3553,26 +3551,23 @@ fn show_candidates(session: &mut DiagnosticBuilder,
35533551
// behave differently based on how many candidates we have:
35543552
if !paths.is_empty() {
35553553
if paths.len() == 1 {
3556-
session.fileline_help(
3557-
span,
3554+
session.help(
35583555
&format!("you can import it into scope: `use {};`.",
35593556
&path_strings[0]),
35603557
);
35613558
} else {
3562-
session.fileline_help(span, "you can import several candidates \
3559+
session.help("you can import several candidates \
35633560
into scope (`use ...;`):");
35643561
let count = path_strings.len() as isize - MAX_CANDIDATES as isize + 1;
35653562

35663563
for (idx, path_string) in path_strings.iter().enumerate() {
35673564
if idx == MAX_CANDIDATES - 1 && count > 1 {
3568-
session.fileline_help(
3569-
span,
3565+
session.help(
35703566
&format!(" and {} other candidates", count).to_string(),
35713567
);
35723568
break;
35733569
} else {
3574-
session.fileline_help(
3575-
span,
3570+
session.help(
35763571
&format!(" `{}`", path_string).to_string(),
35773572
);
35783573
}
@@ -3581,8 +3576,7 @@ fn show_candidates(session: &mut DiagnosticBuilder,
35813576
}
35823577
} else {
35833578
// nothing found:
3584-
session.fileline_help(
3585-
span,
3579+
session.help(
35863580
&format!("no candidates by the name of `{}` found in your \
35873581
project; maybe you misspelled the name or forgot to import \
35883582
an external crate?", candidates.name.to_string()),

branches/borrowck-snippet/src/librustc_typeck/astconv.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ pub fn ast_region_to_region(tcx: &TyCtxt, lifetime: &hir::Lifetime)
200200

201201
fn report_elision_failure(
202202
db: &mut DiagnosticBuilder,
203-
default_span: Span,
204203
params: Vec<ElisionFailureInfo>)
205204
{
206205
let mut m = String::new();
@@ -237,29 +236,29 @@ fn report_elision_failure(
237236
}
238237

239238
if len == 0 {
240-
fileline_help!(db, default_span,
241-
"this function's return type contains a borrowed value, but \
242-
there is no value for it to be borrowed from");
243-
fileline_help!(db, default_span,
244-
"consider giving it a 'static lifetime");
239+
help!(db,
240+
"this function's return type contains a borrowed value, but \
241+
there is no value for it to be borrowed from");
242+
help!(db,
243+
"consider giving it a 'static lifetime");
245244
} else if !any_lifetimes {
246-
fileline_help!(db, default_span,
247-
"this function's return type contains a borrowed value with \
248-
an elided lifetime, but the lifetime cannot be derived from \
249-
the arguments");
250-
fileline_help!(db, default_span,
251-
"consider giving it an explicit bounded or 'static \
252-
lifetime");
245+
help!(db,
246+
"this function's return type contains a borrowed value with \
247+
an elided lifetime, but the lifetime cannot be derived from \
248+
the arguments");
249+
help!(db,
250+
"consider giving it an explicit bounded or 'static \
251+
lifetime");
253252
} else if len == 1 {
254-
fileline_help!(db, default_span,
255-
"this function's return type contains a borrowed value, but \
256-
the signature does not say which {} it is borrowed from",
257-
m);
253+
help!(db,
254+
"this function's return type contains a borrowed value, but \
255+
the signature does not say which {} it is borrowed from",
256+
m);
258257
} else {
259-
fileline_help!(db, default_span,
260-
"this function's return type contains a borrowed value, but \
261-
the signature does not say whether it is borrowed from {}",
262-
m);
258+
help!(db,
259+
"this function's return type contains a borrowed value, but \
260+
the signature does not say whether it is borrowed from {}",
261+
m);
263262
}
264263
}
265264

@@ -280,7 +279,7 @@ pub fn opt_ast_region_to_region<'tcx>(
280279
let mut err = struct_span_err!(this.tcx().sess, default_span, E0106,
281280
"missing lifetime specifier");
282281
if let Some(params) = params {
283-
report_elision_failure(&mut err, default_span, params);
282+
report_elision_failure(&mut err, params);
284283
}
285284
err.emit();
286285
ty::ReStatic
@@ -1081,7 +1080,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
10811080
}
10821081

10831082
_ => {
1084-
fileline_help!(&mut err, ty.span,
1083+
help!(&mut err,
10851084
"perhaps you forgot parentheses? (per RFC 438)");
10861085
}
10871086
}

branches/borrowck-snippet/src/librustc_typeck/check/callee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id:
6464
struct_span_err!(tcx.sess, span, E0174,
6565
"explicit use of unboxed closure method `{}` is experimental",
6666
method)
67-
.fileline_help(span, "add `#![feature(unboxed_closures)]` to the crate \
68-
attributes to enable")
67+
.help("add `#![feature(unboxed_closures)]` to the crate \
68+
attributes to enable")
6969
.emit();
7070
}
7171
}

0 commit comments

Comments
 (0)