Skip to content

Commit ab050f0

Browse files
committed
---
yaml --- r: 146076 b: refs/heads/try2 c: 3675e42 h: refs/heads/master v: v3
1 parent 864b918 commit ab050f0

File tree

17 files changed

+147
-126
lines changed

17 files changed

+147
-126
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: 6dd6623b71ccee5b24117fa14df2bf3e5533e0c7
8+
refs/heads/try2: 3675e42334e9e58ae16446f52b2c6c951e8e1628
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/glob.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,32 @@ pub struct GlobIterator {
3939
priv todo: ~[(Path,uint)]
4040
}
4141

42-
///
43-
/// Return an iterator that produces all the Paths that match the given pattern,
44-
/// which may be absolute or relative to the current working directory.
45-
///
46-
/// is method uses the default match options and is equivalent to calling
47-
/// `glob_with(pattern, MatchOptions::new())`. Use `glob_with` directly if you
48-
/// want to use non-default match options.
49-
///
50-
/// # Example
51-
///
52-
/// Consider a directory `/media/pictures` containing only the files `kittens.jpg`,
53-
/// `puppies.jpg` and `hamsters.gif`:
54-
///
55-
/// ```rust
56-
/// for path in glob("/media/pictures/*.jpg") {
57-
/// println(path.to_str());
58-
/// }
59-
/// ```
60-
///
61-
/// The above code will print:
62-
///
63-
/// ```
64-
/// /media/pictures/kittens.jpg
65-
/// /media/pictures/puppies.jpg
66-
/// ```
67-
///
42+
/**
43+
* Return an iterator that produces all the Paths that match the given pattern,
44+
* which may be absolute or relative to the current working directory.
45+
*
46+
* This method uses the default match options and is equivalent to calling
47+
* `glob_with(pattern, MatchOptions::new())`. Use `glob_with` directly if you
48+
* want to use non-default match options.
49+
*
50+
* # Example
51+
*
52+
* Consider a directory `/media/pictures` containing only the files `kittens.jpg`,
53+
* `puppies.jpg` and `hamsters.gif`:
54+
*
55+
* ```rust
56+
* for path in glob("/media/pictures/*.jpg") {
57+
* println(path.to_str());
58+
* }
59+
* ```
60+
*
61+
* The above code will print:
62+
*
63+
* ```
64+
* /media/pictures/kittens.jpg
65+
* /media/pictures/puppies.jpg
66+
* ```
67+
*/
6868
pub fn glob(pattern: &str) -> GlobIterator {
6969
glob_with(pattern, MatchOptions::new())
7070
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,8 +2797,8 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
27972797

27982798
ifn!(intrinsics, "llvm.fabs.f32", [Type::f32()], Type::f32());
27992799
ifn!(intrinsics, "llvm.fabs.f64", [Type::f64()], Type::f64());
2800-
ifn!(intrinsics, "llvm.copysign.f32", [Type::f32(), Type::f32()], Type::f32());
2801-
ifn!(intrinsics, "llvm.copysign.f64", [Type::f64(), Type::f64()], Type::f64());
2800+
ifn!(intrinsics, "llvm.copysign.f32", [Type::f32()], Type::f32());
2801+
ifn!(intrinsics, "llvm.copysign.f64", [Type::f64()], Type::f64());
28022802

28032803
ifn!(intrinsics, "llvm.floor.f32",[Type::f32()], Type::f32());
28042804
ifn!(intrinsics, "llvm.floor.f64",[Type::f64()], Type::f64());
@@ -2807,12 +2807,12 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
28072807
ifn!(intrinsics, "llvm.trunc.f32",[Type::f32()], Type::f32());
28082808
ifn!(intrinsics, "llvm.trunc.f64",[Type::f64()], Type::f64());
28092809

2810-
ifn!(intrinsics, "llvm.rint.f32", [Type::f32()], Type::f32());
2811-
ifn!(intrinsics, "llvm.rint.f64", [Type::f64()], Type::f64());
2812-
ifn!(intrinsics, "llvm.nearbyint.f32", [Type::f32()], Type::f32());
2813-
ifn!(intrinsics, "llvm.nearbyint.f64", [Type::f64()], Type::f64());
2814-
ifn!(intrinsics, "llvm.round.f32", [Type::f32()], Type::f32());
2815-
ifn!(intrinsics, "llvm.round.f64", [Type::f64()], Type::f64());
2810+
ifn!(intrinsics, "llvm.rint.f32",[Type::f64()], Type::f64());
2811+
ifn!(intrinsics, "llvm.rint.f64",[Type::f64()], Type::f64());
2812+
ifn!(intrinsics, "llvm.nearbyint.f32",[Type::f64()], Type::f64());
2813+
ifn!(intrinsics, "llvm.nearbyint.f64",[Type::f64()], Type::f64());
2814+
ifn!(intrinsics, "llvm.round.f32",[Type::f64()], Type::f64());
2815+
ifn!(intrinsics, "llvm.round.f64",[Type::f64()], Type::f64());
28162816

28172817
ifn!(intrinsics, "llvm.ctpop.i8", [Type::i8()], Type::i8());
28182818
ifn!(intrinsics, "llvm.ctpop.i16",[Type::i16()], Type::i16());

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,20 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
460460
"fmaf64" => simple_llvm_intrinsic(bcx, "llvm.fma.f64", 3),
461461
"fabsf32" => simple_llvm_intrinsic(bcx, "llvm.fabs.f32", 1),
462462
"fabsf64" => simple_llvm_intrinsic(bcx, "llvm.fabs.f64", 1),
463-
"copysignf32" => simple_llvm_intrinsic(bcx, "llvm.copysign.f32", 2),
464-
"copysignf64" => simple_llvm_intrinsic(bcx, "llvm.copysign.f64", 2),
463+
"copysignf32" => simple_llvm_intrinsic(bcx, "llvm.copysign.f32", 1),
464+
"copysignf64" => simple_llvm_intrinsic(bcx, "llvm.copysign.f64", 1),
465465
"floorf32" => simple_llvm_intrinsic(bcx, "llvm.floor.f32", 1),
466466
"floorf64" => simple_llvm_intrinsic(bcx, "llvm.floor.f64", 1),
467467
"ceilf32" => simple_llvm_intrinsic(bcx, "llvm.ceil.f32", 1),
468468
"ceilf64" => simple_llvm_intrinsic(bcx, "llvm.ceil.f64", 1),
469469
"truncf32" => simple_llvm_intrinsic(bcx, "llvm.trunc.f32", 1),
470470
"truncf64" => simple_llvm_intrinsic(bcx, "llvm.trunc.f64", 1),
471-
"rintf32" => simple_llvm_intrinsic(bcx, "llvm.rint.f32", 1),
472471
"rintf64" => simple_llvm_intrinsic(bcx, "llvm.rint.f64", 1),
473-
"nearbyintf32" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f32", 1),
474-
"nearbyintf64" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f64", 1),
475-
"roundf32" => simple_llvm_intrinsic(bcx, "llvm.round.f32", 1),
476-
"roundf64" => simple_llvm_intrinsic(bcx, "llvm.round.f64", 1),
472+
"rintf32" => simple_llvm_intrinsic(bcx, "llvm.rint.f32", 1),
473+
"nearbyintf32" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f64", 1),
474+
"nearbyintf64" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f32", 1),
475+
"roundf32" => simple_llvm_intrinsic(bcx, "llvm.round.f64", 1),
476+
"roundf64" => simple_llvm_intrinsic(bcx, "llvm.round.f32", 1),
477477
"ctpop8" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i8", 1),
478478
"ctpop16" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i16", 1),
479479
"ctpop32" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i32", 1),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3809,8 +3809,8 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
38093809
}
38103810
"fabsf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
38113811
"fabsf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
3812-
"copysignf32" => (0, ~[ ty::mk_f32(), ty::mk_f32() ], ty::mk_f32()),
3813-
"copysignf64" => (0, ~[ ty::mk_f64(), ty::mk_f64() ], ty::mk_f64()),
3812+
"copysignf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
3813+
"copysignf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
38143814
"floorf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
38153815
"floorf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
38163816
"ceilf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),

