Skip to content

Commit 1c5dc87

Browse files
committed
---
yaml --- r: 209582 b: refs/heads/try c: 966e53d h: refs/heads/master v: v3
1 parent d5e6c0a commit 1c5dc87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+774
-1036
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: efa6a46a8eceb4ab792d5ec8e28cf3baaaa96491
5+
refs/heads/try: 966e53d8b6272a324c6be3460ae6bf52e47202fe
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/crates.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ TARGET_CRATES := libc std flate arena term \
5454
log graphviz core rbml alloc \
5555
unicode rustc_bitflags
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
57-
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint
57+
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
58+
rustc_data_structures
5859
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
5960
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
6061
TOOLS := compiletest rustdoc rustc rustbook
@@ -80,9 +81,10 @@ DEPS_rustc_resolve := rustc log syntax
8081
DEPS_rustc_privacy := rustc log syntax
8182
DEPS_rustc_lint := rustc log syntax
8283
DEPS_rustc := syntax flate arena serialize getopts rbml \
83-
log graphviz rustc_llvm rustc_back
84+
log graphviz rustc_llvm rustc_back rustc_data_structures
8485
DEPS_rustc_llvm := native:rustllvm libc std
8586
DEPS_rustc_back := std syntax rustc_llvm flate log libc
87+
DEPS_rustc_data_structures := std log serialize
8688
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
8789
test rustc_lint
8890
DEPS_rustc_bitflags := core

branches/try/src/doc/trpl/hello-cargo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ we hadn’t changed the source file, and so it just ran the binary. If we had
8989
made a modification, we would have seen it do both:
9090

