lifthrasiir / rust-encoding

Character encoding support for Rust
MIT License
284 stars 59 forks source link

Fix hyphens on target names error #78

Closed filipegoncalves closed 9 years ago

filipegoncalves commented 9 years ago

As of the latest nightly, the rules in https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md are now fully implemented and in use. This patch fixes the errors on cargo build that arise when attempting to build projects that depend on this library:

Unable to get packages from source

Caused by:
  failed to parse manifest at `/home/filipe/.cargo/registry/src/github.com-1ecc6299db9ec823/encoding-index-simpchinese-1.20141219.1/Cargo.toml`

Caused by:
  target names cannot contain hyphens: encoding-index-simpchinese
SimonSapin commented 9 years ago

Looks good, thanks!

Using unstable features without #![feature(...)] is now also an error. (See Travis-CI logs.) Could you fix that as well?

filipegoncalves commented 9 years ago

Thanks for the feedback. I updated the PR to fix the unstable features error.

Adding #![feature(core)] to the crate's attributes does seem to solve the additional errors, just like the compiler suggests, but although all the errors go away, it spits a somewhat annoying warning about "unused or unknown feature". After a brief discussion on IRC, it seems like a bug in rust internals.

I decided to leave it like that for now, since there's no apparent fix to make the warning disappear.

SimonSapin commented 9 years ago

It looks like some of the *-index crates also need #![feature(core)] (or perhaps #![cfg_attr(test, feature(core))]) as well. You can run make test to run tests in every crate.

… and by the time I typed this, I see you’ve already pushed a fix :)

filipegoncalves commented 9 years ago

Yep, I saw it :) It should build now.

UPDATE: turns out the warning is not a bug in Rust. It was my fault - indeed, feature(core) in some cases was needed for tests only, wrapping it in cfg_attr fixed it.

lifthrasiir commented 9 years ago

Thank you!