Commit Graph

28839 Commits

Author SHA1 Message Date
Patrick Walton
30dbcf5f88 libglob: Remove all uses of ~str from libglob 2014-05-14 18:29:12 -07:00
Patrick Walton
8a1aaac396 liblog: Remove all uses of ~str from liblog 2014-05-14 18:29:12 -07:00
Patrick Walton
e786a745b5 libgraphviz: Remove all uses of ~str from libgraphviz. 2014-05-14 18:29:12 -07:00
Patrick Walton
ec5911b2a6 libregex: Remove all uses of ~str from libregex 2014-05-14 18:29:12 -07:00
Patrick Walton
62cf95f674 libarena: Remove all uses of ~str from libarena 2014-05-14 14:58:01 -07:00
Patrick Walton
bf249b4411 libhexfloat: Remove all uses of ~str from libhexfloat 2014-05-14 14:58:01 -07:00
Patrick Walton
27977e41fc libuuid: Remove all uses of ~str from libuuid. 2014-05-14 14:58:01 -07:00
Patrick Walton
504335ae5a libworkcache: Remove all uses of ~str from libworkcache. 2014-05-14 14:58:00 -07:00
Patrick Walton
95e310abdc test: Remove all uses of ~str from the test suite. 2014-05-14 14:58:00 -07:00
bors
2a7a39191a auto merge of #14086 : Ryman/rust/resolve_error_suggestions, r=alexcrichton
Provides better help for the resolve failures inside an `impl` if the name matches:
- a field on the self type
- a method on the self type
- a method on the current trait ref (in a trait impl)

Not handling trait method suggestions if in a regular `impl` (as you can see on line 69 of the test), I believe it is possible though.

Also, provides a better message when `self` fails to resolve due to being a static method.

It's using some unsafe pointers to skip copying the larger structures (which are only used in error conditions); it's likely possible to get it working with lifetimes (all the useful refs should outlive the visitor calls) but I haven't really figured that out for this case. (can switch to copying code if wanted)

Closes #2356.
2014-05-14 12:06:29 -07:00
Kevin Butler
595e2910d8 rustc: Improve error messages for resolve failures. 2014-05-14 19:18:18 +01:00
bors
1a1645d3b1 auto merge of #14009 : jcmoyer/rust/bitflags-complement, r=alexcrichton
I feel that this is a very vital, missing piece of functionality. This adds on to #13072.

Only bits used in the definition of the bitflag are considered for the universe set. This is a bit safer than simply inverting all of the bits in the wrapped value.

```rust
bitflags!(flags Flags: u32 {
    FlagA       = 0x00000001,
    FlagB       = 0x00000010,
    FlagC       = 0x00000100,
    FlagABC     = FlagA.bits
                | FlagB.bits
                | FlagC.bits
})

...

// `Not` implements set complement
assert!(!(FlagB | FlagC) == FlagA);
// `all` and `is_all` are the inverses of `empty` and `is_empty`
assert!(Flags::all() - FlagA == !FlagA);
assert!(FlagABC.is_all());
```
2014-05-14 09:21:25 -07:00
bors
96bcadc181 auto merge of #14192 : pongad/rust/walkcleanup, r=pcwalton
Fixes #14134
2014-05-14 07:31:45 -07:00
bors
d78718ad63 auto merge of #14191 : luqmana/rust/eu, r=alexcrichton
We were correctly determining the attributes needed for the parameters for extern fns, but when that extern fn was from another crate we never bothered to pass that information along to LLVM. (i.e never called `foreign::add_argument_attributes`).

I've just changed both local and non-local (crate) extern fn's to be dealt with together (through `foreign::register_foreign_item_fn`) so we don't run into something like again.

Fixes #14177.
2014-05-14 05:56:18 -07:00
bors
d9906813c8 auto merge of #14186 : omasanori/rust/suppress-warnings, r=alexcrichton 2014-05-14 04:06:26 -07:00
bors
03053580ca auto merge of #14179 : luqmana/rust/acp, r=alexcrichton
It's a bit odd to single out just android when we don't do this for any other cross compiling targets. Android builds will still work since we just pass the full path for gcc and ar with `-C linker` and `-C ar`.

