101933 Commits

Author SHA1 Message Date
Pietro Albini
6ad9f56316
Rollup merge of #66025 - petrochenkov:lohi, r=eddyb
`Span` cannot represent `span.hi < span.lo`

So we can remove the corresponding checks from various code
2019-11-05 14:37:01 +01:00
Pietro Albini
b5bcb28b72
Rollup merge of #66012 - nnethercote:dequery-trivial_dropck_outlives, r=michaelwoerister
De-querify `trivial_dropck_outlives`.

It's sufficiently simple and fast that memoizing it is a slight
pessimization.

r? @michaelwoerister
2019-11-05 14:36:59 +01:00
Pietro Albini
26449f8db4
Rollup merge of #65953 - keystone-enclave:llvm_abiname, r=alexcrichton
Allow specifying LLVM's MCTargetOptions::ABIName in target specification files

This addresses #65024, as it allows RISC-V target specification files to set `"llvm-abiname": "lp64d"`.

Other languages (read: C) usually expose this codegen parameter under a compiler argument like `-mabi=<XYZ>`.
2019-11-05 14:36:57 +01:00
Pietro Albini
54c57a2f21
Rollup merge of #65948 - danielhenrymantilla:doc/maybe_uninit_ref_mut, r=RalfJung
Improve MaybeUninit::get_{ref,mut} documentation

As mentioned in https://github.com/rust-lang/rust/issues/63568#issuecomment-544106668, `MaybeUninit`'s `get_{ref,mut}` documentation is lacking, so this PR attempts to fix that.

That being said, and as @RalfJung mentions in that thread,

> In particular, we should clarify that all the UB rules for these methods equally apply when calling the raw ptr methods and creating a reference manually.

these other docs also need to be improved, which I can do in this PR ~~(hence the `[WIP]`)~~.

Finally, since all these documentations are related to clearly establishing when dealing with uninitialized memory which patterns are known to be sound and which patterns are currently UB (that is, until, if ever, the rules around references to unintialized integers get relaxed, this documentation will treat them as UB, and advise against such patterns (_e.g._, it is not possible to use uninitialized buffers with the `Read` API)), I think that adding even more examples to the main documentation of `MaybeUninit` inherent definition wouldn't hurt either.

