1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 //! This modules implements the gating necessary for preventing certain compiler
14 //! features from being used by default. This module will crawl a pre-expanded
15 //! AST to ensure that there are no features which are used that are not
18 //! Features are enabled in programs via the crate-level attributes of
19 //! `#![feature(...)]` with a comma-separated list of features.
21 //! For the purpose of future feature-tracking, once code for detection of feature
22 //! gate usage is added, *do not remove it again* even once the feature
26 use self::AttributeType::*;
28 use abi::RustIntrinsic;
32 use attr::AttrMetaMethods;
33 use codemap::{CodeMap, Span};
34 use diagnostic::SpanHandler;
37 use parse::token::{self, InternedString};
39 use std::ascii::AsciiExt;
41 // If you change this list without updating src/doc/reference.md, @cmr will be sad
42 // Don't ever remove anything from this list; set them to 'Removed'.
43 // The version numbers here correspond to the version in which the current status
44 // was set. This is most important for knowing when a particular feature became
46 // NB: The featureck.py script parses this information directly out of the source
47 // so take care when modifying it.
48 const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
49 ("globs", "1.0.0", Accepted),
50 ("macro_rules", "1.0.0", Accepted),
51 ("struct_variant", "1.0.0", Accepted),
52 ("asm", "1.0.0", Active),
53 ("managed_boxes", "1.0.0", Removed),
54 ("non_ascii_idents", "1.0.0", Active),
55 ("thread_local", "1.0.0", Active),
56 ("link_args", "1.0.0", Active),
57 ("phase", "1.0.0", Removed),
58 ("plugin_registrar", "1.0.0", Active),
59 ("log_syntax", "1.0.0", Active),
60 ("trace_macros", "1.0.0", Active),
61 ("concat_idents", "1.0.0", Active),
62 ("unsafe_destructor", "1.0.0", Active),
63 ("intrinsics", "1.0.0", Active),
64 ("lang_items", "1.0.0", Active),
66 ("simd", "1.0.0", Active),
67 ("default_type_params", "1.0.0", Accepted),
68 ("quote", "1.0.0", Active),
69 ("link_llvm_intrinsics", "1.0.0", Active),
70 ("linkage", "1.0.0", Active),
71 ("struct_inherit", "1.0.0", Removed),
73 ("quad_precision_float", "1.0.0", Removed),
75 ("rustc_diagnostic_macros", "1.0.0", Active),
76 ("unboxed_closures", "1.0.0", Active),
77 ("import_shadowing", "1.0.0", Removed),
78 ("advanced_slice_patterns", "1.0.0", Active),
79 ("tuple_indexing", "1.0.0", Accepted),
80 ("associated_types", "1.0.0", Accepted),
81 ("visible_private_types", "1.0.0", Active),
82 ("slicing_syntax", "1.0.0", Accepted),
83 ("box_syntax", "1.0.0", Active),
84 ("on_unimplemented", "1.0.0", Active),
85 ("simd_ffi", "1.0.0", Active),
86 ("allocator", "1.0.0", Active),
88 ("if_let", "1.0.0", Accepted),
89 ("while_let", "1.0.0", Accepted),
91 ("plugin", "1.0.0", Active),
92 ("start", "1.0.0", Active),
93 ("main", "1.0.0", Active),
95 // A temporary feature gate used to enable parser extensions needed
96 // to bootstrap fix for #5723.
97 ("issue_5723_bootstrap", "1.0.0", Accepted),
99 // A way to temporarily opt out of opt in copy. This will *never* be accepted.
100 ("opt_out_copy", "1.0.0", Removed),
102 // A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
103 ("old_orphan_check", "1.0.0", Deprecated),
105 // OIBIT specific features
106 ("optin_builtin_traits", "1.0.0", Active),
108 // int and uint are now deprecated
109 ("int_uint", "1.0.0", Active),
111 // macro reexport needs more discussion and stabilization
112 ("macro_reexport", "1.0.0", Active),
114 // These are used to test this portion of the compiler, they don't actually
116 ("test_accepted_feature", "1.0.0", Accepted),
117 ("test_removed_feature", "1.0.0", Removed),
119 // Allows use of #[staged_api]
120 ("staged_api", "1.0.0", Active),
122 // Allows using items which are missing stability attributes
123 ("unmarked_api", "1.0.0", Active),
125 // Allows using #![no_std]
126 ("no_std", "1.0.0", Active),
128 // Allows using `box` in patterns; RFC 469
129 ("box_patterns", "1.0.0", Active),
131 // Allows using the unsafe_no_drop_flag attribute (unlikely to
132 // switch to Accepted; see RFC 320)
133 ("unsafe_no_drop_flag", "1.0.0", Active),
135 // Allows the use of custom attributes; RFC 572
136 ("custom_attribute", "1.0.0", Active),
138 // Allows the use of #[derive(Anything)] as sugar for
139 // #[derive_Anything].
140 ("custom_derive", "1.0.0", Active),
142 // Allows the use of rustc_* attributes; RFC 572
143 ("rustc_attrs", "1.0.0", Active),
145 // Allows the use of `static_assert`
146 ("static_assert", "1.0.0", Active),
148 // Allows the use of #[allow_internal_unstable]. This is an
149 // attribute on macro_rules! and can't use the attribute handling
150 // below (it has to be checked before expansion possibly makes
151 // macros disappear).
152 ("allow_internal_unstable", "1.0.0", Active),
154 // (changing above list without updating src/doc/reference.md makes @cmr sad)
157 /// Represents an active feature that is currently being implemented or
158 /// currently being considered for addition/removal.
161 /// Represents a feature gate that is temporarily enabling deprecated behavior.
162 /// This gate will never be accepted.
165 /// Represents a feature which has since been removed (it was once Active)
168 /// This language feature has since been Accepted (it was once Active)
172 // Attributes that have a special meaning to rustc or rustdoc
173 pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
181 ("macro_reexport", Normal),
182 ("macro_use", Normal),
183 ("macro_export", Normal),
184 ("plugin_registrar", Normal),
187 ("cfg_attr", Normal),
196 ("unsafe_destructor", Normal),
197 ("automatically_derived", Normal),
198 ("no_mangle", Normal),
201 ("should_fail", Normal),
202 ("should_panic", Normal),
204 ("no_implicit_prelude", Normal),
205 ("reexport_test_harness_main", Normal),
206 ("link_args", Normal),
207 ("macro_escape", Normal),
210 ("staged_api", Gated("staged_api",
211 "staged_api is for use by rustc only")),
212 ("plugin", Gated("plugin",
213 "compiler plugins are experimental \
214 and possibly buggy")),
215 ("no_std", Gated("no_std",
216 "no_std is experimental")),
217 ("lang", Gated("lang_items",
218 "language items are subject to change")),
219 ("linkage", Gated("linkage",
220 "the `linkage` attribute is experimental \
221 and not portable across platforms")),
222 ("thread_local", Gated("thread_local",
223 "`#[thread_local]` is an experimental feature, and does not \
224 currently handle destructors. There is no corresponding \
225 `#[task_local]` mapping to the task model")),
227 ("rustc_on_unimplemented", Gated("on_unimplemented",
228 "the `#[rustc_on_unimplemented]` attribute \
229 is an experimental feature")),
230 ("allocator", Gated("allocator",
231 "the `#[allocator]` attribute is an experimental feature")),
232 ("rustc_variance", Gated("rustc_attrs",
233 "the `#[rustc_variance]` attribute \
234 is an experimental feature")),
235 ("rustc_error", Gated("rustc_attrs",
236 "the `#[rustc_error]` attribute \
237 is an experimental feature")),
238 ("rustc_move_fragments", Gated("rustc_attrs",
239 "the `#[rustc_move_fragments]` attribute \
240 is an experimental feature")),
242 ("allow_internal_unstable", Gated("allow_internal_unstable",
243 EXPLAIN_ALLOW_INTERNAL_UNSTABLE)),
245 // FIXME: #14408 whitelist docs since rustdoc looks at them
246 ("doc", Whitelisted),
248 // FIXME: #14406 these are processed in trans, which happens after the
250 ("cold", Whitelisted),
251 ("export_name", Whitelisted),
252 ("inline", Whitelisted),
253 ("link", Whitelisted),
254 ("link_name", Whitelisted),
255 ("link_section", Whitelisted),
256 ("no_builtins", Whitelisted),
257 ("no_mangle", Whitelisted),
258 ("no_stack_check", Whitelisted),
259 ("packed", Whitelisted),
260 ("static_assert", Gated("static_assert",
261 "`#[static_assert]` is an experimental feature, and has a poor API")),
262 ("no_debug", Whitelisted),
263 ("omit_gdb_pretty_printer_section", Whitelisted),
264 ("unsafe_no_drop_flag", Gated("unsafe_no_drop_flag",
265 "unsafe_no_drop_flag has unstable semantics \
266 and may be removed in the future")),
269 ("prelude_import", Whitelisted),
271 // FIXME: #14407 these are only looked at on-demand so we can't
272 // guarantee they'll have already been checked
273 ("deprecated", Whitelisted),
274 ("must_use", Whitelisted),
275 ("stable", Whitelisted),
276 ("unstable", Whitelisted),
278 // FIXME: #19470 this shouldn't be needed forever
279 ("old_orphan_check", Whitelisted),
280 ("rustc_paren_sugar", Whitelisted), // FIXME: #18101 temporary unboxed closure hack
282 // Crate level attributes
283 ("crate_name", CrateLevel),
284 ("crate_type", CrateLevel),
285 ("crate_id", CrateLevel),
286 ("feature", CrateLevel),
287 ("no_start", CrateLevel),
288 ("no_main", CrateLevel),
289 ("no_builtins", CrateLevel),
290 ("recursion_limit", CrateLevel),
293 #[derive(PartialEq, Copy, Debug)]
294 pub enum AttributeType {
295 /// Normal, builtin attribute that is consumed
296 /// by the compiler before the unused_attribute check
299 /// Builtin attribute that may not be consumed by the compiler
300 /// before the unused_attribute check. These attributes
301 /// will be ignored by the unused_attribute lint
304 /// Is gated by a given feature gate and reason
305 /// These get whitelisted too
306 Gated(&'static str, &'static str),
308 /// Builtin attribute that is only allowed at the crate level
312 /// A set of features to be used by later passes.
313 pub struct Features {
314 pub unboxed_closures: bool,
315 pub rustc_diagnostic_macros: bool,
316 pub visible_private_types: bool,
317 pub allow_quote: bool,
319 pub allow_log_syntax: bool,
320 pub allow_concat_idents: bool,
321 pub allow_trace_macros: bool,
322 pub allow_internal_unstable: bool,
323 pub allow_custom_derive: bool,
324 pub old_orphan_check: bool,
326 pub unmarked_api: bool,
327 /// spans of #![feature] attrs for stable language features. for error reporting
328 pub declared_stable_lang_features: Vec<Span>,
329 /// #![feature] attrs for non-language (library) features
330 pub declared_lib_features: Vec<(InternedString, Span)>
334 pub fn new() -> Features {
336 unboxed_closures: false,
337 rustc_diagnostic_macros: false,
338 visible_private_types: false,
341 allow_log_syntax: false,
342 allow_concat_idents: false,
343 allow_trace_macros: false,
344 allow_internal_unstable: false,
345 allow_custom_derive: false,
346 old_orphan_check: false,
349 declared_stable_lang_features: Vec::new(),
350 declared_lib_features: Vec::new()
356 features: Vec<&'static str>,
357 span_handler: &'a SpanHandler,
362 impl<'a> Context<'a> {
363 fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
364 let has_feature = self.has_feature(feature);
365 debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", feature, span, has_feature);
367 emit_feature_err(self.span_handler, feature, span, explain);
371 fn warn_feature(&self, feature: &str, span: Span, explain: &str) {
372 if !self.has_feature(feature) && self.do_warnings {
373 emit_feature_warn(self.span_handler, feature, span, explain);
376 fn has_feature(&self, feature: &str) -> bool {
377 self.features.iter().any(|&n| n == feature)
380 fn check_attribute(&self, attr: &ast::Attribute) {
381 debug!("check_attribute(attr = {:?})", attr);
382 let name = &*attr.name();
383 for &(n, ty) in KNOWN_ATTRIBUTES {
385 if let Gated(gate, desc) = ty {
386 self.gate_feature(gate, attr.span, desc);
388 debug!("check_attribute: {:?} is known, {:?}", name, ty);
392 if name.starts_with("rustc_") {
393 self.gate_feature("rustc_attrs", attr.span,
394 "unless otherwise specified, attributes \
395 with the prefix `rustc_` \
396 are reserved for internal compiler diagnostics");
397 } else if name.starts_with("derive_") {
398 self.gate_feature("custom_derive", attr.span,
399 "attributes of the form `#[derive_*]` are reserved
402 self.gate_feature("custom_attribute", attr.span,
403 &format!("The attribute `{}` is currently \
404 unknown to the the compiler and \
406 added to it in the future",
412 pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
413 diag.span_err(span, explain);
414 diag.fileline_help(span, &format!("add #![feature({})] to the \
415 crate attributes to enable",
419 pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
420 diag.span_warn(span, explain);
421 if diag.handler.can_emit_warnings {
422 diag.fileline_help(span, &format!("add #![feature({})] to the \
423 crate attributes to silence this warning",
428 pub const EXPLAIN_ASM: &'static str =
429 "inline assembly is not stable enough for use and is subject to change";
431 pub const EXPLAIN_LOG_SYNTAX: &'static str =
432 "`log_syntax!` is not stable enough for use and is subject to change";
434 pub const EXPLAIN_CONCAT_IDENTS: &'static str =
435 "`concat_idents` is not stable enough for use and is subject to change";
437 pub const EXPLAIN_TRACE_MACROS: &'static str =
438 "`trace_macros` is not stable enough for use and is subject to change";
439 pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =
440 "allow_internal_unstable side-steps feature gating and stability checks";
442 pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
443 "`#[derive]` for custom traits is not stable enough for use and is subject to change";
445 struct MacroVisitor<'a> {
446 context: &'a Context<'a>
449 impl<'a, 'v> Visitor<'v> for MacroVisitor<'a> {
450 fn visit_mac(&mut self, mac: &ast::Mac) {
451 let ast::MacInvocTT(ref path, _, _) = mac.node;
452 let id = path.segments.last().unwrap().identifier;
454 // Issue 22234: If you add a new case here, make sure to also
455 // add code to catch the macro during or after expansion.
457 // We still keep this MacroVisitor (rather than *solely*
458 // relying on catching cases during or after expansion) to
459 // catch uses of these macros within conditionally-compiled
460 // code, e.g. `#[cfg]`-guarded functions.
462 if id == token::str_to_ident("asm") {
463 self.context.gate_feature("asm", path.span, EXPLAIN_ASM);
466 else if id == token::str_to_ident("log_syntax") {
467 self.context.gate_feature("log_syntax", path.span, EXPLAIN_LOG_SYNTAX);
470 else if id == token::str_to_ident("trace_macros") {
471 self.context.gate_feature("trace_macros", path.span, EXPLAIN_TRACE_MACROS);
474 else if id == token::str_to_ident("concat_idents") {
475 self.context.gate_feature("concat_idents", path.span, EXPLAIN_CONCAT_IDENTS);
479 fn visit_attribute(&mut self, attr: &'v ast::Attribute) {
480 self.context.check_attribute(attr);
484 struct PostExpansionVisitor<'a> {
485 context: &'a Context<'a>
488 impl<'a> PostExpansionVisitor<'a> {
489 fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
490 if !self.context.cm.span_allows_unstable(span) {
491 self.context.gate_feature(feature, span, explain)
496 impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
497 fn visit_attribute(&mut self, attr: &ast::Attribute) {
498 if !self.context.cm.span_allows_unstable(attr.span) {
499 self.context.check_attribute(attr);
503 fn visit_name(&mut self, sp: Span, name: ast::Name) {
504 if !token::get_name(name).is_ascii() {
505 self.gate_feature("non_ascii_idents", sp,
506 "non-ascii idents are not fully supported.");
510 fn visit_item(&mut self, i: &ast::Item) {
512 ast::ItemExternCrate(_) => {
513 if attr::contains_name(&i.attrs[..], "macro_reexport") {
514 self.gate_feature("macro_reexport", i.span,
515 "macros reexports are experimental \
516 and possibly buggy");
520 ast::ItemForeignMod(ref foreign_module) => {
521 if attr::contains_name(&i.attrs[..], "link_args") {
522 self.gate_feature("link_args", i.span,
523 "the `link_args` attribute is not portable \
524 across platforms, it is recommended to \
525 use `#[link(name = \"foo\")]` instead")
527 if foreign_module.abi == RustIntrinsic {
528 self.gate_feature("intrinsics",
530 "intrinsics are subject to change")
535 if attr::contains_name(&i.attrs[..], "plugin_registrar") {
536 self.gate_feature("plugin_registrar", i.span,
537 "compiler plugins are experimental and possibly buggy");
539 if attr::contains_name(&i.attrs[..], "start") {
540 self.gate_feature("start", i.span,
541 "a #[start] function is an experimental \
542 feature whose signature may change \
545 if attr::contains_name(&i.attrs[..], "main") {
546 self.gate_feature("main", i.span,
547 "declaration of a nonstandard #[main] \
548 function may change over time, for now \
549 a top-level `fn main()` is required");
553 ast::ItemStruct(..) => {
554 if attr::contains_name(&i.attrs[..], "simd") {
555 self.gate_feature("simd", i.span,
556 "SIMD types are experimental and possibly buggy");
560 ast::ItemDefaultImpl(..) => {
561 self.gate_feature("optin_builtin_traits",
563 "default trait implementations are experimental \
564 and possibly buggy");
567 ast::ItemImpl(_, polarity, _, _, _, _) => {
569 ast::ImplPolarity::Negative => {
570 self.gate_feature("optin_builtin_traits",
572 "negative trait bounds are not yet fully implemented; \
573 use marker types for now");
578 if attr::contains_name(&i.attrs,
579 "unsafe_destructor") {
580 self.gate_feature("unsafe_destructor",
582 "`#[unsafe_destructor]` allows too \
583 many unsafe patterns and may be \
584 removed in the future");
587 if attr::contains_name(&i.attrs[..],
588 "old_orphan_check") {
592 "the new orphan check rules will eventually be strictly enforced");
599 visit::walk_item(self, i);
602 fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
603 let links_to_llvm = match attr::first_attr_value_str_by_name(&i.attrs,
605 Some(val) => val.starts_with("llvm."),
609 self.gate_feature("link_llvm_intrinsics", i.span,
610 "linking to LLVM intrinsics is experimental");
613 visit::walk_foreign_item(self, i)
616 fn visit_ty(&mut self, t: &ast::Ty) {
618 ast::TyPath(None, ref p) => {
621 [ast::PathSegment { identifier, .. }] => {
622 let name = token::get_ident(identifier);
623 let msg = if name == "int" {
624 Some("the `int` type is deprecated; \
625 use `isize` or a fixed-sized integer")
626 } else if name == "uint" {
627 Some("the `uint` type is deprecated; \
628 use `usize` or a fixed-sized integer")
633 if let Some(msg) = msg {
634 self.context.warn_feature("int_uint", t.span, msg)
642 visit::walk_ty(self, t);
645 fn visit_expr(&mut self, e: &ast::Expr) {
647 ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => {
648 self.gate_feature("box_syntax",
650 "box expression syntax is experimental; \
651 you can call `Box::new` instead.");
653 ast::ExprLit(ref lit) => {
655 ast::LitInt(_, ty) => {
656 let msg = if let ast::SignedIntLit(ast::TyIs(true), _) = ty {
657 Some("the `i` and `is` suffixes on integers are deprecated; \
658 use `isize` or one of the fixed-sized suffixes")
659 } else if let ast::UnsignedIntLit(ast::TyUs(true)) = ty {
660 Some("the `u` and `us` suffixes on integers are deprecated; \
661 use `usize` or one of the fixed-sized suffixes")
665 if let Some(msg) = msg {
666 self.context.warn_feature("int_uint", e.span, msg);
674 visit::walk_expr(self, e);
677 fn visit_pat(&mut self, pattern: &ast::Pat) {
679 ast::PatVec(_, Some(_), ref last) if !last.is_empty() => {
680 self.gate_feature("advanced_slice_patterns",
682 "multiple-element slice matches anywhere \
683 but at the end of a slice (e.g. \
684 `[0, ..xs, 0]` are experimental")
687 self.gate_feature("box_patterns",
689 "box pattern syntax is experimental");
693 visit::walk_pat(self, pattern)
696 fn visit_fn(&mut self,
697 fn_kind: visit::FnKind<'v>,
698 fn_decl: &'v ast::FnDecl,
699 block: &'v ast::Block,
703 visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
704 self.gate_feature("intrinsics",
706 "intrinsics are subject to change")
710 visit::walk_fn(self, fn_kind, fn_decl, block, span);
714 fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
718 where F: FnOnce(&mut Context, &ast::Crate)
720 let mut cx = Context {
721 features: Vec::new(),
722 span_handler: span_handler,
723 do_warnings: do_warnings,
727 let mut accepted_features = Vec::new();
728 let mut unknown_features = Vec::new();
730 for attr in &krate.attrs {
731 if !attr.check_name("feature") {
735 match attr.meta_item_list() {
737 span_handler.span_err(attr.span, "malformed feature attribute, \
738 expected #![feature(...)]");
742 let name = match mi.node {
743 ast::MetaWord(ref word) => (*word).clone(),
745 span_handler.span_err(mi.span,
746 "malformed feature, expected just \
751 match KNOWN_FEATURES.iter()
752 .find(|& &(n, _, _)| name == n) {
753 Some(&(name, _, Active)) => {
754 cx.features.push(name);
756 Some(&(name, _, Deprecated)) => {
757 cx.features.push(name);
758 span_handler.span_warn(
760 "feature is deprecated and will only be available \
761 for a limited time, please rewrite code that relies on it");
763 Some(&(_, _, Removed)) => {
764 span_handler.span_err(mi.span, "feature has been removed");
766 Some(&(_, _, Accepted)) => {
767 accepted_features.push(mi.span);
770 unknown_features.push((name, mi.span));
778 check(&mut cx, krate);
780 // FIXME (pnkfelix): Before adding the 99th entry below, change it
781 // to a single-pass (instead of N calls to `.has_feature`).
784 unboxed_closures: cx.has_feature("unboxed_closures"),
785 rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
786 visible_private_types: cx.has_feature("visible_private_types"),
787 allow_quote: cx.has_feature("quote"),
788 allow_asm: cx.has_feature("asm"),
789 allow_log_syntax: cx.has_feature("log_syntax"),
790 allow_concat_idents: cx.has_feature("concat_idents"),
791 allow_trace_macros: cx.has_feature("trace_macros"),
792 allow_internal_unstable: cx.has_feature("allow_internal_unstable"),
793 allow_custom_derive: cx.has_feature("custom_derive"),
794 old_orphan_check: cx.has_feature("old_orphan_check"),
795 simd_ffi: cx.has_feature("simd_ffi"),
796 unmarked_api: cx.has_feature("unmarked_api"),
797 declared_stable_lang_features: accepted_features,
798 declared_lib_features: unknown_features
802 pub fn check_crate_macros(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate)
804 check_crate_inner(cm, span_handler, krate, true,
805 |ctx, krate| visit::walk_crate(&mut MacroVisitor { context: ctx }, krate))
808 pub fn check_crate(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
809 do_warnings: bool) -> Features
811 check_crate_inner(cm, span_handler, krate, do_warnings,
812 |ctx, krate| visit::walk_crate(&mut PostExpansionVisitor { context: ctx },