From b3a010a3154d0cd9d4943e794a0e90916da93936 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 8 Mar 2021 19:32:43 +0100 Subject: [PATCH] entry_libloading: Do not pass AsRef implementation by reference (#389) All type parameters are implicitly bound by `Sized`; matching the `&` out of `&str` implies that `str` must be bound by `Sized` which is not true, resulting in: 18 | let entry = ash::Entry::with_library("foo")?; | ^^^^^ doesn't have a size known at compile-time | ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39 | 73 | pub unsafe fn with_library(path: &impl AsRef) -> Result { | ----------------- required by this bound in `ash::entry_libloading::>>::with_library` After all `Library::new` accepts an `impl AsRef` without borrow, which is what this function is modeled after to pass the same parameter on directly. Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (#319)") --- ash/src/entry_libloading.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ash/src/entry_libloading.rs b/ash/src/entry_libloading.rs index 9a392bc..4ff55f3 100644 --- a/ash/src/entry_libloading.rs +++ b/ash/src/entry_libloading.rs @@ -62,7 +62,7 @@ impl EntryCustom> { /// # Ok(()) } /// ``` pub unsafe fn new() -> Result { - Self::with_library(&LIB_PATH) + Self::with_library(LIB_PATH) } /// Load Vulkan library at `path` @@ -70,7 +70,7 @@ impl EntryCustom> { /// # Safety /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines /// for [`Library::new`] and [`Library::get`] apply here. - pub unsafe fn with_library(path: &impl AsRef) -> Result { + pub unsafe fn with_library(path: impl AsRef) -> Result { let lib = Library::new(path).map_err(LoadingError).map(Arc::new)?; Ok(Self::new_custom(lib, |vk_lib, name| {