Skip to content

Commit c868d89

Browse files
committed
Bump MSRV to 1.77
1 parent aa7b455 commit c868d89

File tree

15 files changed

+33
-50
lines changed

15 files changed

+33
-50
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords = ["opencv", "vision"]
88
license = "MIT"
99
version = "0.93.6"
1010
edition = "2021"
11-
rust-version = "1.66"
11+
rust-version = "1.77.0"
1212
authors = ["Pro <twisted.fall@gmail.com>", "Mathieu Poumeyrol <kali@zoy.org>"]
1313
exclude = ["/.github", "/ci", "/tools", ".editorconfig", ".gitattributes", ".gitignore", "release.toml", "rustfmt.toml"]
1414

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The following OpenCV versions are supported at the moment:
163163

164164
### Minimum rustc version (MSRV)
165165

166-
Currently, Rust version 1.66.0 or later is required. General policy is that rust version from 1 year ago is supported.
166+
Currently, Rust version 1.77.0 or later is required. General policy is that rust version from 1 year ago is supported.
167167
Bumping versions older than that is not considered a breaking change.
168168

169169
### Platform support

binding-generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exclude = ["release.toml"]
1515
clang = { version = "2", features = ["clang_6_0"] }
1616
clang-sys = { version = "1", features = ["clang_6_0"] }
1717
dunce = "1"
18-
once_cell = "1" # replace with std::sync::OnceLock when MSRV is 1.70
18+
once_cell = "1" # replace with std::sync::LazyLock when MSRV is 1.80
1919
percent-encoding = { version = "2", default-features = false }
2020
regex = "1"
2121
shlex = { version = "1.3", default-features = false }

binding-generator/src/bin/settings-cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct FunctionFinder<'tu> {
1616
pub gen_env: GeneratorEnv<'tu>,
1717
}
1818

