alexcrichton / filetime

Accessing file timestamps in a platform-agnostic fashion in Rust
Apache License 2.0
122 stars 56 forks source link

Was migration to 2018 edition a backwards breaking change needing 0.3 release? #42

Closed oherrala closed 5 years ago

oherrala commented 5 years ago

In the commit 38857bbda347a983a4b9b252e22e48cbd3f5443c project is migrated to Rust 2018 edition.

This causes breakage for projects using older Rust, for example rouille with Rust 1.24.1:

error: non-ident macro paths are experimental (see issue #35896)
  --> /Users/oherrala/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:43:1
   |
43 | cfg_if::cfg_if! {
   | ^^^^^^^^^^^^^^

error: aborting due to previous error

I know this is semver 0.x.y version, but I think this breakage would be avoided by releasing this change as 0.3.0 and keeping 0.2 as is.

alexcrichton commented 5 years ago

The policy of this crate is that it's not a breaking change, and the newer version require 1.32.0 or greater.

arianvp commented 5 years ago

I get this error on 1.36.0 too.

   Compiling filetime v0.2.6
error: cannot find macro `__cfg_if_items!` in this scope
  --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:43:1
   |
43 | / cfg_if::cfg_if! {
44 | |     if #[cfg(target_os = "redox")] {
45 | |         #[path = "redox.rs"]
46 | |         mod imp;
...  |
56 | |     }
57 | | }
   | |_^
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:116:9
    |
116 |         imp::from_last_modification_time(meta).emulate_second_only_system()
    |         ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:125:9
    |
125 |         imp::from_last_access_time(meta).emulate_second_only_system()
    |         ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:136:9
    |
136 |         imp::from_creation_time(meta).map(|x| x.emulate_second_only_system())
    |         ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:220:5
    |
220 |     imp::set_file_times(p.as_ref(), atime, mtime)
    |     ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:234:5
    |
234 |     imp::set_file_handle_times(f, atime, mtime)
    |     ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:246:5
    |
246 |     imp::set_symlink_file_times(p.as_ref(), atime, mtime)
    |     ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:263:5
    |
263 |     imp::set_file_mtime(p.as_ref(), mtime)
    |     ^^^ use of undeclared type or module `imp`

error[E0433]: failed to resolve: use of undeclared type or module `imp`
   --> /home/arian/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.6/src/lib.rs:280:5
    |
280 |     imp::set_file_atime(p.as_ref(), atime)
    |     ^^^ use of undeclared type or module `imp`

error: aborting due to 9 previous errors

For more information about this error, try `rustc --explain E0433`.
error: Could not compile `filetime`.
warning: build failed, waiting for other jobs to finish...
error: build failed
arianvp commented 5 years ago

I have some projects for which this compiles and for others for which it doesn't.

The only difference I have found so far is that some projects have decided to choose cfg-if 0.1.9 as a dependency (does work)

and others have chosen to pick cfg-if 0.1.4 (doesn't work)

So apparently there was a breaking change between these two versions? I suggest adding a more constrained version bound on cfg-if because = 0.1 is too loose.

arianvp commented 5 years ago

Deleting my Cargo.lock file made it pick 0.1.9 this time. Seems to work now!