Skip to content

Commit

Permalink
add applicability to span suggestion call
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpst committed Sep 21, 2018
1 parent 3bc2ca7 commit 7f9a259
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::collections::VecDeque;
use std::fmt;
use syntax::symbol::keywords;
use syntax_pos::Span;
use syntax::errors::Applicability;

mod region_name;
mod var_name;
Expand Down Expand Up @@ -540,14 +541,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
RegionName::Named(name) => format!("{}", name),
RegionName::Synthesized(_) => "'_".to_string(),
};
diag.span_suggestion(
diag.span_suggestion_with_applicability(
span,
&format!(
"to allow this impl Trait to capture borrowed data with lifetime \
`{}`, add `{}` as a constraint",
fr_name, suggestable_fr_name,
),
format!("{} + {}", snippet, suggestable_fr_name),
Applicability::MachineApplicable,
);
}
}
Expand Down

0 comments on commit 7f9a259

Please sign in to comment.