19-
impl<'tu> FunctionFinder<'tu> {
19+
impl FunctionFinder<'_> {
2020
pub fn update_used_func(&self, f: &Func) {
2121
let mut matcher = f.matcher();
2222
self.gen_env.settings.arg_override.get(&mut matcher);

binding-generator/src/renderer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<'s> CppRenderer<'s> {
2929
}
3030
}
3131

32-
impl<'a> TypeRefRenderer<'a> for CppRenderer<'_> {
32+
impl TypeRefRenderer<'_> for CppRenderer<'_> {
3333
type Recursed = Self;
3434

3535
fn render<'t>(self, type_ref: &'t TypeRef) -> Cow<'t, str> {

binding-generator/src/writer/rust_native/type_ref.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,7 @@ impl TypeRefExt for TypeRef<'_, '_> {
235235
}
236236

237237
fn rust_extern_return_fallible(&self) -> Cow<str> {
238-
if self.kind().is_void() {
239-
"ResultVoid".into()
240-
} else {
241-
format!("Result<{ext}>", ext = self.rust_extern(ExternDir::FromCpp)).into()
242-
}
238+
format!("Result<{ext}>", ext = self.rust_extern(ExternDir::FromCpp)).into()
243239
}
244240

245241
fn rust_lifetime_count(&self) -> usize {

binding-generator/src/writer/rust_native/type_ref/render_lane.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub enum RenderLane<'tu, 'ge> {
7777
SimpleClass(SimpleClassRenderLane<'tu, 'ge>),
7878
}
7979

80-
impl<'tu, 'ge> RenderLane<'tu, 'ge> {
80+
impl RenderLane<'_, '_> {
8181
#[inline(always)]
8282
pub fn to_dyn(&self) -> &dyn RenderLaneTrait {
8383
match self {

build.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,18 @@ fn make_compiler(opencv: &Library, ffi_export_suffix: &str) -> cc::Build {
324324

325325
fn setup_rerun() -> Result<()> {
326326
for &v in AFFECTING_ENV_VARS.iter() {
327-
println!("cargo:rerun-if-env-changed={v}"); // replace with cargo:: syntax when MSRV is 1.77
327+
println!("cargo::rerun-if-env-changed={v}");
328328
}
329329

330330
let include_exts = &[OsStr::new("cpp"), OsStr::new("hpp")];
331331
let files_with_include_exts =
332332
files_with_predicate(&SRC_CPP_DIR, |p| p.extension().map_or(false, |e| include_exts.contains(&e)))?;
333333
for path in files_with_include_exts {
334334
if let Some(path) = path.to_str() {
335-
println!("cargo:rerun-if-changed={path}"); // replace with cargo:: syntax when MSRV is 1.77
335+
println!("cargo::rerun-if-changed={path}");
336336
}
337337
}
338-
println!("cargo:rerun-if-changed=Cargo.toml"); // replace with cargo:: syntax when MSRV is 1.77
338+
println!("cargo::rerun-if-changed=Cargo.toml");
339339
Ok(())
340340
}
341341

@@ -360,10 +360,10 @@ fn main() -> Result<()> {
360360
}
361361

362362
for branch in ["34", "4", "5"] {
363-
println!("cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_{branch})"); // replace with cargo:: syntax when MSRV is 1.77
363+
println!("cargo::rustc-check-cfg=cfg(ocvrs_opencv_branch_{branch})");
364364
}
365365
for module in SUPPORTED_MODULES {
366-
println!("cargo:rustc-check-cfg=cfg(ocvrs_has_module_{module})"); // replace with cargo:: syntax when MSRV is 1.77
366+
println!("cargo::rustc-check-cfg=cfg(ocvrs_has_module_{module})");
367367
}
368368

369369
if matches!(handle_running_in_docsrs(), GenerateFullBindings::Stop) {
@@ -396,11 +396,11 @@ fn main() -> Result<()> {
396396
let opencv = Library::probe()?;
397397
eprintln!("=== OpenCV library configuration: {opencv:#?}");
398398
if OPENCV_BRANCH_5.matches(&opencv.version) {
399-
println!("cargo:rustc-cfg=ocvrs_opencv_branch_5"); // replace with cargo:: syntax when MSRV is 1.77
399+
println!("cargo::rustc-cfg=ocvrs_opencv_branch_5");
400400
} else if OPENCV_BRANCH_4.matches(&opencv.version) {
401-
println!("cargo:rustc-cfg=ocvrs_opencv_branch_4"); // replace with cargo:: syntax when MSRV is 1.77
401+
println!("cargo::rustc-cfg=ocvrs_opencv_branch_4");
402402
} else if OPENCV_BRANCH_34.matches(&opencv.version) {
403-
println!("cargo:rustc-cfg=ocvrs_opencv_branch_34"); // replace with cargo:: syntax when MSRV is 1.77
403+
println!("cargo::rustc-cfg=ocvrs_opencv_branch_34");
404404
} else {
405405
panic!(
406406
"Unsupported OpenCV version: {}, must be from 3.4, 4.x or 5.x branch",
@@ -420,7 +420,7 @@ fn main() -> Result<()> {
420420
);
421421
let (modules, module_aliases) = make_modules_and_alises(&opencv_module_header_dir, &opencv.version)?;
422422
for module in &modules {
423-
println!("cargo:rustc-cfg=ocvrs_has_module_{module}"); // replace with cargo:: syntax when MSRV is 1.77
423+
println!("cargo::rustc-cfg=ocvrs_has_module_{module}");
424424
}
425425

426426
if let Some(header_version) = get_version_from_headers(opencv_header_dir) {

build/cmake_probe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ impl LinkLib {
1818
#[inline]
1919
pub fn emit_cargo_rustc_link(&self) -> String {
2020
format!(
21-
"cargo:rustc-link-lib={}{}",
21+
"cargo::rustc-link-lib={}{}",
2222
self.0.as_cargo_rustc_link_spec_no_static(),
2323
self.1
24-
) // replace with cargo:: syntax when MSRV is 1.77
24+
)
2525
}
2626

2727
/// Returns Some(new_file_name) if some parts of the filename were removed, None otherwise
@@ -82,10 +82,10 @@ impl LinkSearch {
8282
#[inline]
8383
pub fn emit_cargo_rustc_link_search(&self) -> String {
8484
format!(
85-
"cargo:rustc-link-search={}{}",
85+
"cargo::rustc-link-search={}{}",
8686
self.0.as_cargo_rustc_link_search_spec(),
8787
self.1.to_str().expect("Can't convert link search path to UTF-8 string")
88-
) // replace with cargo:: syntax when MSRV is 1.77
88+
)
8989
}
9090
}
9191

build/docs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ pub fn handle_running_in_docsrs() -> GenerateFullBindings {
88
if env::var_os("DOCS_RS").is_some() {
99
let docs_dir = MANIFEST_DIR.join("docs");
1010
// fake setup for docs.rs
11-
println!("cargo:rustc-cfg=ocvrs_opencv_branch_4"); // replace with cargo:: syntax when MSRV is 1.77
11+
println!("cargo::rustc-cfg=ocvrs_opencv_branch_4");
1212
transfer_bindings_from_docs(&docs_dir, &OUT_DIR);
1313
for path in files_with_extension(&docs_dir, "rs").expect("Can't read hub dir") {
1414
if let Some(module) = path.file_stem().and_then(OsStr::to_str) {
15-
println!("cargo:rustc-cfg=ocvrs_has_module_{module}"); // replace with cargo:: syntax when MSRV is 1.77
15+
println!("cargo::rustc-cfg=ocvrs_has_module_{module}");
1616
}
1717
}
1818
GenerateFullBindings::Stop

0 commit comments

Comments
 (0)