Skip to content

Commit 67a4ab0

Browse files
committed
---
yaml --- r: 143255 b: refs/heads/try2 c: 0012b50 h: refs/heads/master i: 143253: 69840e6 143251: 361896f 143247: c79011c v: v3
1 parent c35c499 commit 67a4ab0

Some content is hidden

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

92 files changed

+1615
-1359
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: ba41755069998bcaa5fbb3817cc98e97e83240d4
8+
refs/heads/try2: 0012b5008b32543cf61a2beba36160c42f36d704
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/tests.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
537537

538538
# Rules for the cfail/rfail/rpass/bench/perf test runner
539539

540+
# The tests select when to use debug configuration on their own;
541+
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
542+
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
543+
540544
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
541545
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
542546
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
@@ -548,7 +552,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
548552
--target $(2) \
549553
--adb-path=$(CFG_ADB) \
550554
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
551-
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
555+
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) --target=$(2)" \
552556
$$(CTEST_TESTARGS)
553557

554558
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)

branches/try2/src/etc/tidy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def do_license_check(name, contents):
4949
report_err("FIXME without issue number")
5050
if line.find("TODO") != -1:
5151
report_err("TODO is deprecated; use FIXME")
52-
idx = line.find("// NOTE")
53-
if idx != -1:
54-
report_warn("NOTE" + line[idx + len("// NOTE"):])
52+
match = re.match(r'^.*//\s*(NOTE.*)$', line)
53+
if match:
54+
report_warn(match.group(1))
5555
if (line.find('\t') != -1 and
5656
fileinput.filename().find("Makefile") == -1):
5757
report_err("tab character")

branches/try2/src/libextra/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ mod test {
194194
195195
#[test]
196196
fn test_interface_unwrap() {
197-
let mut f = from_value(~"fail");
197+
let f = from_value(~"fail");
198198
assert_eq!(f.unwrap(), ~"fail");
199199
}
200200

branches/try2/src/libextra/getopts.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
457457
let vals = opt_vals(mm, nm);
458458
if vals.is_empty() { return None::<~str>; }
459459
return match vals[0] { Val(ref s) => Some::<~str>((*s).clone()),
460-
_ => Some::<~str>(str::to_owned(def)) }
460+
_ => Some::<~str>(def.to_owned()) }
461461
}
462462

