Commit Graph

37869 Commits

Author SHA1 Message Date
bors
8ec3a833d5 Auto merge of #21617 - alexcrichton:less-quotes, r=nikomatsakis
This ends up propagating all the way out to the output of dep-info which then
makes Cargo think that files are not existent (it thinks the files have quotes
in their name) when they in fact do.
2015-01-26 19:44:12 +00:00
Tshepang Lekhonkhobe
f1c22a0b4c bench: this file has not compiled at least since March last year
See 579eb2400b
2015-01-26 21:27:08 +02:00
Tobias Bucher
cbcb191b97 Remove comment about UnsafeCells and static
It has actually been safe to put an `UnsafeCell` into a non-mutable `static`
since the `const` change.
2015-01-26 17:45:21 +01:00
bors
16286f5cf9 Auto merge of #21614 - kvark:typedef, r=huonw
Fixes #21497 

I don't know if this can be tested with built-in tests.
2015-01-26 15:39:13 +00:00
Oliver Schneider
82b0b0fcc7 fallout 2015-01-26 16:27:28 +01:00
Oliver Schneider
85b80aa1e1 don't ignore errors in encode and allow hashmaps with enum keys
closes #21470 on main rust repository
was fixed on rust-lang/rustc-serialize (see https://github.com/rust-lang/rustc-serialize/pull/32)
2015-01-26 16:27:28 +01:00
bors
977c44ade0 Auto merge of #21401 - kballard:optimize-shrink-to-fit, r=nikomatsakis
Don't reallocate when capacity is already equal to length

`Vec::shrink_to_fit()` may be called on vectors that are already the
correct length. Calling out to `reallocate()` in this case is a bad idea
because there is no guarantee that `reallocate()` won't allocate a new
buffer anyway, and based on performance seen in external benchmarks, it
seems likely that it is in fact reallocating a new buffer.

Before:

    test string::tests::bench_exact_size_shrink_to_fit         ... bench:        45 ns/iter (+/- 2)

After:

    test string::tests::bench_exact_size_shrink_to_fit         ... bench:        26 ns/iter (+/- 1)
2015-01-26 13:01:00 +00:00
Nelson Chen
e0dc9bd275 Add same "-webkit-overflow-scrolling: touch" to the table of contents in the book. 2015-01-26 02:37:17 -08:00
Nelson Chen
f7f80ce61a Add "-webkit-overflow-scrolling: touch" to book CSS for the page wrapper.
This change permits native momentum scrolling in Safari on iOS in the book.
2015-01-26 02:37:01 -08:00
bors
59dcba5d14 Auto merge of #21610 - sfackler:debug-lint, r=alexcrichton
Closes #20855

r? @alexcrichton
2015-01-26 10:26:54 +00:00
Björn Steinbrink
296c74de96 Default to Pentium 4 as the x86 target CPU on Windows/Linux/DragonFly
Limiting ourselves to a generic x86 instruction set doesn't seem useful.
Both users running those systems on original i386 hardware might as well
manually specify a target cpu ;-)

Clang uses the same default.
2015-01-26 09:58:56 +01:00
Björn Steinbrink
bca25aeeb4 Use more specific target CPUs on Darwin
Macs don't come with anything older than a Yonah (32bit) or Core2 (64bit),
so we can default to those targets. Clang does the same.
2015-01-26 09:58:55 +01:00
Flavio Percoco
fde4472848 Make Unix and Windows impls consistent
There are some explicit Send/Sync implementations for Window's types
that don't exist in Unix. While the end result will be the same, I
believe it's clearer if we keep the explicit implementations consistent
by making the os-specific types Send/Sync where needed and possible.

This commit addresses tcp. Existing differences below:

src/libstd/sys/unix/tcp.rs
unsafe impl Sync for TcpListener {}
unsafe impl Sync for AcceptorInner {}

src/libstd/sys/windows/tcp.rs
unsafe impl Send for Event {}
unsafe impl Sync for Event {}
unsafe impl Send for TcpListener {}
unsafe impl Sync for TcpListener {}
unsafe impl Send for TcpAcceptor {}
unsafe impl Sync for TcpAcceptor {}
unsafe impl Send for AcceptorInner {}
unsafe impl Sync for AcceptorInner {}
2015-01-26 09:12:28 +01:00
Flavio Percoco
fff5600925 Make Unix and Windows impls consistent
There are some explicit Send/Sync implementations for Window's types
that don't exist in Unix. While the end result will be the same, I
believe it's clearer if we keep the explicit implementations consistent
by making the os-specific types Send/Sync where needed and possible.

