Steve Klabnik [Wed, 2 Dec 2015 00:01:42 +0000 (19:01 -0500)]
Rollup merge of #30153 - durka:patch-11, r=steveklabnik
I think this fixes #30137. I basically just repeated some details that were scattered around other places in this document, and emphasized that you probably don't want an `extern crate` or `mod` statement to end up inside a function.
Steve Klabnik [Wed, 2 Dec 2015 00:01:41 +0000 (19:01 -0500)]
Rollup merge of #30144 - pjungwir:clarify-semver-rules, r=steveklabnik
The documentation shows this:
[dependencies]
rand="0.3.0"
and says it allows any version compatible with 0.3.0, but then it says, "If we wanted to use only 0.3.0 exactly, we could use `=0.3.0`." That is very easy to misunderstand, so hopefully this PR will help others not to be as confused as me. :-)
Alex Burka [Tue, 1 Dec 2015 23:18:19 +0000 (18:18 -0500)]
trpl: explain how to inhibit rustdoc's auto-main
I think this fixes #30137. I basically just repeated some details that were scattered around other places in this document, and emphasized that you probably don't want an `extern crate` or `mod` statement to end up inside a function.
bors [Tue, 1 Dec 2015 21:38:20 +0000 (21:38 +0000)]
Auto merge of #29858 - fhahn:abort-if-path-has-spaces, r=brson
The Rust build scripts do work if the source directory contains spaces. I tried to make it work with spaces. I managed to get the Rust's and LLVM's configure scripts to work with spaces in the path, but I could not figure out how to get the Rust makefiles working.
So for now, this PR updates Rust's `configure` to abort if the source path contains spaces. I also added a note about spaces in the source path to the README.
bors [Tue, 1 Dec 2015 19:47:38 +0000 (19:47 +0000)]
Auto merge of #25570 - oli-obk:const_indexing, r=nikomatsakis
This PR allows the constant evaluation of index operations on constant arrays and repeat expressions. This allows index expressions to appear in the expression path of the length expression of a repeat expression or an array type.
bors [Tue, 1 Dec 2015 17:59:42 +0000 (17:59 +0000)]
Auto merge of #29391 - DanielKeep:syntax-index, r=steveklabnik
* `const`: Add reference to raw pointers
* Change `expr!(...)` etc. examples to use `ident` instead.
*Technically*, it should be `pat`, but that's not how it works in
practice.
* `|`: add reference to closure syntax.
* Closure syntax entry.
* Indexing and slicing entries.
* Add history of obsolete and deprecated syntax.
bors [Tue, 1 Dec 2015 13:19:41 +0000 (13:19 +0000)]
Auto merge of #30135 - michaelwoerister:interning-checks, r=sanxiyn
This PR adds some safety checks to interning things in `ty::ctxt`. Accidentally re-interning an `AdtDef` has bitten me in the behind just last week (it messes up things in very subtle way only showing up later as an LLVM assertion).
Initially I had also added a check to `ty::ctxt::node_type_insert()` -- but there it seems to be expected that the same table slot is written to multiple times.
Daniel Keep [Tue, 1 Dec 2015 08:37:15 +0000 (19:37 +1100)]
trpl: additions & fixes for syntax index.
* `const`: Add reference to raw pointers
* Change `expr!(...)` etc. examples to use `ident` instead.
*Technically*, it should be `pat`, but that's not how it works in
practice.
* `|`: add reference to closure syntax.
* Closure syntax entry.
* Indexing and slicing entries.
bors [Tue, 1 Dec 2015 07:40:41 +0000 (07:40 +0000)]
Auto merge of #30118 - alexcrichton:fix-time-again, r=aturon
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.
Steve Klabnik [Mon, 30 Nov 2015 23:02:21 +0000 (18:02 -0500)]
Rollup merge of #30115 - nilcons-contrib:fix-book-stack, r=steveklabnik
The `f` argument will reference the actual value in the `d` box, not the box in the `bar`'s stack frame.
I am just learning Rust, so I don't know how to explain this well, but just from `f`'s type it is clear that it will be a pointer to an `i32`, not a pointer to a pointer. Some `println!("{:p}", ...)`'s can easily confirm this.
I would actually suggest to remove/simplify this part of the example. This is a subtle issue that can easily confuse people at the early stages of familiarizing with the language. (As I got confused by it. :))
bors [Mon, 30 Nov 2015 21:15:56 +0000 (21:15 +0000)]
Auto merge of #30080 - durka:patch-10, r=alexcrichton
Fixes #30073. The input to `cfg!` is a meta attribute, but not _any_ meta attribute (e.g. `cfg!(allow(dead_code))` doesn't compile). But the macro_rules syntax can't quite express this, so I added a note to the doc.
Alex Crichton [Mon, 30 Nov 2015 18:53:20 +0000 (10:53 -0800)]
std: Bump time margin in std::time tests
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.
bors [Sun, 29 Nov 2015 21:10:36 +0000 (21:10 +0000)]
Auto merge of #30088 - sourcefrog:doc-casts, r=steveklabnik
Based on the description in https://github.com/rust-lang/rust/blob/219eca11b044de3644b3e9101124513c1a842b09/src/librustc_typeck/check/cast.rs#L11 and https://doc.rust-lang.org/nightly/nomicon/casts.html
bors [Sat, 28 Nov 2015 00:45:34 +0000 (00:45 +0000)]
Auto merge of #29383 - petrochenkov:empstr, r=pnkfelix
Fixes https://github.com/rust-lang/rust/issues/28692
Fixes https://github.com/rust-lang/rust/issues/28992
Fixes some other similar issues (see the tests)
[breaking-change], needs crater run (cc @brson or @alexcrichton )
The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
bors [Fri, 27 Nov 2015 18:41:53 +0000 (18:41 +0000)]
Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiyn
Fixes #13677
This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers.
Example. Compiling this program:
```rust
macro_rules! foo {
($e:expr) => ( $e )
}
fn main() {
fob!("hello!");
}
```
gives the following error message:
```
/Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!'
/Users/mcp/temp/test.rs:7 fob!("hello!");
^~~
/Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`?
/Users/mcp/temp/test.rs:7 fob!("hello!");
```
I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
bors [Fri, 27 Nov 2015 15:55:05 +0000 (15:55 +0000)]
Auto merge of #30082 - semarie:execve, r=alexcrichton
under OpenBSD and Bitrig, it is an error to pass an empty argv
argument to execve(2). It results the test fail as execve(2) don't exec
and set errno to EINVAL.
instead, make argv with two arguments (in order to differenciate the
initial call, from the execve call).
Sébastien Marie [Fri, 27 Nov 2015 12:48:07 +0000 (13:48 +0100)]
pass at least one argument to execve
under OpenBSD and Bitrig, it is an error to pass an empty argv
argument to execve(2). It results the test fail as execve(2) don't exec
and set errno to EINVAL.
instead, make argv with two arguments (in order to differenciate the
initial call, from the execve call).
bors [Thu, 26 Nov 2015 18:20:58 +0000 (18:20 +0000)]
Auto merge of #30043 - arielb1:split-metadata, r=nikomatsakis
This improves bootstrap times because of better parallelism - though I need to measure how much - and allows metadata to be modified without triggering a full recompile. This also ensures that metadata handling and the rest of rustc remain decoupled, which is a first step for switching to a new metadata format.
This is a [breaking-change] to all plugin authors because of the following renames:
* `rustc::plugin` is now `rustc_plugin`
* `rustc::metadata` is now `rustc_metadata`
* Most data types from `rustc::metadata`, along with `LOCAL_CRATE`, are now in `rustc::middle::cstore`.
* The CStore methods were split between the `rustc::middle::CrateStore` trait (and trait object) and the `rustc_metadata::cstore::CStore`, with an `Rc<CrateStore>` stored in the `Session`. The inner `CStore` can be accessed via the inner `Any` bound, but this is deprecated.