463463
#[deriving(Eq)]
@@ -497,10 +497,10 @@ pub mod groups {
497497
desc: &str, hint: &str) -> OptGroup {
498498
let len = short_name.len();
499499
assert!(len == 1 || len == 0);
500-
return OptGroup { short_name: str::to_owned(short_name),
501-
long_name: str::to_owned(long_name),
502-
hint: str::to_owned(hint),
503-
desc: str::to_owned(desc),
500+
return OptGroup { short_name: short_name.to_owned(),
501+
long_name: long_name.to_owned(),
502+
hint: hint.to_owned(),
503+
desc: desc.to_owned(),
504504
hasarg: Yes,
505505
occur: Req};
506506
}
@@ -510,10 +510,10 @@ pub mod groups {
510510
desc: &str, hint: &str) -> OptGroup {
511511
let len = short_name.len();
512512
assert!(len == 1 || len == 0);
513-
return OptGroup {short_name: str::to_owned(short_name),
514-
long_name: str::to_owned(long_name),
515-
hint: str::to_owned(hint),
516-
desc: str::to_owned(desc),
513+
return OptGroup {short_name: short_name.to_owned(),
514+
long_name: long_name.to_owned(),
515+
hint: hint.to_owned(),
516+
desc: desc.to_owned(),
517517
hasarg: Yes,
518518
occur: Optional};
519519
}
@@ -523,10 +523,10 @@ pub mod groups {
523523
desc: &str) -> OptGroup {
524524
let len = short_name.len();
525525
assert!(len == 1 || len == 0);
526-
return OptGroup {short_name: str::to_owned(short_name),
527-
long_name: str::to_owned(long_name),
526+
return OptGroup {short_name: short_name.to_owned(),
527+
long_name: long_name.to_owned(),
528528
hint: ~"",
529-
desc: str::to_owned(desc),
529+
desc: desc.to_owned(),
530530
hasarg: No,
531531
occur: Optional};
532532
}
@@ -536,10 +536,10 @@ pub mod groups {
536536
desc: &str, hint: &str) -> OptGroup {
537537
let len = short_name.len();
538538
assert!(len == 1 || len == 0);
539-
return OptGroup {short_name: str::to_owned(short_name),
540-
long_name: str::to_owned(long_name),
541-
hint: str::to_owned(hint),
542-
desc: str::to_owned(desc),
539+
return OptGroup {short_name: short_name.to_owned(),
540+
long_name: long_name.to_owned(),
541+
hint: hint.to_owned(),
542+
desc: desc.to_owned(),
543543
hasarg: Maybe,
544544
occur: Optional};
545545
}
@@ -552,10 +552,10 @@ pub mod groups {
552552
desc: &str, hint: &str) -> OptGroup {
553553
let len = short_name.len();
554554
assert!(len == 1 || len == 0);
555-
return OptGroup {short_name: str::to_owned(short_name),
556-
long_name: str::to_owned(long_name),
557-
hint: str::to_owned(hint),
558-
desc: str::to_owned(desc),
555+
return OptGroup {short_name: short_name.to_owned(),
556+
long_name: long_name.to_owned(),
557+
hint: hint.to_owned(),
558+
desc: desc.to_owned(),
559559
hasarg: Yes,
560560
occur: Multi};
561561
}
@@ -678,7 +678,7 @@ pub mod groups {
678678
row
679679
});
680680

681-
return str::to_owned(brief) +
681+
return brief.to_owned() +
682682
"\n\nOptions:\n" +
683683
rows.collect::<~[~str]>().connect("\n") +
684684
"\n\n";

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ impl Ord for Sign {
732732
}
733733
}
734734

735+
impl TotalEq for Sign {
736+
fn equals(&self, other: &Sign) -> bool {
737+
*self == *other
738+
}
739+
}
735740
impl TotalOrd for Sign {
736741

737742
fn cmp(&self, other: &Sign) -> Ordering {

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ cmp_impl!(impl TotalEq, equals)
110110
cmp_impl!(impl Ord, lt, gt, le, ge)
111111
cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering)
112112

113+
impl<T: Clone + Integer + Ord> Orderable for Ratio<T> {
114+
#[inline]
115+
fn min(&self, other: &Ratio<T>) -> Ratio<T> {
116+
if *self < *other { self.clone() } else { other.clone() }
117+
}
118+
119+
#[inline]
120+
fn max(&self, other: &Ratio<T>) -> Ratio<T> {
121+
if *self > *other { self.clone() } else { other.clone() }
122+
}
123+
124+
#[inline]
125+
fn clamp(&self, mn: &Ratio<T>, mx: &Ratio<T>) -> Ratio<T> {
126+
if *self > *mx { mx.clone()} else
127+
if *self < *mn { mn.clone() } else { self.clone() }
128+
}
129+
}
130+
131+
113132
/* Arithmetic */
114133
// a/b * c/d = (a*c)/(b*d)
115134
impl<T: Clone + Integer + Ord>

branches/try2/src/libextra/rl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub mod rustrt {
3232

3333
/// Add a line to history
3434
pub unsafe fn add_history(line: &str) -> bool {
35-
do str::as_c_str(line) |buf| {
35+
do line.as_c_str |buf| {
3636
rustrt::linenoiseHistoryAdd(buf) == 1 as c_int
3737
}
3838
}
@@ -44,21 +44,21 @@ pub unsafe fn set_history_max_len(len: int) -> bool {
4444

4545
/// Save line history to a file
4646
pub unsafe fn save_history(file: &str) -> bool {
47-
do str::as_c_str(file) |buf| {
47+
do file.as_c_str |buf| {
4848
rustrt::linenoiseHistorySave(buf) == 1 as c_int
4949
}
5050
}
5151

5252
/// Load line history from a file
5353
pub unsafe fn load_history(file: &str) -> bool {
54-
do str::as_c_str(file) |buf| {
54+
do file.as_c_str |buf| {
5555
rustrt::linenoiseHistoryLoad(buf) == 1 as c_int
5656
}
5757
}
5858

5959
/// Print out a prompt and then wait for input and return it
6060
pub unsafe fn read(prompt: &str) -> Option<~str> {
61-
do str::as_c_str(prompt) |buf| {
61+
do prompt.as_c_str |buf| {
6262
let line = rustrt::linenoise(buf);
6363

6464
if line.is_null() { None }
@@ -80,7 +80,7 @@ pub unsafe fn complete(cb: CompletionCb) {
8080

8181
unsafe {
8282
do cb(str::raw::from_c_str(line)) |suggestion| {
83-
do str::as_c_str(suggestion) |buf| {
83+
do suggestion.as_c_str |buf| {
8484
rustrt::linenoiseAddCompletion(completions, buf);
8585
}
8686
}

branches/try2/src/libextra/terminfo/parm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
545545
String(s) => {
546546
match op {
547547
FormatString => {
548-
let mut s = s.as_bytes_with_null_consume();
548+
let mut s = s.to_bytes_with_null();
549549
s.pop(); // remove the null
550550
if flags.precision > 0 && flags.precision < s.len() {
551551
s.truncate(flags.precision);

branches/try2/src/libextra/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ mod tests {
10271027
10281028
fn test(s: &str, format: &str) -> bool {
10291029
match strptime(s, format) {
1030-
Ok(ref tm) => tm.strftime(format) == str::to_owned(s),
1030+
Ok(ref tm) => tm.strftime(format) == s.to_owned(),
10311031
Err(e) => fail!(e)
10321032
}
10331033
}

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ pub fn WriteOutputFile(sess: Session,
7676
OptLevel: c_int,
7777
EnableSegmentedStacks: bool) {
7878
unsafe {
79-
do str::as_c_str(Triple) |Triple| {
80-
do str::as_c_str(Feature) |Feature| {
81-
do str::as_c_str(Output) |Output| {
79+
do Triple.as_c_str |Triple| {
80+
do Feature.as_c_str |Feature| {
81+
do Output.as_c_str |Output| {
8282
let result = llvm::LLVMRustWriteOutputFile(
8383
PM,
8484
M,
@@ -263,16 +263,16 @@ pub mod write {
263263
output_type_bitcode => {
264264
if opts.optimize != session::No {
265265
let filename = output.with_filetype("no-opt.bc");
266-
str::as_c_str(filename.to_str(), |buf| {
267-
llvm::LLVMWriteBitcodeToFile(llmod, buf)
268-
});
266+
do filename.to_str().as_c_str |buf| {
267+
llvm::LLVMWriteBitcodeToFile(llmod, buf);
268+
}
269269
}
270270
}
271271
_ => {
272272
let filename = output.with_filetype("bc");
273-
str::as_c_str(filename.to_str(), |buf| {
274-
llvm::LLVMWriteBitcodeToFile(llmod, buf)
275-
});
273+
do filename.to_str().as_c_str |buf| {
274+
llvm::LLVMWriteBitcodeToFile(llmod, buf);
275+
}
276276
}
277277
}
278278
}
@@ -333,9 +333,9 @@ pub mod write {
333333
// Always output the bitcode file with --save-temps
334334

335335
let filename = output.with_filetype("opt.bc");
336-
str::as_c_str(filename.to_str(), |buf| {
336+
do filename.to_str().as_c_str |buf| {
337337
llvm::LLVMWriteBitcodeToFile(llmod, buf)
338-
});
338+
};
339339
// Save the assembly file if -S is used
340340
if output_type == output_type_assembly {
341341
WriteOutputFile(
@@ -391,13 +391,15 @@ pub mod write {
391391

392392
if output_type == output_type_llvm_assembly {
393393
// Given options "-S --emit-llvm": output LLVM assembly
394-
str::as_c_str(output.to_str(), |buf_o| {
395-
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o)});
394+
do output.to_str().as_c_str |buf_o| {
395+
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o);
396+
}
396397
} else {
397398
// If only a bitcode file is asked for by using the
398399
// '--emit-llvm' flag, then output it here
399-
str::as_c_str(output.to_str(),
400-
|buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) );
400+
do output.to_str().as_c_str |buf| {
401+
llvm::LLVMWriteBitcodeToFile(llmod, buf);
402+
}
401403
}
402404

403405
llvm::LLVMDisposeModule(llmod);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::str;
1211
use std::io;
1312

1413
use driver::session::{OptLevel, No, Less, Aggressive};
@@ -174,7 +173,7 @@ pub fn populate_pass_manager(sess: Session, pm: &mut PassManager, pass_list:&[~s
174173
}
175174

176175
pub fn create_pass(name:&str) -> Option<PassRef> {
177-
do str::as_c_str(name) |s| {
176+
do name.as_c_str |s| {
178177
unsafe {
179178
let p = llvm::LLVMCreatePass(s);
180179
if p.is_null() {

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use std::hashmap::HashMap;
1313
use std::libc::{c_uint, c_ushort};
1414
use std::option;
15-
use std::str;
1615

1716
use middle::trans::type_::Type;
1817

@@ -2287,10 +2286,9 @@ pub struct TargetData {
22872286
}
22882287

22892288
pub fn mk_target_data(string_rep: &str) -> TargetData {
2290-
let lltd =
2291-
str::as_c_str(string_rep, |buf| unsafe {
2292-
llvm::LLVMCreateTargetData(buf)
2293-
});
2289+
let lltd = do string_rep.as_c_str |buf| {
2290+
unsafe { llvm::LLVMCreateTargetData(buf) }
2291+
};
22942292

22952293
TargetData {
22962294
lltd: lltd,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ pub static tag_misc_info: uint = 0x7f;
180180
pub static tag_misc_info_crate_items: uint = 0x80;
181181

182182
pub static tag_item_method_provided_source: uint = 0x81;
183+
pub static tag_item_impl_vtables: uint = 0x82;
183184

184185
pub struct LinkMeta {
185186
name: @str,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use metadata::cstore;
1616
use metadata::decoder;
1717
use metadata;
1818
use middle::ty;
19+
use middle::typeck;
1920

2021
use std::vec;
2122
use reader = extra::ebml::reader;
@@ -216,6 +217,14 @@ pub fn get_impl_trait(tcx: ty::ctxt,
216217
decoder::get_impl_trait(cdata, def.node, tcx)
217218
}
218219

220+
// Given a def_id for an impl, return information about its vtables
221+
pub fn get_impl_vtables(tcx: ty::ctxt,
222+
def: ast::def_id) -> typeck::impl_res {
223+
let cstore = tcx.cstore;
224+
let cdata = cstore::get_crate_data(cstore, def.crate);
225+
decoder::get_impl_vtables(cdata, def.node, tcx)
226+
}
227+
219228
pub fn get_impl_method(cstore: @mut cstore::CStore,
220229
def: ast::def_id,
221230
mname: ast::ident)

0 commit comments

Comments
 (0)