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

configured-off modules are required to exist #5870

Closed
doy opened this issue Apr 13, 2013 · 8 comments
Closed

configured-off modules are required to exist #5870

doy opened this issue Apr 13, 2013 · 8 comments
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-frontend Area: Compiler frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST P-low Low priority

Comments

@doy
Copy link
Contributor

doy commented Apr 13, 2013

// test.rs
#[cfg(foo)]
#[path = "foo.rs"]
pub mod backend;

#[cfg(not(foo))]
#[path = "bar.rs"]
pub mod backend;

If foo.rs does not exist, this fails to compile, even if bar.rs exists and the foo configuration option isn't given. Seems like only modules that are actually being compiled should be required to exist.

@graydon
Copy link
Contributor

graydon commented May 29, 2013

I agree this behavior is somewhat surprising. At the moment, cfg()-filtering happens after parsing and expansion. Possibly it should happen during parsing, as this bug suggests. Nominating for backwards compatibility.

@emberian
Copy link
Member

Still a bug. With @huonw's work in #7902 this should be easier.

@graydon
Copy link
Contributor

graydon commented Aug 22, 2013

accepted for feature-complete milestone

@brson
Copy link
Contributor

brson commented Feb 13, 2014

This may be working as intended. cfg happens after parsing.

@pnkfelix
Copy link
Member

"Fixing" this will be backwards compatible, so not a 1.0 blocker.

It is a useful property that everything that is cfg'ed off is still checked as parseable. So it is not clear whether we even want to "fix" this.

Assigning P-low, but at some point, the team should also decide whether this is even a bug or not.

@nikomatsakis
Copy link
Contributor

My opinion is this is not a bug. This is just our model.

@nikomatsakis
Copy link
Contributor

To clarify: I think it's even useful to check that windows-specific
modules at least parse and so on. I wish we could go farther and
run the type checker over them and so on, but obviously we can't.

@sanxiyn
Copy link
Member

sanxiyn commented Feb 27, 2014

CC #4047 and closing.

@sanxiyn sanxiyn closed this as completed Feb 27, 2014
pczarn added a commit to pczarn/rustboot that referenced this issue Mar 25, 2014
ARM target works except dependency info.

Moved .gitignore from project root to build directories.
Makefile reads patterns specified in gitignore to find
all output files and remove them with the help of `find` and
`xargs`.
Do not overwrite dep info. Using `sed` to remove some dependency info.
See http://stackoverflow.com/a/9054420
and rust-lang/rust#5870.
Specified that makefiles should use bash.
pczarn added a commit to pczarn/rustboot that referenced this issue Mar 25, 2014
ARM target works.

Moved .gitignore from project root to build directories.
Makefile reads patterns specified in gitignore to find
all output files and remove them with the help of `find` and
`xargs`.
Do not overwrite dep info. Using `sed` to remove some dependency info.
See http://stackoverflow.com/a/9054420
and rust-lang/rust#5870.
Specified that makefiles should use bash.
pczarn added a commit to pczarn/rustboot that referenced this issue Mar 25, 2014
ARM target works.

Moved .gitignore from project root to build directories.
Makefile reads patterns specified in gitignore to find
all output files and remove them with the help of `find` and
`xargs`.
Do not overwrite dep info. Using `sed` to remove some dependency info.
See http://stackoverflow.com/a/9054420
and rust-lang/rust#5870.
Specified that makefiles should use bash.
flip1995 added a commit to flip1995/rust that referenced this issue Aug 11, 2020
…rialize, r=flip1995

enable #[allow(clippy::unsafe_derive_deserialize)]

Before this change this lint could not be allowed as the code we are checking is automatically generated.

changelog: Enable using the `allow` attribute on top of an ADT linted by [`unsafe_derive_deserialize`].

Fixes: rust-lang#5789
flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 11, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#5825 (Add the new lint `same_item_push`)
 - rust-lang#5869 (New lint against `Self` as an arbitrary self type)
 - rust-lang#5870 (enable #[allow(clippy::unsafe_derive_deserialize)])
 - rust-lang#5871 (Lint .min(x).max(y) with x < y)
 - rust-lang#5874 (Make the docs clearer for new contributors)

Failed merges:

r? @ghost

changelog: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-frontend Area: Compiler frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST P-low Low priority
Projects
None yet
Development

No branches or pull requests

8 participants