Commit Graph

22537 Commits

Author SHA1 Message Date
Grigoriy
eb519b952d Fix example in std::Option 2013-09-21 02:00:20 +04:00
bors
a95604fcaa auto merge of #9276 : alexcrichton/rust/dox, r=brson
Hopefull this will make our libstd docs appear a little more "full".
2013-09-20 14:11:08 -07:00
bors
2fd3c07242 auto merge of #9278 : alexcrichton/rust/ndebug, r=brson
Many people will be very confused that their debug! statements aren't working
when they first use rust only to learn that they should have been building with
`--cfg debug` the entire time. This inverts the meaning of the flag to instead
of enabling debug statements, now it disables debug statements.

This way the default behavior is a bit more reasonable, and requires less
end-user configuration. Furthermore, this turns on debug by default when
building the rustc compiler.
2013-09-20 12:46:05 -07:00
Alex Crichton
833a64d76e Invert --cfg debug to --cfg ndebug
Many people will be very confused that their debug! statements aren't working
when they first use rust only to learn that they should have been building with
`--cfg debug` the entire time. This inverts the meaning of the flag to instead
of enabling debug statements, now it disables debug statements.

This way the default behavior is a bit more reasonable, and requires less
end-user configuration. Furthermore, this turns on debug by default when
building the rustc compiler.
2013-09-20 12:10:04 -07:00
Brian Anderson
5a0f7aaced Add a note about improved rustc perf to 0.8 relnotes 2013-09-20 11:49:27 -07:00
Brian Anderson
e2e1061814 Fix spelling and phrasing in 0.8 release notes 2013-09-20 11:47:53 -07:00
bors
ff0aaaf138 auto merge of #9338 : steveklabnik/rust/rustpkg_update_manpage, r=catamorphism
I didn't update the manpage when I added the init command. Whoops.
2013-09-20 11:21:07 -07:00
bors
b7bbc2eea2 auto merge of #9327 : larsbergstrom/rust/tutorial_installation_tweak, r=catamorphism
I've had multiple people whom I pointed at the Rust tutorial ask me where to download the snapshot compiler, so I made the text more explicit.
2013-09-20 09:56:09 -07:00
bors
f4479727a6 auto merge of #9337 : steveklabnik/rust/rustpkg_usage, r=catamorphism
When I took out the ability to make a new project by name, I forgot to
update the usage to reflect the changes.
2013-09-20 08:31:12 -07:00
bors
89cc8529cc auto merge of #9332 : eugals/rust/master, r=alexcrichton
It is intended to optimize/beautify the code generated in a few trivial trait operations.
Let's take the following code as an example:
```
trait Stuff {
    fn bar(&self);
}

fn callBar(s: &Stuff) {
    s.bar();
}

struct Foo;

impl Stuff for Foo {
    fn bar(&self) {
    }
}

pub fn main() {
    let o = Foo;
    callBar(&o as &Stuff);
}
```

At present it is translated into something like:
```
define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 {
"function top level":
  %__trait_callee = alloca { %tydesc*, i8* }
  %__auto_borrow_obj = alloca { %tydesc*, i8* }
  %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
  %3 = load %tydesc** %2
  %4 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0
  store %tydesc* %3, %tydesc** %4
  %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
  %6 = load i8** %5
  %7 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1
  store i8* %6, i8** %7
  %8 = bitcast { %tydesc*, i8* }* %__auto_borrow_obj to i8*
  %9 = bitcast { %tydesc*, i8* }* %__trait_callee to i8*
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %9, i8* %8, i32 8, i32 4, i1 false)
  %10 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 1
  %11 = load i8** %10
  %12 = bitcast i8* %11 to { i32, %tydesc*, i8*, i8*, i8 }*
  %13 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 0
  %14 = bitcast %tydesc** %13 to [1 x i8*]**
  %15 = load [1 x i8*]** %14
  %16 = getelementptr inbounds [1 x i8*]* %15, i32 0, i32 1
  %17 = load i8** %16
  %18 = bitcast i8* %17 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)*
  call void %18({ i32, %tydesc*, i8*, i8*, i8 }* %12)
  ret void
}

...

define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 {
"function top level":
  %o = alloca %struct.Foo
  %1 = alloca { %tydesc*, i8* }
  %__auto_borrow_obj = alloca { %tydesc*, i8* }
  %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
  %3 = bitcast i8** %2 to %struct.Foo**
  store %struct.Foo* %o, %struct.Foo** %3
  %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
  %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }**
  store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5
  %6 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
  %7 = load %tydesc** %6
  %8 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0
  store %tydesc* %7, %tydesc** %8
  %9 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
  %10 = load i8** %9
  %11 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1
  store i8* %10, i8** %11
  call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %__auto_borrow_obj)
  ret void
}
```

