Skip to content

Commit 8cc2d23

Browse files
committed
---
yaml --- r: 149554 b: refs/heads/try2 c: 25d6836 h: refs/heads/master v: v3
1 parent 723e59f commit 8cc2d23

Some content is hidden

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

68 files changed

+558
-396
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6335a76b6eb473ea399b16fe9309db142d6b68ce
8+
refs/heads/try2: 25d68366b73c24bd9b7d277b38da087420d63f9b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ before_script:
3939
# manually disables bringing in these two libraries, but the stock LLVM was
4040
# apparently built with these options. We provide these options when building so
4141
# the `rustc` binary can successfully link.
42-
script:
43-
- make tidy
44-
- RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1
45-
- make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
42+
#
43+
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
44+
# everything in one large command instead of multiple commands.
45+
script: |
46+
make tidy &&
47+
RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1 &&
48+
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
4649
4750
env:
4851
- NO_BENCH=1

branches/try2/src/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ Source layout:
1010
| `libgreen/` | The M:N runtime library |
1111
| `libnative/` | The 1:1 runtime library |
1212
| `libsyntax/` | The Rust parser and pretty-printer |
13+
| `libcollections/` | A collection of useful data structures and containers |
14+
| `libnum/` | Extended number support library (complex, rational, etc) |
15+
| `libtest/` | Rust's test-runner code |
16+
| ------------------- | --------------------------------------------------------- |
17+
| `libarena/` | The arena (a fast but limited) memory allocator |
18+
| `libflate/` | Simple compression library |
19+
| `libfourcc/` | Data format identifier library |
20+
| `libgetopts/` | Get command-line-options library |
21+
| `libglob/` | Unix glob patterns library |
22+
| `libsemver/` | Rust's semantic versioning library |
23+
| `libserialize/` | Encode-Decode types library |
24+
| `libsync/` | Concurrency mechanisms and primitives |
25+
| `libterm/` | ANSI color library for terminals |
26+
| `libtime/` | Time operations library |
27+
| `libuuid/` | UUID's handling code |
1328
| ------------------- | --------------------------------------------------------- |
1429
| `rt/` | The runtime system |
1530
| `rt/rust_*.c` | - Some of the runtime services |
@@ -31,8 +46,13 @@ Source layout:
3146
| ------------------- | --------------------------------------------------------- |
3247
| `librustdoc/` | The Rust API documentation tool |
3348
| `libuv/` | The libuv submodule |
49+
| `librustuv/` | Rust libuv support code |
3450
| ------------------- | --------------------------------------------------------- |
3551
| `llvm/` | The LLVM submodule |
3652
| `rustllvm/` | LLVM support code |
3753
| ------------------- | --------------------------------------------------------- |
3854
| `etc/` | Scripts, editors support, misc |
55+
56+
57+
NOTE: This list (especially the second part of the table which contains modules and libraries)
58+
is highly volatile and subject to change.

branches/try2/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So we’d like to define a function
14201420
that takes the points by pointer. We can use references to do this:
14211421
14221422
~~~
1423+
use std::num::sqrt;
14231424
# struct Point { x: f64, y: f64 }
1424-
# fn sqrt(f: f64) -> f64 { 0.0 }
14251425
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
14261426
let x_d = p1.x - p2.x;
14271427
let y_d = p1.y - p2.y;

branches/try2/src/libcollections/hashmap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
//! ```
5454
5555
use std::cmp::max;
56+
use std::default::Default;
5657
use std::fmt;
5758
use std::hash::{Hash, Hasher, sip};
5859
use std::iter::{FilterMap, Chain, Repeat, Zip};

branches/try2/src/libextra/url.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::cmp::Eq;
1616
use std::fmt;
1717
use std::hash::{Hash, sip};
1818
use std::io::BufReader;
19+
use std::from_str::FromStr;
1920
use std::uint;
2021

2122
use collections::HashMap;

branches/try2/src/libgreen/stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl StackPool {
139139
pub fn take_stack(&mut self, min_size: uint) -> Stack {
140140
// Ideally this would be a binary search
141141
match self.stacks.iter().position(|s| min_size <= s.min_size) {
142-
Some(idx) => self.stacks.swap_remove(idx),
142+
Some(idx) => self.stacks.swap_remove(idx).unwrap(),
143143
None => Stack::new(min_size)
144144
}
145145
}

branches/try2/src/libnum/bigint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use Integer;
2020

2121
use std::cmp;
2222
use std::fmt;
23+
use std::from_str::FromStr;
2324
use std::num::{Bitwise, ToPrimitive, FromPrimitive};
2425
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
2526
use std::rand::Rng;
@@ -1397,8 +1398,9 @@ mod biguint_tests {
13971398
use super::{Plus, BigInt, RandBigInt, ToBigInt};
13981399
13991400
use std::cmp::{Less, Equal, Greater};
1401+
use std::from_str::FromStr;
14001402
use std::i64;
1401-
use std::num::{Zero, One, FromStrRadix};
1403+
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
14021404
use std::num::{ToPrimitive, FromPrimitive};
14031405
use std::rand::{task_rng};
14041406
use std::str;
@@ -2056,7 +2058,7 @@ mod bigint_tests {
20562058

20572059
use std::cmp::{Less, Equal, Greater};
20582060
use std::i64;
2059-
use std::num::{Zero, One, FromStrRadix};
2061+
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
20602062
use std::num::{ToPrimitive, FromPrimitive};
20612063
use std::rand::{task_rng};
20622064
use std::u64;

branches/try2/src/libnum/rational.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
333333
mod test {
334334

335335
use super::{Ratio, Rational, BigRational};
336-
use std::num::{Zero,One,FromStrRadix,FromPrimitive};
336+
use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
337337
use std::from_str::FromStr;
338338

339339
pub static _0 : Rational = Ratio { numer: 0, denom: 1};

branches/try2/src/librustc/back/archive.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ impl Archive {
145145
/// Lists all files in an archive
146146
pub fn files(&self) -> ~[~str] {
147147
let output = run_ar(self.sess, "t", None, [&self.dst]);
148-
str::from_utf8(output.output).unwrap().lines().map(|s| s.to_owned()).collect()
148+
let output = str::from_utf8(output.output).unwrap();
149+
// use lines_any because windows delimits output with `\r\n` instead of
150+
// just `\n`
151+
output.lines_any().map(|s| s.to_owned()).collect()
149152
}
150153

151154
fn add_archive(&mut self, archive: &Path, name: &str,

branches/try2/src/librustc/driver/driver.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ pub fn phase_3_run_analysis_passes(sess: Session,
295295
let region_map = time(time_passes, "region resolution", (), |_|
296296
middle::region::resolve_crate(sess, krate));
297297

298-
let ty_cx = ty::mk_ctxt(sess, def_map, named_region_map, ast_map, freevars,
299-
region_map, lang_items);
298+
let ty_cx = ty::mk_ctxt(sess, def_map, named_region_map, ast_map,
299+
freevars, region_map, lang_items);
300300

301301
// passes are timed inside typeck
302302
let (method_map, vtable_map) = typeck::check_crate(ty_cx, trait_map, krate);
@@ -975,6 +975,7 @@ pub fn build_session_(sopts: @session::Options,
975975
lints: RefCell::new(HashMap::new()),
976976
node_id: Cell::new(1),
977977
crate_types: @RefCell::new(~[]),
978+
features: front::feature_gate::Features::new()
978979
}
979980
}
980981

branches/try2/src/librustc/driver/session.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use back::target_strs;
1313
use back;
1414
use driver::driver::host_triple;
15+
use front;
1516
use metadata::filesearch;
1617
use metadata;
1718
use middle::lint;
@@ -186,6 +187,7 @@ pub struct Session_ {
186187
~[(lint::Lint, codemap::Span, ~str)]>>,
187188
node_id: Cell<ast::NodeId>,
188189
crate_types: @RefCell<~[CrateType]>,
190+
features: front::feature_gate::Features
189191
}
190192

191193
pub type Session = @Session_;

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ use syntax::parse::token;
3030

3131
use driver::session::Session;
3232

33+
use std::cell::Cell;
34+
3335
/// This is a list of all known features since the beginning of time. This list
3436
/// can never shrink, it may only be expanded (in order to prevent old programs
3537
/// from failing to compile). The status of each feature may change, however.
@@ -69,6 +71,19 @@ enum Status {
6971
Accepted,
7072
}
7173

74+
/// A set of features to be used by later passes.
75+
pub struct Features {
76+
default_type_params: Cell<bool>
77+
}
78+
79+
impl Features {
80+
pub fn new() -> Features {
81+
Features {
82+
default_type_params: Cell::new(false)
83+
}
84+
}
85+
}
86+
7287
struct Context {
7388
features: ~[&'static str],
7489
sess: Session,
@@ -315,4 +330,6 @@ pub fn check_crate(sess: Session, krate: &ast::Crate) {
315330
visit::walk_crate(&mut cx, krate, ());
316331

317332
sess.abort_if_errors();
333+
334+
sess.features.default_type_params.set(cx.has_feature("default_type_params"));
318335
}

branches/try2/src/librustc/metadata/loader.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ pub struct ArchiveMetadata {
6767
priv data: &'static [u8],
6868
}
6969

70+
// FIXME(#11857) this should be a "real" realpath
71+
fn realpath(p: &Path) -> Path {
72+
use std::os;
73+
use std::io::fs;
74+
75+
let path = os::make_absolute(p);
76+
match fs::readlink(&path) {
77+
Ok(p) => p,
78+
Err(..) => path
79+
}
80+
}
81+
7082
impl Context {
7183
pub fn load_library_crate(&self, root_ident: Option<~str>) -> Library {
7284
match self.find_library_crate() {
@@ -121,7 +133,7 @@ impl Context {
121133
(HashSet::new(), HashSet::new())
122134
});
123135
let (ref mut rlibs, _) = *slot;
124-
rlibs.insert(path.clone());
136+
rlibs.insert(realpath(path));
125137
FileMatches
126138
}
127139
None => {
@@ -138,7 +150,7 @@ impl Context {
138150
(HashSet::new(), HashSet::new())
139151
});
140152
let (_, ref mut dylibs) = *slot;
141-
dylibs.insert(path.clone());
153+
dylibs.insert(realpath(path));
142154
FileMatches
143155
}
144156
None => {

branches/try2/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,8 @@ fn gather_loans_in_local(this: &mut GatherLoanCtxt,
160160
})
161161
}
162162
Some(init) => {
163-
// Variable declarations with initializers are considered "assigns":
164-
let tcx = this.bccx.tcx;
165-
pat_util::pat_bindings(tcx.def_map, local.pat, |_, id, span, _| {
166-
gather_moves::gather_assignment(this.bccx,
167-
&this.move_data,
168-
id,
169-
span,
170-
@LpVar(id),
171-
id);
172-
});
163+
// Variable declarations with initializers are considered "assigns",
164+
// which is handled by `gather_pat`:
173165
let init_cmt = this.bccx.cat_expr(init);
174166
this.gather_pat(init_cmt, local.pat, None);
175167
}
@@ -811,6 +803,17 @@ impl<'a> GatherLoanCtxt<'a> {
811803
self.bccx.cat_pattern(discr_cmt, root_pat, |cmt, pat| {
812804
match pat.node {
813805
ast::PatIdent(bm, _, _) if self.pat_is_binding(pat) => {
806+
// Each match binding is effectively an assignment.
807+
let tcx = self.bccx.tcx;
808+
pat_util::pat_bindings(tcx.def_map, pat, |_, id, span, _| {
809+
gather_moves::gather_assignment(self.bccx,
810+
&self.move_data,
811+
id,
812+
span,
813+
@LpVar(id),
814+
id);
815+
});
816+
814817
match bm {
815818
ast::BindByRef(mutbl) => {
816819
// ref x or ref x @ p --- creates a ptr which must

branches/try2/src/librustc/middle/lint.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ pub enum Lint {
8888
AttributeUsage,
8989
UnknownFeatures,
9090
UnknownCrateType,
91-
DefaultTypeParamUsage,
9291

9392
ManagedHeapMemory,
9493
OwnedHeapMemory,
@@ -382,14 +381,7 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
382381
lint: UnusedResult,
383382
desc: "unused result of an expression in a statement",
384383
default: allow,
385-
}),
386-
387-
("default_type_param_usage",
388-
LintSpec {
389-
lint: DefaultTypeParamUsage,
390-
desc: "prevents explicitly setting a type parameter with a default",
391-
default: deny,
392-
}),
384+
})
393385
];
394386

395387
/*

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
282282
if !type_is_immediate(ccx, arg_ty) {
283283
unsafe {
284284
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
285+
llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
285286
}
286287
}
287288
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ pub fn mk_ctxt(s: session::Session,
10791079
region_maps: middle::region::RegionMaps,
10801080
lang_items: @middle::lang_items::LanguageItems)
10811081
-> ctxt {
1082+
10821083
@ctxt_ {
10831084
named_region_map: named_region_map,
10841085
item_variance_map: RefCell::new(HashMap::new()),
@@ -1126,7 +1127,7 @@ pub fn mk_ctxt(s: session::Session,
11261127
upvar_borrow_map: RefCell::new(HashMap::new()),
11271128
extern_const_statics: RefCell::new(HashMap::new()),
11281129
extern_const_variants: RefCell::new(HashMap::new()),
1129-
}
1130+
}
11301131
}
11311132

11321133
// Type constructors

branches/try2/src/librustc/middle/typeck/astconv.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252

5353
use middle::const_eval;
54-
use middle::lint;
5554
use middle::subst::Subst;
5655
use middle::ty::{substs};
5756
use middle::ty::{ty_param_substs_and_ty};
@@ -219,11 +218,12 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
219218
expected, formal_ty_param_count, supplied_ty_param_count));
220219
}
221220

222-
if supplied_ty_param_count > required_ty_param_count {
223-
let id = path.segments.iter().flat_map(|s| s.types.iter())
224-
.nth(required_ty_param_count).unwrap().id;
225-
this.tcx().sess.add_lint(lint::DefaultTypeParamUsage, id, path.span,
226-
~"provided type arguments with defaults");
221+
if supplied_ty_param_count > required_ty_param_count
222+
&& !this.tcx().sess.features.default_type_params.get() {
223+
this.tcx().sess.span_err(path.span, "default type parameters are \
224+
experimental and possibly buggy");
225+
this.tcx().sess.span_note(path.span, "add #[feature(default_type_params)] \
226+
to the crate attributes to enable");
227227
}
228228

229229
let tps = path.segments.iter().flat_map(|s| s.types.iter())

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ use middle::const_eval;
8181
use middle::lang_items::{ExchangeHeapLangItem, GcLangItem};
8282
use middle::lang_items::{ManagedHeapLangItem};
8383
use middle::lint::UnreachableCode;
84-
use middle::lint;
8584
use middle::pat_util::pat_id_map;
8685
use middle::pat_util;
8786
use middle::subst::Subst;
@@ -3750,9 +3749,12 @@ pub fn instantiate_path(fcx: @FnCtxt,
37503749
expected, user_ty_param_req, ty_substs_len));
37513750
(fcx.infcx().next_ty_vars(ty_param_count), regions)
37523751
} else {
3753-
if ty_substs_len > user_ty_param_req {
3754-
fcx.tcx().sess.add_lint(lint::DefaultTypeParamUsage, node_id, pth.span,
3755-
~"provided type arguments with defaults");
3752+
if ty_substs_len > user_ty_param_req
3753+
&& !fcx.tcx().sess.features.default_type_params.get() {
3754+
fcx.tcx().sess.span_err(pth.span, "default type parameters are \
3755+
experimental and possibly buggy");
3756+
fcx.tcx().sess.span_note(pth.span, "add #[feature(default_type_params)] \
3757+
to the crate attributes to enable");
37563758
}
37573759

37583760
// Build up the list of type parameters, inserting the self parameter

0 commit comments

Comments
 (0)