I did add the flag to compiletest though so it can find gdb. Though, i'm pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]
2014-05-14 02:36:23 -07:00
J.C. Moyer
1595885501 Implement set complement and universe for bitflags 2014-05-14 04:37:06 -04:00
bors
db5ca23118 auto merge of #14169 : alexcrichton/rust/atomics, r=sanxiyn
This module is a foundation on which many other algorithms are built. When hardware support is missing, stubs are provided in libcompiler-rt.a, so this should be available on all platforms.
2014-05-14 01:06:24 -07:00
Alex Crichton
949443eff6 core: Allow using failure outside of libcore
Due to our excellent macro hygiene, this involves having a global path and a
hidden module in libcore itself.
2014-05-13 23:59:03 -07:00
Alex Crichton
82a8a5ebb3 core: Document should_not_exist's existence
Explain why it should not exist, and the plan of attack for removing it.
2014-05-13 23:59:03 -07:00
Alex Crichton
57f3b6ee5c core: Add a crate doc block 2014-05-13 23:59:03 -07:00
Alex Crichton
325cc51502 core: Inherit the atomics module 2014-05-13 23:59:03 -07:00
Michael Darakananda
fdb30cd22c Removed unnecessary arguments for walk_* functions 2014-05-14 02:20:25 -04:00
Luqman Aden
589f447299 librustc: Make sure to add argument attributes to extern fns from non-local crates. 2014-05-14 02:18:42 -04:00
Luqman Aden
d0d800f125 Get rid of the android-cross-path flag to rustc.
There's no need to include this specific flag just for android. We can
already deal with what it tries to solve by using -C linker=/path/to/cc
and -C ar=/path/to/ar. The Makefiles for rustc already set this up when
we're crosscompiling.

I did add the flag to compiletest though so it can find gdb. Though, I'm
pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]
2014-05-14 02:16:14 -04:00
bors
2e02f6ef00 auto merge of #14178 : alexcrichton/rust/more-ignores, r=brson
It was thought that these failures only happened on windows, turns out they
happen on any 32-bit machine.

cc #14064
2014-05-13 21:41:25 -07:00
bors
e4414739a5 auto merge of #13127 : kballard/rust/read_at_least, r=alexcrichton
Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]
2014-05-13 20:01:28 -07:00
Kevin Ballard
972f2e5855 io: Add .read_at_least() to Reader
Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]
2014-05-13 18:45:20 -07:00
bors
b2b383cab5 auto merge of #14187 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14184 (std: Move the owned module from core to std)
Closes #14183 (Allow blocks in const expressions)
Closes #14176 (Add tests for from_bits.)
Closes #14175 (Replaced ~T by Box<T> in manual)
Closes #14173 (Implements Default trait for BigInt and BigUint)
Closes #14171 (Fix #8391)
Closes #14159 (Clean up unicode code in libstd)
Closes #14126 (docs: Add a not found page)
Closes #14123 (add a line to the example to clarify semantics)
Closes #14106 (Pretty printer improvements)
Closes #14083 (rustllvm: Add LLVMRustArrayType)
Closes #13957 (io: Implement process wait timeouts)
2014-05-13 18:31:51 -07:00
Alex Crichton
f09592a5d1 io: Implement process wait timeouts
This implements set_timeout() for std::io::Process which will affect wait()
operations on the process. This follows the same pattern as the rest of the
timeouts emerging in std::io::net.

The implementation was super easy for everything except libnative on unix
(backwards from usual!), which required a good bit of signal handling. There's a
doc comment explaining the strategy in libnative. Internally, this also required
refactoring the "helper thread" implementation used by libnative to allow for an
extra helper thread (not just the timer).

This is a breaking change in terms of the io::Process API. It is now possible
for wait() to fail, and subsequently wait_with_output(). These two functions now
return IoResult<T> due to the fact that they can time out.

Additionally, the wait_with_output() function has moved from taking `&mut self`
to taking `self`. If a timeout occurs while waiting with output, the semantics
are undesirable in almost all cases if attempting to re-wait on the process.
Equivalent functionality can still be achieved by dealing with the output
handles manually.

[breaking-change]

cc #13523
2014-05-13 17:27:42 -07:00
klutzy
9f7caed202 rustllvm: Add LLVMRustArrayType
LLVM internally uses `uint64_t` for array size, but the corresponding
C API (`LLVMArrayType`) uses `unsigned int` so ths value is truncated.
Therefore rustc generates wrong type for fixed-sized large vector e.g.
`[0 x i8]` for `[0u8, ..(1 << 32)]`.