If you apply my patch, it would become way shorter and cleaner:
```
define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 {
"function top level":
  %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
  %3 = load i8** %2
  %4 = bitcast i8* %3 to { i32, %tydesc*, i8*, i8*, i8 }*
  %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
  %6 = bitcast %tydesc** %5 to [1 x i8*]**
  %7 = load [1 x i8*]** %6
  %8 = getelementptr inbounds [1 x i8*]* %7, i32 0, i32 1
  %9 = load i8** %8
  %10 = bitcast i8* %9 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)*
  call void %10({ i32, %tydesc*, i8*, i8*, i8 }* %4)
  ret void
}

...

define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 {
"function top level":
  %o = alloca %struct.Foo
  %1 = alloca { %tydesc*, i8* }
  %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
  %3 = bitcast i8** %2 to %struct.Foo**
  store %struct.Foo* %o, %struct.Foo** %3
  %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
  %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }**
  store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5
  call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %1)
  ret void
}
```

Although this change doesn't increase the compilation speed much (I mentioned only about 1-2% boost on "rustc -O -Z time-passes syntax.rs"), but I still think it's a good thing to do as it greatly simplifies/clarifies LL generated in some cases which would definitely help in the future code generation investigations.

I don't provide any new test cases in this patch as it is merely an optimization.

Sorry guys, I somehow messed my previous PR and I don't see any better way to fix as to recreate it here.
2013-09-20 07:06:13 -07:00
bors
44997a127b auto merge of #9326 : NiccosSystem/rust/master, r=bstrie 2013-09-20 04:56:09 -07:00
Huon Wilson
76a53911b4 Uncomment a test. Fixes #4449. 2013-09-20 21:47:57 +10:00
bors
176051c6f8 auto merge of #9322 : catamorphism/rust/rustpkg-discovered-outputs, r=brson
r? @brson as per #9112

Closes #9112
2013-09-20 03:26:10 -07:00
bors
ccb80ab4f7 auto merge of #9321 : chris-morgan/rust/lowercase-nan-methods, r=brson
This is for consistency in naming conventions.

- ``std::num::Float::NaN()`` is changed to ``nan()``;
- ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and
- ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``.

