Commit Graph

73373 Commits

Author SHA1 Message Date
kennytm
30a35164ce Rollup merge of #47069 - Kagamihime:master, r=nrc
rustfmt libarena/lib.rs

Note: it's my very first pull request. I'm trying to do something very simple to see how it works here, even if it's a tiny change or maybe it's not correct (sorry if it is the case).

r? @nrc
2018-01-13 02:26:23 +08:00
kennytm
743b976b36 Rollup merge of #46985 - Diggsey:path-component-asref, r=alexcrichton
Implement AsRef<Path> for Component

Fixes #41866
2018-01-13 02:26:22 +08:00
Seiichi Uchida
42410a96c4 Use delay_span_bug() over debug!() 2018-01-13 00:54:56 +09:00
Seiichi Uchida
142134d54f Ignore CTFE errors while lowering patterns
Closes #43105.
2018-01-12 20:50:03 +09:00
bors
0b90e4e8cd Auto merge of #46551 - jseyfried:improve_legacy_modern_macro_interaction, r=nrc
macros: improve 1.0/2.0 interaction

This PR supports using unhygienic macros from hygienic macros without breaking the latter's hygiene.
```rust
// crate A:
#[macro_export]
macro_rules! m1 { () => {
    f(); // unhygienic: this macro needs `f` in its environment
    fn g() {} // (1) unhygienic: `g` is usable outside the macro definition
} }

// crate B:
#![feature(decl_macro)]
extern crate A;
use A::m1;

macro m2() {
    fn f() {} // (2)
    m1!(); // After this PR, `f()` in the expansion resolves to (2), not (3)
    g(); // After this PR, this resolves to `fn g() {}` from the above expansion.
         // Today, it is a resolution error.
}

fn test() {
    fn f() {} // (3)
    m2!(); // Today, `m2!()` can see (3) even though it should be hygienic.
    fn g() {} // Today, this conflicts with `fn g() {}` from the expansion, even though it should be hygienic.
}
```

Once this PR lands, you can make an existing unhygienic macro hygienic by wrapping it in a hygienic macro. There is an [example](b766fa887d) of this in the tests.

r? @nrc
2018-01-12 10:00:09 +00:00
O01eg
472f4e1cc8
Remove unused configuration parameter libdir_relative. 2018-01-12 10:05:08 +03:00
O01eg
83e76d6f29
Remove unused argument rustc_cargo. 2018-01-12 10:05:02 +03:00
O01eg
f05282f036
Add library path for real rustdoc with RUSTDOC_LIBDIR environment variable. 2018-01-12 10:04:02 +03:00
Neil Shen
7cad7f6b3d Fix Duration::subsec_millis and Duration::subsec_micros examples 2018-01-12 13:38:24 +08:00
O01eg
c87a1086dc
Build all stages with relative libdirs. 2018-01-12 07:11:13 +03:00
O01eg
0f5110ea49
Stage 1 and later use relative libdir. 2018-01-12 07:11:13 +03:00
O01eg
27b4f225ea
Accept verbosity in rustdoc. 2018-01-12 07:11:12 +03:00
O01eg
ee8b5783af
Fix #45345.
Re-implement

```bash
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
```

from old `configure` script.
2018-01-12 07:10:58 +03:00
Diggory Blake
53c05ffdda Enable num tests on wasm 2018-01-11 21:26:53 +00:00
muvlon
80028760ed s/OsStr/&OsStr in docs to align with &str/String comparison 2018-01-11 22:07:06 +01:00
Alexander Regueiro
e2c1a9393b Don't track local_needs_drop separately in qualify_consts (fixes #47351). 2018-01-11 20:13:06 +00:00
Marco A L Barbosa
882cd3cf0b Add i586-unknown-linux-musl target 2018-01-11 15:57:28 -02:00
muvlon
bac725ecdf Fix dead links in docs for OsStr 2018-01-11 17:20:30 +01:00
muvlon
fc825f09e8 Fix confusing documentation for OsStr 2018-01-11 17:20:16 +01:00
Ed Schouten
6a8d55a235 Extend tidy to allow conditionalizing tests for multiple targets. 2018-01-11 17:06:33 +01:00
bors
73ac5d6a80 Auto merge of #47180 - varkor:range-iterator-overrides, r=alexcrichton
Add iterator method specialisations to Range*

Add specialised implementations of `max` for `Range`, and `last`, `min` and `max` for `RangeInclusive`, all of which lead to significant advantages in the generated assembly on x86.

Note that adding specialisations of `min` and `last` for `Range` led to no benefit, and adding `sum` for `Range` and `RangeInclusive` led to type inference issues (though this is possibly still worthwhile considering the performance gain).

This addresses some of the concerns in #39975.
2018-01-11 12:22:54 +00:00
Ed Schouten
9babb8a863 Make libtest build on CloudABI.
Just like on UNIX systems, we need to use sysconf() to obtain the number
of CPUs. Extend the existing cfg()'s to match CloudABI as well.
2018-01-11 11:42:33 +01:00
Ed Schouten
cc8565b20a Make the documentation build work on CloudABI.
Just like with wasm, we can't just import unix::ext and windows::ext.
Our shims are not complete enough for that.
2018-01-11 11:29:52 +01:00
Ed Schouten
d9d97c9f09 Make tests build on CloudABI.
There are some tests that need to be disabled on CloudABI specifically,
due to the fact that the shims cannot be built in combination with
unix::ext or windows::ext. Also improve the scoping of some imports to
suppress compiler warnings.
2018-01-11 11:28:34 +01:00
Ed Schouten
d882bb516e Add shims for modules that we can't implement on CloudABI.
As discussed in #47268, libstd isn't ready to have certain functionality
disabled yet. Follow wasm's approach of adding no-op modules for all of
the features that we can't implement.

I've placed all of those shims in a shims/ subdirectory, so we (the
CloudABI folks) can experiment with removing them more easily. It also
ensures that the code that does work doesn't get polluted with lots of
useless boilerplate code.
2018-01-11 11:26:13 +01:00
Ed Schouten
20745264ce Implement libstd for CloudABI.
Though CloudABI is strongly inspired by POSIX, its absence of features
that don't work well with capability-based sandboxing makes it different
enough that adding bits to sys/unix will make things a mess. This change
therefore adds CloudABI specific platform code under sys/cloudabi and
borrows parts from sys/unix that can be used without changes.

One of the goals of this implementation is to build as much as possible
directly on top of CloudABI's system call layer, as opposed to using the
C library. This is preferred, as the system call layer is supposed to be
stable, whereas the C library ABI technically is not. An advantage of
this approach is that it allows us to implement certain interfaces, such
as mutexes and condition variables more optimally. They can be lighter
than the ones provided by pthreads.

This change disables some modules that cannot realistically be
implemented right now. For example, libstd's pathname abstraction is not
designed with POSIX *at() (e.g., openat()) in mind. The *at() functions
are the only set of file system APIs available on CloudABI. There is no
global file system namespace, nor a process working directory.
Discussions on how to port these modules over are outside the scope of
this change.

Apart from this change, there are still some other minor fixups that
need to be made to platform independent code to make things build. These
will be sent out separately, so they can be reviewed more thoroughly.
2018-01-11 11:21:54 +01:00
Ed Schouten
795e173a76 Import the CloudABI system call bindings into the libstd tree.
These automatically generated Rust source files allow us to invoke
system calls within CloudABI processes. These will be used by libstd to
implement primitives for I/O, threading, etc.

These source files are normally part of the 'cloudabi' crate. In the
case of libstd, we'd better copy them into the source tree, as having
external dependencies in libstd is a bit messy. Original source files
can be found here:

    https://github.com/NuxiNL/cloudabi/tree/master/rust
2018-01-11 11:21:51 +01:00
Seiichi Uchida
9649c4a27c Add tests to fixed issues.
Closes #36792. Closes #38091. Closes #39687. Closes #42148. Closes #42956.
2018-01-11 13:03:25 +09:00
bors
619ced0578 Auto merge of #47087 - Zoxc:incr_no_in_ignore, r=michaelwoerister
Replace uses of DepGraph.in_ignore with DepGraph.with_ignore

I currently plan to track tasks in thread local storage. Ignoring things in a closure ensures that the ignore tasks do not overlap the beginning or end of any other task. The TLS API will also use a closure to change a TLS value, so having the ignore task be a closure also helps there.

It also adds `assert_ignored` which is used before a `TyCtxt` is created. Instead of adding a new ignore task this simply ensures that we are in a context where reads are ignored.

r? @michaelwoerister
2018-01-11 03:24:16 +00:00
Geoffry Song
2e0ad5af30 Glued tokens can themselves be joint.
When gluing two tokens, the second of which is joint, the result should also be
joint.
This fixes an issue with joining three `Dot` tokens to make a `DotDotDot` - the
intermediate `DotDot` would not be joint and therefore we would not attempt to
glue the last `Dot` token, yielding `.. .` instead of `...`.
2018-01-10 17:20:04 -08:00
bors
c9c2980736 Auto merge of #47243 - wesleywiser:incr_fingerprint_encoding, r=michaelwoerister
[incremental] Specialize encoding and decoding of Fingerprints

This saves the storage space used by about 32 bits per `Fingerprint`.
On average, this reduces the size of the `/target/{mode}/incremental`
folder by roughly 5% [Full details here](https://gist.github.com/wesleywiser/264076314794fbd6a4c110d7c1adc43e).

Fixes #45875

r? @michaelwoerister
2018-01-11 00:23:23 +00:00
Alexis Hunt
9d9504a27c Fix typo. 2018-01-10 17:58:00 -05:00
Matt Brubeck
3f9c057ea6 Use the new fs_read_write functions in rustc internals 2018-01-10 14:53:40 -08:00
Dan Robertson
c78679db08
Fix panic strings.
- Fix panic string in `check_ast_crate`.
2018-01-10 21:39:21 +00:00
Esteban Küber
90bc98c5d1 Modify message to match label 2018-01-10 11:41:12 -08:00
Matt Brubeck
44912bf77b Pre-allocate in fs::read and fs::read_string 2018-01-10 10:48:11 -08:00
Michael Woerister
fe21c4c522 Add -Ztime-passes line for dep-graph loading. 2018-01-10 18:23:50 +01:00
Niko Matsakis
00ce7eed7d resolve type and region variables in "NLL dropck"
Fixes #47022.
2018-01-10 10:15:08 -05:00
bors
f62f774035 Auto merge of #47167 - ivanbakel:builtin_indexing, r=nikomatsakis
Fix built-in indexing not being used where index type wasn't "obviously" usize

Fixes #33903
Fixes #46095

This PR was made possible thanks to the generous help of @eddyb

Following the example of binary operators, builtin checking for indexing has been moved from the typecheck stage to a writeback stage, after type constraints have been resolved.
2018-01-10 12:29:05 +00:00
bors
27ede55414 Auto merge of #46830 - Diggsey:cursor-vec-mut, r=alexcrichton
Implement `Write` for `Cursor<&mut Vec<T>>`

Fixes #30132

r? @dtolnay (I'm just going through `feature-accepted` issues I swear 😛)
2018-01-10 06:33:31 +00:00
Manish Goregaokar
44b659ac2d Add test for #45868 2018-01-10 10:34:14 +05:30
Bulat Musin
d0d5db65c7
fix typo rwlock.rs
Hi. Fixed typo: contained -> content
2018-01-10 08:03:10 +03:00
Manish Goregaokar
730679685e Use correct line offsets for doctests (fixes #45868) 2018-01-10 10:10:34 +05:30
bors
92c32d2d8c Auto merge of #47308 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #46762, #46777, #47262, #47285, #47301
- Failed merges:
2018-01-10 03:52:19 +00:00
Corey Farwell
8fbfd2c940 Rollup merge of #47301 - GuillaumeGomez:fix-error-index-display, r=QuietMisdreavus
Fix error index display

Fixes #47284.

r? @QuietMisdreavus
2018-01-09 22:28:26 -05:00
Corey Farwell
14a9e264ba Rollup merge of #47285 - AndrewBrinker:master, r=kennytm
Fixed a typo in the compile_error docs

Noticed a typo and fixed it.
2018-01-09 22:28:25 -05:00
Corey Farwell
14284f3646 Rollup merge of #47262 - estebank:issue-45562, r=petrochenkov
Account for `pub` in `const` -> `static` suggestion

Fix #45562.
2018-01-09 22:28:24 -05:00
Corey Farwell
e2e8cd3d14 Rollup merge of #46777 - frewsxcv:frewsxcv-rotate, r=alexcrichton
Deprecate [T]::rotate in favor of [T]::rotate_{left,right}.

Background
==========

Slices currently have an **unstable** [`rotate`] method which rotates
elements in the slice to the _left_ N positions. [Here][tracking] is the
tracking issue for this unstable feature.

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
```

Proposal
========

Deprecate the [`rotate`] method and introduce `rotate_left` and
`rotate_right` methods.

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate_left(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
```

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate_right(2);
assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);
```

Justification
=============

I used this method today for my first time and (probably because I’m a
naive westerner who reads LTR) was surprised when the docs mentioned that
elements get rotated in a left-ward direction. I was in a situation
where I needed to shift elements in a right-ward direction and had to
context switch from the main problem I was working on and think how much
to rotate left in order to accomplish the right-ward rotation I needed.

Ruby’s `Array.rotate` shifts left-ward, Python’s `deque.rotate` shifts
right-ward. Both of their implementations allow passing negative numbers
to shift in the opposite direction respectively. The current `rotate`
implementation takes an unsigned integer argument which doesn't allow
the negative number behavior.

Introducing `rotate_left` and `rotate_right` would:

- remove ambiguity about direction (alleviating need to read docs 😉)
- make it easier for people who need to rotate right

[`rotate`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rotate
[tracking]: https://github.com/rust-lang/rust/issues/41891
2018-01-09 22:28:23 -05:00
Corey Farwell
2b61564f26 Rollup merge of #46762 - est31:master, r=alexcrichton
Stabilize the panic_col feature

I've added the panic_col feature in PR #42938.
Now it's time to stabilize it!
Closes #42939.
2018-01-09 22:28:22 -05:00
est31
24918148bb We have Rust 1.25 now 2018-01-10 03:27:08 +01:00