branches/try2/src/libstd/fmt/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ use rt::io::Decorator;
466466
use rt::io::mem::MemWriter;
467467
use rt::io;
468468
use str;
469-
use sys;
469+
use repr;
470470
use util;
471471
use vec;
472472

@@ -1087,17 +1087,13 @@ impl<T> Poly for T {
10871087
fn fmt(t: &T, f: &mut Formatter) {
10881088
match (f.width, f.precision) {
10891089
(None, None) => {
1090-
// XXX: sys::log_str should have a variant which takes a stream
1091-
// and we should directly call that (avoids unnecessary
1092-
// allocations)
1093-
let s = sys::log_str(t);
1094-
f.buf.write(s.as_bytes());
1090+
repr::write_repr(f.buf, t);
10951091
}
10961092

10971093
// If we have a specified width for formatting, then we have to make
10981094
// this allocation of a new string
10991095
_ => {
1100-
let s = sys::log_str(t);
1096+
let s = repr::repr_to_str(t);
11011097
f.pad(s);
11021098
}
11031099
}

branches/try2/src/libstd/os.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@ pub fn self_exe_path() -> Option<Path> {
546546
load_self().and_then(|path| Path::new_opt(path).map(|mut p| { p.pop(); p }))
547547
}
548548

549+
550+
/**
551+
* Returns the path to the user's home directory, if known.
552+
}
553+
554+
549555
/**
550556
* Returns the path to the user's home directory, if known.
551557
*

branches/try2/src/libstd/repr.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,16 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) {
616616
}
617617
}
618618

619+
pub fn repr_to_str<T>(t: &T) -> ~str {
620+
use str;
621+
use rt::io;
622+
use rt::io::Decorator;
623+
624+
let mut result = io::mem::MemWriter::new();
625+
write_repr(&mut result as &mut io::Writer, t);
626+
str::from_utf8_owned(result.inner())
627+
}
628+
619629
#[cfg(test)]
620630
struct P {a: int, b: f64}
621631

branches/try2/src/libstd/sys.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,7 @@
1515
use c_str::ToCStr;
1616
use libc::size_t;
1717
use libc;
18-
use repr;
1918
use rt::task;
20-
use str;
21-
22-
pub fn log_str<T>(t: &T) -> ~str {
23-
use rt::io;
24-
use rt::io::Decorator;
25-
26-
let mut result = io::mem::MemWriter::new();
27-
repr::write_repr(&mut result as &mut io::Writer, t);
28-
str::from_utf8_owned(result.inner())
29-
}
3019

3120
/// Trait for initiating task failure.
3221
pub trait FailWithCause {

branches/try2/src/libstd/unstable/intrinsics.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ extern "rust-intrinsic" {
330330

331331
pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
332332

333+
#[cfg(not(stage0))]
334+
pub fn frame_address(f: &fn(*u8));
335+
333336
/// Get the address of the `__morestack` stack growth function.
334337
pub fn morestack_addr() -> *();
335338

@@ -411,9 +414,9 @@ extern "rust-intrinsic" {
411414
pub fn fabsf64(x: f64) -> f64;
412415

413416
#[cfg(not(stage0))]
414-
pub fn copysignf32(x: f32, y: f32) -> f32;
417+
pub fn copysignf32(x: f32) -> f32;
415418
#[cfg(not(stage0))]
416-
pub fn copysignf64(x: f64, y: f64) -> f64;
419+
pub fn copysignf64(x: f64) -> f64;
417420

418421
pub fn floorf32(x: f32) -> f32;
419422
pub fn floorf64(x: f64) -> f64;

branches/try2/src/libsyntax/ext/deriving/to_str.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt,
4040
}
4141

4242
// It used to be the case that this deriving implementation invoked
43-
// std::sys::log_str, but this isn't sufficient because it doesn't invoke the
44-
// to_str() method on each field. Hence we mirror the logic of the log_str()
45-
// method, but with tweaks to call to_str() on sub-fields.
43+
// std::repr::repr_to_str, but this isn't sufficient because it
44+
// doesn't invoke the to_str() method on each field. Hence we mirror
45+
// the logic of the repr_to_str() method, but with tweaks to call to_str()
46+
// on sub-fields.
4647
fn to_str_substructure(cx: @ExtCtxt, span: Span,
4748
substr: &Substructure) -> @Expr {
4849
let to_str = cx.ident_of("to_str");

branches/try2/src/libsyntax/parse/lexer.rs

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -373,49 +373,49 @@ pub fn is_block_non_doc_comment(s: &str) -> bool {
373373
fn consume_block_comment(rdr: @mut StringReader)
374374
-> Option<TokenAndSpan> {
375375
// block comments starting with "/**" or "/*!" are doc-comments
376-
let is_doc_comment = rdr.curr == '*' || rdr.curr == '!';
377-
let start_bpos = rdr.pos - BytePos(if is_doc_comment {3u} else {2u});
378-
379-
let mut level: int = 1;
380-
while level > 0 {
381-
if is_eof(rdr) {
382-
let msg = if is_doc_comment {
383-
~"unterminated block doc-comment"
384-
} else {
385-
~"unterminated block comment"
386-
};
387-
fatal_span(rdr, start_bpos, rdr.last_pos, msg);
388-
} else if rdr.curr == '/' && nextch(rdr) == '*' {
389-
level += 1;
390-
bump(rdr);
391-
bump(rdr);
392-
} else if rdr.curr == '*' && nextch(rdr) == '/' {
393-
level -= 1;
394-
bump(rdr);
376+
let res = if rdr.curr == '*' || rdr.curr == '!' {
377+
let start_bpos = rdr.pos - BytePos(3u);
378+
while !(rdr.curr == '*' && nextch(rdr) == '/') && !is_eof(rdr) {
395379
bump(rdr);
380+
}
381+
if is_eof(rdr) {
382+
fatal_span(rdr, start_bpos, rdr.last_pos,
383+
~"unterminated block doc-comment");
396384
} else {
397385
bump(rdr);
386+
bump(rdr);
387+
do with_str_from(rdr, start_bpos) |string| {
388+
// but comments with only "*"s between two "/"s are not
389+
if !is_block_non_doc_comment(string) {
390+
Some(TokenAndSpan{
391+
tok: token::DOC_COMMENT(str_to_ident(string)),
392+
sp: codemap::mk_sp(start_bpos, rdr.pos)
393+
})
394+
} else {
395+
None
396+
}
397+
}
398398
}
399-
}
400-
401-
let res = if is_doc_comment {
402-
do with_str_from(rdr, start_bpos) |string| {
403-
// but comments with only "*"s between two "/"s are not
404-
if !is_block_non_doc_comment(string) {
405-
Some(TokenAndSpan{
406-
tok: token::DOC_COMMENT(str_to_ident(string)),
407-
sp: codemap::mk_sp(start_bpos, rdr.pos)
408-
})
399+
} else {
400+
let start_bpos = rdr.last_pos - BytePos(2u);
401+
loop {
402+
if is_eof(rdr) {
403+
fatal_span(rdr, start_bpos, rdr.last_pos,
404+
~"unterminated block comment");
405+
}
406+
if rdr.curr == '*' && nextch(rdr) == '/' {
407+
bump(rdr);
408+
bump(rdr);
409+
break;
409410
} else {
410-
None
411+
bump(rdr);
411412
}
412413
}
413-
} else {
414414
None
415415
};
416-
417416
// restart whitespace munch.
418-
if res.is_some() { res } else { consume_whitespace_and_comments(rdr) }
417+
418+
if res.is_some() { res } else { consume_whitespace_and_comments(rdr) }
419419
}
420420

421421
fn scan_exponent(rdr: @mut StringReader, start_bpos: BytePos) -> Option<~str> {
@@ -1056,12 +1056,4 @@ mod test {
10561056
assert!(!is_line_non_doc_comment("/// blah"));
10571057
assert!(is_line_non_doc_comment("////"));
10581058
}
1059-
1060-
#[test] fn nested_block_comments() {
1061-
let env = setup(@"/* /* */ */'a'");
1062-
let TokenAndSpan {tok, sp: _} =
1063-
env.string_reader.next_token();
1064-
assert_eq!(tok,token::LIT_CHAR('a' as u32));
1065-
}
1066-
10671059
}

