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

auxiliary files in compile-test aren't compatible with extern_prelude feature #52428

Closed
nikomatsakis opened this issue Jul 16, 2018 · 3 comments
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@nikomatsakis
Copy link
Contributor

When we use the "auxiliary crate" feature in compile-test, it adds a -L <aux-path> flag that points rustc at the directory where to find those crates. This means that when rustc sees an extern crate it then searches those directories. It's good to have the ability to test that behavior, but it's not the way that cargo drives rustc -- and as a result it's not compatible with the new extern-prelude feature set, requiring awkward run-make tests like extern-prelude.

It would probably be better for compiletest, by default, to add a --extern foo=<path-to-foo> flag for each auxiliary crate. We could maybe keep a way to use the "auxdir" option.

cc @petrochenkov @zackmdavis @nrc @qmx

@nikomatsakis nikomatsakis added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jul 16, 2018
@nikomatsakis
Copy link
Contributor Author

Here is where to find the current code around auxiliary crates. The idea, for review, is that tests can have a // aux-build:foo.rs annotation like this one:

// aux-build:derive-foo.rs

When we see such an annotation, we will build the crate auxiliary/foo.rs. This is done in this loop here:

for rel_ab in &self.props.aux_builds {

We then later add a -L flag with the directory. Here is one such place but there seem to be several:

rustc.arg("-L").arg(&self.aux_output_dir_name());

The ideal seems to me to be to instead be adding --extern flags, but it'll take a bit of digging to see just the best place to do it.

@Enselic Enselic added the C-bug Category: This is a bug. label Nov 18, 2023
@jieyouxu jieyouxu added the A-compiletest Area: The compiletest test runner label May 31, 2024
@jieyouxu jieyouxu added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 13, 2024
@ehuss
Copy link
Contributor

ehuss commented Dec 5, 2024

I think this is now essentially resolved via #67074 which added the aux-crate header which uses --extern instead of -L.

It's not a huge benefit because aux crates still default to 2015, and you can't refer to these crates in use statements, unless you change the edition in the aux crate.

@jieyouxu
Copy link
Member

compiletest triage: indeed, closing as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
Development

No branches or pull requests

4 participants