-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Two adjustments to rustc for cargo #15686
Conversation
let msg = format!("--crate-name and #[crate_name] \ | ||
are required to match, but `{}` \ | ||
!= `{}`", s, name); | ||
sess.span_err(attr.span, msg.as_slice()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to update the comment a few lines above (lines 558-560), as it still claims that the crate name from the command-line is favored.
Travis failure says run-pass/crate-name-attr-used.rs failed, because I'm also not really clear what the motivation is for requiring Anyway, r=me with the test fixed and the comment updated. |
Part of the original discussions around the `--crate-name` flag brought up that mass confusion can arise when the flag specifies a different name than is contained in the crate. The current primary use case of the `--crate-name` flag is through cargo and not requiring a `#[crate_name]` attribute, but if the `#[crate_name]` attribute is specified it will likely go awry when the two names deviate from one another. This commit requires that if both are provided they both match to prevent this confusion.
When invoking the compiler in parallel, the intermediate output of the object files and bytecode can stomp over one another if two crates with the same name are being compiled. The output file is already being disambiguated with `-C extra-filename`, so this commit alters the naming of the temporary files to also mix in the extra filename to ensure that file names don't clash.
The first is to require that `#[crate_name]` and `--crate-name` always match (if both are specified). The second is to fix parallel compilation in cargo by mixing in `-C extra-filename` into the temporary outputs of the compiler.
Only run tests on linux in pull requests There is little gain from running them on all platforms, they should almost never fail if the linux one pass and if they do, bors will catch it still.
The first is to require that
#[crate_name]
and--crate-name
always match (if both are specified). The second is to fix parallel compilation in cargo by mixing in-C extra-filename
into the temporary outputs of the compiler.