This commit addresses pipe

src/libstd/sys/unix/pipe.rs
unsafe impl Send for UnixListener {}
unsafe impl Sync for UnixListener {}

src/libstd/sys/windows/pipe.rs
unsafe impl Send for UnixStream {}
unsafe impl Sync for UnixStream {}
unsafe impl Send for UnixListener {}
unsafe impl Sync for UnixListener {}
unsafe impl Send for UnixAcceptor {}
unsafe impl Sync for UnixAcceptor {}
unsafe impl Send for AcceptorState {}
unsafe impl Sync for AcceptorState {}
2015-01-26 09:12:26 +01:00
bors
7615e187c6 Auto merge of #21605 - huonw:omg-muscle-memory, r=eddyb
I'm beginning to suspect it's impossible to avoid accidentally writing
`#[deriving]` at least once in every program, and it results in
non-intuitive error messages: "Foo doesn't have any method in scope
`clone`" despite there being a `#[deriv...(Clone)]` attribute!

Also, lots of documentation around the internet uses `#[deriving]` so
providing this guidance is very helpful (lots of people ask in #rust
about this error).
2015-01-26 07:49:01 +00:00
Sébastien Marie
d553ed66c7 shell 'case' statement don't need 'break'
the syntax of 'case' is:
`case word in [[(] pattern [| pattern] ...) list ;; ] ... esac`

`list` don't have to issue `break`. `break` is normally used to exit a
`for`, `until` or `while` loop.
2015-01-26 08:32:34 +01:00
Brian Anderson
d179ba3b8e Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	src/libcore/cmp.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/result.rs
	src/libcore/str/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/lint/context.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/poison.rs
2015-01-25 22:14:06 -08:00
bors
9252525196 Auto merge of #21598 - eddyb:there-are-no-boxed-closures, r=brson 2015-01-26 04:49:37 +00:00
Peter Atashian
8f38eae7ad wrmdir -> RemoveDirectoryW
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-25 23:00:21 -05:00
Eduard Burtescu
9690be5ece Adjust most comments and messages to not use "unboxed". 2015-01-26 04:15:09 +02:00
Eduard Burtescu
e0afa82c67 Remove every mention of "onceness". 2015-01-26 04:15:09 +02:00
Eduard Burtescu
50a370aa2d Remove dead code related to old closures. 2015-01-26 04:15:09 +02:00
Eduard Burtescu
ab9c773cdb librustc: remove unused DefUpvar field. 2015-01-26 04:15:09 +02:00
Eduard Burtescu
11ef6f1349 Remove "unboxed" attribute in code referring to new closures. 2015-01-26 04:15:09 +02:00
bors
47621db62c Auto merge of #21574 - japaric:walk-projections, r=nikomatsakis
closes #21363

r? @nikomatsakis
2015-01-25 23:55:55 +00:00
bors
458a6a2f6e Auto merge of #21561 - edwardw:deref, r=nikomatsakis
As part of #20432, upvar checking is now moved out of regionck to its
own pass and before regionck. But regionck has some type resolution of
its own. Without them, now separated upvar checking may be tripped over
by residue `ty_infer`.

Closes #21306
2015-01-25 21:20:37 +00:00
Steven Fackler
70214915b0 Add a missing fmt::Debug impl lint
Closes #20855
2015-01-25 11:22:41 -08:00
bors
c80e556e15 Auto merge of #21519 - michaelwoerister:misc, r=eddyb
Two minor improvements that have been on my TODO list for a while:
* Clang uses a size of `-1` for arrays of unknown size and we should do that too as it will tell LLVM to omit the size information in debuginfo.
* There was no LLDB test case for handling the optimized enum representation introduced by @luqmana. This PR finally adds one.
2015-01-25 18:46:33 +00:00
Jorge Aparicio
bff462302b cleanup: s/impl Copy/#[derive(Copy)]/g 2015-01-25 11:20:38 -05:00
bors
d15192317a Auto merge of #21518 - Zoxc:asm-err, r=luqmana
Before:
```
error: invalid operand for inline asm constraint 'i' at line 11
```
Note that 11 is not the line the inline assembly appears in.

After:
```
src/arch/x64/multiboot/bootstrap.rs:203:5: 209:9 error: invalid operand for inline asm constraint 'i'
src/arch/x64/multiboot/bootstrap.rs:203     asm! {
src/arch/x64/multiboot/bootstrap.rs:204         [multiboot => %ecx, mod attsyntax]
src/arch/x64/multiboot/bootstrap.rs:205 
src/arch/x64/multiboot/bootstrap.rs:206         ljmp {size_of::<Descriptor>() => %i}, $bootstrap.64
src/arch/x64/multiboot/bootstrap.rs:207     }
src/arch/x64/multiboot/bootstrap.rs:208 
                                        ...
error: aborting due to previous error
```
2015-01-25 16:09:48 +00:00
emanueLczirai
59c2de16df fix vim syntastic: --parse-only => -Z parse-only
when saving .rs files under vim
do not fail to run the syntax checker
error: Unrecognized option: 'parse-only'.

due to this commit
953f294ea3
which removed the deprecated flag --parse-only
2015-01-25 16:17:19 +01:00
Dominik Inführ
a09c085976 more-strings.md: repaired links to API 2015-01-25 15:20:49 +01:00
bors
102ab57d80 Auto merge of #21582 - FlaPer87:rollup, r=brson
- Successful merges: #21108, #21445, #21498, #21504, #21532, #21535, #21539, #21540, #21541, #21550, #21560, #21573, #21579
- Failed merges:
2015-01-25 13:33:18 +00:00
Flavio Percoco
7e83e46556 assert path ends with executable. On Windows the process executable contains the full path 2015-01-25 13:05:37 +01:00
bors
0899807294 Auto merge of #20613 - dgriffen:master, r=alexcrichton 2015-01-25 10:59:28 +00:00
Brian Anderson
de5498650a featurkck: Typo 2015-01-25 01:25:59 -08:00
Brian Anderson
63fcbcf3ce Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	mk/tests.mk
	src/liballoc/arc.rs
	src/liballoc/boxed.rs
	src/liballoc/rc.rs
	src/libcollections/bit.rs
	src/libcollections/btree/map.rs
	src/libcollections/btree/set.rs
	src/libcollections/dlist.rs
	src/libcollections/ring_buf.rs
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/libcollections/vec_map.rs
	src/libcore/any.rs
	src/libcore/array.rs
	src/libcore/borrow.rs
	src/libcore/error.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/ops.rs
	src/libcore/result.rs
	src/libcore/slice.rs
	src/libcore/str/mod.rs
	src/libregex/lib.rs
	src/libregex/re.rs
	src/librustc/lint/builtin.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/poison.rs
	src/libstd/sync/rwlock.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/test.rs
2015-01-25 01:20:55 -08:00
bors
9bac0179df Auto merge of #20373 - huonw:self-call-lint, r=luqmana
E.g. `fn foo() { foo() }`, or, more subtlely

    impl Foo for Box<Foo+'static> {
        fn bar(&self) {
            self.bar();
        }
    }

The compiler will warn and point out the points where recursion occurs,
if it determines that the function cannot return without calling itself.

Closes #17899.

---

This is highly non-perfect, in particular, my wording above is quite precise, and I have some unresolved questions: This currently will warn about

```rust
fn foo() {
    if bar { loop {} }

    foo()
}
```

even though `foo` may never be called (i.e. our apparent "unconditional" recursion is actually conditional). I don't know if we should handle this case, and ones like it with `panic!()` instead of `loop` (or anything else that "returns" `!`).

However, strictly speaking, it seems to me that changing the above to not warn will require changing

```rust
fn foo() {
    while bar {}
    foo()
}
```

to also not warn since it could be that the `while` is an infinite loop and doesn't ever hit the `foo`.

I'm inclined to think we let these cases warn since true edge cases like the first one seem rare, and if they do occur they seem like they would usually be typos in the function call. (I could imagine someone accidentally having code like `fn foo() { assert!(bar()); foo() /* meant to be boo() */ }` which won't warn if the `loop` case is "fixed".)

(Part of the reason this is unresolved is wanting feedback, part of the reason is I couldn't devise a strategy that worked in all cases.)

---

The name `unconditional_self_calls` is kinda clunky; and this reconstructs the CFG for each function that is linted which may or may not be very expensive, I don't know.
2015-01-25 08:24:47 +00:00
Tyler Thrailkill
a0ed0f30ba Add example for Lifetime Elision with two inputs
Lifetime elision with two input references is not clear.
Closes #21284
2015-01-25 01:24:41 -07:00
Alex Crichton
0dac568578 syntax: Don't put quotes around filenames in codemap
This ends up propagating all the way out to the output of dep-info which then
makes Cargo think that files are not existent (it thinks the files have quotes
in their name) when they in fact do.
2015-01-24 22:43:11 -08:00
Dzmitry Malyshau
e5632157b1 Associated types support for deriving::generic::TraitDef 2015-01-25 00:54:30 -05:00
bors
43046becce Auto merge of #21558 - alexcrichton:result-debug, r=aturon
This commit relaxes the bound on `Result::unwrap` and `Result::unwrap_err` from
the `Display` trait to the `Debug` trait for generating an error message about
the unwrapping operation.

This commit is a breaking change and any breakage should be mitigated by
ensuring that `Debug` is implemented on the relevant type.

[breaking-change]
2015-01-25 05:50:30 +00:00
York Xiang
ac3b4b8074 fix wrong link 2015-01-25 12:36:15 +08:00
bors
70b13a7c7c Auto merge of #21511 - alfie:suffix-cleanup, r=huonw 2015-01-25 00:49:41 +00:00
Alfie John
f67e7470b3 Moving away from deprecated i/u suffixes in libcore 2015-01-25 00:17:41 +00:00
Huon Wilson
ae4e1a190b Tell the compiler to tell us that deriving is dead.
I'm beginning to suspect it's impossible to avoid accidentally writing
`#[deriving]` at least once in every program, and it results in
non-intuitive error messages: "Foo doesn't have any method in scope
`clone`" despite there being a `#[deriv...(Clone)]` attribute!

Also, lots of documentation around the internet uses `#[deriving]` so
providing this guidance is very helpful (lots of people ask in #rust
about this error).

Fixes #21166.
2015-01-25 10:44:56 +11:00
Ariel Ben-Yehuda
e7245252cc Cleanup check_cast. Fixes #21554
This also makes the cast error messages somewhat more uniform.
2015-01-25 01:44:49 +02:00
bors
4e4e8cff16 Auto merge of #21452 - bleibig:bison-grammar, r=nikomatsakis
This adds a new lexer/parser combo for the entire Rust language can be generated with with flex and bison, taken from my project at https://github.com/bleibig/rust-grammar. There is also a testing script that runs the generated parser with all *.rs files in the repository (except for tests in compile-fail or ones that marked as "ignore-test" or "ignore-lexer-test"). If you have flex and bison installed, you can run these tests using the new "check-grammar" make target.

This does not depend on or interact with the existing testing code in the grammar, which only provides and tests a lexer specification.

OS X users should take note that the version of bison that comes with the Xcode toolchain (2.3) is too old to work with this grammar, they need to download and install version 3.0 or later.

The parser builds up an S-expression-based AST, which can be displayed by giving the "-v" argument to parser-lalr (normally it only gives output on error). It is only a rough approximation of what is parsed and doesn't capture every detail and nuance of the program.

Hopefully this should be sufficient for issue #2234, or at least a good starting point.
2015-01-24 22:14:14 +00:00
Kevin Yap
1ec13e7f50 Improve mobile-friendliness of API docs
Removes min-width rule from body so that the page does not scroll
horizontally on mobile displays; hides out-of-band information.
2015-01-24 12:09:24 -08:00
bors
bb7cc4eb26 Auto merge of #21488 - aturon:os-str, r=alexcrichton
Per [RFC 517](https://github.com/rust-lang/rfcs/pull/575/), this commit introduces platform-native strings. The API is essentially as described in the RFC.

The WTF-8 implementation is adapted from @SimonSapin's [implementation](https://github.com/SimonSapin/rust-wtf8). To make this work, some encodign and decoding functionality in `libcore` is now exported in a "raw" fashion reusable for WTF-8. These exports are *not* reexported in `std`, nor are they stable.
2015-01-24 19:39:52 +00:00