Skip to content

Commit 28b5cd0

Browse files
authored
Fix before_snippet failing in release (#2040)
* Fix before_snippet failing in release * Fix esp-hal-embassy comment
1 parent 5917275 commit 28b5cd0

File tree

5 files changed

+16
-40
lines changed

5 files changed

+16
-40
lines changed

esp-hal-embassy/src/executor/thread.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ impl Executor {
7272
multi_core,
7373
doc = r#"
7474
75-
This will use software-interrupt 3 which isn't
76-
available for anything else to wake the other core(s).
77-
"#
75+
This will use software-interrupt 3 which isn't available for anything else to wake the other core(s)."#
7876
)]
7977
pub fn new() -> Self {
8078
#[cfg(multi_core)]

esp-hal/build.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ fn main() -> Result<(), Box<dyn Error>> {
117117
)?;
118118
}
119119

120-
// needed for before_snippet! macro
121-
let host = env::var_os("HOST").expect("HOST not set");
122-
if let Some("windows") = host.to_str().unwrap().split('-').nth(2) {
123-
println!("cargo:rustc-cfg=host_os=\"windows\"");
124-
}
125-
126120
// With the architecture-specific linker scripts taken care of, we can copy all
127121
// remaining linker scripts which are common to all devices:
128122
copy_dir_all(&config_symbols, "ld/sections", &out)?;

esp-hal/doc-helper/before

Lines changed: 0 additions & 12 deletions
This file was deleted.

esp-hal/src/lib.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -621,26 +621,22 @@ unsafe extern "C" fn stack_chk_fail() {
621621

622622
#[doc(hidden)]
623623
/// Helper macro for checking doctest code snippets
624-
#[cfg(not(host_os = "windows"))]
625624
#[macro_export]
626625
macro_rules! before_snippet {
627626
() => {
628-
core::include_str!(concat!(
629-
env!("CARGO_MANIFEST_DIR"),
630-
"/../esp-hal/doc-helper/before"
631-
))
632-
};
633-
}
634-
635-
#[doc(hidden)]
636-
/// Helper macro for checking doctest code snippets
637-
#[cfg(host_os = "windows")]
638-
#[macro_export]
639-
macro_rules! before_snippet {
640-
() => {
641-
core::include_str!(concat!(
642-
env!("CARGO_MANIFEST_DIR"),
643-
"\\..\\esp-hal\\doc-helper\\before"
644-
))
627+
r#"
628+
# #![no_std]
629+
# use esp_hal::peripherals::Peripherals;
630+
# use esp_hal::clock::ClockControl;
631+
# use esp_hal::system::SystemControl;
632+
# #[panic_handler]
633+
# fn panic(_ : &core::panic::PanicInfo) -> ! {
634+
# loop {}
635+
# }
636+
# fn main() {
637+
# let peripherals = Peripherals::take();
638+
# let system = SystemControl::new(peripherals.SYSTEM);
639+
# let mut clocks = ClockControl::boot_defaults(system.clock_control).freeze();
640+
"#
645641
};
646642
}

esp-hal/src/mcpwm/operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'d, Pin: OutputPin, PWM: PwmPeripheral, const OP: u8, const IS_A: bool>
480480
///
481481
/// # H-Bridge example
482482
/// ```rust, no_run
483-
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/doc-helper/before"))]
483+
#[doc = crate::before_snippet!()]
484484
/// # use esp_hal::{mcpwm, prelude::*};
485485
/// # use esp_hal::mcpwm::{McPwm, PeripheralClockConfig};
486486
/// # use esp_hal::mcpwm::operator::{DeadTimeCfg, PwmPinConfig, PWMStream};

0 commit comments

Comments
 (0)