Skip to content

FileExt methods cause compiler warnings on rust 1.84 #50

@eric-seppanen

Description

@eric-seppanen

Using the lock methods from fs2 cause rustc warnings on rust 1.84:

pub fn read_file(filename: &str) -> String {
    let mut file = std::fs::File::open(filename).unwrap();
    file.lock_shared().unwrap();
    let mut data = String::new();
    file.read_to_string(&mut data).unwrap();
    data
}
warning: a method with this name may be added to the standard library in the future
 --> src/lib.rs:8:10
  |
8 |     file.lock_shared().unwrap();
  |          ^^^^^^^^^^^
  |
  = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
  = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
  = help: call with fully qualified syntax `lock_shared(...)` to keep using the current method
  = note: `#[warn(unstable_name_collisions)]` on by default

The name collision happens for lock_shared, try_lock_shared, and unlock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions