Commit Graph

78321 Commits

Author SHA1 Message Date
Oliver Schneider
3a5b13ad36
Bump clippy 2018-05-14 16:11:57 +02:00
Nicholas Nethercote
f46b888f73 Remove LazyBTreeMap.
It was introduced in #50240 to avoid an allocation when creating a new
BTreeMap, which gave some speed-ups. But then #50352 made that the
default behaviour for BTreeMap, so LazyBTreeMap is no longer necessary.
2018-05-14 22:27:45 +10:00
bors
cb1ce7ddf8 Auto merge of #50385 - durka:stabilize-macro-lifetime, r=petrochenkov
stabilize macro_lifetime_matcher

This stabilizes `:lifetime` which has completed FCP in #34303.
2018-05-14 12:24:45 +00:00
Tobias Bucher
6d1da82329 Don't unconditionally set CLOEXEC twice on every fd we open on Linux
Previously, every `open64` was accompanied by a `ioctl(…, FIOCLEX)`,
because some old Linux version would ignore the `O_CLOEXEC` flag we pass
to the `open64` function.

Now, we check whether the `CLOEXEC` flag is set on the first file we
open – if it is, we won't do extra syscalls for every opened file. If it
is not set, we fall back to the old behavior of unconditionally calling
`ioctl(…, FIOCLEX)` on newly opened files.

On old Linuxes, this amounts to one extra syscall per process, namely
the `fcntl(…, F_GETFD)` call to check the `CLOEXEC` flag.

On new Linuxes, this reduces the number of syscalls per opened file by
one, except for the first file, where it does the same number of
syscalls as before (`fcntl(…, F_GETFD)` to check the flag instead of
`ioctl(…, FIOCLEX)` to set it).
2018-05-14 13:20:39 +02:00
John-John Tedro
f73c4a4768 env: remove unwrap in examples in favor of try op 2018-05-14 12:56:18 +02:00
bors
7bfa20b8b0 Auto merge of #50648 - nox:volatile-store, r=eddyb
Fix volatile_store and nontemporal_store

Fixes #50371.
2018-05-14 10:00:41 +00:00
Eduard-Mihai Burtescu
29b4c7b9e0 rustc: don't trip an assertion for enums with present but uninhabited variants. 2018-05-14 12:23:12 +03:00
bors
8f39dbae8c Auto merge of #50703 - semarie:openbsd-libcompiler_builtins, r=alexcrichton
update libcompiler_builtins

let's OpenBSD to use libcompiler_rt.a from system library. it unbreaks
the build from source on OpenBSD.

see https://github.com/rust-lang-nursery/compiler-builtins/pull/241 for related PR

note this PR brings some other changes (on `floatdisf`/`floatundisf`) with compiler-builtins update.

r? @alexcrichton
2018-05-14 07:28:48 +00:00
Katrin Leinweber
703ecebe02
Hyperlink DOI against preferred resolver
https://www.doi.org/doi_handbook/3_Resolution.html#3.8
2018-05-14 07:17:56 +02:00
bors
76027ed2ad Auto merge of #50694 - leodasvacas:fix-impl-trait-self-substitution, r=petrochenkov
Fix self referential impl Trait substitutions

A high impact bug because a lot of common traits use a `Self` substitution by default. Should be backported to beta.

There was a check for this which wasn't catching all cases, it was made more robust.

Fixes #49376
Fixes #50626

r? @petrochenkov
2018-05-14 04:56:56 +00:00
Nicholas Nethercote
e913d69211 Remove StringReader::col.
It only has a single use, within code handling indented block comments.
We can replace that with the new `FileMap::col_pos()`, which computes
the col position (BytePos instead of CharPos) based on the record of the
last newline char (which we already record).

This is actually an improvement, because
`trim_whitespace_prefix_and_push_line()` was using `col`, which is a
`CharPos`, as a slice index, which is a byte/char confusion.
2018-05-14 14:41:34 +10:00
bors
4468e3ea3e Auto merge of #50675 - csmoe:var_span, r=oli-obk
Reduce span highlighted code in unused_variables lint

