Commit graph

101841 commits

Author SHA1 Message Date
Ralf Jung
769d52774b partially port invalid_value lint to diagnostic items 2019-11-09 10:34:16 +01:00
bors
7a76fe76f7 Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #65794 (gate rustc_on_unimplemented under rustc_attrs)
 - #65945 (Optimize long-linker-command-line test)
 - #66044 (Improve uninit/zeroed lint)
 - #66076 (HIR docs: mention how to resolve method paths)
 - #66084 (Do not require extra LLVM backends for `x.py test` to pass)
 - #66111 (improve from_raw_parts docs)
 - #66114 (Improve std:🧵:Result documentation)
 - #66117 (Fixed PhantomData markers in Arc and Rc)
 - #66146 (Remove unused parameters in `__thread_local_inner`)
 - #66147 (Miri: Refactor to_scalar_ptr out of existence)
 - #66162 (Fix broken link in README)
 - #66171 (Update link on CONTRIBUTING.md)

Failed merges:

r? @ghost
2019-11-07 03:54:25 +00:00
Yuki Okushi
b59d166006
Rollup merge of #66171 - JohnTitor:update-link, r=ehuss
Update link on CONTRIBUTING.md

This is a lost article of #66162
Follow-up for rust-lang/rustc-guide#491

CC: @mark-i-m
2019-11-07 09:20:49 +09:00
Yuki Okushi
02de841def
Rollup merge of #66162 - Darksonn:master, r=ehuss
Fix broken link in README

The link to the rustc guide on building and running the compiler is broken. It was broken in [rustc-guide#491](https://github.com/rust-lang/rustc-guide/pull/491).
2019-11-07 09:20:48 +09:00
Yuki Okushi
9e3f0003fd
Rollup merge of #66147 - RalfJung:no-scalar-ptr, r=oli-obk
Miri: Refactor to_scalar_ptr out of existence

`to_scalar_ptr` is somewhat subtle as it just throws away the 2nd component of a `ScalarPair` if there is one -- without any check if this is truly a pointer or so. And indeed we used it wrong on two occasions!

So I fixed those two, and then refactored things such that everyone calls `ref_to_mplace` instead (which they did anyway, I just moved up the calls), which is the only place that should interpret a `ScalarPair` as a wide ptr -- and it checks the type first. Thus we can remove `to_scalar_ptr` and `to_meta`.

r? @oli-obk
2019-11-07 09:20:46 +09:00
Yuki Okushi
de401900b4
Rollup merge of #66146 - 3442853561:patch-2, r=Mark-Simulacrum
Remove unused parameters in `__thread_local_inner`

Fixes #65993.
2019-11-07 09:20:45 +09:00
Yuki Okushi
a2b4ad439c
Rollup merge of #66117 - olegnn:fixed_linked_list_marker, r=RalfJung
Fixed PhantomData markers in Arc and Rc

Include owned internal structs in `PhantomData` markers in `Arc` (`PhantomData<T>` => `PhantomData<ArcInner<T>>`) and `Rc` (`PhantomData<T>` => `PhantomData<RcBox<T>>`).
2019-11-07 09:20:44 +09:00
Yuki Okushi
3032233bb2
Rollup merge of #66114 - golddranks:improve_thread_docs, r=Centril
Improve std:🧵:Result documentation

Thanks to @dtolnay for pointing out the different premise of the contents of the `Err` variant in `std:🧵:Result` WRT normal error handling.
2019-11-07 09:20:42 +09:00
Yuki Okushi
b94a2f9e38
Rollup merge of #66111 - RalfJung:from_raw_parts, r=Centril
improve from_raw_parts docs

Triggered by https://github.com/rust-lang/rfcs/pull/2806. Hopefully this helps clarify that joining slices across allocations is not possible in Rust currently.

r? @Centril
2019-11-07 09:20:41 +09:00
Yuki Okushi
64b2f5cc9f
Rollup merge of #66084 - petrochenkov:x86arm, r=alexcrichton
Do not require extra LLVM backends for `x.py test` to pass

For long time our testing passed with a partially built LLVM
```
[llvm]
targets = "X86;ARM"
```
, a [recent PR](https://github.com/rust-lang/rust/pull/65809) changed that.
2019-11-07 09:20:39 +09:00
Yuki Okushi
a30964e6c0
Rollup merge of #66076 - RalfJung:qpath, r=davidtwco,oli-obk
HIR docs: mention how to resolve method paths
2019-11-07 09:20:38 +09:00
Yuki Okushi
12ffe5ffdd
Rollup merge of #66044 - RalfJung:uninit-lint, r=oli-obk
Improve uninit/zeroed lint

* Also warn when creating a raw pointer with a NULL vtable.
* Also identify `MaybeUninit::uninit().assume_init()` and `MaybeUninit::zeroed().assume_init()` as dangerous.
2019-11-07 09:20:36 +09:00
Yuki Okushi
1988f28009
Rollup merge of #65945 - tmiasko:long-linker-command-line, r=alexcrichton
Optimize long-linker-command-line test

Replace O(n^3) text matching with inexpensive hash set lookups.

On my machine this reduces the total runtime of complete
run-make-fulldeps suite from roughly 75 seconds to 45 seconds.
2019-11-07 09:20:34 +09:00
Yuki Okushi
082a07695b
Rollup merge of #65794 - Centril:unimpl-internal, r=varkor
gate rustc_on_unimplemented under rustc_attrs

Move `rustc_on_implemented` from the `on_implemented` gate to `rustc_attrs` as it is internal.

Closes #29628

r? @varkor
2019-11-07 09:20:33 +09:00
bors
caf0187141 Auto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkov
Cheaper doc comments

This PR implements the idea from #60935: represent doc comments more cheaply, rather than converting them into `#[doc="..."]` attribute form. Unlike #60936 (which is about coalescing doc comments to reduce their number), this approach does not have any backwards compatibility concerns, and it eliminates about 80-90% of the current cost of doc comments (as estimated using the numbers in #60930, which eliminated the cost of doc comments entirely by treating them as normal comments).

r? @petrochenkov
2019-11-07 00:10:52 +00:00
Yuki Okushi
90b094a01a Fix other broken link 2019-11-07 08:30:44 +09:00
Yuki Okushi
1d2a314ef5 Update link on CONTRIBUTING.md 2019-11-07 06:48:28 +09:00
bors
38048763e8 Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddyb
Fix promotion in a `const` when projections are present

Resolves #65727.

This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`.

r? @eddyb
2019-11-06 18:12:57 +00:00
Pyry Kontio
8568204f4e Try with crate::error::Error 2019-11-07 01:45:46 +09:00
Alice Ryhl
2daf7b9fe3
Fix broken link in README 2019-11-06 16:41:24 +01:00
bors
3f0e16473d Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe
improper_ctypes: `extern "C"` fns

cc #19834. Fixes #65867.

This pull request implements the change [described in this comment](https://github.com/rust-lang/rust/issues/19834#issuecomment-466671572).

cc @rkruppe @varkor @shepmaster
2019-11-06 12:45:35 +00:00
Nicholas Nethercote
eea6f23a0e Make doc comments cheaper with AttrKind.
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a
big performance win (over 10% in some cases) because `DocComment` lets doc
comments (which are common) be represented very cheaply.

`Attribute` gets some new helper methods to ease the transition:
- `has_name()`: check if the attribute name matches a single `Symbol`; for
  `DocComment` variants it succeeds if the symbol is `sym::doc`.
- `is_doc_comment()`: check if it has a `DocComment` kind.
- `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant;
  panic otherwise.

Fixes #60935.
2019-11-06 23:05:07 +11:00
Nicholas Nethercote
69bc4aba78 Remove unnecessary Deref impl for Attribute.
This kind of thing just makes the code harder to read.
2019-11-06 23:01:02 +11:00
Ralf Jung
f2ed1e661e
Fix markdown link
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2019-11-06 11:15:30 +01:00
bors
61a551b493 Auto merge of #65830 - Quantumplation:master, r=davidtwco,estebank
Use ident.span instead of def_span in dead-code pass

Hello! First time contributor! :)

This should fix #58729.

According to @estebank in the duplicate #63064, def_span scans forward on the line until it finds a {,
and if it can't find one, falls back to the span for the whole item. This
was apparently written before the identifier span was explicitly tracked on
each node.

This means that if an unused function signature spans multiple lines, the
entire function (potentially hundreds of lines) gets flagged as dead code.
This could, for example, cause IDEs to add error squiggly's to the whole
function.

By using the span from the ident instead, we narrow the scope of this in
most cases. In a wider sense, it's probably safe to use ident.span
instead of def_span in most locations throughout the whole code base,
but since this is my first contribution, I kept it small.

Some interesting points that came up while I was working on this:
- I reorganized the tests a bit to bring some of the dead code ones all
into the same location
- A few tests were for things unrelated to dead code (like the
path-lookahead for parens), so I added #![allow(dead_code)] and
cleaned up the stderr file to reduce noise in the future
- The same fix doesn't apply to const and static declarations. I tried
adding these cases to the match expression, but that created a much
wider change to tests and error messages, so I left it off until I
could get some code review to validate the approach.
2019-11-06 09:35:27 +00:00
Ralf Jung
2312a56f5c --bless 2019-11-06 10:06:11 +01:00
Ralf Jung
87edcf095d improve a comment 2019-11-06 10:06:11 +01:00
Ralf Jung
32453ce488 remvoe to_scalar_ptr and use ref_to_mplace everywhere 2019-11-06 10:06:11 +01:00
Ralf Jung
14ee66acec miri cast: avoid unnecessary to_scalar_ptr 2019-11-06 10:05:34 +01:00
3442853561
936349c81b
Update local.rs
Removed parameters not used in the macro
2019-11-06 16:39:48 +08:00
Pyry Kontio
4317263a31 Fix the Error linking. 2019-11-06 16:59:53 +09:00
Mazdak Farrokhzad
1c7595fd0f gate rustc_on_unimplemented under rustc_attrs 2019-11-06 07:34:51 +01:00
bors
e8b190ac4a Auto merge of #66143 - Centril:rollup-qmzuex0, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #65776 (Rename `LocalInternedString` and more)
 - #65973 (caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!.)
 - #66015 (librustc_lexer: Refactor the module)
 - #66062 (Configure LLVM module PIC level)
 - #66086 (bump smallvec to 1.0)
 - #66092 (Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.)
 - #66103 (Add target thumbv7neon-unknown-linux-musleabihf)
 - #66133 (Update the bundled `wasi-libc` repository)
 - #66139 (use American spelling for `pluralize!`)

Failed merges:

r? @ghost
2019-11-06 06:14:03 +00:00
Mazdak Farrokhzad
4f9651b854
Rollup merge of #66139 - euclio:pluralize, r=nagisa
use American spelling for `pluralize!`
2019-11-06 07:03:14 +01:00
Mazdak Farrokhzad
7f7218fd21
Rollup merge of #66133 - alexcrichton:update-wasi-libc, r=Mark-Simulacrum
Update the bundled `wasi-libc` repository

This updates the libc that the `wasm32-wasi` target links against to the
latest revision, mostly just bringing in minor bug fixes and minor wasm
size improvements.
2019-11-06 07:03:12 +01:00
Mazdak Farrokhzad
40558c329c
Rollup merge of #66103 - smaeul:patch/thumb-musl, r=nagisa
Add target thumbv7neon-unknown-linux-musleabihf

This is a copy of thumbv7neon-unknown-linux-gnueabihf with musl changes
merged from armv7-unknown-linux-musleabihf. This appears to have been
missed when adding the other ARMv7-A thumb targets.
2019-11-06 07:03:11 +01:00
Mazdak Farrokhzad
828a3eef66
Rollup merge of #66092 - niacat:master, r=nagisa
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 like `/dev/urandom` 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-06 07:03:09 +01:00
Mazdak Farrokhzad
167b8fedd6
Rollup merge of #66086 - RalfJung:smallvec, r=nagisa
bump smallvec to 1.0

This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec.

See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement.

Cc @mbrubeck @emilio
2019-11-06 07:03:08 +01:00
Mazdak Farrokhzad
98cbe17903
Rollup merge of #66062 - smaeul:patch/pic-level, r=estebank
Configure LLVM module PIC level

As of LLVM 9, this is required for 32-bit PowerPC to properly generate
PLT references. Previously, only BigPIC was supported; now LLVM supports
both BigPIC and SmallPIC, and there is no default value provided.
2019-11-06 07:03:06 +01:00
Mazdak Farrokhzad
81550a00d1
Rollup merge of #66015 - popzxc:refactor-librustc_parser, r=matklad
librustc_lexer: Refactor the module

This PR introduces a refactoring of the `librustc_lexer` in order to improve readability.

All the changes performed are only cosmetic and do not introduce any changes the lexer logic or performance.

Newly introduced modules `literal`, `token` and `utils` are just copy-pasted from the `lib.rs` and do not contain even cosmetic changes (I decided to do so so it'll be easier to review changes looking only on diff).

r? @petrochenkov

cc @Centril @matklad
2019-11-06 07:03:05 +01:00
Mazdak Farrokhzad
24af0c94b3
Rollup merge of #65973 - eddyb:caller-location-panic, r=petrochenkov
caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!.

The main change here is to `core::panic!`, trying to fix this remaining regression: https://github.com/rust-lang/rust/pull/65927#issuecomment-547625147

However, in order for `caller_location` to be usable from macros the same way `file!()`/`line!()` are, it needs to have the same behavior (of extracting the macro invocation site `Span` and using that).

Arguably we would've had to do this at some point anyway, if we want to use `#[track_caller]` to replace the `file!()`/`line!()` uses from macros, but I'm not sure the RFC mentions this at all.

r? @petrochenkov cc @anp @nnethercote
2019-11-06 07:03:03 +01:00
Mazdak Farrokhzad
a0b4b4dafa
Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, r=estebank
Rename `LocalInternedString` and more

This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses.

r? @estebank
2019-11-06 07:03:01 +01:00
Pyry Kontio
f1bc4ef170 Addressed review comments. 2019-11-06 14:48:23 +09:00
bors
e4931eaaa3 Auto merge of #66141 - Centril:rollup-n2fcvp9, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #65892 (Remove `PartialEq` and `Eq` from the `SpecialDerives`.)
 - #66014 (Show type parameter name and definition in type mismatch error messages )
 - #66027 (Move has_panic_handler to query)
 - #66054 (syntax: Avoid span arithmetic for delimiter tokens)
 - #66068 (use silent emitter for rustdoc highlighting pass)
 - #66081 (let caller of check_ptr_access_align control the error message)
 - #66093 (Do not ICE with a precision flag in formatting str and no format arguments)
 - #66098 (Detect `::` -> `:` typo when involving turbofish)
 - #66101 (Tweak type mismatch caused by break on tail expr)
 - #66106 (Fix typo in explanation of `E0080`)
 - #66115 (rustc: remove "GlobalMetaData" dead code from hir::map::definitions.)

Failed merges:

r? @ghost
2019-11-06 02:29:21 +00:00
Mazdak Farrokhzad
35a5ffc8ea
Rollup merge of #66115 - eddyb:global-meta-what, r=michaelwoerister
rustc: remove "GlobalMetaData" dead code from hir::map::definitions.

Spotted while refactoring uses of `DefIndex` and/or `LocalDefId`.

r? @michaelwoerister
2019-11-06 03:28:20 +01:00
Mazdak Farrokhzad
f221c3d83c
Rollup merge of #66106 - JOE1994:master, r=GuillaumeGomez
Fix typo in explanation of `E0080`

Handling issue #66105 in Rust repo.
`evaluate an constant expression` to `evaluate a constant expression`
2019-11-06 03:28:19 +01:00
Mazdak Farrokhzad
32e745fc94
Rollup merge of #66101 - estebank:break-tail-e0308, r=Centril
Tweak type mismatch caused by break on tail expr

When `break;` has a type mismatch because the `Destination` points at a tail
expression with an obligation flowing from a return type, point at the
return type.

Fix #39968.
2019-11-06 03:28:17 +01:00
Mazdak Farrokhzad
409b2bf941
Rollup merge of #66098 - estebank:path-asciption-typo, r=Centril
Detect `::` -> `:` typo when involving turbofish

Fix #65569.
2019-11-06 03:28:15 +01:00
Mazdak Farrokhzad
7d66a09a29
Rollup merge of #66093 - estebank:fmt-ice, r=Centril
Do not ICE with a precision flag in formatting str and no format arguments

Fix #66065.
2019-11-06 03:28:14 +01:00
Mazdak Farrokhzad
76311a8db9
Rollup merge of #66081 - RalfJung:ptr-offset, r=zackmdavis
let caller of check_ptr_access_align control the error message

This is needed for https://github.com/rust-lang/miri/pull/1031
2019-11-06 03:28:12 +01:00