rust-lang / rust-lang/rust-bindgen

Incompatibility with libloading 0.9.0

Open
#3,332 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

Hi all,

When I use bindgen with libloading, starting from 0.9.0, there is an issue with a trait requirement inside a new method.

    |         let library = ::libloading::Library::new(path)?;
    |                       -------------------------- ^^^^ the trait `AsFilename` is not implemented for `P`
    |                       |
    |                       required by a bound introduced by this call
    |
note: required by a bound in `libloading::Library::new`
   --> ***\libloading-0.9.0\src\safe.rs:84:38
    |
    |     pub unsafe fn new(filename: impl AsFilename) -> Result<Library, Error> {
    |                                      ^^^^^^^^^^ required by this bound in `Library::new`
help: consider further restricting type parameter `P` with trait `AsFilename`
    |
    |         P: AsRef<::std::ffi::OsStr> + libloading::AsFilename,
    |                                     ++++++++++++++++++++++++

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the bindgen use case with libloading 0.9.0 and inspect the code around the Library::new call and its generic path parameter. Done means the affected bindgen usage compiles successfully with libloading 0.9.0 without requiring an incompatible trait bound.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.