Commit Graph

43107 Commits

Author SHA1 Message Date
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
Sean Patrick Santos 8db699d18d Add diagnostic code for generic associated const error. 2015-05-21 21:12:49 -06:00
Matt Brubeck 54b1608b2d Document the debug_assertions cfg option 2015-05-21 16:34:26 -07:00
bors c3d60aba6c Auto merge of #25669 - GuillaumeGomez:typo-fix, r=Manishearth
r? @steveklabnik
2015-05-21 19:41:18 +00:00
Tshepang Lekhonkhobe 5263d628b1 doc: miscellaneous improvements to std::path::Path examples 2015-05-21 21:31:38 +02:00
Guillaume Gomez 86a821e5d1 Replace "more later" by "later" 2015-05-21 20:30:15 +02:00
Tamir Duberstein cf11c261f0 Standardize on `$t:ty` 2015-05-21 14:04:13 -04:00
Tamir Duberstein 3241b487fd Use `Self` to simplify 2015-05-21 14:01:44 -04:00
bors 7044f4a394 Auto merge of #25601 - ericye16:master, r=steveklabnik 2015-05-21 17:01:51 +00:00
Steve Klabnik 65ead717a7 she -> they in Dining Philosophers
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-21 11:53:45 -04:00
Niko Matsakis df93deab10 Make various fixes:
- add feature gate
- add basic tests
- adjust parser to eliminate conflict between `const fn` and associated
constants
- allow `const fn` in traits/trait-impls, but forbid later in type check
- correct some merge conflicts
2015-05-21 11:47:30 -04:00
Eduard Burtescu fb206bf34a rustc_trans: evaluate `const fn` function and method calls. 2015-05-21 11:47:30 -04:00
Eduard Burtescu 1bd420555e rustc: const-qualify `const fn` function and method calls. 2015-05-21 11:47:30 -04:00
Eduard Burtescu af3795721c syntax: parse `const fn` for free functions and inherent methods. 2015-05-21 11:47:30 -04:00
bors 59ba55ddbd Auto merge of #25473 - doomrobo:patch-3, r=steveklabnik
Added `Deref` to the "Special Traits" section
2015-05-21 15:24:16 +00:00
bors bc6318d2be Auto merge of #25676 - dmgawel:patch-1, r=huonw
Earlier created vector `["Hello", "world"]` has two elements and we try to add a third element.
2015-05-21 13:00:04 +00:00
dmgawel e30c6d131f Introduction vector example elements counting fix
Earlier created vector `["Hello", "world"]` has two elements and we try to add a third element.
2015-05-21 14:30:32 +02:00
Ulrik Sverdrup 093e18d184 rustdoc: Skip types in impls in search index
For a trait *implementation* there are typedefs which are the types for
that particular trait and implementor. Skip these in the search index.

There were lots of dud items in the search index due to this (search for
Item, Iterator's associated type).

Add a boolean to clean::TypedefItem so that it tracks whether the it is
a type alias on its own, or if it's a `type` item in a trait impl.

Fixes #22442
2015-05-21 14:17:37 +02:00
bors 7bd3bbd78e Auto merge of #25552 - GuillaumeGomez:left-hand-error, r=pnkfelix
Part of #24407.
2015-05-21 10:00:04 +00:00
Björn Steinbrink a3c4ce4444 Fix ICE trying to pass DST to C functions
Fixes #25581
2015-05-21 10:46:30 +02:00
bors d3543099d6 Auto merge of #25671 - Manishearth:rollup, r=Manishearth
- Successful merges: #25648, #25659, #25661, #25665
- Failed merges:
2015-05-21 08:19:17 +00:00
Manish Goregaokar 06d343b691 Rollup merge of #25665 - OlegTsyba:fix_documentation, r=Gankro
fix a small typo in the official tutorial. "coerce" instead of "coerece"
r? @steveklabnik
2015-05-21 13:38:26 +05:30
Manish Goregaokar 1fb2102498 Rollup merge of #25661 - Stebalien:macro, r=Gankro
They don't have to be followed by anything.
2015-05-21 13:38:26 +05:30
Manish Goregaokar 8007eada79 Rollup merge of #25659 - tshepang:improve-rendering, r=steveklabnik 2015-05-21 13:38:26 +05:30
Manish Goregaokar 02bce96e7b Rollup merge of #25648 - semarie:head-cut, r=luqmana
the "-c" option of head isn't a posix option, and it isn't supported
under openbsd.

prefer the use of cut -c 1-8 (which is posix) to extract the first 8
chars.

r? @alexcrichton
2015-05-21 13:38:26 +05:30
bors 4423748eb8 Auto merge of #25656 - tshepang:spell-em-out, r=brson 2015-05-21 05:37:01 +00:00