From c3209197dfbc0c760c843c7905d49b83b99714e3 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Sun, 12 May 2024 17:25:37 +0200 Subject: [PATCH] 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. --- Cargo.toml | 1 + examples/loopback.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 7280727e..a3932436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ assert_hex = "0.4.1" clap = { version = "3.1.6", features = ["derive"] } envconfig = "0.10.0" rstest = { version = "0.12.0", default-features = false } +rustversion = "1.0.16" [features] default = ["libudev"] diff --git a/examples/loopback.rs b/examples/loopback.rs index 65f5bd35..dc519345 100644 --- a/examples/loopback.rs +++ b/examples/loopback.rs @@ -193,6 +193,16 @@ fn loopback_standard<'a>( } } +#[rustversion::before(1.63)] +fn loopback_split<'a>( + _port: &mut Box, + _read_stats: &mut Stats<'a>, + _write_stats: &mut Stats<'a>, +) { + unimplemented!("requires Rust 1.63 or later"); +} + +#[rustversion::since(1.63)] fn loopback_split<'a>( port: &mut Box, read_stats: &mut Stats<'a>,