]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #28079 - huonw:simd, r=alexcrichton
bors [Mon, 31 Aug 2015 21:34:08 +0000 (21:34 +0000)]
Auto merge of #28079 - huonw:simd, r=alexcrichton

This adds a new Python script (compatible with 2.7 and 3.x) that will consume some JSON files that define a platform's intrinsics. It can output a file that defines the intrinsics in the compiler, or an `extern` block that will import them.

The complexity of the generator is to be DRY: platforms (especially ARM and AArch64) have a lot of repetition with their intrinsics, for different versions with different types, so being able to write it once is nice.

8 years agoDelete unused macros from rustc_platform_intrinsics.
Huon Wilson [Mon, 31 Aug 2015 20:42:09 +0000 (13:42 -0700)]
Delete unused macros from rustc_platform_intrinsics.

8 years agoAuto merge of #28009 - GuillaumeGomez:patch-1, r=Manishearth
bors [Mon, 31 Aug 2015 16:52:46 +0000 (16:52 +0000)]
Auto merge of #28009 - GuillaumeGomez:patch-1, r=Manishearth

r? @Manishearth

8 years agoAuto merge of #28123 - Aatch:fix-silly-tuple-constructor, r=eddyb
bors [Mon, 31 Aug 2015 15:00:48 +0000 (15:00 +0000)]
Auto merge of #28123 - Aatch:fix-silly-tuple-constructor, r=eddyb

This was preventing any side-effects from the expressions from
happening.

Fixes #28114

cc @rust-lang/compiler

8 years agoAuto merge of #28116 - nrc:closure-expand, r=alexcrichton
bors [Mon, 31 Aug 2015 13:10:23 +0000 (13:10 +0000)]
Auto merge of #28116 - nrc:closure-expand, r=alexcrichton

8 years agoTranslate constructor arguments for zero-sized tuple structs
James Miller [Mon, 31 Aug 2015 11:57:41 +0000 (23:57 +1200)]
Translate constructor arguments for zero-sized tuple structs

This was preventing any side-effects from the expressions from
happening.

Fixes #28114

8 years agoAuto merge of #28107 - mneumann:dragonfly_ar, r=alexcrichton
bors [Mon, 31 Aug 2015 11:19:27 +0000 (11:19 +0000)]
Auto merge of #28107 - mneumann:dragonfly_ar, r=alexcrichton

8 years agoAuto merge of #28101 - ijks:24214-str-bytes, r=alexcrichton
bors [Mon, 31 Aug 2015 09:15:55 +0000 (09:15 +0000)]
Auto merge of #28101 - ijks:24214-str-bytes, r=alexcrichton

Specifically, `count`, `last`, and `nth` are implemented to use the
methods of the underlying slice iterator.

Partially closes #24214.

8 years agoAuto merge of #27980 - tbu-:pr_cloexec_dup, r=alexcrichton
bors [Mon, 31 Aug 2015 07:24:39 +0000 (07:24 +0000)]
Auto merge of #27980 - tbu-:pr_cloexec_dup, r=alexcrichton

Still needs values of F_DUPFD_CLOEXEC on other OSs.

For Bitrig, NetBSD and OpenBSD the constant was incorrectly in posix01, when
it's actually posix08. In order to maintain backwards-compatiblity, the
constant was only copied, not moved.

cc #24237

8 years agoClosures are not generated code.
Nick Cameron [Mon, 31 Aug 2015 05:06:30 +0000 (17:06 +1200)]
Closures are not generated code.

8 years agoAuto merge of #28103 - GuillaumeGomez:fix-intrinsic, r=huonw
bors [Mon, 31 Aug 2015 03:00:21 +0000 (03:00 +0000)]
Auto merge of #28103 - GuillaumeGomez:fix-intrinsic, r=huonw

Fixes #28062

8 years agoAuto merge of #28007 - Ms2ger:FnKind, r=nrc
bors [Mon, 31 Aug 2015 01:09:40 +0000 (01:09 +0000)]
Auto merge of #28007 - Ms2ger:FnKind, r=nrc

There is no longer a need for that pattern, since enums are now qualified.

8 years agoAuto merge of #27983 - barosl:respect-color, r=nrc
bors [Sun, 30 Aug 2015 23:18:34 +0000 (23:18 +0000)]
Auto merge of #27983 - barosl:respect-color, r=nrc