Fixes #9319.
2013-09-20 02:01:13 -07:00
bors
e5fdc7dee5 auto merge of #9320 : chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton
This is the second of two parts of #8991, now possible as a new snapshot
has been made. (The first part implemented the unreachable!() macro; it
was #8992, 6b7b8f2682.)

``std::util::unreachable()`` is removed summarily; any code which used
it should now use the ``unreachable!()`` macro.

Closes #9312.

Closes #8991.
2013-09-20 00:36:11 -07:00
bors
c7c769d8c2 auto merge of #9315 : thestinger/rust/doc, r=alexcrichton
This also renames the section, as managed vectors cannot be resized
(since it would invalidate the other references).
2013-09-19 23:11:19 -07:00
Daniel Micay
807725b995 util: remove unused with function 2013-09-20 00:59:02 -04:00
bors
7f826cb25a auto merge of #9308 : ben0x539/rust/lexer-error-spans, r=alexcrichton
Previously, the lexer calling `rdr.fatal(...)` would report the span of
the last complete token, instead of a span within the erroneous token
(besides one span fixed in 1ac90bb).

This branch adds wrappers around `rdr.fatal(...)` that sets the span
explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now
report the offending code more precisely. A number of tests try to
verify that, though the `compile-fail` testing setup can only check that
the spans are on the right lines, and the "unterminated string/block
comment" errors can't have the line marked at all, so that's incomplete.

This closes #9149.

Also, the lexer errors now report the offending code in the error message,
not just via the span, just like other errors do.
2013-09-19 21:46:45 -07:00
Brian Anderson
c767643f2b std::rt: Try stealing from all schedulers
This guarantees that if there is work to do it will be found
2013-09-19 19:48:58 -07:00
bors
407d179f4e auto merge of #9285 : sfackler/rust/future, r=alexcrichton
The `Drop` implementation was used to prevent `Future` from being implicitly copyable. Since `~fn`s are no longer copyable, this is no longer needed. I added a cfail test to make sure that this is actually the case.

I method-ized all of the `Future` creation methods and added a new one, `spawn_with`, which is similar to `task::spawn_with`.

I also got rid of some unused imports in tests.
2013-09-19 19:31:13 -07:00
Felix S. Klock II
4e543f7a93 fixed another test. 2013-09-20 03:15:21 +02:00
Felix S. Klock II
9627e80ce5 fix bug in test. 2013-09-20 03:09:57 +02:00
Felix S. Klock II
89b363de0c Resolves third bullet of #4691, and adds tests for it. Fix #4691. 2013-09-20 02:59:06 +02:00
Daniel Micay
9e3258e51f restore auto-detection of text files
We force the usage of LF line endings, but *only* in text files.
2013-09-19 19:06:05 -04:00
bors
570431fcac auto merge of #9342 : alexcrichton/rust/ignore-libuv-signal-tests, r=brson
They're causing syscalls to get interrupted, and std::io doesn't correctly
handle EINTR
2013-09-19 15:56:04 -07:00
Steven Fackler
963707f45d Clean up unused imports 2013-09-19 15:19:25 -07:00
Steven Fackler
48d5b4b8e1 Add Future::spawn_with 2013-09-19 15:19:25 -07:00
Steven Fackler
ff85389344 Modernize extra::future API 2013-09-19 15:19:20 -07:00
Alex Crichton
5165ecde66 Ignore io::process tests
They're causing syscalls to get interrupted, and std::io doesn't correctly
handle EINTR
2013-09-19 15:17:29 -07:00
Benjamin Herr
567c567b2d lexer: further slight improvements to lexer errors 2013-09-19 23:08:06 +02:00
Steve Klabnik
ad5f619d8a Update rustpkg manpage to add init.
I didn't update the manpage when I added the init command. Whoops.
2013-09-19 12:58:29 -07:00
Steve Klabnik
806105fea8 Fix usage for rustpkg init
When I took out the ability to make a new project by name, I forgot to
update the usage to reflect the changes.
2013-09-19 12:53:38 -07:00
bors
85c0fb7b8a auto merge of #9295 : alexcrichton/rust/fix-lang-items, r=thestinger
Also add a test to help prevent this from getting out of sync again.
2013-09-19 11:11:01 -07:00
Evgeny Sologubov
fadc6cc4b0 pacified test/run-pass/core-run-destroy on Win7x64 2013-09-19 21:25:27 +04:00
bors
755f6229da auto merge of #9279 : erickt/rust/master, r=alexcrichton
`Some(5).or_{default,zero}` can be easily replaced with `Some(Some(5).unwrap_or_default())`.
2013-09-19 09:55:59 -07:00
Steven Fackler
2df5a13334 Removed future's destructor
It was only there to prevent Future from being copyable, but it's
noncopyable anyways since it contains a ~fn.
2013-09-19 09:06:42 -07:00
Lars Bergstrom
9051a35fc8 Clarify that snapshots are automatically retrieved. 2013-09-19 10:58:26 -05:00
bors
068e04231d auto merge of #9313 : brson/rust/relnotes, r=thestinger 2013-09-19 08:40:59 -07:00
NiccosSystem
5708b91969 Fix broken tutorial link 2013-09-19 17:18:40 +02:00
Benjamin Herr
8009c97a55 lexer: report problematic chars verbatim or as escape sequence
... instead of giving their numeric codepoint, following the lead of
fdaae34. So the error message for, say, '\_' mentions _ instead of 95,
and '\●' now mentions \u25cf.
2013-09-19 16:58:49 +02:00
Benjamin Herr
1019177958 lexer: show correct span on lexical errors
Previously, the lexer calling `rdr.fatal(...)` would report the span of
the last complete token, instead of a span within the erroneous token
(besides one span fixed in 1ac90bb).

This commit adds a wrapper around `rdr.fatal(...)` that sets the span
explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now
report the offending code more precisely. A number of tests try to
verify that, though the `compile-fail` testing setup can only check that
the spans are on the right lines, and the "unterminated string/block
comment" errors can't have the line marked at all, so that's incomplete.

Closes #9149.
2013-09-19 16:58:11 +02:00
U-NOV2010\eugals
0c3b6ad6b8 will not copy trait_callee on stack if it's source expr is a plain borrowed ref 2013-09-19 18:34:30 +04:00
U-NOV2010\eugals
dfa3f5fa8d minor Type::opaque_trait code cleanup 2013-09-19 18:34:26 +04:00
U-NOV2010\eugals
2927ab13df optimized trans_to_datum::auto_borrow_obj code generation in case some trivial cases where simple copying can be applied 2013-09-19 18:34:23 +04:00
bors
da29a8e6be auto merge of #9299 : alexcrichton/rust/fmt-trailing-comma, r=huonw
This is more consistent with other parts of the language and it also makes it
easier to use in situations where format string is massive.
2013-09-19 07:06:04 -07:00
Chris Morgan
d9874c0885 Rename the NaN and is_NaN methods to lowercase.
This is for consistency in naming conventions.

- ``std::num::Float::NaN()`` is changed to ``nan()``;
- ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and
- ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``.

Fixes #9319.
2013-09-19 23:59:51 +10:00
bors
99ec14dbb0 auto merge of #9267 : Kimundi/rust/master, r=huonw 2013-09-19 05:06:00 -07:00
Marvin Löbel
06d1dccf95 Turned extra::getopts functions into methods
Some minor api and doc adjustments
2013-09-19 12:32:18 +02:00
bors
4904bc33cc auto merge of #9292 : blake2-ppc/rust/borrow-ref-eq, r=huonw
std::borrow: Use raw pointer comparison for `ref_eq`

Compare as `*T` in `ref_eq` instead of casting to uint, to match what
std::ptr does.
2013-09-19 03:01:05 -07:00
bors
a7cf7b7b0b auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichton
This is my first contribution, so please point out anything that I may have missed.

I consulted IRC and settled on `match () { ... }` for most of the replacements.
2013-09-19 00:31:05 -07:00