Various cleanups
This commit is contained in:
parent
85fb054fef
commit
5ea922aec4
4 changed files with 22 additions and 21 deletions
|
@ -1256,23 +1256,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
|
||||||
match category {
|
let msg = match category {
|
||||||
ConstraintCategory::Return => {
|
ConstraintCategory::Return => "closure is returned here".to_string(),
|
||||||
err.span_note(constraint_span, "closure is returned here");
|
ConstraintCategory::OpaqueType => "generator is returned here".to_string(),
|
||||||
}
|
|
||||||
ConstraintCategory::OpaqueType => {
|
|
||||||
err.span_note(constraint_span, "generator is returned here");
|
|
||||||
}
|
|
||||||
ConstraintCategory::CallArgument => {
|
ConstraintCategory::CallArgument => {
|
||||||
fr_name.highlight_region_name(&mut err);
|
fr_name.highlight_region_name(&mut err);
|
||||||
err.span_note(
|
format!("function requires argument type to outlive `{}`", fr_name)
|
||||||
constraint_span,
|
|
||||||
&format!("function requires argument type to outlive `{}`", fr_name),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
_ => bug!("report_escaping_closure_capture called with unexpected constraint \
|
_ => bug!("report_escaping_closure_capture called with unexpected constraint \
|
||||||
category: `{:?}`", category),
|
category: `{:?}`", category),
|
||||||
}
|
};
|
||||||
|
err.span_note(constraint_span, &msg);
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,9 +490,12 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a macro invocation inside a `trait`, `impl` or `extern` block.
|
/// Parses a macro invocation inside a `trait`, `impl` or `extern` block.
|
||||||
fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>,
|
fn parse_assoc_macro_invoc(
|
||||||
at_end: &mut bool) -> PResult<'a, Option<Mac>>
|
&mut self,
|
||||||
{
|
item_kind: &str,
|
||||||
|
vis: Option<&Visibility>,
|
||||||
|
at_end: &mut bool,
|
||||||
|
) -> PResult<'a, Option<Mac>> {
|
||||||
if self.token.is_path_start() &&
|
if self.token.is_path_start() &&
|
||||||
!(self.is_async_fn() && self.token.span.rust_2015()) {
|
!(self.is_async_fn() && self.token.span.rust_2015()) {
|
||||||
let prev_span = self.prev_span;
|
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)
|
fn missing_assoc_item_kind_err(
|
||||||
-> DiagnosticBuilder<'a>
|
&self,
|
||||||
{
|
item_type: &str,
|
||||||
|
prev_span: Span,
|
||||||
|
) -> DiagnosticBuilder<'a> {
|
||||||
let expected_kinds = if item_type == "extern" {
|
let expected_kinds = if item_type == "extern" {
|
||||||
"missing `fn`, `type`, or `static`"
|
"missing `fn`, `type`, or `static`"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1160,8 +1160,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
||||||
.emit();
|
.emit();
|
||||||
} else {
|
} else {
|
||||||
let msg = format!("`{}` is private, and cannot be re-exported", ident);
|
let msg = format!("`{}` is private, and cannot be re-exported", ident);
|
||||||
let note_msg =
|
let note_msg = format!(
|
||||||
format!("consider marking `{}` as `pub` in the imported module", ident);
|
"consider marking `{}` as `pub` in the imported module",
|
||||||
|
ident,
|
||||||
|
);
|
||||||
struct_span_err!(self.r.session, directive.span, E0364, "{}", &msg)
|
struct_span_err!(self.r.session, directive.span, E0364, "{}", &msg)
|
||||||
.span_note(directive.span, ¬e_msg)
|
.span_note(directive.span, ¬e_msg)
|
||||||
.emit();
|
.emit();
|
||||||
|
|
|
@ -270,7 +270,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.handler.struct_span_err(attr.span, &msg)
|
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();
|
.emit();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue