Skip to content

Commit 04d9729

Browse files
committed
Rebasing and review comments
1 parent aaa02b3 commit 04d9729

File tree

6 files changed

+30
-35
lines changed

6 files changed

+30
-35
lines changed

src/librustc_metadata/loader.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,11 @@ impl<'a> Context<'a> {
676676
return true
677677
}
678678
}
679-
sess.err(&format!("extern location for {} is of an unknown type: {}",
680-
self.crate_name, loc.display()));
681-
sess.help(&format!("file name should be lib*.rlib or {}*.{}",
682-
dylibname.0, dylibname.1));
679+
sess.struct_err(&format!("extern location for {} is of an unknown type: {}",
680+
self.crate_name, loc.display()))
681+
.help(&format!("file name should be lib*.rlib or {}*.{}",
682+
dylibname.0, dylibname.1))
683+
.emit();
683684
false
684685
});
685686

src/librustc_resolve/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,12 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
425425
argument is missing?")
426426
}
427427
ResolutionError::UnresolvedName(path, msg, context) => {
428-
let err = struct_span_err!(resolver.session,
429-
span,
430-
E0425,
431-
"unresolved name `{}`{}",
432-
path,
433-
msg);
428+
let mut err = struct_span_err!(resolver.session,
429+
span,
430+
E0425,
431+
"unresolved name `{}`{}",
432+
path,
433+
msg);
434434

435435
match context {
436436
UnresolvedNameContext::Other => {} // no help available

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
30113011
// only find fits with at least one matching letter
30123012
if let Some(name) = find_best_match_for_name(names, &name, Some(name.len())) {
30133013
err.span_help(field.span,
3014-
&format!("did you mean `{}`?", n));
3014+
&format!("did you mean `{}`?", name));
30153015
}
30163016
}
30173017

src/libsyntax/errors/emitter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait Emitter {
2828
fn emit(&mut self, span: Option<Span>, msg: &str, code: Option<&str>, lvl: Level);
2929
fn custom_emit(&mut self, sp: RenderSpan, msg: &str, lvl: Level);
3030

31-
// Emit a structured diagnostic.
31+
/// Emit a structured diagnostic.
3232
fn emit_struct(&mut self, db: &DiagnosticBuilder) {
3333
self.emit(db.span, &db.message, db.code.as_ref().map(|s| &**s), db.level);
3434
for child in &db.children {
@@ -60,8 +60,8 @@ impl ColorConfig {
6060
}
6161
}
6262

63-
// A basic emitter for when we don't have access to a codemap or registry. Used
64-
// for reporting very early errors, etc.
63+
/// A basic emitter for when we don't have access to a codemap or registry. Used
64+
/// for reporting very early errors, etc.
6565
pub struct BasicEmitter {
6666
dst: Destination,
6767
}

src/libsyntax/errors/mod.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl error::Error for ExplicitBug {
9898
}
9999
}
100100

101-
// Used for emitting structured error messages and other diagnostic information.
101+
/// Used for emitting structured error messages and other diagnostic information.
102102
#[must_use]
103103
pub struct DiagnosticBuilder<'a> {
104104
emitter: &'a RefCell<Box<Emitter>>,
@@ -109,7 +109,7 @@ pub struct DiagnosticBuilder<'a> {
109109
children: Vec<SubDiagnostic>,
110110
}
111111

112-
// For example a note attached to an error.
112+
/// For example a note attached to an error.
113113
struct SubDiagnostic {
114114
level: Level,
115115
message: String,
@@ -118,7 +118,7 @@ struct SubDiagnostic {
118118
}
119119

120120
impl<'a> DiagnosticBuilder<'a> {
121-
// Emit the diagnostic.
121+
/// Emit the diagnostic.
122122
pub fn emit(&mut self) {
123123
if self.cancelled() {
124124
return;
@@ -132,11 +132,11 @@ impl<'a> DiagnosticBuilder<'a> {
132132
// }
133133
}
134134

135-
// Cancel the diagnostic (a structured diagnostic must either be emitted or
136-
// cancelled or it will panic when dropped).
137-
// BEWARE: if this DiagnosticBuilder is an error, then creating it will
138-
// bump the error count on the Handler and cancelling it won't undo that.
139-
// If you want to decrement the error count you should use `Handler::cancel`.
135+
/// Cancel the diagnostic (a structured diagnostic must either be emitted or
136+
/// cancelled or it will panic when dropped).
137+
/// BEWARE: if this DiagnosticBuilder is an error, then creating it will
138+
/// bump the error count on the Handler and cancelling it won't undo that.
139+
/// If you want to decrement the error count you should use `Handler::cancel`.
140140
pub fn cancel(&mut self) {
141141
self.level = Level::Cancelled;
142142
}
@@ -160,12 +160,6 @@ impl<'a> DiagnosticBuilder<'a> {
160160
self.sub(Level::Note, msg, Some(sp), None);
161161
self
162162
}
163-
pub fn note_rfc_1214(&mut self , span: Span) -> &mut DiagnosticBuilder<'a> {
164-
self.span_note(span,
165-
"this warning results from recent bug fixes and clarifications; \
166-
it will become a HARD ERROR in the next release. \
167-
See RFC 1214 for details.")
168-
}
169163
pub fn help(&mut self , msg: &str) -> &mut DiagnosticBuilder<'a> {
170164
self.sub(Level::Help, msg, None, None);
171165
self
@@ -220,8 +214,8 @@ impl<'a> DiagnosticBuilder<'a> {
220214
self
221215
}
222216

223-
// Convenience function for internal use, clients should use one of the
224-
// struct_* methods on Handler.
217+
/// Convenience function for internal use, clients should use one of the
218+
/// struct_* methods on Handler.
225219
fn new(emitter: &'a RefCell<Box<Emitter>>,
226220
level: Level,
227221
message: &str) -> DiagnosticBuilder<'a> {
@@ -235,8 +229,8 @@ impl<'a> DiagnosticBuilder<'a> {
235229
}
236230
}
237231

238-
// Convenience function for internal use, clients should use one of the
239-
// public methods above.
232+
/// Convenience function for internal use, clients should use one of the
233+
/// public methods above.
240234
fn sub(&mut self,
241235
level: Level,
242236
message: &str,
@@ -258,8 +252,8 @@ impl<'a> fmt::Debug for DiagnosticBuilder<'a> {
258252
}
259253
}
260254

261-
// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
262-
// we emit a bug.
255+
/// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
256+
/// we emit a bug.
263257
impl<'a> Drop for DiagnosticBuilder<'a> {
264258
fn drop(&mut self) {
265259
if !self.cancelled() {

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ impl<'a> Parser<'a> {
749749
pub fn parse_seq_to_before_gt_or_return<T, F>(&mut self,
750750
sep: Option<token::Token>,
751751
mut f: F)
752-
-> PResult<'a, (P<[T]>, bool)> where
752+
-> PResult<'a, (P<[T]>, bool)>
753753
where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option<T>>,
754754
{
755755
let mut v = Vec::new();

0 commit comments

Comments
 (0)