Skip to content

Commit cb12e7a

Browse files
committed
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
1 parent 1f4d8f9 commit cb12e7a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ endif
818818
ifeq ($(2),$$(CFG_BUILD))
819819
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
820820
@$$(call E, run doc-crate-$(4) [$(2)])
821-
$$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test \
821+
$$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
822822
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
823823
else
824824
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):

src/libstd/macros.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ pub mod builtin {
465465
/// ```
466466
/// let rust = bytes!("r", 'u', "st", 255);
467467
/// assert_eq!(rust[1], 'u' as u8);
468-
/// assert_eq!(rust[5], 255);
468+
/// assert_eq!(rust[4], 255);
469469
/// ```
470470
#[macro_export]
471471
macro_rules! bytes( ($($e:expr),*) => ({ /* compiler built-in */ }) )
@@ -482,10 +482,14 @@ pub mod builtin {
482482
/// # Example
483483
///
484484
/// ```
485+
/// #![feature(concat_idents)]
486+
///
487+
/// # fn main() {
485488
/// fn foobar() -> int { 23 }
486489
///
487490
/// let f = concat_idents!(foo, bar);
488491
/// println!("{}", f());
492+
/// # }
489493
/// ```
490494
#[macro_export]
491495
macro_rules! concat_idents( ($($e:ident),*) => ({ /* compiler built-in */ }) )

0 commit comments

Comments
 (0)