Commit Graph

41202 Commits

Author SHA1 Message Date
Manish Goregaokar
5daee19eca Rollup merge of #24212 - alexcrichton:destabilize-begin-unwind, r=huonw
Now that we have a `#[allow_internal_unstable]` attribute for macros there's no
need for these two `begin_unwind` functions to be stable. Right now the `panic!`
interface is the only one we wish to stabilize, so remove the stability markers
from these functions.

While this is a breaking change, it is highly unlikely to break any actual code.
It is recommended to use the `panic!` macro instead if it breaks explicit calls
into `std::rt`.

[breaking-change]
cc #24208
2015-04-10 00:24:43 +05:30
Manish Goregaokar
4e466e730b Rollup merge of #24207 - kmcallister:llvm-plugin, r=brson
r? @brson

I'm using this to integrate rustc with [american-fuzzy-lop](http://lcamtuf.coredump.cx/afl/). Building with afl instrumentation is no different from loading any other plugin library.

I'd like this PR to include a `run-make` test with a custom LLVM pass; however I'm not sure it's worth the trouble of building C++ code and linking LLVM from the test suite (are there existing tests that do this?)
2015-04-10 00:24:43 +05:30
Manish Goregaokar
2dffe78979 Rollup merge of #24205 - brson:debug, r=alexcrichton
This makes the default configuration fully optimized, with no debugging options, no llvm asserts, renames --enable-debug to --enable-debug-assertions, and adds --enable-debug as a blanket option that toggles various things, per #17665. It does not add a `--enable-release` flag since that would be a no-op.

cc @nrc

Fixes https://github.com/rust-lang/rust/issues/22390
Fixes https://github.com/rust-lang/rust/issues/17081
Partially addresses https://github.com/rust-lang/rust/issues/17665
2015-04-10 00:24:43 +05:30
Manish Goregaokar
67fa4d3a0c Rollup merge of #24193 - lstat:needstest, r=alexcrichton
Closes #22289
Closes #22370
Closes #22384
2015-04-10 00:24:42 +05:30
Manish Goregaokar
3b87140299 Rollup merge of #24191 - nikomatsakis:issue-20791, r=pnkfelix
Modify the ExprUseVisitor to walk each part of an AutoRef, and in
particular to treat an AutoUnsize as as kind of \"instantaneous\" borrow
of the value being unsized. This prevents us from feeding uninitialized
data.

This caused a problem for the eager reborrow of comparison traits,
because that wound up introducing a \"double AutoRef\", which was not
being thoroughly checked before but turned out not to type check.
Fortunately, we can just remove that \"eager reborrow\" as it is no longer
needed now that `PartialEq` doesn't force both LHS and RHS to have the
same type (and even if we did have this problem, the better way would be
to lean on introducing a common supertype).

Fixes #20791.

r? @nrc
2015-04-10 00:24:42 +05:30
Brian Anderson
0e0c841bd5 Nightly gets LLVM assertions 2015-04-09 11:51:46 -07:00
Andrew Paseltiner
644a75ecd1 Fix borrow docs 2015-04-09 12:51:19 -04:00
Aaron Turon
c3aa05752c Add regression test for #19097
Closes #19097
2015-04-09 09:29:40 -07:00
Thiago Carvalho
549bd55eed resurrect research paper list #24004 2015-04-09 18:07:33 +02:00
Aaron Turon
e3f324cd9d Improve bounds in Iterator API
This commit changes `Iterator`'s API by:

* Generalizing bounds from `Iterator` to `IntoIterator` whenever
  possible, matching the semantics and ergonomics of `for` loops.

* Tightens up a few method-level bounds so that you get an error
  earlier. For example, `rev` did not require `DoubleEndedIterator` even
  though the result is only an `Iterator` when the original iterator was
  double-ended.

Closes #23587

The bound-tightening is technically a:

[breaking-change]

but no code should break in practice.
2015-04-09 08:54:09 -07:00
bors
e326aa197b Auto merge of #24176 - kballard:bufreader-seek-impl, r=aturon 2015-04-09 12:07:24 +00:00
Manish Goregaokar
68100e4c07 Rollup merge of #24176 - kballard:bufreader-seek-impl, r=aturon 2015-04-09 15:53:48 +05:30
Manish Goregaokar
a00ab58f3c Rollup merge of #24175 - dhuseby:bitrig_fixing_tests_2, r=alexcrichton
I'm not sure why this is failing.  This patch disables this test until I can figure out what is wrong.
2015-04-09 15:53:43 +05:30
Manish Goregaokar
ce765896c1 Rollup merge of #24171 - rillian:rustup, r=brson
The idea here is if you don't want rust in /usr/local
you can put something like this is your .profile:

