Commit Graph

28420 Commits

Author SHA1 Message Date
bors
de78d7f56c auto merge of #12922 : luqmana/rust/fix-arm, r=alexcrichton 2014-03-15 17:51:35 -07:00
Brian Anderson
94078f750a mk: Clean libbacktrace w/ gusto
After `make clean' I'm seeing the build break with

```
cp: cannot stat ‘x86_64-unknown-linux-gnu/rt/libbacktrace/.libs/libbacktrace.a’: No such file or directory
```

Deleteing the libbacktrace dir entirely on clean fixes.
2014-03-15 17:48:04 -07:00
bors
4444f49f63 auto merge of #12921 : alexcrichton/rust/no-extra, r=sfackler
Forgot to remove this as part of the previous removal of libextra
2014-03-15 16:11:32 -07:00
Florian Zeitz
ce2ce2410f num: Migrate ~[T] to std::vec_ng::Vec 2014-03-16 00:01:49 +01:00
Florian Zeitz
f496ab6a6f num: Slightly optimize bigint 2014-03-16 00:01:49 +01:00
Luqman Aden
15b962a9b9 libstd: Fix a typo. s/target_os/target_arch/ 2014-03-15 18:45:26 -04:00
Steven Fackler
a37ca8ce38 Remove ~[] from libsemver 2014-03-15 15:41:51 -07:00
Alex Crichton
cdd8d4854e doc: Remove reference to the 'extra' library
Forgot to remove this as part of the previous removal of libextra
2014-03-15 15:37:16 -07:00
Steven Fackler
b1f523525a Remove most ~[] usage in liburl 2014-03-15 15:13:00 -07:00
bors
5cd17b8150 auto merge of #12918 : sfackler/rust/doc-html-attr, r=alexcrichton 2014-03-15 14:31:38 -07:00
Steven Fackler
9106c15ffd Add rustdoc html crate info 2014-03-15 14:26:12 -07:00
bors
352c5e7eb7 auto merge of #12908 : alexcrichton/rust/issue-12897, r=thestinger
This is mostly just an implementation detail, and anyone worried about the stack
bounds doesn't need to be bothered with the red zone because it's not usable
anyway.

Closes #12897
2014-03-15 02:21:26 -07:00
bors
1d828eb3a4 auto merge of #12906 : sfackler/rust/timespec-total, r=thestinger 2014-03-15 00:46:28 -07:00
bors
fc7a112808 auto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brson
This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576
2014-03-14 23:11:31 -07:00
Alex Crichton
bf67783332 green: Don't return the red zone in stack_bounds()
This is mostly just an implementation detail, and anyone worried about the stack
bounds doesn't need to be bothered with the red zone because it's not usable
anyway.

Closes #12897
2014-03-14 22:46:13 -07:00
Steven Fackler
8e53d61afe Implement TotalEq and TotalOrd for Timespec
There's a test making sure that Ord works, so the order dependence
shouldn't be an issue
2014-03-14 21:57:47 -07:00
bors
2682c47dfb auto merge of #12895 : michaelwoerister/rust/limited-debuginfo, r=alexcrichton
Very minor modification of just one test case. Fixes #12787.
2014-03-14 21:36:26 -07:00
bors
1218f6db77 auto merge of #12887 : huonw/rust/danger-guide, r=alexcrichton
docs: begin a "low-level & unsafe code" guide.

This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.
2014-03-14 20:01:32 -07:00
Huon Wilson
3d6c28acd0 docs: begin a "low-level & unsafe code" guide.
This aims to cover the basics of writing safe unsafe code. At the moment
it is just designed to be a better place for the `asm!()` docs than the
detailed release notes wiki page, and I took the time to write up some
other things.

More examples are needed, especially of things that can subtly go wrong;
and vast areas of `unsafe`-ty aren't covered, e.g. `static mut`s and
thread-safety in general.
2014-03-15 13:51:53 +11:00
bors
58fb492f9c auto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmana
The two commits have the details of the two fixes
2014-03-14 18:26:30 -07:00
bors
76e0e26603 auto merge of #12888 : aochagavia/rust/Fix-comment, r=alexcrichton
The old comment of as_mut_slice() did not describe the function correctly. The new one does.

Also refactored option::iter() and option::mut_iter() to use as_ref() and as_mut() instead of match.
2014-03-14 16:51:26 -07:00
bors
26fdfa124c auto merge of #12878 : crabtw/rust/mips, r=alexcrichton
I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.

By the way, the patched LLVM doesn't have MIPS split stack anymore.
Should I file an issue about that?
2014-03-14 15:16:31 -07:00
Alex Crichton
58e4ab2b33 extra: Put the nail in the coffin, delete libextra
This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576
2014-03-14 13:59:02 -07:00
bors
42fc32f293 auto merge of #12869 : thestinger/rust/cmp, r=brson
The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712
2014-03-14 13:41:36 -07:00
Daniel Micay
4e1c2158f2 cmp: switch min and max to TotalOrd
The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712
2014-03-14 15:26:05 -04:00
Michael Woerister
de03900464 debuginfo: Make limited-debuginfo test case more robust against GDB output variations.
Fixes issue #12787.
2014-03-14 19:11:02 +01:00
Alex Crichton
8e5ca4b793 std: Fix backtraces on arm linux
On android, libgcc is missing the _Unwind_GetIP symbol because it's defined as a
macro. This is the same case for arm linux, so this commit adds the necessary
cfgs in place to use the "expanded macro" in rust for arm linux.
2014-03-14 10:34:29 -07:00
Alex Crichton
770b6e2fc2 rustc: Fix cfg(not(a, b)) to be not(a && b)
Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`,
but this isn't very useful because that can already be expressed as
`cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which
is more symmetrical of the rest of the `cfg` attribute.

Put another way, I would expect `cfg(clause)` to be the opposite of
`cfg(not(clause))`, but this is not currently the case with multiple element
clauses.
2014-03-14 10:32:22 -07:00
aochagavia
a7d3637f67 Refactored iter and mut_iter
Replaced match by self.as_ref() and self.as_mut()
2014-03-14 17:29:47 +01:00
bors
e99d523707 auto merge of #12880 : tedhorst/rust/master, r=alexcrichton
Fix a test that was missed in the chan/port renaming (PR #12815).  This was missed because it is skipped on linux and windows, and the mac bots were moving at the time the PR landed.
2014-03-14 09:16:35 -07:00
aochagavia
dcf320a639 Fixed comment of as_mut_slice (libstd/option.rs)
The old comment did not describe the function correctly
2014-03-14 16:32:04 +01:00
bors
2585803ec1 auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis
# Summary

This patch introduces the `_` token into the type grammar, with the meaning "infer this type".
With this change, the following two lines become equivalent:
```
let x = foo();
let x: _ = foo();
```
But due to its composability, it enables partial type hints like this:
```
let x: Bar<_> = baz();
```

Using it on the item level is explicitly forbidden, as the Rust language does not enable global type inference by design.

This implements the feature requested in https://github.com/mozilla/rust/issues/9508.

# Things requiring clarification

- The change to enable it is very small, but I have only limited understanding of the related code, so the approach here might be wrong.
  - In particular, while this patch works, it does so in a way not originally intended according to the code comments.
- This probably needs more tests, or rather feedback for which tests are still missing.
- I'm unsure how this interacts with lifetime parameters, and whether it is correct in regard to them.
- Partial type hints on the right side of `as` like `&foo as *_` work in both a normal function contexts and in constexprs like `static foo: *int = &'static 123 as *_`. The question is whether this should be allowed in general.

