Skip to content

Commit

Permalink
Various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 25, 2019
1 parent 85fb054 commit 5ea922a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
18 changes: 6 additions & 12 deletions src/librustc_mir/borrow_check/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,23 +1256,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
Applicability::MachineApplicable,
);

match category {
ConstraintCategory::Return => {
err.span_note(constraint_span, "closure is returned here");
}
ConstraintCategory::OpaqueType => {
err.span_note(constraint_span, "generator is returned here");
}
let msg = match category {
ConstraintCategory::Return => "closure is returned here".to_string(),
ConstraintCategory::OpaqueType => "generator is returned here".to_string(),
ConstraintCategory::CallArgument => {
fr_name.highlight_region_name(&mut err);
err.span_note(
constraint_span,
&format!("function requires argument type to outlive `{}`", fr_name),
);
format!("function requires argument type to outlive `{}`", fr_name)
}
_ => bug!("report_escaping_closure_capture called with unexpected constraint \
category: `{:?}`", category),
}
};
err.span_note(constraint_span, &msg);
err
}

Expand Down
17 changes: 11 additions & 6 deletions src/librustc_parse/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,12 @@ impl<'a> Parser<'a> {
}

/// Parses a macro invocation inside a `trait`, `impl` or `extern` block.
fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>,
at_end: &mut bool) -> PResult<'a, Option<Mac>>
{
fn parse_assoc_macro_invoc(
&mut self,
item_kind: &str,
vis: Option<&Visibility>,
at_end: &mut bool,
) -> PResult<'a, Option<Mac>> {
if self.token.is_path_start() &&
!(self.is_async_fn() && self.token.span.rust_2015()) {
let prev_span = self.prev_span;
Expand Down Expand Up @@ -531,9 +534,11 @@ impl<'a> Parser<'a> {
}
}

fn missing_assoc_item_kind_err(&self, item_type: &str, prev_span: Span)
-> DiagnosticBuilder<'a>
{
fn missing_assoc_item_kind_err(
&self,
item_type: &str,
prev_span: Span,
) -> DiagnosticBuilder<'a> {
let expected_kinds = if item_type == "extern" {
"missing `fn`, `type`, or `static`"
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
.emit();
} else {
let msg = format!("`{}` is private, and cannot be re-exported", ident);
let note_msg =
format!("consider marking `{}` as `pub` in the imported module", ident);
let note_msg = format!(
"consider marking `{}` as `pub` in the imported module",
ident,
);
struct_span_err!(self.r.session, directive.span, E0364, "{}", &msg)
.span_note(directive.span, &note_msg)
.emit();
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax_ext/proc_macro_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
};

self.handler.struct_span_err(attr.span, &msg)
.span_note(prev_attr.span, "previous attribute here")
.span_label(prev_attr.span, "previous attribute here")
.emit();

return;
Expand Down

0 comments on commit 5ea922a

Please sign in to comment.