branches/try2/src/snapshots.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
S 2013-10-21 6e6981c
2-
freebsd-x86_64 7f630581d0e881483272140e84bc2f494daf6204
3-
linux-i386 5c754455610013bbe448e8f6ef8ba1a05b167919
4-
linux-x86_64 d993920210413add241f7b235dec0e4d72164be5
5-
macos-i386 8b48d8598f4d503e6bbc40bff52457c659d6de2b
6-
macos-x86_64 e84bcd0b08af6a0ff602dca7a5bec21a001c5eb8
7-
winnt-i386 3f4441509f89a794ec9b53e38756e6124df78df0
8-
91
S 2013-10-16 6c08cc2
102
freebsd-x86_64 03caf882078eff9b4e04d116732b41a3cdfc260f
113
linux-i386 ce30bb90434e9eb9920028a5408e1f986ba2ad5d
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2012 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+
// error-pattern:
12+
13+
/* This is a test to ensure that we do _not_ support nested/balanced comments. I know you might be
14+
thinking "but nested comments are cool", and that would be a valid point, but they are also a
15+
thing that would make our lexical syntax non-regular, and we do not want that to be true.
16+
17+
omitting-things at a higher level (tokens) should be done via token-trees / macros,
18+
not comments.
19+
20+
/*
21+
fail here
22+
*/
23+
*/
24+
25+
fn main() {
26+
}

0 commit comments

Comments
 (0)