Commit Graph

46147 Commits

Author SHA1 Message Date
Manish Goregaokar
ab3dc54bcf Rollup merge of #28022 - steveklabnik:gh27936, r=alexcrichton
Fixes #27936
2015-08-28 03:38:37 +05:30
Manish Goregaokar
71ecc42eed 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
2015-08-28 03:38:36 +05:30
Manish Goregaokar
a3b32ebda4 Rollup merge of #28010 - GuillaumeGomez:patch-2, r=Manishearth
r? @Manishearth
2015-08-28 03:38:36 +05:30
Manish Goregaokar
25cbb4385e Move ExpnInfo to Name 2015-08-28 03:37:13 +05:30
bors
79dd92fc16 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
2015-08-27 21:47:33 +00:00
bors
abfa081c10 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.
2015-08-27 20:09:15 +00:00
Barosl Lee
6065678e62 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.
2015-08-28 04:48:03 +09:00
Barosl Lee
7723550fdd 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.
2015-08-28 04:46:55 +09:00
bors
17b6fcd458 Auto merge of #28031 - durka:patch-6, r=alexcrichton
It was pointing at the issue for `placement_new_protocol`.
2015-08-27 18:30:47 +00:00
Barosl Lee
4ff44ff8fa 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): 373135ec52/newlib/libc/include/sys/unistd.h (430)

* _PC_NAME_MAX == 4

Android (Bionic): 7e919daeaa/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.
2015-08-28 03:15:15 +09:00
Steve Klabnik
59653c10a6 Some extra examples for the unimplemented! macro 2015-08-27 14:14:06 -04:00
Steve Klabnik
af58e5cfea Add Windows-specific comments to testing guide
Fixes #27936
2015-08-27 13:43:43 -04:00
Andrew Paseltiner
21f209a28b remove calls to deprecated iter::order functions 2015-08-27 13:30:37 -04:00
Guillaume Gomez
fbbd874171 Comment out unused error codes in librustc_typeck/diagnostics.rs 2015-08-27 19:16:40 +02:00
bors
b28f0b1887 Auto merge of #28030 - tshepang:improve-example, r=alexcrichton 2015-08-27 16:51:57 +00:00
Georg Brandl
a7313a0b89 core: Implement IntoIterator for Option and Result references
Fixes #27996.
2015-08-27 18:48:41 +02:00
Alex Burka
595fda0de7 fix some more unstable issue annotations 2015-08-27 12:48:35 -04:00
Without Boats
8af543af5d Implemented Extend<String> and FromIterator<String> for String. 2015-08-27 08:47:08 -07:00
bors
ccf8317694 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.
2015-08-27 15:13:30 +00:00
Jake Shadle
10d3873fb5 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. :)
2015-08-27 17:00:06 +02:00
bors
40fd4d6787 Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton 2015-08-27 10:29:26 +00:00
bors
f663286f26 Auto merge of #28027 - tshepang:improve-sentence, r=alexcrichton 2015-08-27 08:51:15 +00:00
Andrea Canciani
4653a8b3fd Restore removed code and mark it for usage in stage0
The old code is temporarily needed in order to keep the MSVC build
working. It should be possible to remove this code after the bootstrap
compiler is updated to contain the MSVC workaround from #27875.
2015-08-27 10:12:48 +02:00
bors
d6a65cd3fe Auto merge of #27975 - sfackler:iter-order-methods, r=aturon
This does cause some breakage due to deficiencies in resolve -
`path::Components` is both an `Iterator` and implements `Eq`, `Ord`,
etc. If one calls e.g. `partial_cmp` on a `Components` and passes a
`&Components` intending to target the `PartialOrd` impl, the compiler
will select the `partial_cmp` from `Iterator` and then error out. I
doubt anyone will run into breakage from `Components` specifically, but
we should see if there are third party types that will run into issues.

`iter::order::equals` wasn't moved to `Iterator` since it's exactly the
same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound,
which doensn't seem very useful.

I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop
the extra `PartialEq` bound.

cc #27737 

r? @alexcrichton
2015-08-27 07:13:02 +00:00
Steven Fackler
651c42f11f Make iter::order functions into methods on Iterator
This does cause some breakage due to deficiencies in resolve -
`path::Components` is both an `Iterator` and implements `Eq`, `Ord`,
etc. If one calls e.g. `partial_cmp` on a `Components` and passes a
`&Components` intending to target the `PartialOrd` impl, the compiler
will select the `partial_cmp` from `Iterator` and then error out. I
doubt anyone will run into breakage from `Components` specifically, but
we should see if there are third party types that will run into issues.

`iter::order::equals` wasn't moved to `Iterator` since it's exactly the
same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound,
which doensn't seem very useful.

I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop
the extra `PartialEq` bound.

cc #27737
2015-08-26 23:23:57 -07:00
bors
0d5142f9b8 Auto merge of #28023 - jmesmon:llvm-path-native-only, r=alexcrichton
This fixes the case where we try to re-build & re-install rust to the
same prefix (without uninstalling) while using an llvm-root that is the
same as the prefix.

Without this, builds like that fail with:
	'error: multiple dylib candidates for `std` found'

See https://github.com/jmesmon/meta-rust/issues/6 for some details.

May also be related to #20342.
2015-08-27 05:35:02 +00:00
bors
ab21fe59e9 Auto merge of #28020 - dotdash:ref_fat_ptr_be_gone, r=eddyb
r? @eddyb -- we talked about this on IRC a while back but I only now managed to get the change done.
2015-08-27 03:57:21 +00:00
bors
af83d98d24 Auto merge of #28001 - arielb1:dtor-fixes, r=pnkfelix
r? @pnkfelix
2015-08-27 02:19:09 +00:00
bors
fd302a95e1 Auto merge of #27808 - SimonSapin:utf16decoder, r=alexcrichton
* Rename `Utf16Items` to `Utf16Decoder`. "Items" is meaningless.
* Generalize it to any `u16` iterator, not just `[u16].iter()`
* Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl.
* Replace `Utf16Item::to_char_lossy` with a `Utf16Decoder::lossy` iterator adaptor.

This is a [breaking change], but only for users of the unstable `rustc_unicode` crate.

I’d like this functionality to be stabilized and re-exported in `std` eventually, as the "low-level equivalent" of `String::from_utf16` and `String::from_utf16_lossy` like #27784 is the low-level equivalent of #27714.

CC @aturon, @alexcrichton
2015-08-27 00:41:13 +00:00
Manish Goregaokar
4ec7b713dd Enumify CompilerExpansion in ExpnInfo 2015-08-27 05:16:05 +05:30
Alex Burka
2367cafe9d fix unstable issue ref for Unsize
It was pointing at the issue for `placement_new_protocol`.
2015-08-26 19:07:44 -04:00
bors
80b971a9b8 Auto merge of #28003 - nkondratyev:patch-1, r=steveklabnik 2015-08-26 23:03:24 +00:00
Tshepang Lekhonkhobe
0ca1caee93 doc: add Iterator::size_hint example 2015-08-26 23:59:30 +02:00
Tshepang Lekhonkhobe
469620fd8e doc: I had to read this twice before understanding it 2015-08-26 23:48:45 +02:00
Tshepang Lekhonkhobe
cf3d6b569c doc: improve as_path example 2015-08-26 23:40:36 +02:00
bors
1c3b19d69d Auto merge of #28021 - steveklabnik:gh27958, r=alexcrichton
Fixes #27958
2015-08-26 21:25:13 +00:00
Tshepang Lekhonkhobe
933eb3e320 path: the if-else block looked unusual 2015-08-26 23:16:53 +02:00
bors
a48c29dcea Auto merge of #27992 - wthrowe:dead-main-2, r=alexcrichton
* Suppresses warnings that main is unused when testing (#12327)
* Makes `--test` work with explicit `#[start]` (#11766)
* Fixes some cases where the normal main would not be disabled by `--test`, resulting in compilation failures.
2015-08-26 18:29:02 +00:00
Steve Klabnik
dec43510f1 Any docs: as_ref doesn't exist anymore
Fixes #27958
2015-08-26 13:59:39 -04:00
Cody P Schafer
2d0cb31d30 mk: tell rustc that we're only looking for native libs in the LLVM_LIBDIR
This fixes the case where we try to re-build & re-install rust to the
same prefix (without uninstalling) while using an llvm-root that is the
same as the prefix.

Without this, builds like that fail with:
	'error: multiple dylib candidates for `std` found'

See https://github.com/jmesmon/meta-rust/issues/6 for some details.

May also be related to #20342.
2015-08-26 13:43:15 -04:00
Björn Steinbrink
05d36965df Avoid an extra alloca/memcpy when auto-ref'ing fat pointers
auto_ref() handles fat pointers just fine and unlike ref_fat_ptr() does so
without creating an unnecessary copy of the pointer.
2015-08-26 19:41:27 +02:00
bors
685332c8d3 Auto merge of #27998 - birkenfeld:patch-1, r=alexcrichton
These have been removed and should not be documented here.

Should the replacement crates on crates.io be linked to, or is that not wanted in the core docs?
2015-08-26 15:50:52 +00:00
Artem Shitov
b39201637d Remove redundant overflowing rule 2015-08-26 16:28:31 +03:00
Artem Shitov
c891fae175 Fix keyboard scrolling in rustbook 2015-08-26 16:20:57 +03:00
Guillaume Gomez
acafe3b730 Add E0370 error explanation 2015-08-26 14:43:28 +02:00
Guillaume Gomez
805e4e6fd1 Remove unnecessary empty lines 2015-08-26 14:28:42 +02:00
Guillaume Gomez
dfb0677bee Remove unnecessary whitespace 2015-08-26 14:23:51 +02:00
Guillaume Gomez
9f15b28119 Add missing ';' in E0132 2015-08-26 14:21:46 +02:00
Guillaume Gomez
0c4faf2a07 Add erroneous code example for E0131 2015-08-26 14:21:03 +02:00
Guillaume Gomez
af02bccb41 Fix typo in E0087 2015-08-26 14:16:12 +02:00