Skip to content

Commit 2c9438b

Browse files
committed
---
yaml --- r: 276150 b: refs/heads/master c: 489a6c9 h: refs/heads/master
1 parent 3821f70 commit 2c9438b

File tree

26 files changed

+173
-261
lines changed

26 files changed

+173
-261
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1ff1887cc9537cf45c2bc405ce0b026ef9a2246a
2+
refs/heads/master: 489a6c95bf747059b28472efc17d39795c6adcad
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/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),

trunk/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
}

trunk/src/librustc/traits/error_reporting.rs

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

trunk/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",

trunk/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
}

trunk/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);

trunk/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
}

trunk/src/librustc_metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ impl<'a> CrateReader<'a> {
241241
crate_rustc_version
242242
.as_ref().map(|s| &**s)
243243
.unwrap_or("an old version of rustc"));
244-
err.fileline_help(span, "consider removing the compiled binaries and recompiling \
245-
with your current version of rustc");
244+
err.help("consider removing the compiled binaries and recompiling \
245+
with your current version of rustc");
246246
err.emit();
247247
}
248248
}

trunk/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

trunk/src/librustc_passes/consts.rs

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

trunk/src/librustc_resolve/lib.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
244244
E0405,
245245
"trait `{}` is not in scope",
246246
name);
247-
show_candidates(&mut err, span, &candidates);
247+
show_candidates(&mut err, &candidates);
248248
err
249249
}
250250
ResolutionError::UndeclaredAssociatedType => {
@@ -312,7 +312,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
312312
"{} `{}` is undefined or not in scope",
313313
kind,
314314
name);
315-
show_candidates(&mut err, span, &candidates);
315+
show_candidates(&mut err, &candidates);
316316
err
317317
}
318318
ResolutionError::DeclarationShadowsEnumVariantOrUnitLikeStruct(name) => {
@@ -420,7 +420,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
420420
match context {
421421
UnresolvedNameContext::Other => { } // no help available
422422
UnresolvedNameContext::PathIsMod(parent) => {
423-
err.fileline_help(span, &match parent.map(|parent| &parent.node) {
423+
err.help(&match parent.map(|parent| &parent.node) {
424424
Some(&ExprField(_, ident)) => {
425425
format!("To reference an item from the `{module}` module, \
426426
use `{module}::{ident}`",
@@ -1784,8 +1784,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
17841784

17851785
// If it's a typedef, give a note
17861786
if let Def::TyAlias(..) = path_res.base_def {
1787-
err.fileline_note(trait_path.span,
1788-
"`type` aliases cannot be used for traits");
1787+
err.note(trait_path.span,
1788+
"`type` aliases cannot be used for traits");
17891789

17901790
let definition_site = {
17911791
let segments = &trait_path.segments;
@@ -2880,7 +2880,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
28802880
let msg = format!("did you mean to write: `{} {{ /* fields */ }}`?",
28812881
path_name);
28822882
if self.emit_errors {
2883-
err.fileline_help(expr.span, &msg);
2883+
err.help(&msg);
28842884
} else {
28852885
err.span_help(expr.span, &msg);
28862886
}
@@ -2922,7 +2922,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29222922
path_name);
29232923

29242924
if self.emit_errors {
2925-
err.fileline_help(expr.span, &msg);
2925+
err.help(&msg);
29262926
} else {
29272927
err.span_help(expr.span, &msg);
29282928
}
@@ -3420,7 +3420,6 @@ fn path_names_to_string(path: &Path, depth: usize) -> String {
34203420
/// entities with that name in all crates. This method allows outputting the
34213421
/// results of this search in a programmer-friendly way
34223422
fn show_candidates(session: &mut DiagnosticBuilder,
3423-
span: syntax::codemap::Span,
34243423
candidates: &SuggestedCandidates) {
34253424

34263425
let paths = &candidates.candidates;
@@ -3440,26 +3439,23 @@ fn show_candidates(session: &mut DiagnosticBuilder,
34403439
// behave differently based on how many candidates we have:
34413440
if !paths.is_empty() {
34423441
if paths.len() == 1 {
3443-
session.fileline_help(
3444-
span,
3442+
session.help(
34453443
&format!("you can import it into scope: `use {};`.",
34463444
&path_strings[0]),
34473445
);
34483446
} else {
3449-
session.fileline_help(span, "you can import several candidates \
3447+
session.help("you can import several candidates \
34503448
into scope (`use ...;`):");
34513449
let count = path_strings.len() as isize - MAX_CANDIDATES as isize + 1;
34523450

34533451
for (idx, path_string) in path_strings.iter().enumerate() {
34543452
if idx == MAX_CANDIDATES - 1 && count > 1 {
3455-
session.fileline_help(
3456-
span,
3453+
session.help(
34573454
&format!(" and {} other candidates", count).to_string(),
34583455
);
34593456
break;
34603457
} else {
3461-
session.fileline_help(
3462-
span,
3458+
session.help(
34633459
&format!(" `{}`", path_string).to_string(),
34643460
);
34653461
}
@@ -3468,8 +3464,7 @@ fn show_candidates(session: &mut DiagnosticBuilder,
34683464
}
34693465
} else {
34703466
// nothing found:
3471-
session.fileline_help(
3472-
span,
3467+
session.help(
34733468
&format!("no candidates by the name of `{}` found in your \
34743469
project; maybe you misspelled the name or forgot to import \
34753470
an external crate?", candidates.name.to_string()),

trunk/src/librustc_typeck/astconv.rs

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

207207
fn report_elision_failure(
208208
db: &mut DiagnosticBuilder,
209-
default_span: Span,
210209
params: Vec<ElisionFailureInfo>)
211210
{
212211
let mut m = String::new();
@@ -243,29 +242,29 @@ fn report_elision_failure(
243242
}
244243

245244
if len == 0 {
246-
fileline_help!(db, default_span,
247-
"this function's return type contains a borrowed value, but \
248-
there is no value for it to be borrowed from");
249-
fileline_help!(db, default_span,
250-
"consider giving it a 'static lifetime");
245+
help!(db,
246+
"this function's return type contains a borrowed value, but \
247+
there is no value for it to be borrowed from");
248+
help!(db,
249+
"consider giving it a 'static lifetime");
251250
} else if !any_lifetimes {
252-
fileline_help!(db, default_span,
253-
"this function's return type contains a borrowed value with \
254-
an elided lifetime, but the lifetime cannot be derived from \
255-
the arguments");
256-
fileline_help!(db, default_span,
257-
"consider giving it an explicit bounded or 'static \
258-
lifetime");
251+
help!(db,
252+
"this function's return type contains a borrowed value with \
253+
an elided lifetime, but the lifetime cannot be derived from \
254+
the arguments");
255+
help!(db,
256+
"consider giving it an explicit bounded or 'static \
257+
lifetime");
259258
} else if len == 1 {
260-
fileline_help!(db, default_span,
261-
"this function's return type contains a borrowed value, but \
262-
the signature does not say which {} it is borrowed from",
263-
m);
259+
help!(db,
260+
"this function's return type contains a borrowed value, but \
261+
the signature does not say which {} it is borrowed from",
262+
m);
264263
} else {
265-
fileline_help!(db, default_span,
266-
"this function's return type contains a borrowed value, but \
267-
the signature does not say whether it is borrowed from {}",
268-
m);
264+
help!(db,
265+
"this function's return type contains a borrowed value, but \
266+
the signature does not say whether it is borrowed from {}",
267+
m);
269268
}
270269
}
271270

@@ -286,7 +285,7 @@ pub fn opt_ast_region_to_region<'tcx>(
286285
let mut err = struct_span_err!(this.tcx().sess, default_span, E0106,
287286
"missing lifetime specifier");
288287
if let Some(params) = params {
289-
report_elision_failure(&mut err, default_span, params);
288+
report_elision_failure(&mut err, params);
290289
}
291290
err.emit();
292291
ty::ReStatic
@@ -1087,7 +1086,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
10871086
}
10881087

10891088
_ => {
1090-
fileline_help!(&mut err, ty.span,
1089+
help!(&mut err,
10911090
"perhaps you forgot parentheses? (per RFC 438)");
10921091
}
10931092
}

trunk/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)