Skip to content

Commit 08ded25

Browse files
committed
---
yaml --- r: 273133 b: refs/heads/beta c: 7366034 h: refs/heads/master i: 273131: 794f6eb
1 parent d8f6bfe commit 08ded25

File tree

10 files changed

+21
-35
lines changed

10 files changed

+21
-35
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 6d215fe04ce3f638d717d7fcea95c40d0a655ff9
26+
refs/heads/beta: 736603424e48db41e1f2e3ad58e67809ab608a33
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/middle/traits/select.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
836836
return Ok(None);
837837
}
838838

839-
840-
// If there are *NO* candidates, that there are no impls --
839+
// If there are *NO* candidates, then there are no impls --
841840
// that we know of, anyway. Note that in the case where there
842841
// are unbound type variables within the obligation, it might
843842
// be the case that you could still satisfy the obligation

branches/beta/src/librustc/session/config.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,16 @@ pub enum PrintRequest {
172172
pub enum Input {
173173
/// Load source from file
174174
File(PathBuf),
175-
Str {
176-
/// String that is shown in place of a filename
177-
name: String,
178-
/// Anonymous source string
179-
input: String,
180-
},
175+
/// The string is the source
176+
Str(String)
181177
}
182178

183179
impl Input {
184180
pub fn filestem(&self) -> String {
185181
match *self {
186182
Input::File(ref ifile) => ifile.file_stem().unwrap()
187183
.to_str().unwrap().to_string(),
188-
Input::Str { .. } => "rust_out".to_string(),
184+
Input::Str(_) => "rust_out".to_string(),
189185
}
190186
}
191187
}

branches/beta/src/librustc_driver/driver.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ pub fn compile_input(sess: &Session,
231231
Ok(())
232232
}
233233

234+
234235
/// The name used for source code that doesn't originate in a file
235236
/// (e.g. source from stdin or a string)
236237
pub fn anon_src() -> String {
@@ -241,7 +242,7 @@ pub fn source_name(input: &Input) -> String {
241242
match *input {
242243
// FIXME (#9639): This needs to handle non-utf8 paths
243244
Input::File(ref ifile) => ifile.to_str().unwrap().to_string(),
244-
Input::Str { ref name, .. } => name.clone(),
245+
Input::Str(_) => anon_src(),
245246
}
246247
}
247248

@@ -433,9 +434,9 @@ pub fn phase_1_parse_input<'a>(sess: &'a Session,
433434
Input::File(ref file) => {
434435
parse::parse_crate_from_file(file, cfg.clone(), &sess.parse_sess)
435436
}
436-
Input::Str { ref input, ref name } => {
437-
parse::parse_crate_from_source_str(name.clone(),
438-
input.clone(),
437+
Input::Str(ref src) => {
438+
parse::parse_crate_from_source_str(anon_src().to_string(),
439+
src.to_string(),
439440
cfg.clone(),
440441
&sess.parse_sess)
441442
}

branches/beta/src/librustc_driver/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ fn make_input(free_matches: &[String]) -> Option<(Input, Option<PathBuf>)> {
223223
if ifile == "-" {
224224
let mut src = String::new();
225225
io::stdin().read_to_string(&mut src).unwrap();
226-
Some((Input::Str { name: driver::anon_src(), input: src },
227-
None))
226+
Some((Input::Str(src), None))
228227
} else {
229228
Some((Input::File(PathBuf::from(ifile)),
230229
Some(PathBuf::from(ifile))))
@@ -512,7 +511,7 @@ impl RustcDefaultCalls {
512511
.unwrap();
513512
println!("{}", String::from_utf8(v).unwrap());
514513
}
515-
&Input::Str { .. } => {
514+
&Input::Str(_) => {
516515
early_error(ErrorOutputType::default(), "cannot list metadata for stdin");
517516
}
518517
}
@@ -995,9 +994,9 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec<as
995994
Input::File(ref ifile) => {
996995
parse::parse_crate_attrs_from_file(ifile, Vec::new(), &sess.parse_sess)
997996
}
998-
Input::Str { ref name, ref input } => {
999-
parse::parse_crate_attrs_from_source_str(name.clone(),
1000-
input.clone(),
997+
Input::Str(ref src) => {
998+
parse::parse_crate_attrs_from_source_str(driver::anon_src().to_string(),
999+
src.to_string(),
10011000
Vec::new(),
10021001
&sess.parse_sess)
10031002
}

branches/beta/src/librustc_driver/test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ fn test_env<F>(source_string: &str,
113113
Rc::new(CodeMap::new()), cstore.clone());
114114
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
115115
let krate_config = Vec::new();
116-
let input = config::Input::Str {
117-
name: driver::anon_src(),
118-
input: source_string.to_string(),
119-
};
116+
let input = config::Input::Str(source_string.to_string());
120117
let krate = driver::phase_1_parse_input(&sess, krate_config, &input).unwrap();
121118
let krate = driver::phase_2_configure_and_expand(&sess, &cstore, krate, "test", None)
122119
.expect("phase 2 aborted");

branches/beta/src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
205205
current_dir().unwrap().join(path)
206206
}
207207
},
208-
Input::Str { ref name, .. } => PathBuf::from(name.clone()),
208+
Input::Str(_) => PathBuf::new() // FIXME: this is wrong
209209
};
210210

211211
Crate {

branches/beta/src/librustdoc/test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
180180
// the test harness wants its own `main` & top level functions, so
181181
// never wrap the test in `fn main() { ... }`
182182
let test = maketest(test, Some(cratename), as_test_harness, opts);
183-
let input = config::Input::Str {
184-
name: driver::anon_src(),
185-
input: test.to_owned(),
186-
};
183+
let input = config::Input::Str(test.to_string());
187184
let mut outputs = HashMap::new();
188185
outputs.insert(OutputType::Exe, None);
189186

branches/beta/src/test/run-make/execution-engine/test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,7 @@ fn build_exec_options(sysroot: PathBuf) -> Options {
216216
/// for crates used in the given input.
217217
fn compile_program(input: &str, sysroot: PathBuf)
218218
-> Option<(llvm::ModuleRef, Vec<PathBuf>)> {
219-
let input = Input::Str {
220-
name: driver::anon_src(),
221-
input: input.to_string(),
222-
};
219+
let input = Input::Str(input.to_string());
223220
let thread = Builder::new().name("compile_program".to_string());
224221

225222
let handle = thread.spawn(move || {

branches/beta/src/test/run-make/issue-19371/foo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern crate syntax;
1818

1919
use rustc::session::{build_session, Session};
2020
use rustc::session::config::{basic_options, build_configuration, Input, OutputType};
21-
use rustc_driver::driver::{compile_input, CompileController, anon_src};
21+
use rustc_driver::driver::{compile_input, CompileController};
2222
use rustc_metadata::cstore::CStore;
2323
use syntax::diagnostics::registry::Registry;
2424
use syntax::parse::token;
@@ -67,7 +67,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
6767

6868
compile_input(&sess, &cstore,
6969
cfg,
70-
&Input::Str { name: anon_src(), input: code },
70+
&Input::Str(code),
7171
&None,
7272
&Some(output),
7373
None,

0 commit comments

Comments
 (0)