Commit graph

43132 commits

Author SHA1 Message Date
bors ba0e1cd814 Auto merge of #25609 - nikomatsakis:const-fn, r=pnkfelix
This is a port of @eddyb's `const-fn` branch. I rebased it, tweaked a few things, and added tests as well as a feature gate. The set of tests is still pretty rudimentary, I'd appreciate suggestions on new tests to write. Also, a double-check that the feature-gate covers all necessary cases.

One question: currently, the feature-gate allows the *use* of const functions from stable code, just not the definition. This seems to fit our usual strategy, and implies that we might (perhaps) allow some constant functions in libstd someday, even before stabilizing const-fn, if we were willing to commit to the existence of const fns but found some details of their impl unsatisfactory.

r? @pnkfelix
2015-05-24 11:12:34 +00:00
bors cc56c20ba4 Auto merge of #25168 - Manishearth:register_attr, r=eddyb
This lets plugin authors opt attributes out of the `custom_attribute`
and `unused_attribute` checks.


cc @thepowersgang
2015-05-24 09:38:26 +00:00
Simon Sapin bbf8ba7c23 Implement Eq for Cell and RefCell.
`core::cell::Cell<T>` and `core::cell::RefCell<T>` currently implement
`PartialEq` when `T` does, and just defer to comparing `T` values.
There is no reason the same shouldn’t apply to `Eq`.

This enables `#[derive(Eq, PartialEq)]` on e.g.
structs that have a `RefCell` field.
2015-05-24 10:38:59 +02:00
Thomas Karpiniec 49597fcbf2 book: explanation that String -> &str coercion doesn't happen for &str traits 2015-05-24 13:54:05 +10:00
Richo Healey 1b3465cf9e driver: Only emit the RUST_BACKTRACE message if not present 2015-05-23 19:51:44 -07:00
bors 0fc0476e6a Auto merge of #25719 - brson:crosslink, r=eddyb
The recent MSVC patch made the build system pass explicit linkers to
rustc, but did not set that up for anything other than MSVC.

This is blocking nightlies.
2015-05-24 00:36:56 +00:00
bors 0c2642a571 Auto merge of #25666 - tshepang:better-path-docs, r=steveklabnik 2015-05-23 22:07:58 +00:00
Tshepang Lekhonkhobe 462829cb13 doc: fix Windows test failure 2015-05-23 23:13:57 +02:00
Tshepang Lekhonkhobe d59546d07d path: make this bit follow idiom 2015-05-23 19:51:52 +02:00
Tshepang Lekhonkhobe d233c28e76 doc: missing words 2015-05-23 19:51:07 +02:00
bors a33b808ac0 Auto merge of #25735 - oli-obk:rollup, r=steveklabnik
- Successful merges: #25681, #25687, #25695, #25697, #25702, #25703, #25709, #25710, #25714, #25715, #25716, #25722
- Failed merges:
2015-05-23 17:33:54 +00:00
Oliver Schneider a650075f89 Rollup merge of #25722 - nickdesaulniers:configureClang37, r=brson
Was able to successfully configure.  Building and testing now.
2015-05-23 19:03:20 +02:00
Oliver Schneider 59820fcf61 Rollup merge of #25716 - steveklabnik:remove_bad_docs, r=Gankro 2015-05-23 19:03:20 +02:00
Oliver Schneider 962b132fe3 Rollup merge of #25715 - nero-luci:patch-1, r=steveklabnik
I consider that this version has a better reading fluency, instead of having a period between clauses
2015-05-23 19:03:19 +02:00
Oliver Schneider 0b70f27b64 Rollup merge of #25714 - brianquinlan:patch-1, r=huonw 2015-05-23 19:03:19 +02:00
Oliver Schneider 04fe212e1f Rollup merge of #25710 - Manishearth:no_decorator_clone, r=sfackler
fixes #25683

I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4)

I measured the memory usage for both --pretty=expanded and -Z no-trans

It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure.

r? @eddyb

(have not yet run tests, but it compiles fine, might want to wait before giving r+)

cc @nrc @huon
2015-05-23 19:03:19 +02:00
Oliver Schneider d5985d3036 Rollup merge of #25709 - MatejLach:stdlib_style, r=steveklabnik
Sounds better to me this way.
r @steveklabnik ?
2015-05-23 19:03:19 +02:00
Oliver Schneider 9aa88c99f7 Rollup merge of #25703 - eddyb:lazier-loads, r=pnkfelix
Reduces pre-trans heap baseline (tested on `fn main() {}`) from 1.2MB to 696kB.
Most of the remaining allocations are used by imported macros.
While it might be possible to also load macros lazily, doing so is non-trivial and this PR doesn't tackle that.
2015-05-23 19:03:19 +02:00
Oliver Schneider d21f41ce6b Rollup merge of #25702 - killercup:rustdoc/search-primitives, r=Gankro
This minimally changes rustdoc's search as described in #25167.