This patch adds `LLVMRustArrayType` function for `uint64_t` support.
2014-05-13 17:24:08 -07:00
Alex Crichton
6878039c12 syntax: Improve --pretty normal slightly
When printing doc comments, always put a newline after them in a macro
invocation to ensure that a line-doc-comment doesn't consume remaining tokens on
the line.
2014-05-13 17:24:08 -07:00
Alex Crichton
25ac81eb89 syntax: Preserve attributes in #[deriving]
Now that the #[deriving] attribute is removed, the raw_pointers_deriving lint
was broken. This commit restores the lint by preserving lint attributes
across #[deriving] to the implementations and using #[automatically_derived] as
the trigger for activating the lint.
2014-05-13 17:24:08 -07:00
Alex Crichton
f912005ef3 test: Give a test a bigger stack for pretty printing 2014-05-13 17:24:08 -07:00
Alex Crichton
d92b9ae716 syntax: Print suffixed token literals correctly
Previously, literals "1i" were printed as "1". This fixes the
numeric-method-autoexport test for pretty printing.
2014-05-13 17:24:08 -07:00
Alex Crichton
1581fb8d6f test: Ignore a pretty expanded failing test
When expanding, an extra unsafe block is generated which is currently not
handled well.
2014-05-13 17:24:08 -07:00
Alex Crichton
560def1511 test: Fix a pretty printing test
The pretty printer handles inlines comments quite badly
2014-05-13 17:24:08 -07:00
Alex Crichton
ac1a27043a syntax: Fix parsing << with closure types
This uses the trick of replacing the << token with a < token to parse closure
types correctly.

Closes #13324
2014-05-13 17:24:08 -07:00
Alex Crichton
042c8ae40e syntax: Fix printing INT64_MIN
Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The
parser and pretty printer both printed an i64 instead of u64, sometimes
introducing an extra negative sign.
2014-05-13 17:24:08 -07:00
Alex Crichton
1237530452 Touch up and rebase previous commits
* Added `// no-pretty-expanded` to pretty-print a test, but not run it through
  the `expanded` variant.
* Removed #[deriving] and other expanded attributes after they are expanded
* Removed hacks around &str and &&str and friends (from both the parser and the
  pretty printer).
* Un-ignored a bunch of tests
2014-05-13 17:24:08 -07:00
klutzy
ce8c467bd2 compiletest: Test --pretty expanded
After testing `--pretty normal`, it tries to run `--pretty expanded` and
typecheck output.
Here we don't check convergence since it really diverges: for every
iteration, some extra lines (e.g.`extern crate std`) are inserted.

Some tests are `ignore-pretty`-ed since they cause various issues
with `--pretty expanded`.
2014-05-13 17:24:08 -07:00
klutzy
96eeda9708 compiletest: Modernize typenames 2014-05-13 17:24:08 -07:00
klutzy
0350d8e6d0 test: Add missing #![feature(managed_boxes)]
The tests use managed boxes, but are not perfectly feature-gated because
they use `@` inside macros. (It causes issue after `--pretty expanded`.)
2014-05-13 17:24:08 -07:00
klutzy
bdd360bb13 libsyntax: Workaround pprust for issue 2014-05-13 17:24:08 -07:00
klutzy
90d976e8fc pprust: Remove unnecessary && of print_tt 2014-05-13 17:24:08 -07:00
klutzy
4675a87c8b pprust: Print &&e instead of & &e 2014-05-13 17:24:08 -07:00
klutzy
cc31bb0a9e pprust: Fix asm output 2014-05-13 17:24:08 -07:00
klutzy
7f203b6955 pprust: Add parentheses to some Expr
Some `Expr` needs parentheses when printed. For example, without
parentheses, `ExprUnary(UnNeg, ExprBinary(BiAdd, ..))` becomes
`-lhs + rhs` which is wrong.

Those cases don't appear in ordinary code (since parentheses are
explicitly added) but they can appear in manually crafted ast by
extensions.
2014-05-13 17:24:08 -07:00
klutzy
6d535b5b8d rustc: Make std_inject valid for pretty-printer
Inject `extern crate {std, native}` before `use` statements.
Add `#![feature(glob)]` since `use std::prelude::*` is used.

(Unfortunately `rustc --pretty expanded` does not converge,
since `extern crate` and `use std::prelude::*` is injected at every
iteration.)
2014-05-13 17:24:08 -07:00
Zooko Wilcox-O'Hearn
0004953c3a add a line to the example to clarify semantics
This is to clarify that match construct doesn't define a new variable, since I
observed a person reading the Rust tutorial who seemed to incorrectly think
that it did. Fixes https://github.com/mozilla/rust/issues/13571 .
2014-05-13 17:24:08 -07:00