Skip to content

Commit

Permalink
Fix before_snippet failing in release (#2040)
Browse files Browse the repository at this point in the history
* Fix before_snippet failing in release

* Fix esp-hal-embassy comment
  • Loading branch information
bugadani authored Aug 30, 2024
1 parent 5917275 commit 28b5cd0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 40 deletions.
4 changes: 1 addition & 3 deletions esp-hal-embassy/src/executor/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ impl Executor {
multi_core,
doc = r#"
This will use software-interrupt 3 which isn't
available for anything else to wake the other core(s).
"#
This will use software-interrupt 3 which isn't available for anything else to wake the other core(s)."#
)]
pub fn new() -> Self {
#[cfg(multi_core)]
Expand Down
6 changes: 0 additions & 6 deletions esp-hal/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ fn main() -> Result<(), Box<dyn Error>> {
)?;
}

// needed for before_snippet! macro
let host = env::var_os("HOST").expect("HOST not set");
if let Some("windows") = host.to_str().unwrap().split('-').nth(2) {
println!("cargo:rustc-cfg=host_os=\"windows\"");
}

// With the architecture-specific linker scripts taken care of, we can copy all
// remaining linker scripts which are common to all devices:
copy_dir_all(&config_symbols, "ld/sections", &out)?;
Expand Down
12 changes: 0 additions & 12 deletions esp-hal/doc-helper/before

This file was deleted.

32 changes: 14 additions & 18 deletions esp-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,26 +621,22 @@ unsafe extern "C" fn stack_chk_fail() {

#[doc(hidden)]
/// Helper macro for checking doctest code snippets
#[cfg(not(host_os = "windows"))]
#[macro_export]
macro_rules! before_snippet {
() => {
core::include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../esp-hal/doc-helper/before"
))
};
}

#[doc(hidden)]
/// Helper macro for checking doctest code snippets
#[cfg(host_os = "windows")]
#[macro_export]
macro_rules! before_snippet {
() => {
core::include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"\\..\\esp-hal\\doc-helper\\before"
))
r#"
# #![no_std]
# use esp_hal::peripherals::Peripherals;
# use esp_hal::clock::ClockControl;
# use esp_hal::system::SystemControl;
# #[panic_handler]
# fn panic(_ : &core::panic::PanicInfo) -> ! {
# loop {}
# }
# fn main() {
# let peripherals = Peripherals::take();
# let system = SystemControl::new(peripherals.SYSTEM);
# let mut clocks = ClockControl::boot_defaults(system.clock_control).freeze();
"#
};
}
2 changes: 1 addition & 1 deletion esp-hal/src/mcpwm/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl<'d, Pin: OutputPin, PWM: PwmPeripheral, const OP: u8, const IS_A: bool>
///
/// # H-Bridge example
/// ```rust, no_run
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/doc-helper/before"))]
#[doc = crate::before_snippet!()]
/// # use esp_hal::{mcpwm, prelude::*};
/// # use esp_hal::mcpwm::{McPwm, PeripheralClockConfig};
/// # use esp_hal::mcpwm::operator::{DeadTimeCfg, PwmPinConfig, PWMStream};
Expand Down

0 comments on commit 28b5cd0

Please sign in to comment.