___

  - [Rendered](http://dreamy-ritchie-99d637.netlify.com/core/mem/union.maybeuninit#method.get_ref)
2019-11-05 14:36:55 +01:00
David Wood
49e240346f
libstd: allow improper_ctypes in sys/sgx
Signed-off-by: David Wood <david@davidtw.co>
2019-11-05 13:17:05 +00:00
bors
3a1b3b30c6 Auto merge of #66083 - RalfJung:miri-offset-from, r=oli-obk
fix Miri offset_from

This is needed to make https://github.com/rust-lang/miri/pull/1032 pass.
2019-11-05 12:46:29 +00:00
Oleg Nosov
3a54ab78ef
LinkedList: PhantomData<Box<Node<T>>> => PhantomData<T> 2019-11-05 15:44:57 +03:00
David Wood
95c505d92a
tests: add #[repr(C)] to test
Signed-off-by: David Wood <david@davidtw.co>
2019-11-05 12:44:11 +00:00
David Wood
cb60654f78
improper ctypes: adjust lint msg for extern fns
Signed-off-by: David Wood <david@davidtw.co>
2019-11-05 12:44:09 +00:00
David Wood
0128f8ee11
codegen_llvm: remove unnecessary "extern C"
Signed-off-by: David Wood <david@davidtw.co>
2019-11-05 12:44:06 +00:00
David Wood
a515258b35
improper_ctypes: extern "C" fns 2019-11-05 12:44:02 +00:00
Ralf Jung
b1d0a68fd7 fix link to ptr docs 2019-11-05 13:22:43 +01:00
Pyry Kontio
002c1c74d9 Improve std:🧵:Result documentation 2019-11-05 19:23:12 +09:00
Ralf Jung
a593b54199 expand comment explaining integer exception 2019-11-05 10:41:19 +01:00
bors
d1fff4a4b2 Auto merge of #66109 - pietroalbini:rollup-2npidna, r=pietroalbini
Rollup of 10 pull requests

Successful merges:

 - #65136 (Update codegen option documentation.)
 - #65574 (docs: improve disclaimer regarding LinkedList)
 - #65720 (Add FFI bindings for LLVM's Module::getInstructionCount())
 - #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`)
 - #65962 (Fix logic in example.)
 - #66019 (Improved std::iter::Chain documentation)
 - #66038 (doc(str): show example of chars().count() under len())
 - #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait)
 - #66073 (Do not needlessly write-lock)
 - #66096 (Add a failing UI test for multiple loops of all kinds in a `const`)

Failed merges:

r? @ghost
2019-11-05 09:31:36 +00:00
Ralf Jung
6a1f303b98 also edit String::from_raw_parts while we are at it 2019-11-05 09:57:52 +01:00
Ralf Jung
1a254e4f43 expand slice from_raw_part docs 2019-11-05 09:55:33 +01:00
Pietro Albini
1ffa93e5f8
Rollup merge of #66096 - ecstatic-morse:const-loop-test, r=Centril
Add a failing UI test for multiple loops of all kinds in a `const`

This simply demonstrates the current behavior and ensures we don't allow anything by accident.

The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-`while` loops in a `const`, and there were no tests with multiple loops.
2019-11-05 09:50:00 +01:00
Pietro Albini
dc40c9389a
Rollup merge of #66073 - Mark-Simulacrum:no-borrow-mut, r=Centril
Do not needlessly write-lock

Just removes a needless `borrow_mut()` by using `borrow()` instead.
2019-11-05 09:49:59 +01:00
Pietro Albini
1d5cb17ebe
Rollup merge of #66042 - ohadravid:suggest-correct-code-when-ref-current-trait, r=estebank
Suggest correct code when encountering an incorrect trait bound referencing the current trait

Fixes #65985 and also improves the suggestion for code like this:

```
trait Grab {
    type Value;
    fn grab(&self) -> Grab::Value;
}
```

To suggest `<Self as Grab>::Value`.

I wasn't sure which of the syntax versions is better (`<Self as ..>::` vs `Self::`), so I used the former simply because it was less change to the existing code.

r? @estebank
2019-11-05 09:49:58 +01:00
Pietro Albini
d32a262ab8
Rollup merge of #66038 - jdxcode:char-len, r=alexcrichton
doc(str): show example of chars().count() under len()

the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.
2019-11-05 09:49:56 +01:00
Pietro Albini
c25975d327
Rollup merge of #66019 - olegnn:fixed_std_iter_chain_docs, r=Mark-Simulacrum
Improved std::iter::Chain documentation

Replaces `strings two iterators` by `links two iterators` in `std::iter::Chain` documentation.

I didn't find any meaning of `strings` which can be evaluated as `links` or `joins`.

I don't think that `std::iter:Chain` works as a stringer or plays billiards. (https://www.lexico.com/en/definition/string).
2019-11-05 09:49:55 +01:00
Pietro Albini
370d01aea7
Rollup merge of #65962 - kevincox:patch-1, r=sfackler
Fix logic in example.

The example claims SuperiorThanZero and presumably Zero is not Superior than itself so it should not be allowed.
2019-11-05 09:49:53 +01:00
Pietro Albini
0a284153e9
Rollup merge of #65905 - cuviper:doc-unix-mode, r=Dylan-DPC
[doc] fixes for unix/vxworks `OpenOptionsExt::mode`
2019-11-05 09:49:52 +01:00
Pietro Albini
7976d5720a
Rollup merge of #65720 - icefoxen:LLVMgetInstructionCount, r=rkruppe
Add FFI bindings for LLVM's Module::getInstructionCount()

Just to make it usable for profiling and such inside
rustc itself.  It was vaguely useful in
https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured
I might as well upstream it; I may or may not ever get around
to doing more with it (hopefully I will), but it may be useful
for others.
2019-11-05 09:49:50 +01:00
Pietro Albini
5831e0643e
Rollup merge of #65574 - tshepang:linked-list-disclaimer, r=Centril
docs: improve disclaimer regarding LinkedList
2019-11-05 09:49:48 +01:00
Pietro Albini
a4e91c2986
Rollup merge of #65136 - ehuss:update-codegen-options, r=Dylan-DPC
Update codegen option documentation.

Some documentation updates:

- Add more detail to codegen options.
- Add missing options:
    - `force-frame-pointers`
    - `default-linker-libraries`
    - `linker-plugin-lto`
- Add fragment anchors for all command-line-arguments.
- Add some cross links between options.
2019-11-05 09:49:47 +01:00
Ralf Jung
82dc3aa5fb link from raw slice creation methods to safety requirements 2019-11-05 09:32:47 +01:00
bors
2e4da3caad Auto merge of #65938 - eddyb:fn-abi-rename, r=oli-obk
rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.

I was trying to tweak the API of `FnType` (now `FnAbi`) and the name kept bothering me.

`FnAbi` is to a function signature a bit like a layout is to a type, so the name still isn't perfect yet, but at least it doesn't have the misleading `Type` in it anymore.

If this can't land I think I can continue my original refactor without it, so I'm not strongly attached to it.

r? @nagisa cc @oli-obk
2019-11-05 05:47:31 +00:00
Youngsuk Kim
f28126ee1b
Fix typo in explanation of E0080
Handling issue #66105 in Rust repo.
`evaluate an constant expression` to `evaluate a constant expression`
2019-11-05 00:35:18 -05:00
Samuel Holland
d01ebbb34b Add target thumbv7neon-unknown-linux-musleabihf
This is a copy of thumbv7neon-unknown-linux-gnueabihf with musl changes
merged from armv7-unknown-linux-musleabihf.
2019-11-04 22:28:50 -06:00
bors
d2185f6752 Auto merge of #65911 - mati865:static-libstdcxx-mingw, r=alexcrichton
Statically link libstdc++ on windows-gnu

Fixes https://github.com/rust-lang/rust/issues/61561 by not shipping `libstdc++-6.dll` which can conflict with the GCC.
2019-11-05 00:30:58 +00:00
Esteban Küber
3bbfc7320b Detect :: -> : typo when involving turbofish 2019-11-04 16:19:55 -08:00
Dylan MacKenzie
c8ae2819c5 Add tests for loop constructs in consts
These errors are suboptimal, but they will be fixed by the new
`check_consts` pass.
2019-11-04 14:19:51 -08:00
bors
881ebeb776 Auto merge of #65874 - Nadrieril:clarify-usefulness, r=varkor
Clarify pattern-matching usefulness algorithm

This PR clarifies a bit the usefulness algorithm by emphasizing that each row of the matrix can be seen as a sort of stack from which we pop constructors. It also moves code around to increase separation of concerns.

This is part of my splitting of https://github.com/rust-lang/rust/pull/65160 into smaller PRs.
2019-11-04 21:06:50 +00:00
Daniel Henry-Mantilla
67f2200f4a Minor style improvements
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-11-04 19:47:31 +01:00
nia
b4f92eaea2 Use any() in code shared between FreeBSD and NetBSD 2019-11-04 17:34:29 +00:00
nia
23d221153f Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.
This system call is present on all supported NetBSD versions and
provides an endless stream of non-blocking random data from the
kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor
to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call
is fine.

Similar change for getrandom crate: rust-random/getrandom#115
2019-11-04 17:16:11 +00:00
Umesh Kalappa
5083adeaad Implemented the home_dir for VxWorks 2019-11-04 09:15:28 -08:00
Tomasz Miąsko
e8733f7845 Add warning annotations for issue-47094 test 2019-11-04 16:03:46 +01:00
Tomasz Miąsko
0501d8ab0d Use check-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
Tomasz Miąsko
045fdd9fa9 Use build-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
Ralf Jung
90b8d34c9f bump smallvec to 1.0 2019-11-04 15:59:09 +01:00
Vadim Petrochenkov
d22a65995a Do not require extra LLVM backends for x.py test to pass 2019-11-04 16:54:34 +03:00
Tomasz Miąsko
a03474bc54 Use run-pass for ui tests where appropriate 2019-11-04 13:57:42 +01:00
Tomasz Miąsko
a99fba5bc5 Remove no longer useful ui test 2019-11-04 13:57:42 +01:00
Ralf Jung
21d284b6f0 also test different integers 2019-11-04 13:32:38 +01:00
Ralf Jung
3c944feb65 test offset_from with two integers 2019-11-04 13:32:38 +01:00
Ralf Jung
047e702c66 Miri: ptr_offset_from: support offset_from with twice the same non-null integer 2019-11-04 13:32:38 +01:00
Ralf Jung
da0c7c664b Miri: offset_from: do int-to-ptr casts when needed 2019-11-04 13:32:38 +01:00