Stream: t-compiler/help

Topic: How to depend on external crates in ui tests?

David Ross (Feb 02 2020 at 02:16, on Zulip):

Anyone have tips for building test files which depend on extern crates?

I'm trying to write a test case for issue 59191, which involves using a proc macro to replace the crate root with a non-module item.

I've copied one of the other tests which places a support file in an auxiliary/ directory and then uses extern crate to refer to it - but since the test involves a macro executed at the top level, I can't use extern crate. So instead I tried to make it 2018-edition and just using the auxiliary file, but it can't find it.

I've committed both test files at

The actual test is

and the support is

The main error is just "error[E0433]: failed to resolve: use of undeclared type or module issue_59191".

Anyone who's more familiar with the test suite and its configuration flags have advice?

David Ross (Feb 02 2020 at 02:22, on Zulip):

I know the issue isn't with the macro / the compiler since if I change the macro to operate on a sub-module rather than the crate root, then it still fails.

This fails:

// edition:2018


mod x {}

And succeeds only if I add extern crate issue_59191;.

Last update: Sep 22 2020 at 00:45UTC