9191
```bash
92-
$ cargo run
92+
$ cargo build
9393
Compiling hello_world v0.0.1 (file:///home/yourname/projects/hello_world)
9494
Running `target/debug/hello_world`
9595
Hello, world!

branches/try/src/doc/trpl/vectors.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
% Vectors
22

33
A *vector* is a dynamic or "growable" array, implemented as the standard
4-
library type [`Vec<T>`](../std/vec/) (Where `<T>` is a [Generic](./generics.md)
5-
statement). Vectors always allocate their data on the heap. Vectors are to
6-
[slices][slices] what [`String`][string] is to `&str`. You can
7-
create them with the `vec!` macro:
4+
library type [`Vec<T>`](../std/vec/) (Where `<T>` is a [Generic](./generics.md) statement). Vectors always allocate their data on the heap. Vectors are to slices
5+
what `String` is to `&str`. You can create them with the `vec!` macro:
86

97
```{rust}
108
let v = vec![1, 2, 3]; // v: Vec<i32>
119
```
1210

13-
[slices]: primitive-types.html#slices
14-
[string]: strings.html
15-
1611
(Notice that unlike the `println!` macro we've used in the past, we use square
1712
brackets `[]` with `vec!`. Rust allows you to use either in either situation,
1813
this is just convention.)

branches/try/src/libcore/num/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,11 +1321,7 @@ macro_rules! int_impl {
13211321
#[stable(feature = "rust1", since = "1.0.0")]
13221322
#[inline]
13231323
pub fn abs(self) -> $T {
1324-
if self.is_negative() {
1325-
self.wrapping_neg()
1326-
} else {
1327-
self
1328-
}
1324+
if self.is_negative() { -self } else { self }
13291325
}
13301326

13311327
/// Returns a number representing sign of `self`.

branches/try/src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ pub struct RangeFull;
969969
#[stable(feature = "rust1", since = "1.0.0")]
970970
impl fmt::Debug for RangeFull {
971971
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
972-
write!(fmt, "..")
972+
fmt::Debug::fmt("..", fmt)
973973
}
974974
}
975975

branches/try/src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extern crate graphviz;
5454
extern crate libc;
5555
extern crate rustc_llvm;
5656
extern crate rustc_back;
57+
extern crate rustc_data_structures;
5758
extern crate serialize;
5859
extern crate rbml;
5960
extern crate collections;

branches/try/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,7 @@ fn parse_region_<F>(st: &mut PState, conv: &mut F) -> ty::Region where
341341
let index = parse_u32(st);
342342
assert_eq!(next(st), '|');
343343
let nm = token::str_to_ident(&parse_str(st, ']'));
344-
ty::ReEarlyBound(ty::EarlyBoundRegion {
345-
param_id: node_id,
346-
space: space,
347-
index: index,
348-
name: nm.name
349-
})
344+
ty::ReEarlyBound(node_id, space, index, nm.name)
350345
}
351346
'f' => {
352347
assert_eq!(next(st), '[');

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,12 @@ pub fn enc_region(w: &mut Encoder, cx: &ctxt, r: ty::Region) {
241241
enc_bound_region(w, cx, br);
242242
mywrite!(w, "]");
243243
}
244-
ty::ReEarlyBound(ref data) => {
244+
ty::ReEarlyBound(node_id, space, index, name) => {
245245
mywrite!(w, "B[{}|{}|{}|{}]",
246-
data.param_id,
247-
data.space.to_uint(),
248-
data.index,
249-
token::get_name(data.name));
246+
node_id,
247+
space.to_uint(),
248+
index,
249+
token::get_name(name));
250250
}
251251
ty::ReFree(ref fr) => {
252252
mywrite!(w, "f[");

branches/try/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,8 @@ impl tr for ty::Region {
496496
ty::ReLateBound(debruijn, br) => {
497497
ty::ReLateBound(debruijn, br.tr(dcx))
498498
}
499-
ty::ReEarlyBound(data) => {
500-
ty::ReEarlyBound(ty::EarlyBoundRegion {
501-
param_id: dcx.tr_id(data.param_id),
502-
space: data.space,
503-
index: data.index,
504-
name: data.name,
505-
})
499+
ty::ReEarlyBound(id, space, index, ident) => {
500+
ty::ReEarlyBound(dcx.tr_id(id), space, index, ident)
506501
}
507502
ty::ReScope(scope) => {
508503
ty::ReScope(scope.tr(dcx))

branches/try/src/librustc/middle/region.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,14 @@ impl RegionMaps {
603603
self.sub_free_region(sub_fr, super_fr)
604604
}
605605

606-
(ty::ReEarlyBound(data_a), ty::ReEarlyBound(data_b)) => {
606+
(ty::ReEarlyBound(param_id_a, param_space_a, index_a, _),
607+
ty::ReEarlyBound(param_id_b, param_space_b, index_b, _)) => {
607608
// This case is used only to make sure that explicitly-
608609
// specified `Self` types match the real self type in
609-
// implementations. Yuck.
610-
data_a == data_b
610+
// implementations.
611+
param_id_a == param_id_b &&
612+
param_space_a == param_space_b &&
613+
index_a == index_b
611614
}
612615

613616
_ => {

branches/try/src/librustc/middle/subst.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,11 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
622622
// regions that appear in a function signature is done using
623623
// the specialized routine `ty::replace_late_regions()`.
624624
match r {
625-
ty::ReEarlyBound(data) => {
625+
ty::ReEarlyBound(_, space, i, region_name) => {
626626
match self.substs.regions {
627627
ErasedRegions => ty::ReStatic,
628628
NonerasedRegions(ref regions) =>
629-
match regions.opt_get(data.space, data.index as usize) {
629+
match regions.opt_get(space, i as usize) {
630630
Some(&r) => {
631631
self.shift_region_through_binders(r)
632632
}
@@ -635,12 +635,11 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
635635
self.tcx().sess.span_bug(
636636
span,
637637
&format!("Type parameter out of range \
638-
when substituting in region {} (root type={}) \
639-
(space={:?}, index={})",
640-
data.name.as_str(),
641-
self.root_ty.repr(self.tcx()),
642-
data.space,
643-
data.index));
638+
when substituting in region {} (root type={}) \
639+
(space={:?}, index={})",
640+
region_name.as_str(),
641+
self.root_ty.repr(self.tcx()),
642+
space, i));
644643
}
645644
}
646645
}

branches/try/src/librustc/middle/ty.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,10 @@ pub enum Region {
11341134
// Region bound in a type or fn declaration which will be
11351135
// substituted 'early' -- that is, at the same time when type
11361136
// parameters are substituted.
1137-
ReEarlyBound(EarlyBoundRegion),
1137+
ReEarlyBound(/* param id */ ast::NodeId,
1138+
subst::ParamSpace,
1139+
/*index*/ u32,
1140+
ast::Name),
11381141

11391142
// Region bound in a function scope, which will be substituted when the
11401143
// function is called.
@@ -1166,14 +1169,6 @@ pub enum Region {
11661169
ReEmpty,
11671170
}
11681171

1169-
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
1170-
pub struct EarlyBoundRegion {
1171-
pub param_id: ast::NodeId,
1172-
pub space: subst::ParamSpace,
1173-
pub index: u32,
1174-
pub name: ast::Name,
1175-
}
1176-
11771172
/// Upvars do not get their own node-id. Instead, we use the pair of
11781173
/// the original var id (that is, the root variable that is referenced
11791174
/// by the upvar) and the id of the closure expression.
@@ -1766,12 +1761,7 @@ pub struct RegionParameterDef {
17661761

17671762
impl RegionParameterDef {
17681763
pub fn to_early_bound_region(&self) -> ty::Region {
1769-
ty::ReEarlyBound(ty::EarlyBoundRegion {
1770-
param_id: self.def_id.node,
1771-
space: self.space,
1772-
index: self.index,
1773-
name: self.name,
1774-
})
1764+
ty::ReEarlyBound(self.def_id.node, self.space, self.index, self.name)
17751765
}
17761766
pub fn to_bound_region(&self) -> ty::BoundRegion {
17771767
ty::BoundRegion::BrNamed(self.def_id, self.name)
@@ -7081,7 +7071,8 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
70817071
let meth_regions: Vec<ty::Region> =
70827072
method.generics.regions.get_slice(subst::FnSpace)
70837073
.iter()
7084-
.map(|def| def.to_early_bound_region())
7074+
.map(|def| ty::ReEarlyBound(def.def_id.node, def.space,
7075+
def.index, def.name))
70857076
.collect();
70867077
trait_ref.substs.clone().with_method(meth_tps, meth_regions)
70877078
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
606606
"Force overflow checks on or off"),
607607
force_dropflag_checks: Option<bool> = (None, parse_opt_bool,
608608
"Force drop flag checks on or off"),
609-
trace_macros: bool = (false, parse_bool,
610-
"For every macro invocation, print its name and arguments"),
611609
}
612610

613611
pub fn default_lib_output() -> CrateType {
@@ -669,7 +667,7 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
669667
Ok(t) => t,
670668
Err(e) => {
671669
sp.handler().fatal(&format!("Error loading target specification: {}", e));
672-
}
670+
}
673671
};
674672

675673
let (int_type, uint_type) = match &target.target_pointer_width[..] {

branches/try/src/librustc/util/ppaux.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
163163

164164
ReEmpty => { ("the empty lifetime".to_string(), None) }
165165

166-
ReEarlyBound(ref data) => {
167-
(format!("{}", token::get_name(data.name)), None)
166+
ReEarlyBound(_, _, _, name) => {
167+
(format!("{}", token::get_name(name)), None)
168168
}
169169

170170
// I believe these cases should not occur (except when debugging,
@@ -223,8 +223,8 @@ pub fn region_to_string(cx: &ctxt, prefix: &str, space: bool, region: Region) ->
223223
// `explain_region()` or `note_and_explain_region()`.
224224
match region {
225225
ty::ReScope(_) => prefix.to_string(),
226-
ty::ReEarlyBound(ref data) => {
227-
token::get_name(data.name).to_string()
226+
ty::ReEarlyBound(_, _, _, name) => {
227+
token::get_name(name).to_string()
228228
}
229229
ty::ReLateBound(_, br) => bound_region_to_string(cx, prefix, space, br),
230230
ty::ReFree(ref fr) => bound_region_to_string(cx, prefix, space, fr.bound_region),
@@ -810,12 +810,8 @@ impl<'tcx> Repr<'tcx> for ty::TraitRef<'tcx> {
810810
// to enumerate the `for<...>` etc because the debruijn index
811811
// tells you everything you need to know.
812812
let base = ty::item_path_str(tcx, self.def_id);
813-
let result = parameterized(tcx, &base, self.substs, self.def_id, &[],
814-
|| ty::lookup_trait_def(tcx, self.def_id).generics.clone());
815-
match self.substs.self_ty() {
816-
None => result,
817-
Some(sty) => format!("<{} as {}>", sty.repr(tcx), result)
818-
}
813+
parameterized(tcx, &base, self.substs, self.def_id, &[],
814+
|| ty::lookup_trait_def(tcx, self.def_id).generics.clone())
819815
}
820816
}
821817

@@ -903,12 +899,12 @@ impl<'tcx> Repr<'tcx> for ty::BoundRegion {
903899
impl<'tcx> Repr<'tcx> for ty::Region {
904900
fn repr(&self, tcx: &ctxt) -> String {
905901
match *self {
906-
ty::ReEarlyBound(ref data) => {
902+
ty::ReEarlyBound(id, space, index, name) => {
907903
format!("ReEarlyBound({}, {:?}, {}, {})",
908-
data.param_id,
909-
data.space,
910-
data.index,
911-
token::get_name(data.name))
904+
id,
905+
space,
906+
index,
907+
token::get_name(name))
912908
}
913909

914910
ty::ReLateBound(binder_id, ref bound_region) => {
@@ -1508,7 +1504,8 @@ impl<'tcx> UserString<'tcx> for ty::ProjectionPredicate<'tcx> {
15081504

15091505
impl<'tcx> Repr<'tcx> for ty::ProjectionTy<'tcx> {
15101506
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
1511-
format!("{}::{}",
1507+
format!("<{} as {}>::{}",
1508+
self.trait_ref.substs.self_ty().repr(tcx),
15121509
self.trait_ref.repr(tcx),
15131510
self.item_name.repr(tcx))
15141511
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Various data structures used by the Rust compiler. The intention
12+
//! is that code in here should be not be *specific* to rustc, so that
13+
//! it can be easily unit tested and so forth.
14+
//!
15+
//! # Note
16+
//!
17+
//! This API is completely unstable and subject to change.
18+
19+
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
20+
#![cfg_attr(stage0, feature(custom_attribute))]
21+
#![crate_name = "rustc_data_structures"]
22+
#![unstable(feature = "rustc_private")]
23+
#![crate_type = "dylib"]
24+
#![crate_type = "rlib"]
25+
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
26+
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
27+
html_root_url = "http://doc.rust-lang.org/nightly/")]
28+
29+
#![feature(rustc_private)]
30+
#![feature(test)]
31+
32+
#[macro_use] extern crate log;
33+
extern crate serialize as rustc_serialize; // used by deriving

branches/try/src/librustc_driver/driver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
483483
crate_name: crate_name.to_string(),
484484
features: Some(&features),
485485
recursion_limit: sess.recursion_limit.get(),
486-
trace_mac: sess.opts.debugging_opts.trace_macros,
487486
};
488487
let ret = syntax::ext::expand::expand_crate(&sess.parse_sess,
489488
cfg,

branches/try/src/librustc_driver/test.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
290290
-> ty::Region
291291
{
292292
let name = token::intern(name);
293-
ty::ReEarlyBound(ty::EarlyBoundRegion {
294-
param_id: ast::DUMMY_NODE_ID,
295-
space: space,
296-
index: index,
297-
name: name
298-
})
293+
ty::ReEarlyBound(ast::DUMMY_NODE_ID, space, index, name)
299294
}
300295

301296
pub fn re_late_bound_with_debruijn(&self, id: u32, debruijn: ty::DebruijnIndex) -> ty::Region {

0 commit comments

Comments
 (0)