```
export RUSTUP_PREFIX=$HOME/.local/rust
export PATH=$PATH:${RUSTUP_PREFIX}/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${RUSTUP_PREFIX}/lib
```
Then when you run rustup, it will update the install
in ${RUSTUP_PREFIX} without having to remember to pass
an explicit --prefix argument every time.
2015-04-09 15:53:36 +05:30
Nick Cameron
341870a2d1 Fix the span for for expressions 2015-04-09 20:36:07 +12:00
bors
e57410cd92 Auto merge of #24171 - rillian:rustup, r=brson
The idea here is if you don't want rust in /usr/local
you can put something like this is your .profile:

```
export RUSTUP_PREFIX=$HOME/.local/rust
export PATH=$PATH:${RUSTUP_PREFIX}/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${RUSTUP_PREFIX}/lib
```
Then when you run rustup, it will update the install
in ${RUSTUP_PREFIX} without having to remember to pass
an explicit --prefix argument every time.
2015-04-09 07:49:26 +00:00
Nick Cameron
613cf9a2a1 Debug impls for a few things in syntax::codemap 2015-04-09 18:25:48 +12:00
bors
0e5e669272 Auto merge of #24168 - kballard:clone-for-extern-c-unsafe-fns, r=alexcrichton
We only implemented Clone on `extern "Rust" fn`s (for up to 8
parameters). This didn't cover `extern "C"` or `unsafe` (or
`unsafe extern "C"`) `fn`s, but there's no reason why they shouldn't be
cloneable as well.

The new impls are marked unstable because the existing impl for `extern
"Rust" fn`s is.

Fixes #24161.
2015-04-09 04:56:23 +00:00
Kevin Ballard
16052053ac Implement io::Seek for io::BufWriter<W> where W: io::Seek
Seeking the `BufWriter` writes out its internal buffer before seeking.
2015-04-08 21:25:59 -07:00
Kevin Ballard
0a380a9318 Implement io::Seek for io::BufReader<R> where R: io::Seek
Seeking the `BufReader` discards the internal buffer (and adjusts the
offset appropriately when seeking with `SeekFrom::Current(_)`).
2015-04-08 21:25:58 -07:00
Brian Anderson
a725426ec8 Don't deoptimize llvm when --enable-debug
libLTO fails to link here.
2015-04-08 18:01:46 -07:00
bors
287a544a30 Auto merge of #24158 - sanxiyn:cast, r=nrc
Fix #13993.
Fix #17167.
2015-04-09 01:00:37 +00:00
Alex Crichton
ec7c800d2f Remove pretty-expanded from failing tests
This commit removes pretty-expanded from all tests that wind up calling panic!
one way or another now that its internals are unstable.
2015-04-08 17:21:34 -07:00
Alex Crichton
561fdec135 std: Stabilize io::Error::from_raw_os_error
This commit stabilizes the old `io::Error::from_os_error` after being renamed to
use the `raw_os_error` terminology instead. This function is often useful when
writing bindings to OS functions but only actually converting to an I/O error at
a later point.
2015-04-08 16:49:49 -07:00
Alex Crichton
6b32072c0c std: Stabilize Clone::clone_from
This method hasn't really changed since is inception, and it can often be a
nice performance win for some situations. This method also imposes no burden on
implementors or users of `Clone` as it's just a default method on the side.
2015-04-08 16:40:03 -07:00
Alex Crichton
65e3f0325a std: Destabilize the internals of panic!
Now that we have a `#[allow_internal_unstable]` attribute for macros there's no
need for these two `begin_unwind` functions to be stable. Right now the `panic!`
interface is the only one we wish to stabilize, so remove the stability markers
from these functions.

While this is a breaking change, it is highly unlikely to break any actual code.
It is recommended to use the `panic!` macro instead if it breaks explicit calls
into `std::rt`.

[breaking-change]
cc #24208
2015-04-08 15:48:46 -07:00
Luke Gallagher
2a9e1011b1 Remove ignore-tidy-linelength from tests that no longer need it 2015-04-09 08:21:59 +10:00
Brian Anderson
6d17c35cd5 configure: Add --enable-debug-jemalloc 2015-04-08 15:12:08 -07:00
bors
6436e348e9 Auto merge of #24144 - richo:ptr-formatter, r=alexcrichton
~~I believe this should fix the issue. Opening a PR to ensure noone duplicates effort, I'm running check now.~~

Closes #24091
2015-04-08 22:08:31 +00:00
Brian Anderson
1002155c75 Add --enable-debug to control multiple perf options 2015-04-08 14:21:36 -07:00
Keegan McAllister
0cb9379446 Allow plugins to register LLVM passes 2015-04-08 14:01:59 -07:00
Brian Anderson
7cbf823353 configure: Add --enable-debuginfo 2015-04-08 13:57:37 -07:00
Brian Anderson
1b34f0aef0 configure: Clarify --enable-debug-assertions status message 2015-04-08 13:31:26 -07:00
Brian Anderson
8545d2ce53 configure: Disable LLVM asserts by default 2015-04-08 13:27:12 -07:00
Brian Anderson
2cdfd372e2 configure: Clarify help message for --enable-debug-assertions 2015-04-08 13:25:20 -07:00
Brian Anderson
59e332bd2f configure: Disable debug assertions by default 2015-04-08 13:23:44 -07:00
Brian Anderson
ed8eebd99b configure: Rename --enable-debug to --enable-debug-assertions 2015-04-08 13:22:56 -07:00
Brian Anderson
bc9f16c599 configure: Remove obsolete --disable-verify option
rust-installer never verifies.
2015-04-08 12:16:47 -07:00
Brian Anderson
45eb54c870 configure: Remove obsolete --nightly flag 2015-04-08 12:07:35 -07:00
bors
ff804778c8 Auto merge of #24029 - nagisa:print-locking, r=alexcrichton
write_fmt calls write for each formatted field. The default implementation of write_fmt is used,
which will call write on not-yet-locked stdout (and write locking after), therefore making print!
in multithreaded environment still interleave contents of two separate prints.

I’m not sure whether we want to do this change, though, because it has the same deadlock hazard which we tried to avoid by not locking inside write_fmt itself (see [this comment](80def6c244/src/libstd/io/stdio.rs (L267))).

Spotted on [reddit].

cc @alexcrichton 

[reddit]: http://www.reddit.com/r/rust/comments/31comh/println_with_multiple_threads/
2015-04-08 19:03:09 +00:00
Alex Crichton
f3f99fb44e std: Fix fs::read_link behavior on Windows
The current implementation of using GetFinalPathNameByHandle actually reads all
intermediate links instead of just looking at the current link. This commit
alters the behavior of the function to use a different API which correctly reads
only one level of the soft link.

[breaking-change]
2015-04-08 10:33:39 -07:00
Simonas Kazlauskas
45aa6c8d1b Implement reentrant mutexes and make stdio use them
write_fmt calls write for each formatted field. The default implementation of write_fmt is used,
which will call write on not-yet-locked stdout (and write locking after), therefore making print!
in multithreaded environment still interleave contents of two separate prints.

This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides
write_fmt to lock the stdio handle for the whole duration of the call.
2015-04-08 19:42:16 +03:00
bors
30e7e6e8b0 Auto merge of #24195 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24143, #24149, #24167, #24178
- Failed merges:
2015-04-08 15:59:10 +00:00
Steve Klabnik
12e9d7ced0 Rollup merge of #24178 - steveklabnik:new_toc, r=nikomatsakis
Basically, the overall structure is this:

* Getting Started - getting an environment up and running
* Learn Rust - project-based learning the basics
* Effective Rust - higher level concepts that lead to writing good rust
* Syntax and Semantics - chunks of exactly what it sounds like
* Nightly Rust - unstable stuff, a staging area for documenting features
* Glossary - self-explanatory

There's a number of weaknesses with the current TOC, but I'll just focus on the strengths of the new one:

We start off with getting our environment set up. That's "getting started".

Then, we basically present you with two choices: do you want to start small, with bits of syntax? Or do you want to dive in with projects?

I'm guessing more people will choose the second, so that's the next part: "Learn Rust." I don't have any chapters here, but this would have an updated guessing game, a tutorial on building a little `wc` clone, and something else I haven't decided yet. Lots of options. But the idea is to just dive in and get your hands dirty. I'll heavily link to the 'syntax and semantics' sections that are relevant.

Then, a section I'm calling 'Effective Rust'. it feels greedy to steal that title, so I'm hoping to give it another name. These are higher-level things than syntax that Rust programmers should know: error handling is a great example. Most of these are sort of 'how do I use the standard library together' kinds of things. This also contains informations about systems programming that those new to it might not know: the stack vs the heap, for example.

Then, "Syntax and Semantics." This has one section for each bit of Rust. Small, focused, but explains _everything_. These are positioned to be almost entirely in-order, but heavily cross-link, so you can go out of order if you want to, but you can also use it as a reference.

Next, "Nightly Rust," where documenting unstable things goes. If we want to get good feedback on new features, they'll need to be documented, but we don't want to taint the main docs, so that's what this is for.

Finally, the glossary. Straightforward enough.

--------------------------------

This is going to be a terrible PR to review, so I just did the TOC re-organization, with basically no editing. So it'll be a bit jumbled at first. But next steps are to go through and edit / revise / tweak / add stuff to get it in tip-top shape for 1.0!
2015-04-08 11:34:12 -04:00
Steve Klabnik
91798a89e5 Rollup merge of #24167 - hauleth:remove-incorrect-example-from-mpsc, r=steveklabnik
As beta is now released and is "suggested" version of `rustc` then there should be no code (in documentation) that will not compile with it. This one does not.

So according to [this great talk](http://delete-your-code.herokuapp.com/), I am doing what should be done.
2015-04-08 11:34:12 -04:00
Steve Klabnik
4cef7f296f Rollup merge of #24149 - bombless:update-faq, r=steveklabnik
I think "let is used to introduce variables" is incorrent.
You can use
```rust
match (42, true) {
    (x, y) => { /* ... */ }
}
```
to replace
```rust
let x = 42;
let y = true;
```
so it's nothing special for `let`.
2015-04-08 11:34:12 -04:00
Steve Klabnik
ac3cc6c427 Rollup merge of #24143 - michaelsproul:extended-errors, r=pnkfelix
I've taken another look at extended errors - fixing up the printing and adding a few more for match expressions.

With regards to printing, the previous behaviour was to just print the error message string directly, despite it containing indentation which caused it to overflow the standard terminal width of 80 columns (try `rustc --explain E0004`). The first approach I considered was to strip the leading whitespace from each line and lay out the text dynamically, inserting spaces in between. This approach became quite messy when taking multi-paragraph errors into account (and seemed overkill). The approach I settled on removes the indentation in the string itself and begins each message with a newline that is stripped before printing.

I feel like complete extended errors would be nice to have for 1.0.0 and I'm happy to spearhead an effort to get them written. Brian got me onto writing them at an SF meetup and I think it shouldn't be too hard to get the remaining 80 or so written with the help of people who don't really work on compiler innards.
2015-04-08 11:34:11 -04:00
Niko Matsakis
1e79870770 Modify the ExprUseVisitor to walk each part of an AutoRef, and in
particular to treat an AutoUnsize as as kind of "instantaneous" borrow
of the value being unsized. This prevents us from feeding uninitialized
data.

This caused a problem for the eager reborrow of comparison traits,
because that wound up introducing a "double AutoRef", which was not
being thoroughly checked before but turned out not to type check.
Fortunately, we can just remove that "eager reborrow" as it is no longer
needed now that `PartialEq` doesn't force both LHS and RHS to have the
same type (and even if we did have this problem, the better way would be
to lean on introducing a common supertype).
2015-04-08 09:49:41 -04:00
Luke Gallagher
59e62deac9 Add tests for #22289, #22370 and #22384
Closes #22289
Closes #22370
Closes #22384
2015-04-08 23:23:43 +10:00
bors
9266d599f4 Auto merge of #24021 - pnkfelix:fn-params-outlive-body, r=nikomatsakis
Encode more precise scoping rules for function params

Function params outlive everything in the body (incl temporaries).  Thus if we assign them their own `CodeExtent`, the region inference can properly show that it is sound to have temporaries with destructors that reference the parameters (because such temporaries will be dropped before the parameters are dropped).

Fix #23338
2015-04-08 12:57:58 +00:00