Currently, `early_error` and `early_warn` in `librustc::session` always use `ColorConfig::Auto`. Modify them to follow the color configuration set by the `--color` option.

As colored output is also printed during the early stage, parsing the `--color` option should be done as early as possible. However, there are still some cases when the output needs to be colored before knowing the exact color settings. In these cases, it will be defaulted to `ColorConfig::Auto`, which is the same as before.

Fixes #27879.

8 years agofixes #27124 for DragonFly
Michael Neumann [Sun, 30 Aug 2015 20:31:39 +0000 (22:31 +0200)]
fixes #27124 for DragonFly

8 years agoAuto merge of #28106 - marcusklaas:continue, r=eddyb
bors [Sun, 30 Aug 2015 20:26:44 +0000 (20:26 +0000)]
Auto merge of #28106 - marcusklaas:continue, r=eddyb

Fixes https://github.com/rust-lang/rust/issues/28105.

8 years agoAssign correct span to continue expression
Marcus Klaas [Sun, 30 Aug 2015 18:43:09 +0000 (20:43 +0200)]
Assign correct span to continue expression

Fixes https://github.com/rust-lang/rust/issues/28105.

8 years agoAuto merge of #28102 - arielb1:fix-log-again, r=eddyb
bors [Sun, 30 Aug 2015 16:52:23 +0000 (16:52 +0000)]
Auto merge of #28102 - arielb1:fix-log-again, r=eddyb

r? @eddyb

8 years agofix compilation with RUST_LOG=rustc::middle::traits
Ariel Ben-Yehuda [Sun, 30 Aug 2015 16:07:44 +0000 (19:07 +0300)]
fix compilation with RUST_LOG=rustc::middle::traits

8 years agoAdd overrides to iterator methods for `str::Bytes`
Daan Rijks [Sun, 30 Aug 2015 15:32:43 +0000 (17:32 +0200)]
Add overrides to iterator methods for `str::Bytes`

Specifically, `count`, `last`, and `nth` are implemented to use the
methods of the underlying slice iterator.

Partially closes #24214.

8 years agoAuto merge of #28097 - tbu-:pr_macro_to_const_fn, r=eddyb
bors [Sun, 30 Aug 2015 14:15:42 +0000 (14:15 +0000)]
Auto merge of #28097 - tbu-:pr_macro_to_const_fn, r=eddyb

8 years agoMake a macro a const fn and remove outdated NB
Tobias Bucher [Sun, 30 Aug 2015 12:32:17 +0000 (14:32 +0200)]
Make a macro a const fn and remove outdated NB

8 years agoAdd compile-fail test for E0444
Guillaume Gomez [Sun, 30 Aug 2015 07:53:32 +0000 (09:53 +0200)]
Add compile-fail test for E0444

8 years agoAtomically set CLOEXEC on duplicated sockets
Tobias Bucher [Mon, 24 Aug 2015 11:57:11 +0000 (13:57 +0200)]
Atomically set CLOEXEC on duplicated sockets

For Bitrig, NetBSD and OpenBSD the constant was incorrectly in posix01, when
it's actually posix08, so we move it. This is a [breaking-change], but we
already had one in #27930.

Fix NetBSD's F_DUPFD_CLOEXEC constant.

For a similar feature detection, see this musl thread:
http://comments.gmane.org/gmane.linux.lib.musl.general/2963

This assumes that an int literal has type `c_int` for varidic functions.

8 years agoAdd E0444 error code explanation
Guillaume Gomez [Sun, 30 Aug 2015 07:53:05 +0000 (09:53 +0200)]
Add E0444 error code explanation

8 years agoAdd checkup on number of arguments
Guillaume Gomez [Sun, 30 Aug 2015 07:52:34 +0000 (09:52 +0200)]
Add checkup on number of arguments

8 years agoAuto merge of #27588 - cesarb:read_all, r=alexcrichton
bors [Sun, 30 Aug 2015 05:59:49 +0000 (05:59 +0000)]
Auto merge of #27588 - cesarb:read_all, r=alexcrichton

This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980).

Tracking issue: https://github.com/rust-lang/rust/issues/27585

