Skip to content

Commit 1746a6b

Browse files
committed
---
yaml --- r: 146679 b: refs/heads/try2 c: b60b411 h: refs/heads/master i: 146677: 53874f7 146675: 633fd83 146671: 5998319 v: v3
1 parent 99687fc commit 1746a6b

26 files changed

+235
-394
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: 15a8e6248c99ba9585d0ef23cca8304af69dcf36
8+
refs/heads/try2: b60b4114959a0f0bfa4c1099c5c1af9a35edeb45
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ common_escape : '\x5c'
254254
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
255255
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
256256
| dec_digit ;
257-
oct_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' ;
258257
dec_digit : '0' | nonzero_dec ;
259258
nonzero_dec: '1' | '2' | '3' | '4'
260259
| '5' | '6' | '7' | '8' | '9' ;
@@ -319,9 +318,8 @@ r##"foo #"# bar"##; // foo #"# bar
319318
~~~~ {.ebnf .gram}
320319
321320
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
322-
| '0' [ [ dec_digit | '_' ] * num_suffix ?
321+
| '0' [ [ dec_digit | '_' ] + num_suffix ?
323322
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
324-
| 'o' [ oct_digit | '_' ] + int_suffix ?
325323
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
326324
327325
num_suffix : int_suffix | float_suffix ;

branches/try2/src/libextra/num/bigint.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ impl ToStrRadix for BigUint {
660660
let divider = FromPrimitive::from_uint(base).unwrap();
661661
let mut result = ~[];
662662
let mut m = n;
663-
while m >= divider {
663+
while m > divider {
664664
let (d, m0) = m.div_mod_floor(&divider);
665665
result.push(m0.to_uint().unwrap() as BigDigit);
666666
m = d;
@@ -2520,11 +2520,6 @@ mod bigint_tests {
25202520
check("-10", Some(-10));
25212521
check("Z", None);
25222522
check("_", None);
2523-
2524-
// issue 10522, this hit an edge case that caused it to
2525-
// attempt to allocate a vector of size (-1u) == huge.
2526-
let x: BigInt = from_str("1" + "0".repeat(36)).unwrap();
2527-
let _y = x.to_str();
25282523
}
25292524

25302525
#[test]

branches/try2/src/libextra/url.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,6 @@ fn query_from_str(rawquery: &str) -> Query {
364364
return query;
365365
}
366366

367-
/**
368-
* Converts an instance of a URI `Query` type to a string.
369-
*
370-
* # Example
371-
*
372-
* ```rust
373-
* let query = ~[(~"title", ~"The Village"), (~"north", ~"52.91"), (~"west", ~"4.10")];
374-
* println(query_to_str(&query)); // title=The%20Village&north=52.91&west=4.10
375-
* ```
376-
*/
377367
pub fn query_to_str(query: &Query) -> ~str {
378368
let mut strvec = ~[];
379369
for kv in query.iter() {

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
117117
ExprUnary(_, UnDeref, _) => { }
118118
ExprUnary(_, UnBox(_), _) | ExprUnary(_, UnUniq, _) => {
119119
sess.span_err(e.span,
120-
"cannot do allocations in constant expressions");
120+
"disallowed operator in constant expression");
121121
return;
122122
}
123123
ExprLit(@codemap::Spanned {node: lit_str(*), _}) => { }
@@ -191,13 +191,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
191191
e.span,
192192
"borrowed pointers in constants may only refer to \
193193
immutable values");
194-
},
195-
ExprVstore(_, ExprVstoreUniq) |
196-
ExprVstore(_, ExprVstoreBox) |
197-
ExprVstore(_, ExprVstoreMutBox) => {
198-
sess.span_err(e.span, "cannot allocate vectors in constant expressions")
199-
},
200-
194+
}
201195
_ => {
202196
sess.span_err(e.span,
203197
"constant contains unimplemented expression type");

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -883,23 +883,20 @@ fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
883883

884884
fn check_unused_mut_pat(cx: &Context, p: @ast::Pat) {
885885
match p.node {
886-
ast::PatIdent(ast::BindByValue(ast::MutMutable),
887-
ref path, _) if pat_util::pat_is_binding(cx.tcx.def_map, p)=> {
888-
// `let mut _a = 1;` doesn't need a warning.
889-
let initial_underscore = match path.segments {
890-
[ast::PathSegment { identifier: id, _ }] => {
891-
cx.tcx.sess.str_of(id).starts_with("_")
892-
}
893-
_ => {
894-
cx.tcx.sess.span_bug(p.span,
895-
"mutable binding that doesn't \
896-
consist of exactly one segment");
897-
}
898-
};
899-
900-
if !initial_underscore && !cx.tcx.used_mut_nodes.contains(&p.id) {
901-
cx.span_lint(unused_mut, p.span,
902-
"variable does not need to be mutable");
886+
ast::PatIdent(ast::BindByValue(ast::MutMutable), _, _) => {
887+
let mut used = false;
888+
let mut bindings = 0;
889+
do pat_util::pat_bindings(cx.tcx.def_map, p) |_, id, _, _| {
890+
used = used || cx.tcx.used_mut_nodes.contains(&id);
891+
bindings += 1;
892+
}
893+
if !used {
894+
let msg = if bindings == 1 {
895+
"variable does not need to be mutable"
896+
} else {
897+
"variables do not need to be mutable"
898+
};
899+
cx.span_lint(unused_mut, p.span, msg);
903900
}
904901
}
905902
_ => ()

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -863,13 +863,11 @@ pub fn compare_impl_method(tcx: ty::ctxt,
863863
if impl_m.fty.sig.inputs.len() != trait_m.fty.sig.inputs.len() {
864864
tcx.sess.span_err(
865865
impl_m_span,
866-
format!("method `{}` has {} parameter{} \
867-
but the declaration in trait `{}` has {}",
868-
tcx.sess.str_of(trait_m.ident),
869-
impl_m.fty.sig.inputs.len(),
870-
if impl_m.fty.sig.inputs.len() == 1 { "" } else { "s" },
871-
ty::item_path_str(tcx, trait_m.def_id),
872-
trait_m.fty.sig.inputs.len()));
866+
format!("method `{}` has {} parameter(s) \
867+
but the trait has {} parameter(s)",
868+
tcx.sess.str_of(trait_m.ident),
869+
impl_m.fty.sig.inputs.len(),
870+
trait_m.fty.sig.inputs.len()));
873871
return;
874872
}
875873

branches/try2/src/librustpkg/api.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ pub fn new_workcache_context(p: &Path) -> workcache::Context {
8181

8282
pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version,
8383
lib: Path) {
84-
build_lib_with_cfgs(sysroot, root, name, version, lib, ~[])
85-
}
86-
87-
pub fn build_lib_with_cfgs(sysroot: Path, root: Path, name: ~str,
88-
version: Version, lib: Path, cfgs: ~[~str]) {
8984
let cx = default_context(sysroot, root.clone());
9085
let pkg_src = PkgSrc {
9186
source_workspace: root.clone(),
@@ -99,16 +94,11 @@ pub fn build_lib_with_cfgs(sysroot: Path, root: Path, name: ~str,
9994
tests: ~[],
10095
benchs: ~[]
10196
};
102-
pkg_src.build(&cx, cfgs, []);
97+
pkg_src.build(&cx, ~[], []);
10398
}
10499

105100
pub fn build_exe(sysroot: Path, root: Path, name: ~str, version: Version,
106101
main: Path) {
107-
build_exe_with_cfgs(sysroot, root, name, version, main, ~[])
108-
}
109-
110-
pub fn build_exe_with_cfgs(sysroot: Path, root: Path, name: ~str,
111-
version: Version, main: Path, cfgs: ~[~str]) {
112102
let cx = default_context(sysroot, root.clone());
113103
let pkg_src = PkgSrc {
114104
source_workspace: root.clone(),
@@ -123,7 +113,7 @@ pub fn build_exe_with_cfgs(sysroot: Path, root: Path, name: ~str,
123113
benchs: ~[]
124114
};
125115

126-
pkg_src.build(&cx, cfgs, []);
116+
pkg_src.build(&cx, ~[], []);
127117
}
128118

129119
pub fn install_pkg(cx: &BuildContext,

branches/try2/src/librustpkg/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Context data structure used by rustpkg
1212

1313
use extra::workcache;
14-
use rustc::driver::session::{OptLevel, No};
14+
use rustc::driver::session;
1515

1616
use std::hashmap::HashSet;
1717

@@ -88,7 +88,7 @@ pub struct RustcFlags {
8888
// Extra arguments to pass to rustc with the --link-args flag
8989
link_args: Option<~str>,
9090
// Optimization level. 0 = default. -O = 2.
91-
optimization_level: OptLevel,
91+
optimization_level: session::OptLevel,
9292
// True if the user passed in --save-temps
9393
save_temps: bool,
9494
// Target (defaults to rustc's default target)
@@ -224,7 +224,7 @@ impl RustcFlags {
224224
linker: None,
225225
link_args: None,
226226
compile_upto: Nothing,
227-
optimization_level: No,
227+
optimization_level: session::Default,
228228
save_temps: false,
229229
target: None,
230230
target_cpu: None,

branches/try2/src/librustpkg/package_source.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ use workcache_support::{digest_only_date, digest_file_with_date, crate_tag};
2828
use extra::workcache;
2929
use extra::treemap::TreeMap;
3030

31+
use rustc::driver::session;
32+
3133
// An enumeration of the unpacked source of a package workspace.
3234
// This contains a list of files found in the source workspace.
3335
#[deriving(Clone)]
@@ -425,6 +427,7 @@ impl PkgSrc {
425427
}
426428
debug!("Compiling crate {}; its output will be in {}",
427429
subpath.display(), sub_dir.display());
430+
let opt: session::OptLevel = subcx.context.rustc_flags.optimization_level;
428431
let result = compile_crate(&subcx,
429432
exec,
430433
&id,
@@ -433,7 +436,7 @@ impl PkgSrc {
433436
&mut (sub_deps.clone()),
434437
sub_flags,
435438
subcfgs,
436-
false,
439+
opt,
437440
what);
438441
// XXX: result is an Option<Path>. The following code did not take that
439442
// into account. I'm not sure if the workcache really likes seeing the

branches/try2/src/librustpkg/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub fn compile_input(context: &BuildContext,
175175
deps: &mut DepMap,
176176
flags: &[~str],
177177
cfgs: &[~str],
178-
opt: bool,
178+
opt: session::OptLevel,
179179
what: OutputType) -> Option<Path> {
180180
assert!(in_file.component_iter().nth(1).is_some());
181181
let input = driver::file_input(in_file.clone());
@@ -241,7 +241,7 @@ pub fn compile_input(context: &BuildContext,
241241

242242
let options = @session::options {
243243
crate_type: crate_type,
244-
optimize: if opt { session::Aggressive } else { session::No },
244+
optimize: opt,
245245
test: what == Test || what == Bench,
246246
maybe_sysroot: Some(sysroot_to_use),
247247
addl_lib_search_paths: @mut context.additional_library_paths(),
@@ -408,7 +408,7 @@ pub fn compile_crate(ctxt: &BuildContext,
408408
deps: &mut DepMap,
409409
flags: &[~str],
410410
cfgs: &[~str],
411-
opt: bool,
411+
opt: session::OptLevel,
412412
what: OutputType) -> Option<Path> {
413413
debug!("compile_crate: crate={}, workspace={}", crate.display(), workspace.display());
414414
debug!("compile_crate: short_name = {}, flags =...", pkg_id.to_str());

branches/try2/src/libstd/any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ mod tests {
207207

208208
#[test]
209209
fn type_id_hash() {
210-
let (a, b) = (TypeId::of::<uint>(), TypeId::of::<uint>());
210+
let (a, b) = (TypeId::of::<uint>(), TypeId::of::<uint>::());
211211

212212
assert_eq!(a.hash(), b.hash());
213213
}

0 commit comments

Comments
 (0)