Fixes #50472
- [X] reduce var span
- [ ] mark applicable

Before:
```
mut unused_mut_var
^^^^^^^^^^^^^^^^^^
```
After:
```
mut unused_mut_var
    ^^^^^^^^^^^^^^
```
2018-05-14 02:24:13 +00:00
Dan Robertson
cdd61396c9
typeck: Save the index of private fields
Save the index of all fields regardless of their visibility. Problems
could occur later when attempting to index fields in error recovery if
they are not inserted.
2018-05-14 01:28:15 +00:00
John-John Tedro
56f505e6c6 read2: Use inner function instead of closure 2018-05-14 03:23:32 +02:00
Nicholas Nethercote
444b770f4c Make nextnextch() more closely resemble nextch(). 2018-05-14 10:00:39 +10:00
Corey Farwell
2c4b152356 Add “Examples” section header in f32/f64 doc comments.
This is recommend by [RFC 0505] and as far as I know, the only primitive
types without this heading.

[RFC 0505]: c892139be6/text/0505-api-comment-conventions.md (using-markdown)
2018-05-13 15:54:40 -04:00
Alex Burka
e857c1b790 restore feature for stage0 2018-05-13 19:51:33 +00:00
Alex Burka
e6f7cf7e75 remove stray ui stderr 2018-05-13 19:51:32 +00:00
Alex Burka
394945ee36 stabilize :lifetime 2018-05-13 19:51:32 +00:00
Corey Farwell
61d1c14633 Fix incorrect statement about return value for Iterator::zip.
Fixes https://github.com/rust-lang/rust/issues/50225.
2018-05-13 15:45:33 -04:00
bors
9fae153746 Auto merge of #49835 - da-x:literal-fragment-pr, r=petrochenkov
Macros: Add a 'literal' fragment specifier

See: https://github.com/rust-lang/rust/issues/35625

```rust

macro_rules! test_literal {
    ($l:literal) => {
        println!("literal: {}", $l);
    };
    ($e:expr) => {
        println!("expr: {}", $e);
    };
}

fn main() {
    let a = 1;
    test_literal!(a);
    test_literal!(2);
    test_literal!(-3);
}
```

Output:

```
expr: 1
literal: 2
literal: -3
```

ToDo:

* [x] Feature gate
* [x] Basic tests
* [x] Tests for range patterns
* [x] Tests for attributes
* [x] Documentation
* [x] Fix for `true`/`false`
* [x] Fix for negative number literals
2018-05-13 17:07:38 +00:00
John Kåre Alsaker
41a032db90 Fix conversion from Miri Value to ConstValue 2018-05-13 19:03:49 +02:00
Dan Aloni
37ed2ab910 Macros: Add a 'literal' fragment specifier
Implements RFC 1576.

See: https://github.com/rust-lang/rfcs/blob/master/text/1576-macros-literal-matcher.md

Changes are mostly in libsyntax, docs, and tests. Feature gate is
enabled for 1.27.0.

Many thanks to Vadim Petrochenkov for following through code reviews
and suggestions.

Example:

````rust

macro_rules! test_literal {
    ($l:literal) => {
        println!("literal: {}", $l);
    };
    ($e:expr) => {
        println!("expr: {}", $e);
    };
}

fn main() {
    let a = 1;
    test_literal!(a);
    test_literal!(2);
    test_literal!(-3);
}
```

Output:

```
expr: 1
literal: 2
literal: -3
```
2018-05-13 19:17:02 +03:00
leonardo.yvens
87890561f3 Improve eager type resolution error message
This PR improves the span of eager resolution type errors referring to indexing and field access to use the base span rather than the whole expression.

Also a note "Type must be known at this point." is added to where we at some point in the past emitted the "type must be known at this context" error, so that early failures can be differentiated and will hopefully be less surprising.

Fixes #50692 (or at least does the best we can for the moment)

r? @estebank
2018-05-13 13:02:34 -03:00
csmoe
c4e99dd85d Revert "mark applicability"
This reverts commit a880971128.
2018-05-13 22:56:37 +08:00
csmoe
a880971128 mark applicability 2018-05-13 21:10:15 +08:00
bors
3e955a0581 Auto merge of #50704 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #50624 (fs::write: Add example writing a &str)
 - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten)
 - #50644 (AppVeyor: Read back trace from crash dump on failure.)
 - #50661 (Ignore non .rs files for tidy libcoretest)
 - #50663 (rustc: Allow an edition's feature on that edition)
 - #50667 (rustc: Only suggest deleting `extern crate` if it works)
 - #50670 (rustc: Include semicolon when removing `extern crate`)
 - #50678 (Update openbsd targets)

Failed merges:
2018-05-13 11:32:21 +00:00
kennytm
98ce5053df
Rollup merge of #50678 - semarie:openbsd-targets, r=sanxiyn
Update openbsd targets

- add a new target `aarch64-unknown-openbsd`
- update `i686-unknown-openbsd` to use lld with clang, in order to correctly link binaries with `i128`
2018-05-13 17:27:07 +08:00
kennytm
b0d3170485
Rollup merge of #50670 - alexcrichton:remove-extern-crate-correct-span, r=Manishearth
rustc: Include semicolon when removing `extern crate`

Currently the lint for removing `extern crate` suggests removing `extern crate`
most of the time, but the rest of the time it suggest replacing it with `use
crate_name`. Unfortunately though when spliced into the original code you're
replacing

    extern crate foo;

with

    use foo

which is syntactically invalid! This commit ensure that the trailing semicolon
is included in rustc's suggestion to ensure that the code continues to compile
afterwards.
2018-05-13 17:20:31 +08:00
kennytm
ededa9dcd5
Rollup merge of #50667 - alexcrichton:no-remove-extern-crate-unless-works, r=Manishearth
rustc: Only suggest deleting `extern crate` if it works

This commit updates one of the edition lints to only suggest deleting `extern
crate` if it actually works. Otherwise this can yield some confusing behavior
with rustfix specifically where if you accidentally deny the `rust_2018_idioms`
lint in the 2015 edition it's suggesting features that don't work!
2018-05-13 17:20:30 +08:00
kennytm
34cec066d9
Rollup merge of #50663 - alexcrichton:no-removed-error, r=Manishearth
rustc: Allow an edition's feature on that edition

This commit fixes a hard error where the `#![feature(rust_2018_preview)]`
feature was forbidden to be mentioned when the `--edition 2018` flag was passed.
This instead silently accepts that feature gate despite it not being necessary.
It's intended that this will help ease the transition into the 2018 edition as
users will, for the time being, start off with the `rust_2018_preview` feature
and no longer immediately need to remove it.

Closes #50662
2018-05-13 17:20:28 +08:00
kennytm
0cf7be217d
Rollup merge of #50661 - varkor:libcoretest-ignore-non-rs, r=alexcrichton
Ignore non .rs files for tidy libcoretest

Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).
2018-05-13 17:20:27 +08:00
kennytm
42939c57f8
Rollup merge of #50644 - kennytm:read-appveyor-dump, r=alexcrichton
AppVeyor: Read back trace from crash dump on failure.

This is an attempt to debug spurious access violations on Windows (#33434, #50604). Thanks to #50276, there should be minidumps to read when rustc segfault.

(The implementation is based on <https://github.com/springmeyer/travis-coredump/blob/master/test.bat>.)
2018-05-13 17:20:26 +08:00
bors
0d48c96507 Auto merge of #50643 - dlrobertson:fix_ice, r=oli-obk
typeck: Fix ICE with struct update syntax

If check_expr_struct_fields fails, do not continue to record update.
If we continue to record update, the struct may cause us to ICE later
on indexing a field that may or may not exist.

Fixes: #50618
2018-05-13 09:16:11 +00:00
Anthony Ramine
3ebe8679d2 Introduce OperandValue::nontemporal_store and use it in the intrinsics
We use a new MemFlags bitflags type to merge some store code paths.
2018-05-13 10:36:28 +02:00
Anthony Ramine
b638f11b42 Introduce OperandValue::volatile_store and use it in the intrinsics
Fixes #50371.
2018-05-13 10:36:28 +02:00
csmoe
6c682eb46a reduce variable span 2018-05-13 16:34:27 +08:00
kennytm
55792a45a0
Rollup merge of #50634 - tbu-:pr_preadwrite_emscripten, r=kennytm
Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.
2018-05-13 16:15:42 +08:00
kennytm
e0b7f42b59
Rollup merge of #50624 - adevore:fs-write-str-example, r=steveklabnik
fs::write: Add example writing a &str

This adds an example to the documentation for `fs::write` that demonstrates the use of the `AsRef<[u8]>` implementation for &str. Experienced users should already recognize the possibility from the type signature, but new users may not recognize the significance.
2018-05-13 16:15:41 +08:00
Nicholas Nethercote
548067e00f Remove StringReader::terminator.
It's silly for a hot function like `bump()` to have such an expensive
bounds check. This patch replaces terminator with `end_src_index`.

Note that the `self.terminator` check in `is_eof()` wasn't necessary
because of the way `StringReader` is initialized.
2018-05-13 17:16:03 +10:00
Nicholas Nethercote
7a090fbe02 Rename some stuff in StringReader.
- `source_text` becomes `src`, matching `FileMap::src`.

- `byte_offset()` becomes `src_index()`, which makes it clearer that
  it's an index into `src`. (Likewise for variables containing
  `byte_offset` in their name.) This function also now returns a `usize`
  instead of a `BytePos`, because every callsite immediately converted
  the `BytePos` to a `usize`.
2018-05-13 17:16:03 +10:00
Nicholas Nethercote
b1aae607c5 Tweak naming and ordering in StringReader::bump().
This patch removes the "old"/"new" names in favour of "foo"/"next_foo",
which matches the field names.

It also moves the setting of `self.{ch,pos,next_pos}` in the common case
to the end, so that the meaning of "foo"/"next_foo" is consistent until
the end.
2018-05-13 17:16:02 +10:00
Nicholas Nethercote
4465b2fbf3 Inline char_at() and record_width.
Because `bump()` is hot.
2018-05-13 17:16:02 +10:00
bors
f9ae5bc1c5 Auto merge of #50622 - eddyb:make-room-for-ghosts, r=nikomatsakis
rustc: leave space for fields of uninhabited types to allow partial initialization.

Fixes #49298 by only collapsing uninhabited enum variants, and only if they only have ZST fields.
Fixes #50442 incidentally (@nox's optimization didn't take into account uninhabited variants).
2018-05-13 06:04:54 +00:00
Sébastien Marie
e0567158dd update libcompiler_builtins
let's OpenBSD to use libcompiler_rt.a from system library. it unbreaks
the build from source on OpenBSD.
2018-05-13 07:14:36 +02:00
bors
6fc409ed09 Auto merge of #50573 - oli-obk:tool_sanity, r=kennytm
Don't require clippy/miri for beta

r? @kennytm

cc @alexcrichton

I'm trying this out locally atm to see if it works as I think it should. Not sure how to test it for real except wait for the next beta.

fixes #50557
2018-05-13 03:44:00 +00:00
bors
844bc65333 Auto merge of #50235 - Zoxc:rayon, r=michaelwoerister
Add a Rayon thread pool

r? @michaelwoerister
2018-05-13 01:18:45 +00:00
John Kåre Alsaker
4afdae633d Update Cargo.lock 2018-05-13 01:28:20 +02:00
John Kåre Alsaker
28a11825de Add parallel abstractions 2018-05-13 01:28:20 +02:00
John Kåre Alsaker
022dff47e3 Add a Rayon thread pool 2018-05-13 01:28:20 +02:00