Commit Graph

100989 Commits

Author SHA1 Message Date
Mikko Rantanen
040d88dda1
Remove leading :: from paths in doc examples 2019-10-20 21:13:47 +03:00
Yuki Okushi
c609a5aafc
Rollup merge of #65626 - guanqun:patch-1, r=varkor
trivial typo fix
2019-10-21 03:10:59 +09:00
Yuki Okushi
4f74fd745f
Rollup merge of #65605 - bjorn3:fix_63906, r=eddyb
Remove unreachable unit tuple compare binop codegen

Closes #63906
Fixes #63551

This is based on #63906 by @luigishat, who had trouble with rebasing his PR.
2019-10-21 03:10:58 +09:00
Yuki Okushi
3e8acaf68c
Rollup merge of #65579 - skinny121:resolve_const_vars, r=varkor
Changed `resolve_type_vars_with_obligations` to also resolve const inference variables

Fixes #65380
r? @varkor
2019-10-21 03:10:57 +09:00
Yuki Okushi
cc42adf3a2
Rollup merge of #65463 - nnethercote:rm-arena-allocation-from-expand_pattern, r=varkor
Avoid unnecessary arena allocations in `expand_pattern()`.

`expand_pattern()` has two callsites. One of them needs arena
allocation, but the other does not.

This commit moves the arena allocation out of the function. This avoids
the allocation of many 4 KiB page arena chunks that only hold a single
small allocation. It reduces the number of bytes allocated by up to 2%
for various benchmarks, albeit without only a very small improvement in
runtime.
2019-10-21 03:10:55 +09:00
Yuki Okushi
2518bbd5a3
Rollup merge of #65460 - sinkuu:contains_insert, r=varkor
Clean up `contains()` `insert()` chains on HashSet

They can be merged to a single `insert()` call, which may avoid double-hashing/lookup of the value.
2019-10-21 03:10:54 +09:00
Dylan MacKenzie
efcae577bf Ignore DOT files in .gitignore 2019-10-20 11:03:13 -07:00
Dylan MacKenzie
c9e361fcd1 Check all files in src/test for borrowck_graphviz_postflow
This attribute causes DOT files to be generated in the top-level
directory. It is intended to be used only temporarily and should never
appear on master.

This will prevent #65071 from occurring again.
2019-10-20 10:53:10 -07:00
Dylan MacKenzie
51a5b49bda Remove borrowck_graphviz_postflow from test 2019-10-20 09:44:21 -07:00
guanqun
379733e8a0
typo fix 2019-10-20 23:03:33 +08:00
bors
89e645ace8 Auto merge of #65622 - Centril:rollup-l8orba7, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #64996 (Inline `ptr::null(_mut)` even in debug builds)
 - #65551 (Avoid realloc in `CString::new`)
 - #65593 (add test for calling non-const fn)
 - #65595 (move `parse_cfgspecs` to `rustc_interface`)
 - #65600 (Remove unneeded `ref` from docs)
 - #65602 (Fix plural mistake in emitter.rs)

Failed merges:

r? @ghost
2019-10-20 14:07:46 +00:00
Mazdak Farrokhzad
ba42fc27fd
Rollup merge of #65602 - varkor:other-candidates, r=Centril
Fix plural mistake in emitter.rs
2019-10-20 12:40:22 +02:00
Mazdak Farrokhzad
1c0e67ad06
Rollup merge of #65600 - integer32llc:bye-bye-ref, r=Centril
Remove unneeded `ref` from docs

Will reduce confusion like in https://users.rust-lang.org/t/help-understanding-the-ref-t-syntax/33779 since match ergonomics means you (almost) never have to say `ref` anymore!

There might be more like this, but I don't have a checkout on my computer right this second and I'm on slow wifi and GitHub search isn't powerful enough and that's my story.
2019-10-20 12:40:20 +02:00
Mazdak Farrokhzad
ed9cc70768
Rollup merge of #65595 - Centril:cfgspecs, r=Mark-Simulacrum
move `parse_cfgspecs` to `rustc_interface`

Part of https://github.com/rust-lang/rust/pull/65324.

r? @Mark-Simulacrum
2019-10-20 12:40:19 +02:00
Mazdak Farrokhzad
663125cac2
Rollup merge of #65593 - RalfJung:non-const-fn, r=oli-obk
add test for calling non-const fn

The good news is that there is an error. But I expected to see [this error](9578272d68/src/librustc_mir/const_eval.rs (L346)) surface. @oli-obk any idea why that message is not shown anywhere?

r? @oli-obk
2019-10-20 12:40:18 +02:00
Mazdak Farrokhzad
766073aeb4
Rollup merge of #65551 - sinkuu:cstring_spec, r=sfackler
Avoid realloc in `CString::new`

If `&[u8]` or `&str` is given, `CString::new` allocates a new `Vec` with the exact capacity, and then `CString::from_vec_unchecked` calls `.reserve_exact(1)` for nul byte. This PR avoids the reallocation by allocationg `len + 1` bytes beforehand. In microbenchmark this PR speeds up `CString::new(&[u8])` by 30%.
2019-10-20 12:40:16 +02:00
Mazdak Farrokhzad
f01ffbc7f1
Rollup merge of #64996 - lzutao:inline-ptr-null, r=oli-obk
Inline `ptr::null(_mut)` even in debug builds

I think we should treat `ptr::null(_mut)` as a constant. As It may help reduce code size
in debug build.
See godbolt link: https://godbolt.org/z/b9YMtD
2019-10-20 12:40:15 +02:00
bors
857a55b8f0 Auto merge of #65497 - choller:master, r=tmiasko
Avoid injecting sanitizer runtimes into staticlibs (#64629).

This fixes the remaining issue in `creader.rs` and also fixes the expected test failure. I have explicitly turned the `$(CC)` call into a negative check with the `!` to ensure that this command is really failing (if it is not, then either the runtime is attached to the lib or the lib has not been instrumented and both would be an error).

I've also borrowed `program.rs` and the additional `rustc` invocation from @tmiasko 's PR since he pointed out that using `-fsanitize=address` with `$(CC)` for linking could fail if the sanitizer runtimes on the system are incompatible.

With this toolchain I was able to compile Firefox locally without any linker errors. I am still seeing races with Rust in TSan but I assume that is because I did not build with `-Z build-std`.
2019-10-20 10:11:10 +00:00
Ralf Jung
50ddcbb2f5 also check the iterator is not too long 2019-10-20 12:06:03 +02:00
Ralf Jung
5719f57fb1 miri add write_bytes method to Memory doing bounds-checks and supporting iterators 2019-10-20 12:02:35 +02:00
Ralf Jung
f907fbe1a6 skip all refs-to-uninit-local, not just arguments 2019-10-20 11:22:06 +02:00
bors
7bf377f289 Auto merge of #65469 - mati865:libc, r=alexcrichton
Update libc to 0.2.64

Passed local tests.

cc potentially interested people: @gnzlbg @tlively
2019-10-20 06:10:51 +00:00
bors
e66a628227 Auto merge of #65302 - msizanoen1:fix-armv7-segfault, r=alexcrichton
Upgrade GCC to 8.3.0, glibc to 1.17.0 and crosstool-ng to 1.24.0 for dist-armv7-linux

#62896 was caused by the usage of the GCC 5.2.0 toolchain, which was released back in 2015 and may have bugs affecting LLVM 9.
This PR upgrade GCC to 8.3.0 from 5.2.0, glibc from 1.16.0 to 1.17.0 and crosstool-ng to 1.24.0 only for dist-armv7-linux.
Fixes #62896

r? @alexcrichton
2019-10-20 02:06:42 +00:00
varkor
2f7c9a2896 Improve error message for APIT with explicit generic parameters
This is disallowed with type or const generics.
2019-10-20 01:40:24 +01:00
bors
22eec92882 Auto merge of #65094 - oxalica:linux-statx, r=alexcrichton
Prefer statx on linux if available

This PR make `metadata`-related functions try to invoke `statx` first on Linux if available,
making `std::fs::Metadata::created` work on Linux with `statx` supported.

It follows the discussion in #61386 , and will fix #59743

The implementation of this PR is simply converting `struct statx` into `struct stat64` with
extra fields for `btime` if `statx` succeeds, since other fields are not currently used.

---

I also did a separated benchmark for `fs::metadata`, `stat64`, `statx`, and `statx` with conversion to `stat64`.
It shows that `statx` with conversion is even more faster than pure `statx`.
I think it's due to `sizeof stat64 == 114` but `sizeof statx == 256`.

Anyway, the bare implementation of `statx` with conversion is only about 0.2% slower than the original impl (`stat64`-family).
With heap-allocation counted (~8.5% of total cost), the difference between `stat` and `statx` (with or without conversion) is just nothing.

Therefore, I think it is not urgent to use bare `struct statx` as underlying representation now.
There is no need to break `std::os::linux::fs::MetadataExt::as_raw_stat` (https://github.com/rust-lang/rust/pull/61386#issuecomment-538074018)

[Separated bare benchmarks](https://gist.github.com/oxalica/c4073ecb202c599fe41b7f15f86dc79c):
```
metadata_ok             time:   [529.41 ns 529.77 ns 530.19 ns]
metadata_err            time:   [538.71 ns 539.39 ns 540.35 ns]
stat64_ok               time:   [484.32 ns 484.53 ns 484.75 ns]
stat64_err              time:   [481.77 ns 482.00 ns 482.24 ns]
statx_ok                time:   [488.07 ns 488.35 ns 488.62 ns]
statx_err               time:   [487.74 ns 488.00 ns 488.27 ns]
statx_cvt_ok            time:   [485.05 ns 485.28 ns 485.53 ns]
statx_cvt_err           time:   [485.23 ns 485.45 ns 485.67 ns]
```

r? @alexcrichton
2019-10-19 22:01:30 +00:00
ben
9cefcd3051 Rename resolve_type_vars_with_obligations to
resolve_vars_with_obligations, as it now also resolves const variables.
2019-10-20 09:17:40 +13:00
ben
925e3042f6 Fix resolve_type_vars_with_obligations not resolving const inference
variables.
2019-10-20 09:16:52 +13:00
Caleb Behunin
2e36c84ebd Remove unreachable unit tuple compare binop codegen 2019-10-19 21:34:01 +02:00
Nika Layzell
9be0bd8aa1 Avoid ICE when include! is used by stdin crate
This should also eliminate the ICE when using `include_bytes!`, `include_str!`
and `#[doc(include = "...")]`.

Fixes #63900
2019-10-19 15:06:08 -04:00
bors
c23a7aa778 Auto merge of #65599 - Manishearth:clippyup, r=Manishearth
Update clippy

Fixes https://github.com/rust-lang/rust/issues/65585
2019-10-19 17:46:07 +00:00
varkor
f042687959 Fix plural mistake in emitter.rs 2019-10-19 18:08:54 +01:00
Carol (Nichols || Goulding)
4ea1a1983e
Remove unneeded ref from docs
Will reduce confusion like in https://users.rust-lang.org/t/help-understanding-the-ref-t-syntax/33779 since match ergonomics means you (almost) never have to say `ref` anymore!
2019-10-19 11:20:05 -04:00
Ralf Jung
5192daf43e adjust miri sysroot determination 2019-10-19 17:17:02 +02:00
Ralf Jung
f704c099eb bump miri 2019-10-19 17:15:12 +02:00
Manish Goregaokar
90df0f4ec9 Update clippy 2019-10-19 08:00:48 -07:00
bors
c49187530d Auto merge of #65598 - Centril:rollup-vc6ht2c, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #64007 (Add check for overlapping ranges to unreachable patterns lint)
 - #65192 (Use structured suggestion for restricting bounds)
 - #65226 (BTreeSet symmetric_difference & union optimized)
 - #65448 (rustc_codegen_ssa: remove some unnecessary Box special-casing.)
 - #65505 (Rc: value -> allocation)

Failed merges:

r? @ghost
2019-10-19 14:01:35 +00:00
Mazdak Farrokhzad
2de4f4335e
Rollup merge of #65505 - RalfJung:rc, r=Centril
Rc: value -> allocation

See https://github.com/rust-lang/rust/issues/64484. This does not yet edit `Arc` as I first wanted to be sure we agree on the terminology the way it actually ends up. "value" as a term appears a lot in this file, and sometimes it refers to the value stored inside the `RcBox` while sometimes it refers to the `RcBox` itself. I tried to properly tease these apart but may have made some mistakes. The former should now always be called "inner value" and the latter "allocation".

One area where I was very unsure of which terminology is dropping: the `value` field of the `RcBox` will get dropped *earlier* than the `RcBox` itself if there are weak references. I decided that "dropping the value stored in the allocation" refers to dropping the value field, while "destroying the allocation" refers to actually freeing its backing memory.

r? @Centril
2019-10-19 16:00:56 +02:00
Mazdak Farrokhzad
5532699251
Rollup merge of #65448 - eddyb:codegen-box-less-special, r=oli-obk
rustc_codegen_ssa: remove some unnecessary Box special-casing.

Could help simplify #60900.

r? @nikomatsakis
2019-10-19 16:00:54 +02:00
Mazdak Farrokhzad
a6b5c80dbc
Rollup merge of #65226 - ssomers:master, r=bluss
BTreeSet symmetric_difference & union optimized

No scalability changes, but:
- Grew the cmp_opt function (shared by symmetric_difference & union) into a MergeIter, with less memory overhead than the pairs of Peekable iterators now, speeding up ~20% on my machine (not so clear on Travis though, I actually switched it off there because it wasn't consistent about identical code). Mainly meant to improve readability by sharing code, though it does end up using more lines of code. Extending and reusing the MergeIter in btree_map might be better, but I'm not sure that's possible or desirable. This MergeIter probably pretends to be more generic than it is, yet doesn't declare to be an iterator because there's no need to, it's only there to help construct genuine iterators SymmetricDifference & Union.
- Compact the code of #64820 by moving if/else into match guards.

r? @bluss
2019-10-19 16:00:53 +02:00
Mazdak Farrokhzad
7e4ff91403
Rollup merge of #65192 - estebank:restrict-bound, r=matthewjasper
Use structured suggestion for restricting bounds

When a trait bound is not met and restricting a type parameter would
make the restriction hold, use a structured suggestion pointing at an
appropriate place (type param in param list or `where` clause).

Account for opaque parameters where instead of suggesting extending
the `where` clause, we suggest appending the new restriction:
`fn foo(impl Trait + UnmetTrait)`. Fix #64565, fix #41817, fix #24354,
cc #26026, cc #37808, cc #24159, fix #37138, fix #24354, cc #20671.
2019-10-19 16:00:51 +02:00
Mazdak Farrokhzad
53a3bfc82b
Rollup merge of #64007 - estebank:overlapping-patterns, r=matthewjasper
Add check for overlapping ranges to unreachable patterns lint

Fix #63987.
2019-10-19 16:00:50 +02:00
Ralf Jung
38fd74f22a show the proper diagnostics 2019-10-19 15:52:08 +02:00
Ralf Jung
7f1ce45140 add test for calling non-const fn 2019-10-19 15:40:20 +02:00
Ralf Jung
282403e6bd clarify const_prop ICE protection comment 2019-10-19 15:14:59 +02:00
Ralf Jung
1b3846359a do all the same edits with Arc 2019-10-19 13:48:02 +02:00
Ralf Jung
52a31f7a00 some more Rc tweaks 2019-10-19 13:47:32 +02:00
Mazdak Farrokhzad
d945f9860f move parse_cfgspecs to rustc_interface 2019-10-19 13:25:46 +02:00
bors
e5b8c118a3 Auto merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk
[const-prop] Handle remaining MIR Rvalue cases

r? @oli-obk
2019-10-19 08:59:39 +00:00
Ralf Jung
696cba6e25 the exampleis about drop, not (de)allocation 2019-10-19 10:14:10 +02:00
bors
9578272d68 Auto merge of #65588 - Centril:rollup-9k55k3t, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #65174 (Fix zero-size uninitialized boxes)
 - #65252 (expand: Simplify expansion of derives)
 - #65485 (Suppress ICE when validators disagree on `LiveDrop`s in presence of `&mut`)
 - #65542 (Refer to "associated functions" instead of "static methods")
 - #65545 (More symbol cleanups)
 - #65576 (Don't add `argc` and `argv` arguments to `main` on WASI.)

Failed merges:

r? @ghost
2019-10-19 05:11:13 +00:00