Skip to content

Commit c320919

Browse files
sirhceleldruin
authored andcommitted
Build version-dependent examples only when supported
This apparently does not reduce noise in CI but at least allows to build the examples with Rust 1.59.0.
1 parent 7cfe68a commit c320919

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ assert_hex = "0.4.1"
4747
clap = { version = "3.1.6", features = ["derive"] }
4848
envconfig = "0.10.0"
4949
rstest = { version = "0.12.0", default-features = false }
50+
rustversion = "1.0.16"
5051

5152
[features]
5253
default = ["libudev"]

examples/loopback.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ fn loopback_standard<'a>(
193193
}
194194
}
195195

196+
#[rustversion::before(1.63)]
197+
fn loopback_split<'a>(
198+
_port: &mut Box<dyn SerialPort>,
199+
_read_stats: &mut Stats<'a>,
200+
_write_stats: &mut Stats<'a>,
201+
) {
202+
unimplemented!("requires Rust 1.63 or later");
203+
}
204+
205+
#[rustversion::since(1.63)]
196206
fn loopback_split<'a>(
197207
port: &mut Box<dyn SerialPort>,
198208
read_stats: &mut Stats<'a>,

0 commit comments

Comments
 (0)