Additionally, I also cleaned up some parts of the JS code.

There is one more change I made: After each result for a primitive type, I added "(Overview of primitive type)". This further differentiates the result from the module (previously, the only difference was that the module's link was blue). I'm not this is the way to go (this seems to be the only place where we do this) and it's no problem for me to remove that commit.

![std__str_-_rust](https://cloud.githubusercontent.com/assets/20063/7770589/67e8cb26-0090-11e5-8f99-c2a3af9fa37f.png)

cc @steveklabnik (it concerns docs) and @alexcrichton (who made changes to rustdoc previously)
2015-05-23 19:03:18 +02:00
Oliver Schneider a72ddbc2d0 Rollup merge of #25697 - geofft:configure-friendliness, r=brson
Make the error message about missing dependencies clearer, since "need program file" is pretty confusing, and make full commands get logged, since that seems to have been the intention.
2015-05-23 19:03:18 +02:00
Oliver Schneider 691c75a54f Rollup merge of #25695 - mbrubeck:reference, r=brson
r? @steveklabnik
2015-05-23 19:03:18 +02:00
Oliver Schneider 657efde2c6 Rollup merge of #25687 - tamird:num-self-cleanup, r=Gankro
Cleanup extracted from #25684. r? @alexcrichton
2015-05-23 19:03:18 +02:00
Oliver Schneider 0c74a73bd5 Rollup merge of #25681 - steveklabnik:gender, r=nmatsakis
Also, when checking for common gendered words elsewhere, I found one 'he', moved to 'they' as well.

https://github.com/rust-lang/rust/pull/25640#issuecomment-104304643
2015-05-23 19:03:18 +02:00
bors 4ee6820911 Auto merge of #25667 - lambda:rename-soft_link-to-symlink-landed-in-1.1, r=aturon
The change to split up soft_link to OS-specific symlink, symlink_file,
and symlink_dir didn't actually land in 1.0.0.  Update the stability and
deprecation attributes to correctly indicate that these changes happend
in 1.1.0.
2015-05-23 15:57:48 +00:00
bors 88e6976acf Auto merge of #25653 - dotdash:unsize_c, r=luqmana
Fixes #25581
2015-05-23 14:22:35 +00:00
bors d11399039c Auto merge of #25632 - alexcrichton:dt-dir, r=brson
This "fast path" in `DirEntry::file_type` on Unix wasn't turning out to be so
much of a fast path as the `DT_DIR` case wasn't handled, so directories fell
back to using `lstat` instead. This commit adds the missing case to return
quickly if a path is a directory and `DirEntry::file_type` is used.
2015-05-23 12:47:16 +00:00
bors 4c2ebc3947 Auto merge of #25416 - kballard:ffi-cstr-to-str-convenience, r=alexcrichton
This was motivated by http://www.evanmiller.org/a-taste-of-rust.html.

A common problem when working with FFI right now is converting from raw
C strings into `&str` or `String`. Right now you're required to say
something like

    let cstr = unsafe { CStr::from_ptr(ptr) };
    let result = str::from_utf8(cstr.to_bytes());

This is slightly awkward, and is not particularly intuitive for people
who haven't used the ffi module before. We can do a bit better by
providing some convenience methods on CStr:

    fn to_str(&self) -> Result<&str, str::Utf8Error>
    fn to_string_lossy(&self) -> Cow<str>

This will make it immediately apparent to new users of CStr how to get a
string from a raw C string, so they can say:

    let s = unsafe { CStr::from_ptr(ptr).to_string_lossy() };
2015-05-23 11:12:02 +00:00
bors 8bc80ba9fc Auto merge of #24847 - sfackler:debug-builders-stability, r=aturon
The `debug_builders` feature is up for 1.1 stabilization in #24028. This commit stabilizes the API as-is with no changes.

Some nits that @alexcrichton mentioned that may be worth discussing now if anyone cares:

* Should `debug_tuple_struct` and `DebugTupleStruct` be used instead of `debug_tuple` and `DebugTuple`? It's more typing but is a technically more correct name.
* `DebugStruct` and `DebugTuple` have `field` methods while `DebugSet`, `DebugMap` and `DebugList` have `entry` methods. Should we switch those to something else for consistency?

cc @alexcrichton @aturon
2015-05-23 09:36:56 +00:00
bors f472403650 Auto merge of #25717 - brson:compiler-docs, r=pnkfelix
The install target depends on compiler-docs but 'all' does not.
This means that running 'make && make install' will run additional
doc builds and tests during installation, which hides bugs in
the build.

For now this just unconditionally stops building compiler docs.
2015-05-23 08:01:08 +00:00
Felix S Klock II 38a97becdf Merge pull request #25706 from pnkfelix/remove-diagnostics-gen-and-check
Remove error diagnostics uniqueness check and .json generation.
2015-05-23 07:50:46 +02:00
mdinger 5b443b204e Simplify flat_map example 2015-05-22 21:37:11 -04:00
Nick Hamann 0d80b2a041 docs: Improve descriptions for some methods in core::cell. 2015-05-22 19:32:02 -05:00
Nick Desaulniers 64f8640164 allow clang 3.7 to be used when configuring Fixes #25720 2015-05-22 16:07:25 -07:00
Brian Anderson 1cda3236c9 Specify linkers for cross-compile scenarios
The recent MSVC patch made the build system pass explicit linkers to
rustc, but did not set that up for anything other than MSVC.
2015-05-22 14:56:41 -07:00
Pascal Hertleif ec60d9f20c Rustdoc Search: Add Hint to Primitive Type Result
Closes #25167
2015-05-22 22:18:27 +02:00
Brian Anderson e90959e58b mk: Don't build compiler-docs before installation. #25699
The install target depends on compiler-docs but 'all' does not.
This means that running 'make && make install' will run additional
doc builds and tests during installation, which hides bugs in
the build.

For now this just unconditionally stops building compiler docs.
2015-05-22 13:02:52 -07:00
Steve Klabnik 0b1976c2c2 Don't mention outdated methods 2015-05-22 15:24:56 -04:00
Cornel Punga 18dfa80985 Update guessing-game.md
I consider that this version has a better reading fluency, instead of having a period between clauses
2015-05-22 21:55:50 +03:00
Kevin Ballard d0b5eb35a2 Add some convenience methods to go from CStr -> str
A common problem when working with FFI right now is converting from raw
C strings into `&str` or `String`. Right now you're required to say
something like

    let cstr = unsafe { CStr::from_ptr(ptr) };
    let result = str::from_utf8(cstr.to_bytes());

This is slightly awkward, and is not particularly intuitive for people
who haven't used the ffi module before. We can do a bit better by
providing some convenience methods on CStr:

    fn to_str(&self) -> Result<&str, str::Utf8Error>
    fn to_string_lossy(&self) -> Cow<str>

This will make it immediately apparent to new users of CStr how to get a
string from a raw C string, so they can say:

    let s = unsafe { CStr::from_ptr(ptr).to_string_lossy() };
2015-05-22 11:46:46 -07:00
Brian Quinlan 7389b0abc2 Make it clear that push is only amortized O(1) 2015-05-22 10:26:18 -07:00
Steven Allen f21655ec02 Allow patterns to be followed by if and in.
Needed to support:

match X {
  pattern if Y ...
}

for pattern in Y {}
2015-05-22 12:47:52 -04:00
Matej Ľach e790db7518 better describe the stdlib 2015-05-22 16:42:57 +01:00
Manish Goregaokar 6bc5a92484 Let MultiItemDecorator take &Annotatable (fixes #25683) 2015-05-22 21:10:27 +05:30
Felix S. Klock II deaa1172cf Remove error diagnostics uniqueness check and .json generation.
This is meant to be a temporary measure to get the builds to be
reliable again; see also Issue #25705.
2015-05-22 15:40:12 +02:00
Eduard Burtescu 5dc03a8246 Lazy-load filemaps from external crates. 2015-05-22 16:15:21 +03:00
Niko Matsakis 82ded3cd03 Two more small fixes. 2015-05-22 08:45:05 -04:00
Pascal Hertleif 94b6ddc37c Rustdoc Search: Increase Relevance of Primitives 2015-05-22 14:15:35 +02:00
Pascal Hertleif a713867c74 Rustdoc: Clean Up Some JS
There are more possible optimizations left (cached length in loops) as
well as some possible bugs (shadowed variables) to fix. This is mostly
syntactic.
2015-05-22 14:14:28 +02:00
Geoffrey Thomas dfacdcf25d configure: Fix printing of commands from run
The `run` function passed its argument to `msg` via `"$@"`, but `msg`
only printed its first argument. I think the intention was for `msg` to
print all its arguments. (If not, `run` should only `msg "$1"`.)
2015-05-22 00:39:24 -04:00
Geoffrey Thomas 1e180b809f configure: Clarify error message about missing dependencies
Took me a moment to figure out that the appropriate response to
"need program file" was to install the program named "file", not
to think "If I didn't need the program file, why would I be
compiling things?".
2015-05-22 00:38:49 -04:00