# Todo for this PR

- The manual and tutorial still needs updating.

# Bugs I'm unsure how to fix

- Requesting inference for the top level of the right hand side of a `as` fails to infer correctly, even if all possible hints are given:

  ```
.../type_hole_1.rs:35:18: 35:22 error: the type of this value must be known in this context
.../type_hole_1.rs:35     let a: int = 1u32 as _;
                                           ^~~~
```
2014-03-14 08:01:28 -07:00
Marvin Löbel
eb69eb36f8 Added support for type placeholders (explicit requested type
inference in a type with `_` ). This enables partial type inference.
2014-03-14 14:57:31 +01:00
bors
339f8163d6 auto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brson
Add some more infrastructure support for demangling `$`-sequences, as well as fixing demangling of closure symbol names if there's more than one closure in a function.
2014-03-14 06:41:26 -07:00
bors
a1c7ebee1a auto merge of #12874 : huonw/rust/printier-rustc, r=alexcrichton
rustc: make stack traces print for .span_bug/.bug.

Previously a call to either of those to diagnostic printers would defer
to the `fatal` equivalents, which explicitly silence the stderr
printing, including a stack trace from `RUST_LOG=std::rt::backtrace`.

This splits the bug printers out to their own diagnostic type so that
things work properly.

Also, this removes the `Ok(...)` that was being printed around the
subtask's stderr output.
2014-03-14 05:26:29 -07:00
bors
d367482491 auto merge of #12871 : aochagavia/rust/Optimize-while_some, r=alexcrichton
The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option<T>
2014-03-14 04:06:31 -07:00
bors
29756a3b76 auto merge of #12867 : alexcrichton/rust/issue-12860, r=thestinger
This switches a "tail call" to a manual loop to get around LLVM not optimizing
to a tail call.

