Commit Graph

22620 Commits

Author SHA1 Message Date
Huon Wilson
fb923c7d3f std: merge rand::{Rng,RngUtil} with default methods.
Also, documentation & general clean-up:
- remove `gen_char_from`: better served by `sample` or `choose`.
- `gen_bytes` generalised to `gen_vec`.
- `gen_int_range`/`gen_uint_range` merged into `gen_integer_range` and
  made to be properly uniformly distributed. Fixes #8644.

Minor adjustments to other functions.
2013-09-23 00:11:42 +10:00
Huon Wilson
884c1e112d std: move rand.rs to rand/mod.rs. 2013-09-22 21:39:23 +10:00
Birunthan Mohanathas
2ab278f130 Reserve the alignof, offsetof, and sizeof keywords
Closes #9333.
2013-09-22 10:47:36 +03:00
bors
07167826d6 auto merge of #9395 : brson/rust/0.8, r=alexcrichton 2013-09-22 00:25:56 -07:00
bors
eabcb39f8d auto merge of #9401 : bytbox/rust/master, r=thestinger
Along with a tiny bit of cleanup in rust.vim.
2013-09-21 22:20:56 -07:00
Scott Lawrence
72633a2af2 Remove 'copy' from syntax files, as it's no longer a keyword 2013-09-22 00:29:45 -04:00
bors
d72e3328ac auto merge of #9399 : brson/rust/tinfo, r=thestinger
The right way to link to terminfo varies by linux distribution, so
this is making our snapshots less compatible.
2013-09-21 20:40:55 -07:00
bors
11f68f51f0 auto merge of #9353 : brson/rust/sched, r=alexcrichton,cmr
This guarantees that if there is work to do it will be found
2013-09-21 18:31:01 -07:00
Brian Anderson
597e96b549 Pass --disable-terminfo to LLVM's configure script. Closes #9334
The right way to link to terminfo varies by linux distribution, so
this is making our snapshots less compatible.
2013-09-21 18:01:11 -07:00
bors
635a381896 auto merge of #9366 : olsonjeffery/rust/file_io_doc_cleanup, r=brson
fixing spew that @achricto was nice enough to point out to me
2013-09-21 17:06:03 -07:00
Brian Anderson
695cb9fc2b Update version numbers to 0.8 2013-09-21 16:25:08 -07:00
Jeff Olson
c6e5b86db6 std: add file::io::test module and ensure correct build 2013-09-21 14:15:58 -07:00
Jeff Olson
6ebb364d80 std: cleanup file::io rustdoc_ng output 2013-09-21 14:15:58 -07:00
bors
5b3dfb0fe8 auto merge of #9393 : alexcrichton/rust/fix-docs, r=brson
This needs libstd in its proper location to resolve references when generating
docs for libextra.
2013-09-21 13:30:57 -07:00
Alex Crichton
02b27b2998 Fix the dependencies of rustdoc_ng doc generation
This needs libstd in its proper location to resolve references when generating
docs for libextra.
2013-09-21 13:25:33 -07:00
bors
44dc3fba8b auto merge of #9380 : thestinger/rust/par, r=alexcrichton
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 10:10:56 -07:00
bors
d3e6889060 auto merge of #9381 : luisbg/rust/master, r=cmr
Closes #9379
2013-09-21 08:10:55 -07:00
bors
650100dfbf auto merge of #9369 : sebcrozet/rust/f64_inline, r=thestinger
This was, somehow, missed by #8332.
2013-09-21 06:05:56 -07:00
bors
030fffa57c auto merge of #9368 : StrLght/rust/master, r=thestinger 2013-09-21 04:45:57 -07:00
bors
b094cf48e1 auto merge of #9360 : huonw/rust/4449, r=pnkfelix
Fixes #4449. (Ran it through try-bsd: http://buildbot.rust-lang.org/builders/try-bsd/builds/451)
2013-09-21 02:56:01 -07:00
bors
55f528f5af auto merge of #9354 : thestinger/rust/cleanup, r=alexcrichton
I don't see the point of this function, and there are no users.
2013-09-21 01:35:59 -07:00
bors
db78fdc10c auto merge of #9374 : alexcrichton/rust/rustdoc-web, r=cmr
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.

Previews
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/

Missing features
* Different versions of documentation on the same page (all possibly indexed as well?) I think that this needs to be thought out before action is taken. It's an awesome idea, but it should be done carefully.
* Source links are missing. This is a little dependent on getting versions working. In theory we should link back to github, but we should always link back to the exact version the documentation was generated from.
* Integration with other tools. It would be awesome to have rustpkg-style inference of the package name and version so they don't have to be specified anywhere. Additionally, I should be able to build documentation for a pkgid, not necessarily a crate file.

cc @cmr/@Seldaek
2013-09-21 00:16:02 -07:00
Alex Crichton
4fd061c426 Implement a web backend for rustdoc_ng
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.
2013-09-20 22:49:03 -07:00
Luis de Bethencourt
e98bd9bb68 Document a few undocumented methos in Vector
Closes #9379
2013-09-21 01:21:08 -04:00
Daniel Micay
e753618b6b drop extra::par
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 01:02:56 -04:00
bors
e268c7fcc5 auto merge of #9350 : pnkfelix/rust/fsk-issue-4691-catch-bad-fsu-during-compute-moves, r=nikomatsakis
Resolves third bullet of #4691: if the functional-struct-update (FSU) expression `{ a: b, ..s }` causes `s` to move and `s` has a destructor, then the expression is illegal.

r? @nikomatsakis
2013-09-20 20:26:02 -07:00
bors
58424ebcb9 auto merge of #9349 : brson/rust/relnotes, r=thestinger 2013-09-20 18:01:04 -07:00
bors
c29e76b2a3 auto merge of #9371 : thestinger/rust/text, r=pnkfelix
We force the usage of LF line endings, but *only* in text files.
2013-09-20 16:11:04 -07:00
Sébastien Crozet
7cb0c6392b std: add missing #[inline] annotation to the f64 neg method.
This was, somehow, missed by #8332.
2013-09-21 00:23:49 +02:00
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