Auto merge of #46335 - oli-obk:cleanups, r=jseyfried
Use PathBuf instead of String where applicable r? @jseyfried
This commit is contained in:
commit
8624ea5117
48 changed files with 443 additions and 308 deletions
|
|
@ -32,7 +32,7 @@ fn main() {
|
|||
}
|
||||
|
||||
// Here we check that local debuginfo is mapped correctly.
|
||||
// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd")
|
||||
// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd/")
|
||||
|
||||
// And here that debuginfo from other crates are expanded to absolute paths.
|
||||
// CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "")
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ extern crate rustc_trans;
|
|||
extern crate syntax;
|
||||
|
||||
use rustc::session::{build_session, Session};
|
||||
use rustc::session::config::{basic_options, build_configuration, Input,
|
||||
use rustc::session::config::{basic_options, Input,
|
||||
OutputType, OutputTypes};
|
||||
use rustc_driver::driver::{compile_input, CompileController, anon_src};
|
||||
use rustc_driver::driver::{compile_input, CompileController};
|
||||
use rustc_metadata::cstore::CStore;
|
||||
use rustc_errors::registry::Registry;
|
||||
use syntax::codemap::FileName;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc<CStore>) {
|
|||
opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
|
||||
opts.maybe_sysroot = Some(sysroot);
|
||||
if let Ok(linker) = std::env::var("RUSTC_LINKER") {
|
||||
opts.cg.linker = Some(linker);
|
||||
opts.cg.linker = Some(linker.into());
|
||||
}
|
||||
|
||||
let descriptions = Registry::new(&rustc::DIAGNOSTICS);
|
||||
|
|
@ -70,6 +70,6 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc<CStore>) {
|
|||
fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
|
||||
let (sess, cstore) = basic_sess(sysroot);
|
||||
let control = CompileController::basic();
|
||||
let input = Input::Str { name: anon_src(), input: code };
|
||||
let input = Input::Str { name: FileName::Anon, input: code };
|
||||
let _ = compile_input(&sess, &cstore, &input, &None, &Some(output), None, &control);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ extern crate syntax;
|
|||
use syntax::ast::*;
|
||||
use syntax::attr::*;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::FilePathMapping;
|
||||
use syntax::codemap::{FilePathMapping, FileName};
|
||||
use syntax::parse;
|
||||
use syntax::parse::{ParseSess, PResult};
|
||||
use syntax::parse::new_parser_from_source_str;
|
||||
|
|
@ -32,7 +32,7 @@ use std::fmt;
|
|||
// Copied out of syntax::util::parser_testing
|
||||
|
||||
pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> {
|
||||
new_parser_from_source_str(ps, "bogofile".to_string(), source_str)
|
||||
new_parser_from_source_str(ps, FileName::Custom("bogofile".to_owned()), source_str)
|
||||
}
|
||||
|
||||
fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> PResult<'a, T> where
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
extern crate syntax;
|
||||
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::{Spanned, DUMMY_SP};
|
||||
use syntax::codemap::{Spanned, DUMMY_SP, FileName};
|
||||
use syntax::codemap::FilePathMapping;
|
||||
use syntax::fold::{self, Folder};
|
||||
use syntax::parse::{self, ParseSess};
|
||||
|
|
@ -44,7 +44,7 @@ use syntax::util::ThinVec;
|
|||
|
||||
fn parse_expr(ps: &ParseSess, src: &str) -> P<Expr> {
|
||||
let mut p = parse::new_parser_from_source_str(ps,
|
||||
"<expr>".to_owned(),
|
||||
FileName::Custom("expr".to_owned()),
|
||||
src.to_owned());
|
||||
p.parse_expr().unwrap()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue