-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
This code works in the 2020-03-19 nightly:
build.rs:
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let path: PathBuf = [out_dir.clone(), "foo.rs".to_string()].iter().collect();
fs::write(path, "pub mod foo2;").unwrap();
let path: PathBuf = [out_dir, "foo2.rs".to_string()].iter().collect();
fs::write(path, "pub fn foo_fn() {}").unwrap();
}
lib.rs:
mod stuff {
include!(concat!(env!("OUT_DIR"), "/foo.rs"));
}
fn main() {
stuff::foo2::foo_fn();
}
The resulting OUT_DIR looks like:
$ ls target/debug/build/regress-d7c49d33c7449edf/out
foo.rs foo2.rs
With the 2020-03-20 nightly, this crate generates the following output:
error[E0583]: file not found for module `foo2`
--> /Users/joshmatthews/regress/target/debug/build/regress-1976556320d6d1b4/out/foo.rs:1:1
|
1 | pub mod foo2;
| ^^^^^^^^^^^^^
|
= help: to create the module `foo2`, create file "src/stuff/foo2.rs"
error[E0425]: cannot find function `foo_fn` in module `stuff::foo2`
--> src/main.rs:7:18
|
7 | stuff::foo2::foo_fn();
| ^^^^^^ not found in `stuff::foo2`
error: aborting due to 2 previous errors
Metadata
Metadata
Assignees
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.