8 years agoAuto merge of #28087 - AlisdairO:diagnostics122, r=arielb1
bors [Sun, 30 Aug 2015 04:09:11 +0000 (04:09 +0000)]
Auto merge of #28087 - AlisdairO:diagnostics122, r=arielb1

As title :-)
Part of #24407.

r? @Manishearth

8 years agoSupport different scalar integer widths in Rust v. LLVM.
Huon Wilson [Sun, 30 Aug 2015 03:01:33 +0000 (20:01 -0700)]
Support different scalar integer widths in Rust v. LLVM.

Some x86 C intrinsics are declared to take `int ...` (i.e. exposed in
Rust as `i32`), but LLVM implements them by taking `i8` instead.

8 years agoFix typos in some x86 and arm intrinsics.
Huon Wilson [Sun, 30 Aug 2015 02:27:21 +0000 (19:27 -0700)]
Fix typos in some x86 and arm intrinsics.

8 years agoStyle the generator script more PEP8y.
Huon Wilson [Sat, 29 Aug 2015 19:27:59 +0000 (12:27 -0700)]
Style the generator script more PEP8y.

8 years agoAuto merge of #28086 - AlisdairO:diagnostics281, r=arielb1
bors [Sun, 30 Aug 2015 00:38:05 +0000 (00:38 +0000)]
Auto merge of #28086 - AlisdairO:diagnostics281, r=arielb1

As title :-)
Part of #24407.

r? @Manishearth

8 years agoAutogenerate most x86 platform intrinsics.
Huon Wilson [Sat, 29 Aug 2015 05:43:38 +0000 (22:43 -0700)]
Autogenerate most x86 platform intrinsics.

8 years agoAllow unused imports in the generator.
Huon Wilson [Sat, 29 Aug 2015 05:42:39 +0000 (22:42 -0700)]
Allow unused imports in the generator.

8 years agoAdd support for arbitrary metadata for numbers and widths.
Huon Wilson [Sat, 29 Aug 2015 05:27:51 +0000 (22:27 -0700)]
Add support for arbitrary metadata for numbers and widths.

This means that each platform has total control over the formatting info
it needs.

8 years agoAutogenerate most ARM platform intrinsics.
Huon Wilson [Sat, 29 Aug 2015 02:40:36 +0000 (19:40 -0700)]
Autogenerate most ARM platform intrinsics.

8 years agoAutogenerate most AArch64 platform intrinsics.
Huon Wilson [Fri, 28 Aug 2015 23:49:01 +0000 (16:49 -0700)]
Autogenerate most AArch64 platform intrinsics.

8 years agoAdd the platform intrinsic generator script.
Huon Wilson [Fri, 28 Aug 2015 23:39:29 +0000 (16:39 -0700)]
Add the platform intrinsic generator script.

This python script will consume an appropriately formatted JSON file and
output either a Rust file for use in librustc_platform_intrinsics, or an
extern block for importing the intrinsics in an external library.

The --help flag has details.

8 years agoAvoid eagerly stripping the common platform prefix.
Huon Wilson [Fri, 28 Aug 2015 23:38:25 +0000 (16:38 -0700)]
Avoid eagerly stripping the common platform prefix.

This works better with the code generation approach.

8 years agoAdd support for aggregates in platform intrinsics.
Huon Wilson [Fri, 28 Aug 2015 23:34:07 +0000 (16:34 -0700)]
Add support for aggregates in platform intrinsics.

This adds support for flattened intrinsics, which are called in Rust
with tuples but in LLVM without them (e.g. `foo((a, b))` becomes `foo(a,
b)`). Unflattened ones could be supported, but are not yet.

8 years agoSeparate integers into signed and unsigned.
Huon Wilson [Fri, 28 Aug 2015 23:32:25 +0000 (16:32 -0700)]
Separate integers into signed and unsigned.

This is necessary to reflect the ARM APIs accurately, since some
functions explicitly take an unsigned parameter and a signed one, of the
same integer shape, so the no-duplicates check will fail unless we
distinguish.

8 years agoAuto merge of #28077 - jonas-schievink:attr-gateage, r=huonw
bors [Sat, 29 Aug 2015 21:59:24 +0000 (21:59 +0000)]
Auto merge of #28077 - jonas-schievink:attr-gateage, r=huonw

This allows marking attributes as whitelisted/crate-only independent of
their feature gate status.

Closes #24213

8 years agoAuto merge of #28090 - mystor:derive-unsafe-trait, r=Manishearth
bors [Sat, 29 Aug 2015 19:07:19 +0000 (19:07 +0000)]
Auto merge of #28090 - mystor:derive-unsafe-trait, r=Manishearth

8 years agoAllow #[derive()] to generate unsafe trait impls
Michael Layzell [Sat, 29 Aug 2015 18:50:05 +0000 (14:50 -0400)]
Allow #[derive()] to generate unsafe trait impls

8 years agoadd long diagnostics for E0122
Alisdair Owens [Sat, 29 Aug 2015 16:20:46 +0000 (17:20 +0100)]
add long diagnostics for E0122

8 years agoadd diagnostics for E0281
Alisdair Owens [Sat, 15 Aug 2015 09:01:26 +0000 (10:01 +0100)]
add diagnostics for E0281

8 years agoHandle gateage of built-in attributes seperately
Jonas Schievink [Fri, 28 Aug 2015 22:23:32 +0000 (00:23 +0200)]
Handle gateage of built-in attributes seperately

This allows marking attributes as whitelisted/crate-only independent of
their feature gate status.

Closes #24213

8 years agoAuto merge of #28080 - huonw:travis++, r=alexcrichton
bors [Sat, 29 Aug 2015 06:36:51 +0000 (06:36 +0000)]
Auto merge of #28080 - huonw:travis++, r=alexcrichton

It is very difficult to find tidy problems in the midst of the output of
the LLVM/jemalloc/etc. build, and travis is great for the former, so
lets remove that problem.

8 years agoRun tidy by itself on travis.
Huon Wilson [Sat, 29 Aug 2015 05:59:00 +0000 (22:59 -0700)]
Run tidy by itself on travis.

It is very difficult to find tidy problems in the midst of the output of
the LLVM/jemalloc/etc. build, and travis is great for the former, so
lets remove that problem.

8 years agoAuto merge of #28078 - apasel422:patch-1, r=alexcrichton
bors [Sat, 29 Aug 2015 04:58:45 +0000 (04:58 +0000)]
Auto merge of #28078 - apasel422:patch-1, r=alexcrichton

8 years agoAuto merge of #28070 - mdchoate:patch-1, r=alexcrichton
bors [Sat, 29 Aug 2015 03:20:37 +0000 (03:20 +0000)]
Auto merge of #28070 - mdchoate:patch-1, r=alexcrichton

8 years agoRemove superfluous line from Nomicon
Andrew Paseltiner [Sat, 29 Aug 2015 02:07:02 +0000 (22:07 -0400)]
Remove superfluous line from Nomicon

8 years agoAuto merge of #28042 - Jake-Shadle:master, r=steveklabnik
bors [Sat, 29 Aug 2015 01:43:16 +0000 (01:43 +0000)]
Auto merge of #28042 - Jake-Shadle:master, r=steveklabnik

Encountered an issue with `pacman` while going through the guide for installing the `mingw` toolchain on Windows with `msys2`, after some googling I found the [solution](https://github.com/Alexpux/MSYS2-packages/issues/163#issuecomment-73555971).

I thought it would be good to update the README so people don't get frustrated. :smiley:

r? @steveklabnik

8 years agoAuto merge of #28043 - apasel422:rfc-1194, r=alexcrichton
bors [Sat, 29 Aug 2015 00:06:04 +0000 (00:06 +0000)]
Auto merge of #28043 - apasel422:rfc-1194, r=alexcrichton

8 years agoAuto merge of #27900 - SimonSapin:Chars_as_str, r=alexcrichton
bors [Fri, 28 Aug 2015 22:29:23 +0000 (22:29 +0000)]
Auto merge of #27900 - SimonSapin:Chars_as_str, r=alexcrichton

See #27775.

r? @alexcrichton

8 years agoAuto merge of #28068 - apasel422:debug-builders, r=sfackler
bors [Fri, 28 Aug 2015 20:52:16 +0000 (20:52 +0000)]
Auto merge of #28068 - apasel422:debug-builders, r=sfackler

This appears to have been an oversight, as the structs are stable but only nameable through `core::fmt`.

8 years agoAdd .as_str() to str::Chars and str::CharIndices. See #27775.
Simon Sapin [Wed, 19 Aug 2015 15:31:46 +0000 (17:31 +0200)]
Add .as_str() to str::Chars and str::CharIndices. See #27775.

8 years agoAuto merge of #28067 - apasel422:issue-20803, r=alexcrichton
bors [Fri, 28 Aug 2015 19:15:12 +0000 (19:15 +0000)]
Auto merge of #28067 - apasel422:issue-20803, r=alexcrichton

closes #20803

8 years agoFix typo in loops.md
Michael Choate [Fri, 28 Aug 2015 18:34:15 +0000 (14:34 -0400)]
Fix typo in loops.md

8 years agoUpdate README.md
Jake Shadle [Fri, 28 Aug 2015 18:24:13 +0000 (20:24 +0200)]
Update README.md

Use suggested composite command instead of 2 separate commands.

8 years agore-export debug builders in `std::fmt`
Andrew Paseltiner [Fri, 28 Aug 2015 17:39:25 +0000 (13:39 -0400)]
re-export debug builders in `std::fmt`

8 years agoAuto merge of #28063 - steveklabnik:gh28053, r=alexcrichton
bors [Fri, 28 Aug 2015 17:15:07 +0000 (17:15 +0000)]
Auto merge of #28063 - steveklabnik:gh28053, r=alexcrichton

Fixes #28053

8 years agoadd test for #20803
Andrew Paseltiner [Fri, 28 Aug 2015 16:54:17 +0000 (12:54 -0400)]
add test for #20803

closes #20803

8 years agoimplement RFC 1194
Andrew Paseltiner [Thu, 27 Aug 2015 15:10:28 +0000 (11:10 -0400)]
implement RFC 1194

8 years agoBe explicit about using crates.io's libc crate
Steve Klabnik [Fri, 28 Aug 2015 15:43:23 +0000 (11:43 -0400)]
Be explicit about using crates.io's libc crate

Fixes #28053

8 years agoAuto merge of #28047 - steveklabnik:doc_print, r=alexcrichton
bors [Fri, 28 Aug 2015 13:48:09 +0000 (13:48 +0000)]
Auto merge of #28047 - steveklabnik:doc_print, r=alexcrichton

8 years agoAdd issue number to read_exact unstable declarations
Cesar Eduardo Barros [Fri, 28 Aug 2015 09:33:50 +0000 (06:33 -0300)]
Add issue number to read_exact unstable declarations

8 years agoUpdate README.md
Jake Shadle [Fri, 28 Aug 2015 07:46:23 +0000 (09:46 +0200)]
Update README.md

Folded in suggestion from @brson to simply put the mirror update step in the regular set of tool chain install commands.

8 years agoAuto merge of #28054 - zaeleus:ios-imports, r=alexcrichton
bors [Fri, 28 Aug 2015 04:28:23 +0000 (04:28 +0000)]
Auto merge of #28054 - zaeleus:ios-imports, r=alexcrichton

This fixes building for ios targets caused by 7925c79.

8 years agoAuto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichton
bors [Fri, 28 Aug 2015 02:49:45 +0000 (02:49 +0000)]
Auto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichton

After submitting #28031, I ran a [script](https://gist.github.com/durka/a5243440697c780f669b) on the rest of src/ and found some anomalies. In this PR are the fixes that I thought were obvious (but I might be wrong!). The others I've submitted in issue #28037.

8 years agoAuto merge of #27956 - withoutboats:extend_string, r=alexcrichton
bors [Fri, 28 Aug 2015 01:06:51 +0000 (01:06 +0000)]
Auto merge of #27956 - withoutboats:extend_string, r=alexcrichton

If you have an `Iterator<Item=String>` (say because those items were generated using `.to_string()` or similarly), borrow semantics do not permit you map that to an `Iterator<&'a str>`. These two implementations close a small gap in the `String` API.

At the same time I've also made the names of the parameters to `String`'s `Extend` and `FromIterator` implementations consistent.

8 years agostd: Fix backtrace imports for ios targets
Michael Macias [Thu, 27 Aug 2015 23:47:15 +0000 (18:47 -0500)]
std: Fix backtrace imports for ios targets

This fixes building for ios targets caused by 7925c79.

8 years agoAuto merge of #28052 - Manishearth:rollup, r=Manishearth
bors [Thu, 27 Aug 2015 23:25:38 +0000 (23:25 +0000)]
Auto merge of #28052 - Manishearth:rollup, r=Manishearth

- Successful merges: #28010, #28013, #28022, #28029, #28033, #28039, #28045, #28048
- Failed merges:

8 years agoAdd some examples for the print! macro
Steve Klabnik [Thu, 27 Aug 2015 18:04:28 +0000 (14:04 -0400)]
Add some examples for the print! macro

8 years agoRollup merge of #28048 - steveklabnik:doc_unimplemented, r=alexcrichton
Manish Goregaokar [Thu, 27 Aug 2015 22:08:38 +0000 (03:38 +0530)]
Rollup merge of #28048 - steveklabnik:doc_unimplemented, r=alexcrichton

8 years agoRollup merge of #28045 - apasel422:iter, r=sfackler
Manish Goregaokar [Thu, 27 Aug 2015 22:08:38 +0000 (03:38 +0530)]
Rollup merge of #28045 - apasel422:iter, r=sfackler

8 years agoRollup merge of #28039 - birkenfeld:option_result_ref_intoiter, r=alexcrichton
Manish Goregaokar [Thu, 27 Aug 2015 22:08:37 +0000 (03:38 +0530)]
Rollup merge of #28039 - birkenfeld:option_result_ref_intoiter, r=alexcrichton

Fixes #27996.

Does this need any `#[stable]`/`#[unstable]` attributes?

8 years agoRollup merge of #28033 - Manishearth:compilerexpn, r=eddyb
Manish Goregaokar [Thu, 27 Aug 2015 22:08:37 +0000 (03:38 +0530)]
Rollup merge of #28033 - Manishearth:compilerexpn, r=eddyb

We were using them for every expansion, instead of using `Name`.

Also converted `CompilerExpansion` into an enum so its nicer to use and takes up less space.

Will profile later, but this should be a small improvement in memory usage.

r? @eddyb

8 years agoRollup merge of #28029 - tshepang:unusual, r=steveklabnik
Manish Goregaokar [Thu, 27 Aug 2015 22:08:37 +0000 (03:38 +0530)]
Rollup merge of #28029 - tshepang:unusual, r=steveklabnik

8 years agoRollup merge of #28022 - steveklabnik:gh27936, r=alexcrichton
Manish Goregaokar [Thu, 27 Aug 2015 22:08:37 +0000 (03:38 +0530)]
Rollup merge of #28022 - steveklabnik:gh27936, r=alexcrichton

Fixes #27936

8 years agoRollup merge of #28013 - artemshitov:rustbook-scrolling, r=steveklabnik
Manish Goregaokar [Thu, 27 Aug 2015 22:08:36 +0000 (03:38 +0530)]
Rollup merge of #28013 - artemshitov:rustbook-scrolling, r=steveklabnik

As of now, when you open a page in the Rust book and other books made with `rustbook`, you cannot scroll with your keyboard, whether using spacebar or arrow keys, unless you explicitly focus on the content div by clicking.

This PR fixes the issue by removing the bound on the content div size and by sticking the TOC with `position: fixed` rather than restricting the content to the window height.

r? @steveklabnik

8 years agoRollup merge of #28010 - GuillaumeGomez:patch-2, r=Manishearth
Manish Goregaokar [Thu, 27 Aug 2015 22:08:36 +0000 (03:38 +0530)]
Rollup merge of #28010 - GuillaumeGomez:patch-2, r=Manishearth

r? @Manishearth

8 years agoMove ExpnInfo to Name
Manish Goregaokar [Thu, 27 Aug 2015 00:11:53 +0000 (05:41 +0530)]
Move ExpnInfo to Name

8 years agoAuto merge of #27930 - barosl:path_max, r=alexcrichton
bors [Thu, 27 Aug 2015 21:47:33 +0000 (21:47 +0000)]
Auto merge of #27930 - barosl:path_max, r=alexcrichton

This PR rewrites the code that previously relied on `PATH_MAX`.

On my tests, even though the user gives the buffer length explicitly, both Linux's glibc and OS X's libc seems to obey the hard limit of `PATH_MAX` internally. So, to truly remove the limitation of `PATH_MAX`, the related system calls should be rewritten from scratch in Rust, which this PR does not try to do.

However, eliminating the need of `PATH_MAX` is still a good idea for various reasons, such as: (1) they might change the implementation in the future, and (2) some platforms don't have a hard-coded `PATH_MAX`, such as GNU Hurd.

More details are in the commit messages.

Fixes #27454.

r? @alexcrichton

8 years agoAuto merge of #27999 - dotdash:lt, r=eddyb
bors [Thu, 27 Aug 2015 20:09:15 +0000 (20:09 +0000)]
Auto merge of #27999 - dotdash:lt, r=eddyb

The major change here is in the tiny commit at the end and makes it so that we no longer emit lifetime intrinsics for allocas for function arguments. They are live for the whole function anyway, so the intrinsics add no value. This makes the resulting IR more clear, and reduces the peak memory usage and LLVM times by about 1-4%, depending on the crate.

The remaining changes are just preparatory cleanups and fixes for missing lifetime intrinsics.

8 years agoUse a different buffer doubling logic for `std::sys::os::getcwd`
Barosl Lee [Wed, 26 Aug 2015 12:27:32 +0000 (21:27 +0900)]
Use a different buffer doubling logic for `std::sys::os::getcwd`

Make `std::sys::os::getcwd` call `Vec::reserve(1)` followed by
`Vec::set_len` to double the buffer. This is to align with other similar
functions, such as:

- `std::sys_common::io::read_to_end_uninitialized`
- `std::sys::fs::readlink`

Also, reduce the initial buffer size from 2048 to 512. The previous size was
introduced with 4bc26ce in 2013, but it seems a bit excessive. This is
probably because buffer doubling was not implemented back then.

8 years agoReduce the reliance on `PATH_MAX`
Barosl Lee [Wed, 19 Aug 2015 04:11:40 +0000 (13:11 +0900)]
Reduce the reliance on `PATH_MAX`

- Rewrite `std::sys::fs::readlink` not to rely on `PATH_MAX`

It currently has the following problems:

1. It uses `_PC_NAME_MAX` to query the maximum length of a file path in
the underlying system. However, the meaning of the constant is the
maximum length of *a path component*, not a full path. The correct
constant should be `_PC_PATH_MAX`.

2. `pathconf` *may* fail if the referred file does not exist. This can
be problematic if the file which the symbolic link points to does not
exist, but the link itself does exist. In this case, the current
implementation resorts to the hard-coded value of `1024`, which is not
ideal.

3. There may exist a platform where there is no limit on file path
lengths in general. That's the reaon why GNU Hurd doesn't define
`PATH_MAX` at all, in addition to having `pathconf` always returning
`-1`. In these platforms, the content of the symbolic link can be
silently truncated if the length exceeds the hard-coded limit mentioned
above.

4. The value obtained by `pathconf` may be outdated at the point of
actually calling `readlink`. This is inherently racy.

This commit introduces a loop that gradually increases the length of the
buffer passed to `readlink`, eliminating the need of `pathconf`.

- Remove the arbitrary memory limit of `std::sys::fs::realpath`

As per POSIX 2013, `realpath` will return a malloc'ed buffer if the
second argument is a null pointer.[1]

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

- Comment on functions that are still using `PATH_MAX`

There are some functions that only work in terms of `PATH_MAX`, such as
`F_GETPATH` in OS X. Comments on them for posterity.

8 years agoAuto merge of #28031 - durka:patch-6, r=alexcrichton
bors [Thu, 27 Aug 2015 18:30:47 +0000 (18:30 +0000)]
Auto merge of #28031 - durka:patch-6, r=alexcrichton

It was pointing at the issue for `placement_new_protocol`.

8 years agolibc: Fix constants used by `libc::pathconf`
Barosl Lee [Mon, 17 Aug 2015 00:10:26 +0000 (09:10 +0900)]
libc: Fix constants used by `libc::pathconf`

`_PC_NAME_MAX` is necessary to use `libc::pathconf`. Its value is fixed
to 3 currently, but actually it varies with the platform.

* _PC_NAME_MAX == 3

Linux (glibc): https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/confname.h;h=1c714dfbf9398b8a600f9b69426a7ad8c7e89ab4;hb=HEAD#l32
NaCl (newlib): https://chromium.googlesource.com/native_client/nacl-newlib/+/373135ec5241d09138aa56603742b94b3b64ea1d/newlib/libc/include/sys/unistd.h#430

* _PC_NAME_MAX == 4

Android (Bionic): https://github.com/android/platform_bionic/blob/7e919daeaad62515ebbbf7b06badc77625a14d90/libc/include/unistd.h#L59
FreeBSD: https://svnweb.freebsd.org/base/head/sys/sys/unistd.h?revision=239347&view=markup#l127
NetBSD: http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/unistd.h
OS X: http://opensource.apple.com/source/xnu/xnu-2782.10.72/bsd/sys/unistd.h

This commit fixes this, and also addes the `_PC_PATH_MAX` constant
needed by further commits.

8 years agoSome extra examples for the unimplemented! macro
Steve Klabnik [Thu, 27 Aug 2015 18:14:03 +0000 (14:14 -0400)]
Some extra examples for the unimplemented! macro

8 years agoAdd Windows-specific comments to testing guide
Steve Klabnik [Wed, 26 Aug 2015 18:02:38 +0000 (14:02 -0400)]
Add Windows-specific comments to testing guide

Fixes #27936

8 years agoremove calls to deprecated `iter::order` functions
Andrew Paseltiner [Thu, 27 Aug 2015 17:30:37 +0000 (13:30 -0400)]
remove calls to deprecated `iter::order` functions

8 years agoComment out unused error codes in librustc_typeck/diagnostics.rs
Guillaume Gomez [Thu, 27 Aug 2015 13:44:08 +0000 (15:44 +0200)]
Comment out unused error codes in librustc_typeck/diagnostics.rs

8 years agoAuto merge of #28030 - tshepang:improve-example, r=alexcrichton
bors [Thu, 27 Aug 2015 16:51:57 +0000 (16:51 +0000)]
Auto merge of #28030 - tshepang:improve-example, r=alexcrichton

8 years agocore: Implement IntoIterator for Option and Result references
Georg Brandl [Thu, 27 Aug 2015 06:37:40 +0000 (08:37 +0200)]
core: Implement IntoIterator for Option and Result references

Fixes #27996.

8 years agofix some more unstable issue annotations
Alex Burka [Thu, 27 Aug 2015 06:20:00 +0000 (02:20 -0400)]
fix some more unstable issue annotations

8 years agoImplemented Extend<String> and FromIterator<String> for String.
Without Boats [Thu, 27 Aug 2015 15:47:08 +0000 (08:47 -0700)]
Implemented Extend<String> and FromIterator<String> for String.

8 years agoAuto merge of #28016 - ranma42:mini-rem-in-core, r=alexcrichton
bors [Thu, 27 Aug 2015 15:13:30 +0000 (15:13 +0000)]
Auto merge of #28016 - ranma42:mini-rem-in-core, r=alexcrichton

The implementation of the remainder operation belongs to
librustc_trans, but it is also stubbed out in libcore in order to
expose it as a trait on primitive types. Instead of exposing some
implementation details (like the upcast to `f64` in MSVC), use a
minimal implementation just like that of the `Div` trait.

8 years agoUpdate README.md
Jake Shadle [Thu, 27 Aug 2015 15:00:06 +0000 (17:00 +0200)]
Update README.md

Encountered an issue going through the guide for installing the `mingw` toolchain on Windows with msys2, after some googling I found the [solution](https://github.com/Alexpux/MSYS2-packages/issues/163#issuecomment-73555971) and thought it would be good to update the README so people don't get frustrated. :)

8 years agoAuto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton
bors [Thu, 27 Aug 2015 10:29:26 +0000 (10:29 +0000)]
Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton

8 years agoAuto merge of #28027 - tshepang:improve-sentence, r=alexcrichton
bors [Thu, 27 Aug 2015 08:51:15 +0000 (08:51 +0000)]
Auto merge of #28027 - tshepang:improve-sentence, r=alexcrichton