From 014b863142439cc54f551c5ec6e6e8f632d66ed6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 6 Jun 2014 09:22:19 -0700 Subject: [PATCH] mk: Run doc tests with --cfg dox There were a few examples in the macros::builtin module that weren't being run because they were being #[cfg]'d out. Closes #14697 --- mk/tests.mk | 2 +- src/libstd/macros.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mk/tests.mk b/mk/tests.mk index c67fa0042f814..dacea3a4bfc49 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -818,7 +818,7 @@ endif ifeq ($(2),$$(CFG_BUILD)) $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4)) @$$(call E, run doc-crate-$(4) [$(2)]) - $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test \ + $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \ $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@ else $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 0b9fc250636f4..8c87139270102 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -465,7 +465,7 @@ pub mod builtin { /// ``` /// let rust = bytes!("r", 'u', "st", 255); /// assert_eq!(rust[1], 'u' as u8); - /// assert_eq!(rust[5], 255); + /// assert_eq!(rust[4], 255); /// ``` #[macro_export] macro_rules! bytes( ($($e:expr),*) => ({ /* compiler built-in */ }) ) @@ -482,10 +482,14 @@ pub mod builtin { /// # Example /// /// ``` + /// #![feature(concat_idents)] + /// + /// # fn main() { /// fn foobar() -> int { 23 } /// /// let f = concat_idents!(foo, bar); /// println!("{}", f()); + /// # } /// ``` #[macro_export] macro_rules! concat_idents( ($($e:ident),*) => ({ /* compiler built-in */ }) )