Skip to content

Commit 84e3cb1

Browse files
committed
---
yaml --- r: 277593 b: refs/heads/try c: 780f725 h: refs/heads/master i: 277591: 25cdf33
1 parent a0b9bfc commit 84e3cb1

File tree

17 files changed

+463
-578
lines changed

17 files changed

+463
-578
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 7d8100a068151512774caf15a6a88766ca9cf434
4+
refs/heads/try: 780f725176e0fb8f37ef67564dd9ff1ee01f29c2
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/libcore/intrinsics.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ extern "rust-intrinsic" {
192192

193193
/// The size of a type in bytes.
194194
///
195-
/// More specifically, this is the offset in bytes between successive
196-
/// items of the same type, including alignment padding.
195+
/// This is the exact number of bytes in memory taken up by a
196+
/// value of the given type. In other words, a memset of this size
197+
/// would *exactly* overwrite a value. When laid out in vectors
198+
/// and structures there may be additional padding between
199+
/// elements.
197200
pub fn size_of<T>() -> usize;
198201

199202
/// Moves a value to an uninitialized memory location.

branches/try/src/libcore/mem.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ pub fn forget<T>(t: T) {
117117

118118
/// Returns the size of a type in bytes.
119119
///
120-
/// More specifically, this is the offset in bytes between successive
121-
/// items of the same type, including alignment padding.
122-
///
123120
/// # Examples
124121
///
125122
/// ```

branches/try/src/librustc/diagnostics.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,7 @@ fn foo(x: u8) -> u8 {
635635
```
636636
637637
It is advisable to find out what the unhandled cases are and check for them,
638-
returning an appropriate value or panicking if necessary. Check if you need
639-
to remove a semicolon from the last expression, like in this case:
640-
641-
```ignore
642-
fn foo(x: u8) -> u8 {
643-
inner(2*x + 1);
644-
}
645-
```
646-
647-
The semicolon discards the return value of `inner`, instead of returning
648-
it from `foo`.
638+
returning an appropriate value or panicking if necessary.
649639
"##,
650640

651641
E0270: r##"

branches/try/src/librustc_const_eval/check_match.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,7 @@ fn check_arms(cx: &MatchCheckCtxt,
341341
},
342342

343343
hir::MatchSource::Normal => {
344-
let mut err = struct_span_err!(cx.tcx.sess, pat.span, E0001,
345-
"unreachable pattern");
346-
// if we had a catchall pattern, hint at that
347-
for row in &seen.0 {
348-
if pat_is_catchall(&cx.tcx.def_map.borrow(), row[0]) {
349-
span_note!(err, row[0].span, "this pattern matches any value");
350-
}
351-
}
352-
err.emit();
344+
span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern")
353345
},
354346

355347
hir::MatchSource::TryDesugar => {
@@ -369,18 +361,7 @@ fn check_arms(cx: &MatchCheckCtxt,
369361
}
370362
}
371363

372-
/// Checks for common cases of "catchall" patterns that may not be intended as such.
373-
fn pat_is_catchall(dm: &DefMap, p: &Pat) -> bool {
374-
match p.node {
375-
PatKind::Ident(_, _, None) => pat_is_binding(dm, p),
376-
PatKind::Ident(_, _, Some(ref s)) => pat_is_catchall(dm, &s),
377-
PatKind::Ref(ref s, _) => pat_is_catchall(dm, &s),
378-
PatKind::Tup(ref v) => v.iter().all(|p| pat_is_catchall(dm, &p)),
379-
_ => false
380-
}
381-
}
382-
383-
fn raw_pat(p: &Pat) -> &Pat {
364+
fn raw_pat<'a>(p: &'a Pat) -> &'a Pat {
384365
match p.node {
385366
PatKind::Ident(_, _, Some(ref s)) => raw_pat(&s),
386367
_ => p

branches/try/src/librustc_driver/driver.rs

Lines changed: 55 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn compile_input(sess: &Session,
7070
control: &CompileController) -> CompileResult {
7171
macro_rules! controller_entry_point {
7272
($point: ident, $tsess: expr, $make_state: expr, $phase_result: expr) => {{
73-
let state = &mut $make_state;
73+
let state = $make_state;
7474
let phase_result: &CompileResult = &$phase_result;
7575
if phase_result.is_ok() || control.$point.run_callback_on_error {
7676
(control.$point.callback)(state);
@@ -95,24 +95,17 @@ pub fn compile_input(sess: &Session,
9595
}
9696
};
9797

98-
let mut compile_state = CompileState::state_after_parse(input,
99-
sess,
100-
outdir,
101-
output,
102-
krate,
103-
&cstore);
10498
controller_entry_point!(after_parse,
10599
sess,
106-
compile_state,
100+
CompileState::state_after_parse(input, sess, outdir, &krate),
107101
Ok(()));
108-
let krate = compile_state.krate.unwrap();
109102

110103
let outputs = build_output_filenames(input, outdir, output, &krate.attrs, sess);
111104
let id = link::find_crate_name(Some(sess), &krate.attrs, input);
112105
let expanded_crate = phase_2_configure_and_expand(sess,
113106
&cstore,
114107
krate,
115-
&id,
108+
&id[..],
116109
addl_plugins)?;
117110

118111
(outputs, expanded_crate, id)
@@ -123,10 +116,8 @@ pub fn compile_input(sess: &Session,
123116
CompileState::state_after_expand(input,
124117
sess,
125118
outdir,
126-
output,
127-
&cstore,
128119
&expanded_crate,
129-
&id),
120+
&id[..]),
130121
Ok(()));
131122

132123
let expanded_crate = assign_node_ids(sess, expanded_crate);
@@ -171,13 +162,10 @@ pub fn compile_input(sess: &Session,
171162
CompileState::state_after_write_deps(input,
172163
sess,
173164
outdir,
174-
output,
175-
&arenas,
176-
&cstore,
177165
&hir_map,
178166
&expanded_crate,
179167
&hir_map.krate(),
180-
&id),
168+
&id[..]),
181169
Ok(()));
182170
}
183171

@@ -206,17 +194,16 @@ pub fn compile_input(sess: &Session,
206194
// Eventually, we will want to track plugins.
207195
let _ignore = tcx.dep_graph.in_ignore();
208196

209-
let mut state = CompileState::state_after_analysis(input,
210-
sess,
211-
outdir,
212-
output,
213-
opt_crate,
214-
tcx.map.krate(),
215-
&analysis,
216-
mir_map.as_ref(),
217-
tcx,
218-
&id);
219-
(control.after_analysis.callback)(&mut state);
197+
let state = CompileState::state_after_analysis(input,
198+
&tcx.sess,
199+
outdir,
200+
opt_crate,
201+
tcx.map.krate(),
202+
&analysis,
203+
mir_map.as_ref(),
204+
tcx,
205+
&id);
206+
(control.after_analysis.callback)(state);
220207

221208
if control.after_analysis.stop == Compilation::Stop {
222209
return result.and_then(|_| Err(0usize));
@@ -249,7 +236,7 @@ pub fn compile_input(sess: &Session,
249236

250237
controller_entry_point!(after_llvm,
251238
sess,
252-
CompileState::state_after_llvm(input, sess, outdir, output, &trans),
239+
CompileState::state_after_llvm(input, sess, outdir, &trans),
253240
phase5_result);
254241
phase5_result?;
255242

@@ -324,7 +311,7 @@ pub struct PhaseController<'a> {
324311
// If true then the compiler will try to run the callback even if the phase
325312
// ends with an error. Note that this is not always possible.
326313
pub run_callback_on_error: bool,
327-
pub callback: Box<Fn(&mut CompileState) + 'a>,
314+
pub callback: Box<Fn(CompileState) -> () + 'a>,
328315
}
329316

330317
impl<'a> PhaseController<'a> {
@@ -340,38 +327,34 @@ impl<'a> PhaseController<'a> {
340327
/// State that is passed to a callback. What state is available depends on when
341328
/// during compilation the callback is made. See the various constructor methods
342329
/// (`state_*`) in the impl to see which data is provided for any given entry point.
343-
pub struct CompileState<'a, 'b, 'ast: 'a, 'tcx: 'b> where 'ast: 'tcx {
330+
pub struct CompileState<'a, 'ast: 'a, 'tcx: 'a> {
344331
pub input: &'a Input,
345-
pub session: &'ast Session,
346-
pub krate: Option<ast::Crate>,
347-
pub cstore: Option<&'a CStore>,
332+
pub session: &'a Session,
333+
pub cfg: Option<&'a ast::CrateConfig>,
334+
pub krate: Option<&'a ast::Crate>,
348335
pub crate_name: Option<&'a str>,
349336
pub output_filenames: Option<&'a OutputFilenames>,
350337
pub out_dir: Option<&'a Path>,
351-
pub out_file: Option<&'a Path>,
352-
pub arenas: Option<&'ast ty::CtxtArenas<'ast>>,
353338
pub expanded_crate: Option<&'a ast::Crate>,
354339
pub hir_crate: Option<&'a hir::Crate>,
355340
pub ast_map: Option<&'a hir_map::Map<'ast>>,
356-
pub mir_map: Option<&'b MirMap<'tcx>>,
341+
pub mir_map: Option<&'a MirMap<'tcx>>,
357342
pub analysis: Option<&'a ty::CrateAnalysis<'a>>,
358-
pub tcx: Option<&'b TyCtxt<'tcx>>,
343+
pub tcx: Option<&'a TyCtxt<'tcx>>,
359344
pub trans: Option<&'a trans::CrateTranslation>,
360345
}
361346

362-
impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
347+
impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
363348
fn empty(input: &'a Input,
364-
session: &'ast Session,
349+
session: &'a Session,
365350
out_dir: &'a Option<PathBuf>)
366-
-> CompileState<'a, 'b, 'ast, 'tcx> {
351+
-> CompileState<'a, 'ast, 'tcx> {
367352
CompileState {
368353
input: input,
369354
session: session,
370355
out_dir: out_dir.as_ref().map(|s| &**s),
371-
out_file: None,
372-
arenas: None,
356+
cfg: None,
373357
krate: None,
374-
cstore: None,
375358
crate_name: None,
376359
output_filenames: None,
377360
expanded_crate: None,
@@ -385,95 +368,71 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
385368
}
386369

387370
fn state_after_parse(input: &'a Input,
388-
session: &'ast Session,
371+
session: &'a Session,
389372
out_dir: &'a Option<PathBuf>,
390-
out_file: &'a Option<PathBuf>,
391-
krate: ast::Crate,
392-
cstore: &'a CStore)
393-
-> CompileState<'a, 'b, 'ast, 'tcx> {
394-
CompileState {
395-
krate: Some(krate),
396-
cstore: Some(cstore),
397-
out_file: out_file.as_ref().map(|s| &**s),
398-
..CompileState::empty(input, session, out_dir)
399-
}
373+
krate: &'a ast::Crate)
374+
-> CompileState<'a, 'ast, 'tcx> {
375+
CompileState { krate: Some(krate), ..CompileState::empty(input, session, out_dir) }
400376
}
401377

402378
fn state_after_expand(input: &'a Input,
403-
session: &'ast Session,
379+
session: &'a Session,
404380
out_dir: &'a Option<PathBuf>,
405-
out_file: &'a Option<PathBuf>,
406-
cstore: &'a CStore,
407381
expanded_crate: &'a ast::Crate,
408382
crate_name: &'a str)
409-
-> CompileState<'a, 'b, 'ast, 'tcx> {
383+
-> CompileState<'a, 'ast, 'tcx> {
410384
CompileState {
411385
crate_name: Some(crate_name),
412-
cstore: Some(cstore),
413386
expanded_crate: Some(expanded_crate),
414-
out_file: out_file.as_ref().map(|s| &**s),
415387
..CompileState::empty(input, session, out_dir)
416388
}
417389
}
418390

419391
fn state_after_write_deps(input: &'a Input,
420-
session: &'ast Session,
392+
session: &'a Session,
421393
out_dir: &'a Option<PathBuf>,
422-
out_file: &'a Option<PathBuf>,
423-
arenas: &'ast ty::CtxtArenas<'ast>,
424-
cstore: &'a CStore,
425394
hir_map: &'a hir_map::Map<'ast>,
426395
krate: &'a ast::Crate,
427396
hir_crate: &'a hir::Crate,
428397
crate_name: &'a str)
429-
-> CompileState<'a, 'b, 'ast, 'tcx> {
398+
-> CompileState<'a, 'ast, 'tcx> {
430399
CompileState {
431400
crate_name: Some(crate_name),
432-
arenas: Some(arenas),
433-
cstore: Some(cstore),
434401
ast_map: Some(hir_map),
435-
expanded_crate: Some(krate),
402+
krate: Some(krate),
436403
hir_crate: Some(hir_crate),
437-
out_file: out_file.as_ref().map(|s| &**s),
438404
..CompileState::empty(input, session, out_dir)
439405
}
440406
}
441407

442408
fn state_after_analysis(input: &'a Input,
443-
session: &'ast Session,
409+
session: &'a Session,
444410
out_dir: &'a Option<PathBuf>,
445-
out_file: &'a Option<PathBuf>,
446411
krate: Option<&'a ast::Crate>,
447412
hir_crate: &'a hir::Crate,
448-
analysis: &'a ty::CrateAnalysis<'a>,
449-
mir_map: Option<&'b MirMap<'tcx>>,
450-
tcx: &'b TyCtxt<'tcx>,
413+
analysis: &'a ty::CrateAnalysis,
414+
mir_map: Option<&'a MirMap<'tcx>>,
415+
tcx: &'a TyCtxt<'tcx>,
451416
crate_name: &'a str)
452-
-> CompileState<'a, 'b, 'ast, 'tcx> {
417+
-> CompileState<'a, 'ast, 'tcx> {
453418
CompileState {
454419
analysis: Some(analysis),
455420
mir_map: mir_map,
456421
tcx: Some(tcx),
457-
expanded_crate: krate,
422+
krate: krate,
458423
hir_crate: Some(hir_crate),
459424
crate_name: Some(crate_name),
460-
out_file: out_file.as_ref().map(|s| &**s),
461425
..CompileState::empty(input, session, out_dir)
462426
}
463427
}
464428

465429

466430
fn state_after_llvm(input: &'a Input,
467-
session: &'ast Session,
431+
session: &'a Session,
468432
out_dir: &'a Option<PathBuf>,
469-
out_file: &'a Option<PathBuf>,
470433
trans: &'a trans::CrateTranslation)
471-
-> CompileState<'a, 'b, 'ast, 'tcx> {
472-
CompileState {
473-
trans: Some(trans),
474-
out_file: out_file.as_ref().map(|s| &**s),
475-
..CompileState::empty(input, session, out_dir)
476-
}
434+
-> CompileState<'a, 'ast, 'tcx> {
435+
CompileState { trans: Some(trans), ..CompileState::empty(input, session, out_dir) }
477436
}
478437
}
479438

@@ -839,16 +798,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
839798
let index = stability::Index::new(&hir_map);
840799

841800
TyCtxt::create_and_enter(sess,
842-
arenas,
843-
def_map,
844-
named_region_map,
845-
hir_map,
846-
freevars,
847-
region_map,
848-
lang_items,
849-
index,
850-
name,
851-
|tcx| {
801+
arenas,
802+
def_map,
803+
named_region_map,
804+
hir_map,
805+
freevars,
806+
region_map,
807+
lang_items,
808+
index,
809+
name,
810+
|tcx| {
852811
time(time_passes,
853812
"load_dep_graph",
854813
|| rustc_incremental::load_dep_graph(tcx));

0 commit comments

Comments
 (0)