Skip to content

Commit 3e41797

Browse files
committed
Auto merge of rust-lang#6667 - Manishearth:rustup, r=Manishearth
Rustup Pulling in AST changes changelog: none
2 parents 11edf92 + 741259b commit 3e41797

File tree

8 files changed

+49
-30
lines changed

8 files changed

+49
-30
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ indent_style = space
1313
indent_size = 4
1414

1515
[*.md]
16+
# double whitespace at end of line
17+
# denotes a line break in Markdown
1618
trim_trailing_whitespace = false
1719

1820
[*.yml]

clippy_lints/src/doc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::utils::{
44
};
55
use if_chain::if_chain;
66
use itertools::Itertools;
7-
use rustc_ast::ast::{Async, AttrKind, Attribute, FnRetTy, ItemKind};
7+
use rustc_ast::ast::{Async, AttrKind, Attribute, FnKind, FnRetTy, ItemKind};
88
use rustc_ast::token::CommentKind;
99
use rustc_data_structures::fx::FxHashSet;
1010
use rustc_data_structures::sync::Lrc;
@@ -563,7 +563,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
563563
| ItemKind::ExternCrate(..)
564564
| ItemKind::ForeignMod(..) => return false,
565565
// We found a main function ...
566-
ItemKind::Fn(_, sig, _, Some(block)) if item.ident.name == sym::main => {
566+
ItemKind::Fn(box FnKind(_, sig, _, Some(block))) if item.ident.name == sym::main => {
567567
let is_async = matches!(sig.header.asyncness, Async::Yes { .. });
568568
let returns_nothing = match &sig.decl.output {
569569
FnRetTy::Default(..) => true,

clippy_lints/src/excessive_bools.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::utils::{attr_by_name, in_macro, match_path_ast, span_lint_and_help};
2-
use rustc_ast::ast::{AssocItemKind, Extern, FnSig, Item, ItemKind, Ty, TyKind};
2+
use rustc_ast::ast::{AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind};
33
use rustc_lint::{EarlyContext, EarlyLintPass};
44
use rustc_session::{declare_tool_lint, impl_lint_pass};
55
use rustc_span::Span;
@@ -159,17 +159,17 @@ impl EarlyLintPass for ExcessiveBools {
159159
);
160160
}
161161
},
162-
ItemKind::Impl {
162+
ItemKind::Impl(box ImplKind {
163163
of_trait: None, items, ..
164-
}
165-
| ItemKind::Trait(_, _, _, _, items) => {
164+
})
165+
| ItemKind::Trait(box TraitKind(.., items)) => {
166166
for item in items {
167-
if let AssocItemKind::Fn(_, fn_sig, _, _) = &item.kind {
167+
if let AssocItemKind::Fn(box FnKind(_, fn_sig, _, _)) = &item.kind {
168168
self.check_fn_sig(cx, fn_sig, item.span);
169169
}
170170
}
171171
},
172-
ItemKind::Fn(_, fn_sig, _, _) => self.check_fn_sig(cx, fn_sig, item.span),
172+
ItemKind::Fn(box FnKind(_, fn_sig, _, _)) => self.check_fn_sig(cx, fn_sig, item.span),
173173
_ => (),
174174
}
175175
}

clippy_lints/src/non_expressive_names.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use crate::utils::{span_lint, span_lint_and_then};
2-
use rustc_ast::ast::{Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, Item, ItemKind, Local, Pat, PatKind};
2+
use rustc_ast::ast::{
3+
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, FnKind, Item, ItemKind, Local, Pat, PatKind,
4+
};
35
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
46
use rustc_lint::{EarlyContext, EarlyLintPass};
57
use rustc_middle::lint::in_external_macro;
@@ -364,7 +366,7 @@ impl EarlyLintPass for NonExpressiveNames {
364366
return;
365367
}
366368

367-
if let ItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
369+
if let ItemKind::Fn(box FnKind(_, ref sig, _, Some(ref blk))) = item.kind {
368370
do_check(self, cx, &item.attrs, &sig.decl, blk);
369371
}
370372
}
@@ -374,7 +376,7 @@ impl EarlyLintPass for NonExpressiveNames {
374376
return;
375377
}
376378

