Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileExt methods cause compiler warnings on rust 1.84 #31

Open
eric-seppanen opened this issue Nov 27, 2024 · 0 comments
Open

FileExt methods cause compiler warnings on rust 1.84 #31

eric-seppanen opened this issue Nov 27, 2024 · 0 comments

Comments

@eric-seppanen
Copy link

eric-seppanen commented Nov 27, 2024

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

use fs4::fs_std::FileExt;

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
}
$ cargo +beta-2024-11-27 check

warning: a method with this name may be added to the standard library in the future
  --> src/lib.rs:10:10
   |
10 |     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, which are tracked by the file_lock feature (rust-lang/rust#130994).

@eric-seppanen eric-seppanen changed the title FileExt methods cause compiler warnings on rust 1.83 FileExt methods cause compiler warnings on rust 1.84 Nov 27, 2024
mstange added a commit to mstange/samply that referenced this issue Jan 19, 2025
vcfxb added a commit to vcfxb/wright-lang that referenced this issue Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant