Commit Graph

38367 Commits

Author SHA1 Message Date
bors
725cc06464 Auto merge of #22011 - fhahn:separate-parse-fail-tests, r=nikomatsakis
This PR moves all `compile-fail` tests that fail at the parsing stage to a `parse-fail` directory, in order to use the tests in the `parse-fail` directory to test if the new LALR parser rejects the same files as the Rust parser. I also adjusted the `testparser.py` script to handle the tests in `parse-fail` differently.

However during working on this, I discovered, that Rust's parser sometimes fails during parsing, but does not return a nonzero return code, e.g. compiling `/test/compile-fail/doc-before-semi.rs` with `-Z parse-only` prints an error message, but returns status code 0. Compiling the same file without `-Z parse-only`, the same error message is displayed, but error code 101 returned. I'll look into that over the next week.
2015-02-08 12:35:03 +00:00
bors
d4a66e9b09 Auto merge of #21970 - michaelwoerister:lang-item-call-debug-locs, r=brson
Resolves some issues caused by the recent LLVM update (which itself solved some issues).

Closes #19848
Closes #20798
2015-02-08 10:27:58 +00:00
bors
d4f9ec5662 Auto merge of #21565 - kmcallister:poison, r=alexcrichton
I needed these to implement efficient poisoning in [seqloq](https://github.com/kmcallister/seqloq/tree/poison).
2015-02-08 08:21:44 +00:00
bors
cdaf3a4393 Auto merge of #21999 - tomjakubowski:rustdoc-fixes, r=alexcrichton
r? @alexcrichton
2015-02-08 06:15:52 +00:00
bors
f16de18db4 Auto merge of #22044 - caspark:fix-rc-doc-links, r=nikomatsakis
Current link structure is /std/rc/struct.Rc.html so ../index.html ends
up linking to /std/ rather than /std/rc/
2015-02-08 02:30:09 +00:00
bors
74b8740719 Auto merge of #21988 - kmcallister:no-std, r=sfackler
Fixes #21833.

[breaking-change]

r? @alexcrichton 

The tests in #21912 will also need `#[feature(no_std)]`. If you're okay with both PRs, I can merge and test them.
2015-02-08 00:24:03 +00:00
Geoffrey Thomas
bb49195d22 reference.md: Byte string literals start with a 'b'
This was correct in the EBNF, but not in the prose (which seems to have
been copied-and-pasted from regular string literals).
2015-02-07 19:10:32 -05:00
Alexis
dc930b1a52 add split_off to RingBuf 2015-02-07 18:40:14 -05:00
Ulrik Sverdrup
4f61e16032 Fix std::ops::Range size_hint and ExactSizeIterator impls
When self.start > self.end, these iterators simply return None,
so we adjust the size_hint to just return zero in this case.

Certain optimizations can be implemented in and outside libstd if we
know we can trust the size_hint for all inputs to for example
Range<usize>.

This corrects the ExactSizeIterator implementations, which IMO were
unsound and incorrect previously, since they allowed a range like (2..1)
to return a size_hint of -1us in when debug assertions are turned off.
2015-02-08 00:17:04 +01:00
Alexis
d163f1f97b add missing features to libcollections tests 2015-02-07 17:09:07 -05:00
bors
bfaa1a8434 Auto merge of #21874 - nagisa:reference-is-removal, r=steveklabnik
r? @steveklabnik
2015-02-07 21:48:33 +00:00
Alexis
09164f3acf minor fixes to Vec docs and bounds check 2015-02-07 14:58:58 -05:00
Keegan McAllister
312f8bd850 Fix new test 2015-02-07 10:51:25 -08:00
Keegan McAllister
ea85d43903 Make std::fmt a simple re-export from collections 2015-02-07 10:49:58 -08:00
Keegan McAllister
a246b6542a Fake up #![no_std] on pretty-printing; keep it out of AST 2015-02-07 10:49:58 -08:00
Keegan McAllister
d788588dce Feature-gate #![no_std]
Fixes #21833.

[breaking-change]
2015-02-07 10:49:58 -08:00
Keegan McAllister
67350bc868 Don't use std:: paths in syntax extensions when compiling a #![no_std] crate
Fixes #16803.
Fixes #14342.
Fixes half of #21827 -- slice syntax is still broken.
2015-02-07 10:49:57 -08:00
Keegan McAllister
74eef05e7d Use path helper macros in deriving 2015-02-07 10:49:57 -08:00
bors
61626b3063 Auto merge of #21984 - pnkfelix:make-for-loops-a-terminating-scope, r=nikomatsakis
make `for PAT in ITER_EXPR { ... }` a terminating-scope for ITER_EXPR.

In effect, temporary anonymous values created during the evaluation of ITER_EXPR no longer not live for the entirety of the block surrounding the for-loop; instead they only live for the extent of the for-loop itself, and no longer.

----

There is one case I know of that this breaks, demonstrated to me by @nikomatsakis  (but it is also a corner-case that is useless in practice).  Here is that case:

```
fn main() {
    let mut foo: Vec<&i8> = Vec::new();
    for i in &[1, 2, 3] { foo.push(i) }
}
```

Note that if you add any code following the for-loop above, or even a semicolon to the end of it, then the code will stop compiling (i.e., it gathers a vector of references but the gathered vector cannot actually be used.)

(The above code, despite being useless, did occur in one run-pass test by accident; that test is updated here to accommodate the new striction.)

----

So, technically this is a:

[breaking-change]
2015-02-07 18:20:55 +00:00
Leo Testard
8f2ab66ab6 Fix handling of parse errors when using include!().
Makes the compilation abort when a parse error is encountered while
trying to parse an item in an included file. The previous behaviour was
to stop processing the file when a token that can't start an item was
encountered, without producing any error. Fixes #21146.
2015-02-07 19:14:35 +01:00
bors
ce5aad2f10 Auto merge of #21982 - pnkfelix:extend-Z-print-region-graph, r=nikomatsakis
Extend region-inference graphviz rendering with enclosing relationship as well as the constraint edges.
2015-02-07 16:14:20 +00:00
bors
8661b3dc0f Auto merge of #21971 - pnkfelix:fsk-restrict-fixdsz-array-moves, r=nikomatsakis
Revised version of PR #21930.

Restrictions on moves into and out-from fixed-length arrays.

(There was only one use of this "feature" in the compiler source.)

Note 1: the change to the error message in tests/compile-fail/borrowck-use-in-index-lvalue.rs, where we now report that *w is uninitialized (rather than w), was unintended fallout from the implementation strategy used here. The change appears harmless to me, but I welcome advice on how to bring back the old message, which was slightly cleaner (i.e. less unintelligible) since that the syntactic form *w does not actually appear in the source text.

Note 2: the move out-from restriction to only apply to expr[i], and not destructuring bind (e.g. f([a, b, c]: Array) { ... }) since the latter is compatible with nonzeroing drop, AFAICT.

[breaking-change]
2015-02-07 14:08:38 +00:00
Simonas Kazlauskas
b510b90916 Do not fail if --emit≠link and there’s no main fn
Fixes #21813
2015-02-07 15:41:21 +02:00
Felix S. Klock II
4583272bf5 Updates to tests reflecting array-move restrictions.
Note that the change to the error message in
borrowck-use-in-index-lvalue.rs, where we report that `*w` is
uninitialized rather than `w`, was unintended fallout from the
implementation strategy used here.

The change appears harmless to me, but I welcome advice on how to
bring back the old message, which was slightly cleaner (i.e. less
unintelligible).

----

drive-by: revise compile-fail/borrowck-vec-pattern-move-tail to make
it really clear that there is a conflict that must be signaled.

(A hypothetical future version of Rust might be able to accept the
prior version of the code, since the previously updated index was not
actually aliased.)
2015-02-07 13:44:06 +01:00
Felix S. Klock II
128ac9dfcb Add tests of move-into-dead-array restriction. 2015-02-07 13:44:06 +01:00
Felix S. Klock II
ce341f79b4 Add tests of move-out-of-array restriction. 2015-02-07 13:44:06 +01:00
Felix S. Klock II
cc8f35f874 Restrictions on moves out-from and into fixed-length arrays.
No longer legal: `fn foo(a: [D; 5]) { drop(a); a[2] = D::new(); }`;
one must first initialize the entirety of `a` before assigning to its
individual elements.

No longer legal: `fn foo(arr: [D; 5]) -> D { arr[2] }`, unless `D`
implements `Copy`. This "move out-from" restriction only affects
`expr[i]`, and not destructuring (e.g. `f([a, b, c]: Array) { ... }`).

uses mem_categorization to distinguish destructuring-bind from array
indexing.

See discussion on RFC PR 533.

[breaking-change]
2015-02-07 13:44:00 +01:00
Felix S. Klock II
c0a874472a Fix libsyntax so we can bootstrap even with move out of array restriction. 2015-02-07 13:19:30 +01:00
Felix S. Klock II
7610feb82a remove closure &mut:/&: annotations. 2015-02-07 13:16:09 +01:00
bors
80627cd3cc Auto merge of #22023 - alexcrichton:oops-picked-the-wrong-plugin, r=nikomatsakis
The compiler would previously fall back to using `-L` and normal lookup paths if
a `--extern` path was specified but it did not match (wrong architecture, for
example). This commit removes this behavior and forces the hand of the crate
loader to *always* use the `--extern` path if specified, no matter whether it is
correct or not.

This fixes a bug today where the compiler's own libraries are favored in cross
compilation by accident. For example when a crate using the crates.io version of
`log` was cross compiled, Cargo would compile `log` for the target architecture.
When loading the macros, however, the compiler currently favors using the *host*
architecture (for plugins), and because the `--extern log=...` pointed at an
rlib for the target architecture, that lookup failed. The crate loader  then
fell back on `-L` paths to find the compiler-used `log` crate (the wrong one!)
and then a compile failure happened because the logging macros are slightly
different.
2015-02-07 12:01:31 +00:00
Caspar Krieger
4038694718 Link to rustdoc page in the Rust book directly
No point sending people to a page which just says "this is now part of
the Rust book".
2015-02-07 22:21:01 +11:00
Michael Neumann
859f4d9f16 Fix struct passwd and _SC_GETPW_R_SIZE_MAX for DragonFly 2015-02-07 12:04:36 +01:00
Caspar Krieger
684e43e712 Fix broken link to std::rc module docs
Current link structure is /std/rc/struct.Rc.html so ../index.html ends
up linking to /std/ rather than /std/rc/
2015-02-07 21:45:13 +11:00
bors
a08504bb35 Auto merge of #21995 - leejunseok:fix_invariant_ex, r=steveklabnik
Should fix #20147

This is my second PR in the history of ever (I botched my first one #21828). Any tips would be appreciated!
2015-02-07 09:55:14 +00:00
Sébastien Marie
04b7976c2f sed -i option isn't portable
the sed option `--in-place` (or `-i`) is a GNU extension, and it is not
portable to BSD system (openbsd and freebsd checked).

use an alternate construction in order to keep the semantic.
2015-02-07 08:55:37 +01:00
bors
e62fec36b9 Auto merge of #21978 - Potpourri:error-extern-crate-staticlib, r=alexcrichton
Add special error for this case and help message `please recompile this crate using --crate-type lib`, also list found candidates.

See issue #14416

r? @alexcrichton
2015-02-07 06:34:37 +00:00
Keegan McAllister
7324c2cf4f sync: Expose PoisonError::new 2015-02-06 21:36:07 -08:00
Keegan McAllister
96c3a13680 sync: Add is_poisoned to Mutex and RwLock 2015-02-06 21:36:07 -08:00
bors
0b6dbbc9cf Auto merge of #21949 - japaric:index, r=nikomatsakis
closes #21630

Overloaded indexing (`&[mut] foo[bar]`) only works when `<Self as Index>::Output` is the same as `<Self as IndexMut>::Output` (see issue above). To restrict implementations of `IndexMut` that doesn't work, this PR makes `IndexMut` a supertrait over `Index`, i.e. `trait IndexMut<I>: Index<I>`, just like in the `trait DerefMut: Deref` case.

This breaks all downstream implementations of `IndexMut`, in most cases this simply means removing the `type Output = ..` bit, which is now redundant, from `IndexMut` implementations:

``` diff
 impl Index<Foo> for Bar {
     type Output = Baz;
     ..
 }

 impl IndexMut<Foo> for Bar {
-    type Output = Baz;
     ..
 }
```

[breaking-change]

---

r? @nikomatsakis
2015-02-07 04:14:22 +00:00
Jorge Aparicio
724bf7bce2 make IndexMut a super trait over Index
closes #21630
2015-02-06 21:11:59 -05:00
bors
7ebf9bc5c2 Auto merge of #21505 - GuillaumeGomez:interned_string, r=alexcrichton
It's in order to make the code more homogeneous.
2015-02-07 02:04:47 +00:00
Niko Matsakis
acaad3ad67 Simplify cache selection by just using the local cache whenever there
are any where-clauses at all. This seems to be the simplest possible
rule and will (hopefully!) put an end to these annoying "cache leak"
bugs. Fixes #22019.
2015-02-06 19:11:50 -05:00
bors
d3732a12e8 Auto merge of #21997 - Manishearth:rollup, r=alexcrichton
None
2015-02-06 23:30:17 +00:00
GuillaumeGomez
a2e01c62d5 librustdoc has been updated
Fixes run build error

Fix test failure

Fix tests' errors
2015-02-06 22:54:41 +01:00
Alex Crichton
48b6aef660 rustc: Don't fall back to -L if using --extern
The compiler would previously fall back to using `-L` and normal lookup paths if
a `--extern` path was specified but it did not match (wrong architecture, for
example). This commit removes this behavior and forces the hand of the crate
loader to *always* use the `--extern` path if specified, no matter whether it is
correct or not.

This fixes a bug today where the compiler's own libraries are favored in cross
compilation by accident. For example when a crate using the crates.io version of
`log` was cross compiled, Cargo would compile `log` for the target architecture.
When loading the macros, however, the compiler currently favors using the *host*
architecture (for plugins), and because the `--extern log=...` pointed at an
rlib for the target architecture, that lookup failed. The crate loader  then
fell back on `-L` paths to find the compiler-used `log` crate (the wrong one!)
and then a compile failure happened because the logging macros are slightly
different.
2015-02-06 13:53:39 -08:00
Florian Hahn
01db9a46af Move compile-fail tests that are rejected by the parser to parse-fail 2015-02-06 22:23:16 +01:00
Michael Woerister
93edb7c17b debuginfo: Fix problem with debug locations of constants in match patterns. 2015-02-06 21:24:06 +01:00
Michael Woerister
0eec22640c debuginfo: Implement direct debuginfo source location application for ICmp, FCmp, and CallWithConv. 2015-02-06 21:24:06 +01:00
Michael Woerister
d98d50832c debuginfo: Assign debuginfo source locations to lang-item calls. 2015-02-06 21:22:41 +01:00
bors
b75b21cb9b Auto merge of #21926 - mzabaluev:raw-lifetime, r=alexcrichton
New functions, `slice::from_raw_parts` and `slice::from_raw_parts_mut`,
are added to implement the lifetime convention as agreed in rust-lang/rfcs#556.
The functions `slice::from_raw_buf` and `slice::from_raw_mut_buf` are
left deprecated for the time being.

Holding back on changing the signature of `std::ffi::c_str_to_bytes` as consensus in rust-lang/rfcs#592 is building to replace it with a composition of other functions.

Contribution to #21923.
2015-02-06 19:49:31 +00:00