Skip to content
Permalink
Browse files

Various cleanups

  • Loading branch information
estebank committed Nov 25, 2019
1 parent 85fb054 commit 5ea922aec4a66458728fbe74a6e8096ab76f9aec
@@ -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
}

@@ -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;
@@ -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 {
@@ -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();
@@ -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;

0 comments on commit 5ea922a

Please sign in to comment.
You can’t perform that action at this time.