Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document layout SemVer compatibility. #12169

Merged
merged 10 commits into from
Aug 18, 2023
13 changes: 12 additions & 1 deletion crates/semver-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
//! An example with the word "MINOR" at the top is expected to successfully
//! build against the before and after. Otherwise it should fail. A comment of
//! "// Error:" will check that the given message appears in the error output.
//!
//! The code block can also include the annotations:
//! - `run-fail`: The test should fail at runtime, not compiletime.
//! - `dont-deny`: By default tests have a `#![deny(warnings)]`. This option
//! avoids this attribute. Note that `#![allow(unused)]` is always added.

use std::error::Error;
use std::fs;
Expand Down Expand Up @@ -57,7 +62,13 @@ fn doit() -> Result<(), Box<dyn Error>> {
if line.trim() == "```" {
break;
}
block.push(line);
// Support rustdoc/mdbook hidden lines.
let line = line.strip_prefix("# ").unwrap_or(line);
if line == "#" {
block.push("");
} else {
block.push(line);
}
}
None => {
return Err(format!(
Expand Down
Loading