Close #12860
2014-03-14 02:01:34 -07:00
bors
6c895d1d58 auto merge of #12864 : huonw/rust/hash-docs, r=alexcrichton
collections: move hashmap's example to the struct.

Most people go straight to the struct, not looking at the module, so the
example was well hidden.
2014-03-14 00:41:34 -07:00
bors
b35e8fbfcb auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger
lint: add lint for use of a `~[T]`.

This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.
2014-03-13 22:26:35 -07:00
Ted Horst
e9bd12169d fix a test that was missed in the chan/port renaming (PR #12815) 2014-03-13 23:26:14 -05:00
bors
4443fb3cfa auto merge of #12855 : alexcrichton/rust/shutdown, r=brson
This is something that is plausibly useful, and is provided by libuv. This is
not currently surfaced as part of the `TcpStream` type, but it may possibly
appear in the future. For now only the raw functionality is provided through the
Rtio objects.
2014-03-13 21:06:34 -07:00
Jyun-Yan You
6d7e86d099 fix MIPS target
I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.
2014-03-14 11:13:36 +08:00
bors
98fa0f89b1 auto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichton
## read+write modifier '+'
This small sugar was left out in the original implementation (#5359).
 
When an output operand with the '+' modifier is encountered, we store the index of that operand alongside the expression to create and append an input operand later. The following lines are equivalent:
```
asm!("" : "+m"(expr));
asm!("" : "=m"(expr) : "0"(expr));
```
## misplaced options and clobbers give a warning
It's really annoying when a small typo might change behavior without any warning.
```
asm!("mov $1, $0" : "=r"(x) : "r"(8u) : "cc" , "volatile");
//~^ WARNING expected a clobber, but found an option
```
## liveness
Fixed incorrect order of propagation.
Sometimes it caused spurious warnings in code: `warning: value assigned to `i` is never read, #[warn(dead_assignment)] on by default`

~~Note: Rebased on top of another PR. (uses other changes)~~

* [x] Implement read+write
* [x] Warn about misplaced options
* [x] Fix liveness (`dead_assignment` lint)
* [x] Add all tests
2014-03-13 18:41:35 -07:00
Huon Wilson
adc357abe6 std: render the vec_ng docs.
These are wildly incomplete, but having something there is better than
nothing, e.g. so that people know it exists, and many of the functions
behaviour can be guessed from the name or by checking the source: it's
knowing they exist at all that's the hard part.
2014-03-14 11:28:39 +11:00
Huon Wilson
62792f09f2 lint: add lint for use of a ~[T].
This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.
2014-03-14 11:28:39 +11:00
Alex Crichton
a07149b138 rustc: Prevent collisions in names of closures
This commit goes back to using `gensym` to generate unique tokens to put into
the names of closures, allowing closures to be able to get demangled in
backtraces.

Closes #12400
2014-03-13 16:24:46 -07:00
Alex Crichton
6298900895 std: Demangle more escapes in backtraces
The rust compiler not only outputs symbols in the form that C++ does, but it
also mangle symbols like '&' and '~' to special compiler-defined escape
sequences. For convenience, these symbols are demangled when printing
backtraces.
2014-03-13 16:23:10 -07:00
Huon Wilson
edb6b025c4 rustc: make stack traces print for .span_bug/.bug.
Previously a call to either of those to diagnostic printers would defer
to the `fatal` equivalents, which explicitly silence the stderr
printing, including a stack trace from `RUST_LOG=std::rt::backtrace`.

This splits the bug printers out to their own diagnostic type so that
things work properly.

Also, this removes the `Ok(...)` that was being printed around the
subtask's stderr output.
2014-03-14 10:17:14 +11:00
Alex Crichton
a63deeb3d3 io: Bind to shutdown() for TCP streams
This is something that is plausibly useful, and is provided by libuv. This is
not currently surfaced as part of the `TcpStream` type, but it may possibly
appear in the future. For now only the raw functionality is provided through the
Rtio objects.
2014-03-13 15:52:37 -07:00
Piotr Czarnecki
2a1bd2ff9f Fix and improve inline assembly.
Read+write modifier
Some documentation in asm.rs
rpass and cfail tests
2014-03-13 22:38:15 +01:00