]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/mod_dir_path_canonicalized.rs
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC
[rust.git] / src / test / ui-fulldeps / mod_dir_path_canonicalized.rs
1 // run-pass
2 // Testing that a libsyntax can parse modules with canonicalized base path
3 // ignore-cross-compile
4
5 #![feature(rustc_private)]
6
7 extern crate syntax;
8 extern crate syntax_expand;
9 extern crate rustc_parse;
10
11 use rustc_parse::new_parser_from_file;
12 use std::path::Path;
13 use syntax::sess::ParseSess;
14 use syntax::source_map::FilePathMapping;
15 use syntax_expand::config::process_configure_mod;
16
17 #[path = "mod_dir_simple/test.rs"]
18 mod gravy;
19
20 pub fn main() {
21     syntax::with_default_globals(|| parse());
22
23     assert_eq!(gravy::foo(), 10);
24 }
25
26 fn parse() {
27     let parse_session = ParseSess::new(FilePathMapping::empty(), process_configure_mod);
28
29     let path = Path::new(file!());
30     let path = path.canonicalize().unwrap();
31     let mut parser = new_parser_from_file(&parse_session, &path);
32     let _ = parser.parse_crate_mod();
33 }