Merge branch 'master' into compiler/E0384-reduce-assertiveness
This commit is contained in:
commit
ff47e97838
47 changed files with 299 additions and 135 deletions
|
@ -857,11 +857,10 @@ declare_lint! {
|
|||
/// ```
|
||||
///
|
||||
/// This syntax is now a hard error in the 2018 edition. In the 2015
|
||||
/// edition, this lint is "allow" by default, because the old code is
|
||||
/// still valid, and warning for all old code can be noisy. This lint
|
||||
/// edition, this lint is "warn" by default. This lint
|
||||
/// enables the [`cargo fix`] tool with the `--edition` flag to
|
||||
/// automatically transition old code from the 2015 edition to 2018. The
|
||||
/// tool will switch this lint to "warn" and will automatically apply the
|
||||
/// tool will run this lint and automatically apply the
|
||||
/// suggested fix from the compiler (which is to add `_` to each
|
||||
/// parameter). This provides a completely automated way to update old
|
||||
/// code for a new edition. See [issue #41686] for more details.
|
||||
|
@ -869,7 +868,7 @@ declare_lint! {
|
|||
/// [issue #41686]: https://github.com/rust-lang/rust/issues/41686
|
||||
/// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
|
||||
pub ANONYMOUS_PARAMETERS,
|
||||
Allow,
|
||||
Warn,
|
||||
"detects anonymous parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
|
@ -884,6 +883,10 @@ declare_lint_pass!(
|
|||
|
||||
impl EarlyLintPass for AnonymousParameters {
|
||||
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
||||
if cx.sess.edition() != Edition::Edition2015 {
|
||||
// This is a hard error in future editions; avoid linting and erroring
|
||||
return;
|
||||
}
|
||||
if let ast::AssocItemKind::Fn(box FnKind(_, ref sig, _, _)) = it.kind {
|
||||
for arg in sig.decl.inputs.iter() {
|
||||
if let ast::PatKind::Ident(_, ident, None) = arg.pat.kind {
|
||||
|
|
|
@ -666,21 +666,23 @@ impl<'a> Parser<'a> {
|
|||
);
|
||||
match x {
|
||||
Ok((_, _, false)) => {
|
||||
self.bump(); // `>`
|
||||
match self.parse_expr() {
|
||||
Ok(_) => {
|
||||
e.span_suggestion_verbose(
|
||||
binop.span.shrink_to_lo(),
|
||||
TURBOFISH_SUGGESTION_STR,
|
||||
"::".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
e.emit();
|
||||
*expr = self.mk_expr_err(expr.span.to(self.prev_token.span));
|
||||
return Ok(());
|
||||
}
|
||||
Err(mut err) => {
|
||||
err.cancel();
|
||||
if self.eat(&token::Gt) {
|
||||
match self.parse_expr() {
|
||||
Ok(_) => {
|
||||
e.span_suggestion_verbose(
|
||||
binop.span.shrink_to_lo(),
|
||||
TURBOFISH_SUGGESTION_STR,
|
||||
"::".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
e.emit();
|
||||
*expr =
|
||||
self.mk_expr_err(expr.span.to(self.prev_token.span));
|
||||
return Ok(());
|
||||
}
|
||||
Err(mut err) => {
|
||||
err.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1446,8 +1446,8 @@ impl Target {
|
|||
|
||||
let get_req_field = |name: &str| {
|
||||
obj.find(name)
|
||||
.map(|s| s.as_string())
|
||||
.and_then(|os| os.map(|s| s.to_string()))
|
||||
.and_then(Json::as_string)
|
||||
.map(str::to_string)
|
||||
.ok_or_else(|| format!("Field {} in target specification is required", name))
|
||||
};
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
if param_type.is_suggestable() {
|
||||
err.span_suggestion(
|
||||
tcx.def_span(src_def_id),
|
||||
"consider changing this type paramater to a `const`-generic",
|
||||
"consider changing this type parameter to be a `const` generic",
|
||||
format!("const {}: {}", param_name, param_type),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue