]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agorustdoc: Use dyn keyword when rendering dynamic traits
Oliver Middleton [Sun, 14 Oct 2018 23:48:57 +0000 (00:48 +0100)]
rustdoc: Use dyn keyword when rendering dynamic traits

The dyn keyword has been stable for a while now so rustdoc should start using it.

5 years agoAuto merge of #55032 - oli-obk:the_early_unwrap_gets_the_panic, r=Mark-Simulacrum
bors [Sun, 14 Oct 2018 18:06:20 +0000 (18:06 +0000)]
Auto merge of #55032 - oli-obk:the_early_unwrap_gets_the_panic, r=Mark-Simulacrum

Check the invariant for `principal` inside the method

r? @Mark-Simulacrum

5 years agoAuto merge of #55055 - matthiaskrgr:bump_beta, r=Mark-Simulacrum
bors [Sun, 14 Oct 2018 14:24:19 +0000 (14:24 +0000)]
Auto merge of #55055 - matthiaskrgr:bump_beta, r=Mark-Simulacrum

bump bootstrap compiler to rustc beta 2018-10-13

beta was switched to bootstrap from stable 1.29.2 since 1.29.2 got the aliasing bug workaround.
For extra sanity we should probably bootstrap from a beta that was built with these fixed applied in the host compiler.

5 years agoAuto merge of #55051 - matthiaskrgr:dist_msg, r=Mark-Simulacrum
bors [Sun, 14 Oct 2018 11:56:09 +0000 (11:56 +0000)]
Auto merge of #55051 - matthiaskrgr:dist_msg, r=Mark-Simulacrum

boostrap: dist: if a file cannot be installed because it does not exist, print its name in the error message.

5 years agoAuto merge of #55015 - dsciarra:underscores-constant-names, r=petrochenkov
bors [Sun, 14 Oct 2018 09:28:19 +0000 (09:28 +0000)]
Auto merge of #55015 - dsciarra:underscores-constant-names, r=petrochenkov

Support underscore as constant name

Issue: #54912

5 years agoSupport underscore as constant name
Donato Sciarra [Thu, 11 Oct 2018 22:34:26 +0000 (00:34 +0200)]
Support underscore as constant name

Issue: 54912

5 years agoAuto merge of #55049 - tshepang:fix, r=withoutboats
bors [Sun, 14 Oct 2018 06:40:17 +0000 (06:40 +0000)]
Auto merge of #55049 - tshepang:fix, r=withoutboats

doc: fix sentence structure in std::fmt

5 years agoAuto merge of #55018 - euclio:issue-24421, r=alexcrichton
bors [Sun, 14 Oct 2018 01:53:28 +0000 (01:53 +0000)]
Auto merge of #55018 - euclio:issue-24421, r=alexcrichton

add test for #24421

Fixes #24421.

Also removes a README which points to a non-existent directory.

5 years agoAuto merge of #55017 - memoryruins:add-tests, r=alexcrichton
bors [Sat, 13 Oct 2018 23:22:15 +0000 (23:22 +0000)]
Auto merge of #55017 - memoryruins:add-tests, r=alexcrichton

Add tests for issues #54966 and #52240

Closes #54966
Closes #52240

5 years agobump bootstrap compiler to rustc beta 2018-10-13
Matthias Krüger [Sat, 13 Oct 2018 22:47:24 +0000 (00:47 +0200)]
bump bootstrap compiler to rustc beta 2018-10-13

beta was switched to bootstrap from stable 1.29.2 since 1.29.2 got the aliasing bug workaround.
For extra sanity we should probably bootstrap from a beta that was built with these fixed appied in the host compiler.

5 years agoboostrap: dist: if a file cannot be installed because it does not exist, print its...
Matthias Krüger [Sat, 13 Oct 2018 21:33:10 +0000 (23:33 +0200)]
boostrap: dist: if a file cannot be installed because it does not exist, print its name in the error message.

5 years agoAuto merge of #54916 - matthiaskrgr:submodules_update, r=oli-obk
bors [Sat, 13 Oct 2018 19:43:36 +0000 (19:43 +0000)]
Auto merge of #54916 - matthiaskrgr:submodules_update, r=oli-obk

submodules: update clippy, rls and cargo, fix toolstate

rustfmt update failed because of different rustc-ap-syntax versions.

fix clippy toolstate failure

Fixes #54697

5 years agodoc: fix sentence structure in std::fmt
Tshepang Lekhonkhobe [Sat, 13 Oct 2018 19:20:36 +0000 (21:20 +0200)]
doc: fix sentence structure in std::fmt

5 years agobootstrap: update clippy license locations which changed due to relicensing.
Matthias Krüger [Sat, 13 Oct 2018 18:38:49 +0000 (20:38 +0200)]
bootstrap: update clippy license locations which changed due to relicensing.

5 years agoAlso adjust rustdoc to the principal changes
Oliver Scherer [Sat, 13 Oct 2018 17:41:27 +0000 (19:41 +0200)]
Also adjust rustdoc to the principal changes

5 years agosubmodules: update cargo from ad6e5c00 to 5dbac988
Matthias Krüger [Mon, 8 Oct 2018 19:05:14 +0000 (21:05 +0200)]
submodules: update cargo from ad6e5c00 to 5dbac988

Changes:

Switch to use crates-io as the registry name and don't include publish when registry is not specified
fix redundant pkgid generation
validate some basic properties of a valid resolve
Detail dep name in invalid version error
Fix dashes in rename dependencies.
Bump flate2 to 1.0.3
Add default in config document
Add support for providing a default registry
Add support for registry to new and init
use impl Iterator instead of custom types in `source`
let jetbrains reorder some impls to match the definition
use impl Iterator instead of custom types in resolver and graph
remove Graph::sort as it is unused
fmt
Bump libgit2-sys to 0.7.9
Switch to use registry
Allow registry option for cargo install.
Second attempt at fixing msys terminal width.
Try to improve "version not found" error
Fix typo

5 years agosubmodules: update rls from 15d4d4a to 440a985
Matthias Krüger [Thu, 11 Oct 2018 12:03:21 +0000 (14:03 +0200)]
submodules: update rls from 15d4d4a to 440a985

Changes:

Apply Clippy lints
Respect build_dir when creating external build plans
Fix Windows tests
Implement external build plan
Detect manifest diagnostic position for toml::de::Error
Fix std::sync hover doc expectation
Apply CI specific long timeout
Propagate cargo errors as manifest diagnostics
Add test for use statement function completions
Refactor cmd test `within_timeout`
Avoid stdout-writer/rls process exit race
Improve cmd test "no shutdown response" error message
Add RUST_BACKTRACE=1 to ci env
Improve cmd test timeout reliability
Fix use statement function suggestions
Revert "Revert "Remove "edition" Cargo feature (it's stable now)""
Add build_wait() tests
Automatically tune wait_to_build
Rework cmd tests

Fixes #54697

5 years agosubmodules: update clippy from 32b1d1fc to 9d337313
Matthias Krüger [Thu, 11 Oct 2018 11:53:32 +0000 (13:53 +0200)]
submodules: update clippy from 32b1d1fc to 9d337313

Changes:

Remove now-useless `allow(unknown_lints)`
Stabilize tool lints
Use `impl Iterator` in arg position in clippy_dev
Fix fn_to_numeric_cast_with_truncation suppression
Limit commutative assign op lint to primitive types
Clarify code
Fix #2937
Fix cast_possible_wrap and cast_sign_loss warnings
Fix cast_possible_truncation warnings
Fixes #2925 cmp_owned false positive
if_let_redundant_pattern_matching: use Span.to() instead of Span.with_hi() to fix crash.
Improve diagnostics in case of lifetime elision (closes #3284)
Fix items_after_statements for `const`s
Fix items_after_statements for sub-functions
Fix items_after_statements for `use` statements
Don't suggest cloned() for map Box deref
Fix excessive_precision false positive
Fix FP in `fn_to_numeric_cast_with_truncation`
new_without_default should not warn about unsafe new
fix command to manually test an example
Add license to README
Adding more detail to filter_map lint documentation.
additional people
Add license header to other files
Add license header to Rust files
Relicense clippy
Document relicensing process
Fix util/export.py to include lints from methods

5 years agoAuto merge of #55003 - zackmdavis:must_use_assoc_fn, r=varkor
bors [Sat, 13 Oct 2018 17:03:47 +0000 (17:03 +0000)]
Auto merge of #55003 - zackmdavis:must_use_assoc_fn, r=varkor

`#[must_use]` for associated functions is supposed to actually work

In the comments of (closed, defunct) pull request #54884, @Centril [noted that](https://github.com/rust-lang/rust/pull/54884#issuecomment-427626495) must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for `self`-ful methods have always worked—but documenting or reworking that can be left to another day.)

r? @varkor

5 years agoAuto merge of #54951 - alexcrichton:more-wasm-threads, r=sfackler
bors [Sat, 13 Oct 2018 14:28:48 +0000 (14:28 +0000)]
Auto merge of #54951 - alexcrichton:more-wasm-threads, r=sfackler

std: Implement TLS for wasm32-unknown-unknown

This adds an implementation of thread local storage for the
`wasm32-unknown-unknown` target when the `atomics` feature is
implemented. This, however, comes with a notable caveat of that it
requires a new feature of the standard library, `wasm-bindgen-threads`,
to be enabled.

Thread local storage for wasm (when `atomics` are enabled and there's
actually more than one thread) is powered by the assumption that an
external entity can fill in some information for us. It's not currently
clear who will fill in this information nor whose responsibility it
should be long-term. In the meantime there's a strategy being gamed out
in the `wasm-bindgen` project specifically, and the hope is that we can
continue to test and iterate on the standard library without committing
to a particular strategy yet.

As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently
have the ability to emit custom `global` values (thread locals in a
`WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do
it for us. To that end we have a few intrinsics, assuming two global values:

* `__wbindgen_current_id` - gets the current thread id as a 32-bit
  integer. It's `wasm-bindgen`'s responsibility to initialize this
  per-thread and then inform libstd of the id. Currently `wasm-bindgen`
  performs this initialization as part of the `start` function.
* `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed
  that there's a global available for simply storing a pointer's worth
  of information (a thread control block, which currently only contains
  thread local storage). This would ideally be a native `global`
  injected by LLVM, but we don't have a great way to support that right
  now.

To reiterate, this is all intended to be unstable and purely intended
for testing out Rust on the web with threads. The story is very likely
to change in the future and we want to make sure that we're able to do
that!

5 years agoAuto merge of #54997 - davidtwco:issue-54896, r=nagisa
bors [Sat, 13 Oct 2018 11:52:49 +0000 (11:52 +0000)]
Auto merge of #54997 - davidtwco:issue-54896, r=nagisa

The #[panic_handler] attribute can be applied to non-functions

Fixes #54896.

This commit extends the existing lang items functionality to assert
that the `#[lang_item]` attribute is only found on the appropriate item
for any given lang item. That is, language items representing traits
must only ever have their corresponding attribute placed on a trait, for
example.

r? @nagisa

5 years agoCheck the invariant for `principal` inside the method
Oliver Scherer [Sat, 13 Oct 2018 09:32:49 +0000 (11:32 +0200)]
Check the invariant for `principal` inside the method

5 years agoAuto merge of #54955 - RalfJung:miri-validate2, r=oli-obk
bors [Sat, 13 Oct 2018 09:20:48 +0000 (09:20 +0000)]
Auto merge of #54955 - RalfJung:miri-validate2, r=oli-obk

miri engine: Fix run-time validation

This fixes all false positives that came up when actually enabling this in miri.

r? @oli-obk

5 years agoupdate miri
Ralf Jung [Thu, 11 Oct 2018 08:18:31 +0000 (10:18 +0200)]
update miri

5 years agorun-time validation: accept undef in int arrays, as we do for ints
Ralf Jung [Fri, 12 Oct 2018 08:56:47 +0000 (10:56 +0200)]
run-time validation: accept undef in int arrays, as we do for ints

5 years agoaddress nits
Ralf Jung [Thu, 11 Oct 2018 11:13:14 +0000 (13:13 +0200)]
address nits

5 years agovalidation: accept pointers in integer arrays
Ralf Jung [Thu, 11 Oct 2018 09:15:30 +0000 (11:15 +0200)]
validation: accept pointers in integer arrays

5 years agoFix and test upvar name printing for validity
Ralf Jung [Thu, 11 Oct 2018 08:16:51 +0000 (10:16 +0200)]
Fix and test upvar name printing for validity

5 years agomake ENFORCE_VALIDITY a function
Ralf Jung [Thu, 11 Oct 2018 06:48:15 +0000 (08:48 +0200)]
make ENFORCE_VALIDITY a function

miri needs this extra flexibility

5 years agoforeign types: use size and align from layout
Ralf Jung [Wed, 10 Oct 2018 07:11:38 +0000 (09:11 +0200)]
foreign types: use size and align from layout

5 years agoseems like for generators we cannot access the freevars
Ralf Jung [Tue, 9 Oct 2018 20:44:20 +0000 (22:44 +0200)]
seems like for generators we cannot access the freevars

5 years agosize_and_align_of can return no result for extern types
Ralf Jung [Tue, 9 Oct 2018 20:41:41 +0000 (22:41 +0200)]
size_and_align_of can return no result for extern types

5 years agovalidate return value on stack pop
Ralf Jung [Tue, 9 Oct 2018 19:05:53 +0000 (21:05 +0200)]
validate return value on stack pop

5 years agocheck return type even for uninhabited case
Ralf Jung [Tue, 9 Oct 2018 16:16:27 +0000 (18:16 +0200)]
check return type even for uninhabited case

5 years agofix validation around transmuting copy_op
Ralf Jung [Tue, 9 Oct 2018 15:06:57 +0000 (17:06 +0200)]
fix validation around transmuting copy_op

5 years agoAuto merge of #54980 - zackmdavis:and_the_case_of_the_universal_call, r=oli-obk
bors [Sat, 13 Oct 2018 06:48:17 +0000 (06:48 +0000)]
Auto merge of #54980 - zackmdavis:and_the_case_of_the_universal_call, r=oli-obk

structured suggestion for E0223 ambiguous associated type

(routine (and when are we going to be done finding these, anyway?) but something that stuck out to me while glancing at #54970)

r? @estebank

5 years ago`#[must_use]` for associated functions is supposed to actually work
Zack M. Davis [Fri, 12 Oct 2018 06:10:37 +0000 (23:10 -0700)]
`#[must_use]` for associated functions is supposed to actually work

In the comments of (closed, defunct) pull request #54884, Mazdak
"Centril" Farrokhzad noted that must-use annotations didn't work on an
associated function (what other communities might call a "static
method"). Subsequent logging revealed that in this case we have a
`Def::Method`, whereas the lint pass was only matching on
`Def::Fn`. (One could argue that those def-names are thereby
misleading—must-use for self-ful methods have always worked—but
documenting or reworking that can be left to another day.)

5 years agoAuto merge of #54945 - estebank:asm-span, r=petrochenkov
bors [Sat, 13 Oct 2018 00:56:30 +0000 (00:56 +0000)]
Auto merge of #54945 - estebank:asm-span, r=petrochenkov

Point to variable in `asm!` macro when failing borrowck

Fix #34940.

5 years agoAuto merge of #54942 - matthewjasper:wf-type-annotations, r=nikomatsakis
bors [Fri, 12 Oct 2018 21:28:42 +0000 (21:28 +0000)]
Auto merge of #54942 - matthewjasper:wf-type-annotations, r=nikomatsakis

[NLL] Check user types are well-formed

Also contains a change of span for AscribeUserType.
I'm not quite sure if this was what @nikomatsakis was thinking.

Closes #54620

r? @nikomatsakis

5 years agoAdd nll stderr to #52240
memoryruins [Fri, 12 Oct 2018 18:33:38 +0000 (14:33 -0400)]
Add nll stderr to #52240

5 years agoAdd test for issue #52240
memoryruins [Fri, 12 Oct 2018 16:43:13 +0000 (12:43 -0400)]
Add test for issue #52240

Closes #52240

5 years agoadd test for #24421
Andy Russell [Fri, 12 Oct 2018 17:07:39 +0000 (13:07 -0400)]
add test for #24421

Fixes #24421.

5 years agoAdd test for issue #54966
memoryruins [Fri, 12 Oct 2018 16:42:33 +0000 (12:42 -0400)]
Add test for issue #54966

Closes #54966

5 years agoAuto merge of #55012 - kennytm:rollup, r=kennytm
bors [Fri, 12 Oct 2018 15:00:24 +0000 (15:00 +0000)]
Auto merge of #55012 - kennytm:rollup, r=kennytm

Rollup of 16 pull requests

Successful merges:

 - #54755 (Documents reference equality by address (#54197))
 - #54811 (During rustc bootstrap, make default for `optimize` independent of `debug`)
 - #54825 (NLL says "borrowed content" instead of more precise "dereference of raw pointer")
 - #54860 (Add doc comments about safest way to initialize a vector of zeros)
 - #54869 (Fix mobile docs)
 - #54891 (Fix tracking issue for Once::is_completed)
 - #54913 (doc fix: it's auto traits that make for automatic implementations)
 - #54920 (Fix handling of #[must_use] on unit and uninhabited types)
 - #54932 (A handful of random string-related improvements)
 - #54936 (impl Eq+Hash for TyLayout)
 - #54950 (std: Synchronize global allocator on wasm32)
 - #54956 ("(using ..." doesn't have the matching ")")
 - #54958 (add a macro for static (compile-time) assertions)
 - #54967 (Remove incorrect span for second label inner macro invocation)
 - #54983 (Fix slice's benchmarks)
 - #54989 (Fix spelling in the documentation to htmldocck.py)

Failed merges:

r? @ghost

5 years agoRollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandry
kennytm [Fri, 12 Oct 2018 14:04:19 +0000 (22:04 +0800)]
Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandry

Fix spelling in the documentation to htmldocck.py

I was reading through htmldocck.py, and decided to attempt to clean it up a little bit. Let me know if you disagree with my edits.

5 years agoRollup merge of #54983 - kzys:rand-bench, r=tmandry
kennytm [Fri, 12 Oct 2018 14:04:18 +0000 (22:04 +0800)]
Rollup merge of #54983 - kzys:rand-bench, r=tmandry

Fix slice's benchmarks

Fixes #54013.

5 years agoRollup merge of #54967 - holmgr:master, r=estebank
kennytm [Fri, 12 Oct 2018 14:04:16 +0000 (22:04 +0800)]
Rollup merge of #54967 - holmgr:master, r=estebank

Remove incorrect span for second label inner macro invocation

A fix for issue #54841

5 years agoRollup merge of #54958 - RalfJung:static-assert, r=oli-obk
kennytm [Fri, 12 Oct 2018 14:04:15 +0000 (22:04 +0800)]
Rollup merge of #54958 - RalfJung:static-assert, r=oli-obk

add a macro for static (compile-time) assertions

Cc @oli-obk

5 years agoRollup merge of #54956 - kzys:close-paren, r=varkor
kennytm [Fri, 12 Oct 2018 14:04:14 +0000 (22:04 +0800)]
Rollup merge of #54956 - kzys:close-paren, r=varkor

"(using ..." doesn't have the matching ")"

Fixes #54948.

5 years agoRollup merge of #54950 - alexcrichton:wasm-sync-allocator, r=sfackler
kennytm [Fri, 12 Oct 2018 14:04:13 +0000 (22:04 +0800)]
Rollup merge of #54950 - alexcrichton:wasm-sync-allocator, r=sfackler

std: Synchronize global allocator on wasm32

We originally didn't have threads, and now we're starting to add them!
Make sure we properly synchronize access to dlmalloc when the `atomics`
feature is enabled for `wasm32-unknown-unknown`.

5 years agoRollup merge of #54936 - RalfJung:layout-hash, r=oli-obk
kennytm [Fri, 12 Oct 2018 14:04:12 +0000 (22:04 +0800)]
Rollup merge of #54936 - RalfJung:layout-hash, r=oli-obk

impl Eq+Hash for TyLayout

As proposed by @eddyb at https://github.com/rust-lang/rust/pull/53671#pullrequestreview-159761136.

I have an upcoming PR that would also significantly benefit from this.

5 years agoRollup merge of #54932 - ljedrz:a_handful_of_string_improvements, r=alexcrichton
kennytm [Fri, 12 Oct 2018 14:04:10 +0000 (22:04 +0800)]
Rollup merge of #54932 - ljedrz:a_handful_of_string_improvements, r=alexcrichton

A handful of random string-related improvements

- remove a few allocations in `errors/diagnostic`
- make `build_helper::gnu_target` return `Cow<str>`

5 years agoRollup merge of #54920 - varkor:must_use-unit, r=estebank
kennytm [Fri, 12 Oct 2018 14:04:09 +0000 (22:04 +0800)]
Rollup merge of #54920 - varkor:must_use-unit, r=estebank

Fix handling of #[must_use] on unit and uninhabited types

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

5 years agoRollup merge of #54913 - RalfJung:unwind-safe, r=alexcrichton
kennytm [Fri, 12 Oct 2018 14:04:08 +0000 (22:04 +0800)]
Rollup merge of #54913 - RalfJung:unwind-safe, r=alexcrichton

doc fix: it's auto traits that make for automatic implementations

Being a marker trait is not good enough (that just means "no items in the trait").

r? @alexcrichton who [originally wrote these docs](https://github.com/RalfJung/rust/commit/0a13f1abafe70cddf34bf2b2ba3946c418ed6241).

5 years agoRollup merge of #54891 - rust-lang:SimonSapin-patch-1, r=nagisa
kennytm [Fri, 12 Oct 2018 14:04:07 +0000 (22:04 +0800)]
Rollup merge of #54891 - rust-lang:SimonSapin-patch-1, r=nagisa

Fix tracking issue for Once::is_completed

https://github.com/rust-lang/rust/pull/53027 was merged without a tracking issue. I just filed https://github.com/rust-lang/rust/issues/54890. CC @matklad

5 years agoRollup merge of #54869 - GuillaumeGomez:fix-mobile-docs, r=QuietMisdreavus
kennytm [Fri, 12 Oct 2018 14:04:05 +0000 (22:04 +0800)]
Rollup merge of #54869 - GuillaumeGomez:fix-mobile-docs, r=QuietMisdreavus

Fix mobile docs

Fixes #54836.

<img width="1440" alt="screen shot 2018-10-06 at 18 53 19" src="https://user-images.githubusercontent.com/3050060/46573683-1b4cd700-c999-11e8-9e6b-86a23b332e22.png">

r? @QuietMisdreavus

5 years agoRollup merge of #54860 - mandeep:vec-initialize, r=alexcrichton
kennytm [Fri, 12 Oct 2018 14:04:04 +0000 (22:04 +0800)]
Rollup merge of #54860 - mandeep:vec-initialize, r=alexcrichton

Add doc comments about safest way to initialize a vector of zeros

This adds more information about the vec! macro as discussed in #54628. I think this is a good starting point, but I think additional detail is needed so that we can explain why vec! is safer than the alternatives.

5 years agoRollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelix
kennytm [Fri, 12 Oct 2018 14:04:03 +0000 (22:04 +0800)]
Rollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelix

NLL says "borrowed content" instead of more precise "dereference of raw pointer"

Part of #52663.

Previously, move errors involving the dereference of a raw pointer would
say "borrowed content". This commit changes it to say "dereference of
raw pointer".

r? @nikomatsakis
cc @pnkfelix

5 years agoRollup merge of #54811 - pnkfelix:issue-24840-separate-bootstrap-default-for-optimize...
kennytm [Fri, 12 Oct 2018 14:04:01 +0000 (22:04 +0800)]
Rollup merge of #54811 - pnkfelix:issue-24840-separate-bootstrap-default-for-optimize-from-debug-setting, r=nikomatsakis

During rustc bootstrap, make default for `optimize` independent of `debug`

It may have taken me three and a half years, but I'm following through on my ["threat"](https://github.com/rust-lang/rust/issues/24840#issuecomment-97911700)

Fix #24840

5 years agoRollup merge of #54755 - lucasloisp:document-reference-address-eq, r=QuietMisdreavus
kennytm [Fri, 12 Oct 2018 14:04:00 +0000 (22:04 +0800)]
Rollup merge of #54755 - lucasloisp:document-reference-address-eq, r=QuietMisdreavus

Documents reference equality by address (#54197)

Clarification of the use of `ptr::eq` to test equality of references via address by pointer coercion,  regarding issue #54197 .

The same example as in `ptr::eq` docs is shown here to clarify that
`PartialEq` compares values pointed-to instead of via address (which can be desired in some cases)

5 years agoAuto merge of #54715 - oli-obk:nll_deref_promotion, r=RalfJung
bors [Fri, 12 Oct 2018 12:00:50 +0000 (12:00 +0000)]
Auto merge of #54715 - oli-obk:nll_deref_promotion, r=RalfJung

Fix #54224 (const promotion regression)

r? @eddyb

5 years agoAuto merge of #53933 - GuillaumeGomez:codeblock-error-display, r=QuietMisdreavus
bors [Fri, 12 Oct 2018 09:23:10 +0000 (09:23 +0000)]
Auto merge of #53933 - GuillaumeGomez:codeblock-error-display, r=QuietMisdreavus

Improve error display for codeblocks in rustdoc

Part of #53919.

r? @QuietMisdreavus

5 years agoAdd comments explaining why some operations are not constant inside normal functions
Oliver Scherer [Fri, 12 Oct 2018 07:30:28 +0000 (09:30 +0200)]
Add comments explaining why some operations are not constant inside normal functions

5 years agoAuto merge of #54534 - nagisa:align-offset-simplification, r=alexcrichton
bors [Fri, 12 Oct 2018 06:38:11 +0000 (06:38 +0000)]
Auto merge of #54534 - nagisa:align-offset-simplification, r=alexcrichton

Simplify implementation of align_offset slightly

5 years agostructured suggestion for E0223 ambiguous associated type
Zack M. Davis [Thu, 11 Oct 2018 03:49:45 +0000 (20:49 -0700)]
structured suggestion for E0223 ambiguous associated type

It looks like we tend to use angle-brackets around the placeholder in
the few other places we use `Applicability::HasPlaceholders`, but that
would be confusing here, so ...

5 years agoAuto merge of #54924 - RalfJung:use-maybe-uninit2, r=cramertj
bors [Fri, 12 Oct 2018 02:14:47 +0000 (02:14 +0000)]
Auto merge of #54924 - RalfJung:use-maybe-uninit2, r=cramertj

Use MaybeUninit in liballoc

All code by @japaric. This is a re-submission of a part of https://github.com/rust-lang/rust/pull/53508 that hopefully does not regress performance.

5 years agoFix mobile doc display
Guillaume Gomez [Sat, 6 Oct 2018 16:51:56 +0000 (18:51 +0200)]
Fix mobile doc display

5 years agoAuto merge of #54592 - GabrielMajeri:no-plt, r=nagisa
bors [Thu, 11 Oct 2018 19:38:15 +0000 (19:38 +0000)]
Auto merge of #54592 - GabrielMajeri:no-plt, r=nagisa

Support for disabling PLT for better function call performance

This PR gives `rustc` the ability to skip the PLT when generating function calls into shared libraries. This can improve performance by reducing branch indirection.

AFAIK, the only advantage of using the PLT is to allow for ELF lazy binding. However, since Rust already [enables full relro for security](https://github.com/rust-lang/rust/pull/43170), lazy binding was disabled anyway.

This is a little known feature which is supported by [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) and [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fplt) as `-fno-plt` (some Linux distros [enable it by default](https://git.archlinux.org/svntogit/packages.git/tree/trunk/makepkg.conf?h=packages/pacman#n40) for all builds).

Implementation inspired by [this patch](https://reviews.llvm.org/D39079#change-YvkpNDlMs_LT) which adds `-fno-plt` support to Clang.

## Performance

I didn't run a lot of benchmarks, but these are the results on my machine for a `clap` [benchmark](https://github.com/clap-rs/clap/blob/master/benches/05_ripgrep.rs):

```
 name              control ns/iter  no-plt ns/iter  diff ns/iter  diff %  speedup
 build_app_long    11,097           10,733                  -364  -3.28%   x 1.03
 build_app_short   11,089           10,742                  -347  -3.13%   x 1.03
 build_help_long   186,835          182,713               -4,122  -2.21%   x 1.02
 build_help_short  80,949           78,455                -2,494  -3.08%   x 1.03
 parse_clean       12,385           12,044                  -341  -2.75%   x 1.03
 parse_complex     19,438           19,017                  -421  -2.17%   x 1.02
 parse_lots        431,493          421,421              -10,072  -2.33%   x 1.02
```

A small performance improvement across the board, with no downsides. It's likely binaries which make a lot of function calls into dynamic libraries could see even more improvements. [This comment](https://patchwork.ozlabs.org/patch/468993/#1028255) suggests that, in some cases, `-fno-plt` could improve PIC/PIE code performance by 10%.

## Security benefits

**Bonus**: some of the speculative execution attacks rely on the PLT, by disabling it we reduce a big attack surface and reduce the need for [`retpoline`](https://reviews.llvm.org/D41723).

## Remaining PLT calls

The compiled binaries still have plenty of PLT calls, coming from C/C++ libraries. Building dependencies with `CFLAGS=-fno-plt CXXFLAGS=-fno-plt` removes them.

5 years agoUpdate minifier version
Guillaume Gomez [Sat, 6 Oct 2018 16:48:31 +0000 (18:48 +0200)]
Update minifier version

5 years agoSupport for disabling the PLT on ELF targets
Gabriel Majeri [Wed, 26 Sep 2018 16:19:55 +0000 (19:19 +0300)]
Support for disabling the PLT on ELF targets

Disable the PLT where possible to improve performance
for indirect calls into shared libraries.

This optimization is enabled by default where possible.

- Add the `NonLazyBind` attribute to `rustllvm`:
  This attribute informs LLVM to skip PLT calls in codegen.

- Disable PLT unconditionally:
  Apply the `NonLazyBind` attribute on every function.

- Only enable no-plt when full relro is enabled:
  Ensures we only enable it when we have linker support.

- Add `-Z plt` as a compiler option

5 years agoExtend lang items to assert correct target.
David Wood [Thu, 11 Oct 2018 17:36:51 +0000 (19:36 +0200)]
Extend lang items to assert correct target.

This commit extends the existing lang items functionality to assert
that the `#[lang_item]` attribute is only found on the appropriate item
for any given lang item. That is, language items representing traits
must only ever have their corresponding attribute placed on a trait, for
example.

5 years agostd: Implement TLS for wasm32-unknown-unknown
Alex Crichton [Wed, 10 Oct 2018 06:10:25 +0000 (23:10 -0700)]
std: Implement TLS for wasm32-unknown-unknown

This adds an implementation of thread local storage for the
`wasm32-unknown-unknown` target when the `atomics` feature is
implemented. This, however, comes with a notable caveat of that it
requires a new feature of the standard library, `wasm-bindgen-threads`,
to be enabled.

Thread local storage for wasm (when `atomics` are enabled and there's
actually more than one thread) is powered by the assumption that an
external entity can fill in some information for us. It's not currently
clear who will fill in this information nor whose responsibility it
should be long-term. In the meantime there's a strategy being gamed out
in the `wasm-bindgen` project specifically, and the hope is that we can
continue to test and iterate on the standard library without committing
to a particular strategy yet.

As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently
have the ability to emit custom `global` values (thread locals in a
`WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do
it for us. To that end we have a few intrinsics, assuming two global values:

* `__wbindgen_current_id` - gets the current thread id as a 32-bit
  integer. It's `wasm-bindgen`'s responsibility to initialize this
  per-thread and then inform libstd of the id. Currently `wasm-bindgen`
  performs this initialization as part of the `start` function.
* `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed
  that there's a global available for simply storing a pointer's worth
  of information (a thread control block, which currently only contains
  thread local storage). This would ideally be a native `global`
  injected by LLVM, but we don't have a great way to support that right
  now.

To reiterate, this is all intended to be unstable and purely intended
for testing out Rust on the web with threads. The story is very likely
to change in the future and we want to make sure that we're able to do
that!

5 years agoInclude rustdoc tests that have been fixed by #33133
Philip Munksgaard [Thu, 11 Oct 2018 16:18:32 +0000 (18:18 +0200)]
Include rustdoc tests that have been fixed by #33133

There was an issue (#33025) which caused these tests to not work. The issue has
since been fixed in #33133, and so we can now include them.

5 years agoFix spelling in the documentation to htmldocck.py
Philip Munksgaard [Thu, 11 Oct 2018 12:34:43 +0000 (14:34 +0200)]
Fix spelling in the documentation to htmldocck.py

5 years agoAuto merge of #54911 - ljedrz:cleanup_codegen_llvm_top, r=michaelwoerister
bors [Thu, 11 Oct 2018 11:57:06 +0000 (11:57 +0000)]
Auto merge of #54911 - ljedrz:cleanup_codegen_llvm_top, r=michaelwoerister

Cleanup top-level codegen_llvm

- improve allocations
- improve common patterns
- remove explicit returns
- fix spelling & grammatical errors
- whitespace & formatting improvements

5 years agoimpl Eq+Hash for TyLayout
Ralf Jung [Tue, 9 Oct 2018 16:48:44 +0000 (18:48 +0200)]
impl Eq+Hash for TyLayout

5 years agoAuto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, r=nikomatsakis
bors [Thu, 11 Oct 2018 09:19:23 +0000 (09:19 +0000)]
Auto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, r=nikomatsakis

Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.

5 years agoAuto merge of #54969 - Manishearth:rollup, r=Manishearth
bors [Thu, 11 Oct 2018 06:26:03 +0000 (06:26 +0000)]
Auto merge of #54969 - Manishearth:rollup, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #54747 (codegen_llvm: verify that inline assembly operands are scalars)
 - #54848 (Better Diagnostic for Trait Object Capture)
 - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls)
 - #54858 (second round of refactorings for universes)
 - #54862 (Implement RFC 2539: cfg_attr with multiple attributes)
 - #54869 (Fix mobile docs)
 - #54870 (Stabilize tool lints)
 - #54893 (Fix internal compiler error on malformed match arm pattern.)
 - #54904 (Stabilize the `Option::replace` method)

Failed merges:

 - #54909 ( Add chalk rules related to associated type defs)

r? @ghost

5 years agoFix slice's benchmarks
Kazuyoshi Kato [Thu, 11 Oct 2018 05:54:04 +0000 (22:54 -0700)]
Fix slice's benchmarks

Fixes #54013.

5 years agoAuto merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis
bors [Thu, 11 Oct 2018 03:32:12 +0000 (03:32 +0000)]
Auto merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis

Better Diagnostic for Trait Object Capture

Part of #52663.

This commit enhances `LaterUseKind` detection to identify when a borrow
is captured by a trait object which helps explain why there is a borrow
error.

r? @nikomatsakis
cc @pnkfelix

5 years agoRollup merge of #54909 - scalexm:finish-rules, r=nikomatsakis
Manish Goregaokar [Wed, 10 Oct 2018 22:59:25 +0000 (15:59 -0700)]
Rollup merge of #54909 - scalexm:finish-rules, r=nikomatsakis

Fixes #47311.
r? @nrc

5 years agoRollup merge of #54904 - Kerollmops:stabilize-option-replace, r=Centril
Manish Goregaokar [Wed, 10 Oct 2018 22:59:23 +0000 (15:59 -0700)]
Rollup merge of #54904 - Kerollmops:stabilize-option-replace, r=Centril

Fixes #47311.
r? @nrc

5 years agoRollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix
Manish Goregaokar [Wed, 10 Oct 2018 22:59:21 +0000 (15:59 -0700)]
Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix

Fixes #47311.
r? @nrc

5 years agoRollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth
Manish Goregaokar [Wed, 10 Oct 2018 22:59:20 +0000 (15:59 -0700)]
Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth

Fixes #47311.
r? @nrc

5 years agoRollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov
Manish Goregaokar [Wed, 10 Oct 2018 22:58:40 +0000 (15:58 -0700)]
Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov

Fixes #47311.
r? @nrc

5 years agoRollup merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis
Manish Goregaokar [Wed, 10 Oct 2018 22:58:38 +0000 (15:58 -0700)]
Rollup merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis

Fixes #47311.
r? @nrc

5 years agoAuto merge of #54747 - levex:inline-asm-bad-operands, r=nagisa
bors [Wed, 10 Oct 2018 22:24:48 +0000 (22:24 +0000)]
Auto merge of #54747 - levex:inline-asm-bad-operands, r=nagisa

codegen_llvm: verify that inline assembly operands are scalars

Another set of inline assembly fixes. This time let's emit an error message when the operand value cannot be coerced into the operand constraint.

Two questions:

1) Should I reuse `E0668` which was introduced in #54568 or just use `E0669` as it stands because they do mean different things, but maybe that's not too user-friendly. Just a thought.
2) The `try_fold` returns the operand which failed to be converted into a scalar value, any suggestions on how to use that in the error message?

Thanks!

5 years agoAuto merge of #54732 - cramertj:waker, r=aturon
bors [Wed, 10 Oct 2018 18:28:30 +0000 (18:28 +0000)]
Auto merge of #54732 - cramertj:waker, r=aturon

LocalWaker and Waker cleanups

r? @aturon

5 years agoRemove incorrect span for second label inner macro invocation
holmgr [Wed, 10 Oct 2018 13:34:06 +0000 (15:34 +0200)]
Remove incorrect span for second label inner macro invocation

5 years agoCheck user types are well-formed in MIR borrow check
Matthew Jasper [Wed, 10 Oct 2018 07:38:17 +0000 (08:38 +0100)]
Check user types are well-formed in MIR borrow check

Also update some tests so that they don't have user types on `_` in
unreachable code.

5 years agoAuto merge of #54802 - davidtwco:issue-53040, r=pnkfelix
bors [Wed, 10 Oct 2018 14:51:01 +0000 (14:51 +0000)]
Auto merge of #54802 - davidtwco:issue-53040, r=pnkfelix

[nll] better error message when returning refs to upvars

Fixes #53040.

r? @nikomatsakis

5 years agoAuto merge of #54461 - RalfJung:pointer-provenance, r=oli-obk
bors [Wed, 10 Oct 2018 12:13:03 +0000 (12:13 +0000)]
Auto merge of #54461 - RalfJung:pointer-provenance, r=oli-obk

miri engine: basic support for pointer provenance tracking

This enriches pointers with a new member, `tag`, that can be used to do provenance tracking. This is a new type parameter that propagates up through everything. It defaults to `()` (no tag), which is also the value used by CTFE -- but miri will use another type.

The only actually interesting piece here, I think, is what I had to do in the memory's `get`. The problem is that `tcx` (storing the allocations for statics) uses `()` for provenance information. But the machine might need another tag. The machine has a function to do the conversion, but if a conversion actually happened, we need to store the result of this *somewhere* -- we cannot return a pointer into `tcx` as we usually would.
So I introduced `MonoHashMap` which uses `RefCell` to be able to insert new entries even when we just have a shared ref. However, it is important that we can also return shared refs into the map without holding the `RefCell` opan. This is achieved by boxing the values stored in the map, so their addresses remain stable even when the map's table gets reallocated. This is all implemented in `mono_hash_map.rs`.

NOTE: This PR also contains the commits from https://github.com/rust-lang/rust/pull/54380#issuecomment-423130753. Only the [last two commits](https://github.com/rust-lang/rust/pull/54461/files/8e74ee0998a5b11f28d61600dbb881c7168a4a40..HEAD) are new.

5 years agoUse the span of the user type for `AscribeUserType`
Matthew Jasper [Tue, 9 Oct 2018 21:59:46 +0000 (22:59 +0100)]
Use the span of the user type for `AscribeUserType`

Also change the order of the fake read for let and the AscribeUserType,
so that we use the better span and message from the fake read in errors.

5 years agotidy up
Ralf Jung [Wed, 10 Oct 2018 09:31:31 +0000 (11:31 +0200)]
tidy up

5 years agoadd a macro for static assertions
Ralf Jung [Wed, 10 Oct 2018 09:03:58 +0000 (11:03 +0200)]
add a macro for static assertions

5 years agoA handful of random string-related improvements
ljedrz [Tue, 9 Oct 2018 12:30:14 +0000 (14:30 +0200)]
A handful of random string-related improvements

5 years agovtables are not leaks
Ralf Jung [Fri, 5 Oct 2018 16:08:36 +0000 (18:08 +0200)]
vtables are not leaks

5 years agomore comments for these sublte games we are playing with allocations in the miri...
Ralf Jung [Fri, 5 Oct 2018 14:49:51 +0000 (16:49 +0200)]
more comments for these sublte games we are playing with allocations in the miri engine

5 years ago"(using ..." doesn't have the matching ")"
Kazuyoshi Kato [Wed, 10 Oct 2018 08:09:18 +0000 (01:09 -0700)]
"(using ..." doesn't have the matching ")"

Fixes #54948.

5 years agoabstract mono_hash_map through a trait, only miri actually needs the fancy one
Ralf Jung [Fri, 5 Oct 2018 13:13:59 +0000 (15:13 +0200)]
abstract mono_hash_map through a trait, only miri actually needs the fancy one