377-
if let AssocItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
379+
if let AssocItemKind::Fn(box FnKind(_, ref sig, _, Some(ref blk))) = item.kind {
378380
do_check(self, cx, &item.attrs, &sig.decl, blk);
379381
}
380382
}

clippy_lints/src/utils/ast_utils.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
231231
(Use(l), Use(r)) => eq_use_tree(l, r),
232232
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
233233
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
234-
(Fn(ld, lf, lg, lb), Fn(rd, rf, rg, rb)) => {
234+
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
235235
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
236236
},
237237
(Mod(l), Mod(r)) => l.inline == r.inline && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_item_kind)),
238238
(ForeignMod(l), ForeignMod(r)) => {
239239
both(&l.abi, &r.abi, |l, r| eq_str_lit(l, r))
240240
&& over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind))
241241
},
242-
(TyAlias(ld, lg, lb, lt), TyAlias(rd, rg, rb, rt)) => {
242+
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
243243
eq_defaultness(*ld, *rd)
244244
&& eq_generics(lg, rg)
245245
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
@@ -251,7 +251,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
251251
(Struct(lv, lg), Struct(rv, rg)) | (Union(lv, lg), Union(rv, rg)) => {
252252
eq_variant_data(lv, rv) && eq_generics(lg, rg)
253253
},
254-
(Trait(la, lu, lg, lb, li), Trait(ra, ru, rg, rb, ri)) => {
254+
(Trait(box TraitKind(la, lu, lg, lb, li)), Trait(box TraitKind(ra, ru, rg, rb, ri))) => {
255255
la == ra
256256
&& matches!(lu, Unsafe::No) == matches!(ru, Unsafe::No)
257257
&& eq_generics(lg, rg)
@@ -260,7 +260,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
260260
},
261261
(TraitAlias(lg, lb), TraitAlias(rg, rb)) => eq_generics(lg, rg) && over(lb, rb, |l, r| eq_generic_bound(l, r)),
262262
(
263-
Impl {
263+
Impl(box ImplKind {
264264
unsafety: lu,
265265
polarity: lp,
266266
defaultness: ld,
@@ -269,8 +269,8 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
269269
of_trait: lot,
270270
self_ty: lst,
271271
items: li,
272-
},
273-
Impl {
272+
}),
273+
Impl(box ImplKind {
274274
unsafety: ru,
275275
polarity: rp,
276276
defaultness: rd,
@@ -279,7 +279,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
279279
of_trait: rot,
280280
self_ty: rst,
281281
items: ri,
282-
},
282+
}),
283283
) => {
284284
matches!(lu, Unsafe::No) == matches!(ru, Unsafe::No)
285285
&& matches!(lp, ImplPolarity::Positive) == matches!(rp, ImplPolarity::Positive)
@@ -300,10 +300,10 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
300300
use ForeignItemKind::*;
301301
match (l, r) {
302302
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
303-
(Fn(ld, lf, lg, lb), Fn(rd, rf, rg, rb)) => {
303+
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
304304
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
305305
},
306-
(TyAlias(ld, lg, lb, lt), TyAlias(rd, rg, rb, rt)) => {
306+
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
307307
eq_defaultness(*ld, *rd)
308308
&& eq_generics(lg, rg)
309309
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
@@ -318,10 +318,10 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
318318
use AssocItemKind::*;
319319
match (l, r) {
320320
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
321-
(Fn(ld, lf, lg, lb), Fn(rd, rf, rg, rb)) => {
321+
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
322322
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
323323
},
324-
(TyAlias(ld, lg, lb, lt), TyAlias(rd, rg, rb, rt)) => {
324+
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
325325
eq_defaultness(*ld, *rd)
326326
&& eq_generics(lg, rg)
327327
&& over(lb, rb, |l, r| eq_generic_bound(l, r))

clippy_lints/src/write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ops::Range;
33

44
use crate::utils::{snippet_with_applicability, span_lint, span_lint_and_sugg, span_lint_and_then};
55
use if_chain::if_chain;
6-
use rustc_ast::ast::{Expr, ExprKind, Item, ItemKind, LitKind, MacCall, StrLit, StrStyle};
6+
use rustc_ast::ast::{Expr, ExprKind, ImplKind, Item, ItemKind, LitKind, MacCall, StrLit, StrStyle};
77
use rustc_ast::token;
88
use rustc_ast::tokenstream::TokenStream;
99
use rustc_errors::Applicability;
@@ -231,10 +231,10 @@ impl_lint_pass!(Write => [
231231

232232
impl EarlyLintPass for Write {
233233
fn check_item(&mut self, _: &EarlyContext<'_>, item: &Item) {
234-
if let ItemKind::Impl {
234+
if let ItemKind::Impl(box ImplKind {
235235
of_trait: Some(trait_ref),
236236
..
237-
} = &item.kind
237+
}) = &item.kind
238238
{
239239
let trait_name = trait_ref
240240
.path

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-01-30"
2+
channel = "nightly-2021-02-03"
33
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

tests/ui/panicking_macros.stderr

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ error: `panic` should not be present in production code
1111
|
1212
LL | panic!("message");
1313
| ^^^^^^^^^^^^^^^^^^
14-
|
15-
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1614

1715
error: `panic` should not be present in production code
1816
--> $DIR/panicking_macros.rs:10:5
1917
|
2018
LL | panic!("{} {}", "panic with", "multiple arguments");
2119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22-
|
23-
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2420

2521
error: `todo` should not be present in production code
2622
--> $DIR/panicking_macros.rs:16:5
@@ -29,18 +25,23 @@ LL | todo!();
2925
| ^^^^^^^^
3026
|
3127
= note: `-D clippy::todo` implied by `-D warnings`
28+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3229

3330
error: `todo` should not be present in production code
3431
--> $DIR/panicking_macros.rs:17:5
3532
|
3633
LL | todo!("message");
3734
| ^^^^^^^^^^^^^^^^^
35+
|
36+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3837

3938
error: `todo` should not be present in production code
4039
--> $DIR/panicking_macros.rs:18:5
4140
|
4241
LL | todo!("{} {}", "panic with", "multiple arguments");
4342
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43+
|
44+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4445

4546
error: `unimplemented` should not be present in production code
4647
--> $DIR/panicking_macros.rs:24:5
@@ -49,18 +50,23 @@ LL | unimplemented!();
4950
| ^^^^^^^^^^^^^^^^^
5051
|
5152
= note: `-D clippy::unimplemented` implied by `-D warnings`
53+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
5254

5355
error: `unimplemented` should not be present in production code
5456
--> $DIR/panicking_macros.rs:25:5
5557
|
5658
LL | unimplemented!("message");
5759
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
|
61+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
5862

5963
error: `unimplemented` should not be present in production code
6064
--> $DIR/panicking_macros.rs:26:5
6165
|
6266
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
6367
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
|
69+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
6470

6571
error: usage of the `unreachable!` macro
6672
--> $DIR/panicking_macros.rs:32:5
@@ -69,6 +75,7 @@ LL | unreachable!();
6975
| ^^^^^^^^^^^^^^^
7076
|
7177
= note: `-D clippy::unreachable` implied by `-D warnings`
78+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
7279

7380
error: usage of the `unreachable!` macro
7481
--> $DIR/panicking_macros.rs:33:5
@@ -83,6 +90,8 @@ error: usage of the `unreachable!` macro
8390
|
8491
LL | unreachable!("{} {}", "panic with", "multiple arguments");
8592
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93+
|
94+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8695

8796
error: `panic` should not be present in production code
8897
--> $DIR/panicking_macros.rs:40:5
@@ -95,18 +104,24 @@ error: `todo` should not be present in production code
95104
|
96105
LL | todo!();
97106
| ^^^^^^^^
107+
|
108+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
98109

99110
error: `unimplemented` should not be present in production code
100111
--> $DIR/panicking_macros.rs:42:5
101112
|
102113
LL | unimplemented!();
103114
| ^^^^^^^^^^^^^^^^^
115+
|
116+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
104117

105118
error: usage of the `unreachable!` macro
106119
--> $DIR/panicking_macros.rs:43:5
107120
|
108121
LL | unreachable!();
109122
| ^^^^^^^^^^^^^^^
123+
|
124+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
110125

111126
error: aborting due to 16 previous errors
112127

0 commit comments

Comments
 (0)