]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoFix `next_point` to be unicode aware
Esteban Küber [Fri, 10 Jan 2020 19:02:47 +0000 (11:02 -0800)]
Fix `next_point` to be unicode aware

4 years agoDo not ICE on unicode next point
Esteban Küber [Fri, 10 Jan 2020 06:10:18 +0000 (22:10 -0800)]
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point`
Fix #68000.

4 years agoAuto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor
bors [Thu, 9 Jan 2020 19:21:58 +0000 (19:21 +0000)]
Auto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #66254 (Make Layout::new const)
 - #67122 (Do not deduplicate diagnostics in UI tests)
 - #67358 (Add HashSet::get_or_insert_owned)
 - #67725 (Simplify into_key_slice_mut)
 - #67935 (Relax the Sized bounds on Pin::map_unchecked(_mut))
 - #67967 (Delay bug to prevent ICE in MIR borrowck)
 - #67975 (Export public scalar statics in wasm)
 - #68006 (Recognise riscv64 in compiletest)
 - #68040 (Cleanup)
 - #68054 (doc: add Null-unchecked version section to mut pointer as_mut method)

Failed merges:

 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)

r? @ghost

4 years agoRollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj
Yuki Okushi [Thu, 9 Jan 2020 19:18:43 +0000 (04:18 +0900)]
Rollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj

doc: add Null-unchecked version section to mut pointer as_mut method

The [`as_ref`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref-1) method already has a *Null-unchecked version* section, its example is a modification of the example in the main `as_ref` section. Similarly the example in this PR is a modification of the example in main [`as_mut`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_mut) section.

Fixes #68032.

4 years agoRollup merge of #68040 - sinkuu:unused, r=petrochenkov
Yuki Okushi [Thu, 9 Jan 2020 19:18:42 +0000 (04:18 +0900)]
Rollup merge of #68040 - sinkuu:unused, r=petrochenkov

Cleanup

4 years agoRollup merge of #68006 - infinity0:master, r=nikomatsakis
Yuki Okushi [Thu, 9 Jan 2020 19:18:40 +0000 (04:18 +0900)]
Rollup merge of #68006 - infinity0:master, r=nikomatsakis

Recognise riscv64 in compiletest

Otherwise tests can't run, fails with "Cannot determine Architecture from triple"

4 years agoRollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton
Yuki Okushi [Thu, 9 Jan 2020 19:18:39 +0000 (04:18 +0900)]
Rollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton

Export public scalar statics in wasm

Fixes #67453

I am not sure which export level statics should get when exporting them in wasm. This small change fixes the issue that I had, but this might not be the correct way to implement this.

4 years agoRollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper
Yuki Okushi [Thu, 9 Jan 2020 19:18:37 +0000 (04:18 +0900)]
Rollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper

Delay bug to prevent ICE in MIR borrowck

Fixes #67947

r? @matthewjasper

4 years agoRollup merge of #67935 - Thomasdezeeuw:issue_67669, r=withoutboats
Yuki Okushi [Thu, 9 Jan 2020 19:18:36 +0000 (04:18 +0900)]
Rollup merge of #67935 - Thomasdezeeuw:issue_67669, r=withoutboats

Relax the Sized bounds on Pin::map_unchecked(_mut)

Fixes #67669.

4 years agoRollup merge of #67725 - ssomers:into_key_slice_mut, r=RalfJung
Yuki Okushi [Thu, 9 Jan 2020 19:18:34 +0000 (04:18 +0900)]
Rollup merge of #67725 - ssomers:into_key_slice_mut, r=RalfJung

Simplify into_key_slice_mut

Remove a rare and tiny but superfluous run-time check from into_key_slice_mut.

In #67459, I wrote that "`get_mut` [...] does visit `into_key_slice_mut`" and that was wrong. No function that operates on a map that (still) has a shared root ever dives into `into_key_slice_mut`.  So it's more clear to remove the (previously existing, and always incomplete) code it has for dealing with shared roots, as well as a petty performance improvement for those using exotically aligned key types.

~~Also, some testing of the `range` function initially added to #67686 but hardly related.~~

r? @RalfJung

4 years agoRollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodt
Yuki Okushi [Thu, 9 Jan 2020 19:18:32 +0000 (04:18 +0900)]
Rollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodt

Add HashSet::get_or_insert_owned

This is an extension for tracking issue #60896. The more-general `get_or_insert_with` has potential for misuse, so we might remove it, but I think `get_or_insert_owned` covers most use cases.

4 years agoRollup merge of #67122 - petrochenkov:nodedup, r=estebank
Yuki Okushi [Thu, 9 Jan 2020 19:18:30 +0000 (04:18 +0900)]
Rollup merge of #67122 - petrochenkov:nodedup, r=estebank

Do not deduplicate diagnostics in UI tests

Error reporting infrastructure deduplicates identical diagnostics with identical spans.

While it's preferable to do this in "release"/"user-facing" mode, it sometimes brings [confusion](https://github.com/rust-lang/rust/pull/50682#issuecomment-390949878) and hides details that may be important during development.

Do we run some passes multiple times when we could do it once?
How many times we run them exactly? Can this number be large? Can the multiplied error construction be expensive? Can speculative checks be made cheaper if they don't report errors?

*Relying* on this mechanism to deduplicate some specific error never looks like a proper solution to me personally.

In this PR I attempt to disable this deduplication by applying `-Z deduplicate-diagnostics=no` to UI tests.

4 years agoRollup merge of #66254 - CAD97:patch-1, r=KodrAus
Yuki Okushi [Thu, 9 Jan 2020 19:18:29 +0000 (04:18 +0900)]
Rollup merge of #66254 - CAD97:patch-1, r=KodrAus

Make Layout::new const

This seems like a reasonable change to make. If we don't provide `Layout::new::<T>` as `const`, then users can just instead do the more error prone `Layout::from_size_align_unchecked(mem::size_of::<T>(), mem::align_of::<T>())` for the same effect and an extra `unsafe { }` incantation.

4 years agoAddress review comments + Update NLL tests
Vadim Petrochenkov [Wed, 8 Jan 2020 20:16:57 +0000 (23:16 +0300)]
Address review comments + Update NLL tests

4 years agoMark Layout::new as const stable
CAD97 [Tue, 17 Dec 2019 19:55:46 +0000 (14:55 -0500)]
Mark Layout::new as const stable

4 years agoMake Layout::new const
Christopher Durham [Sat, 9 Nov 2019 18:43:11 +0000 (13:43 -0500)]
Make Layout::new const

4 years agoUpdate tests
Vadim Petrochenkov [Wed, 8 Jan 2020 17:02:10 +0000 (20:02 +0300)]
Update tests

4 years agocompiletest: Do not deduplicate diagnostics in UI tests
Vadim Petrochenkov [Wed, 8 Jan 2020 12:07:26 +0000 (15:07 +0300)]
compiletest: Do not deduplicate diagnostics in UI tests

4 years agoAuto merge of #68047 - pietroalbini:fix-toolstate-again, r=Mark-Simulacrum
bors [Thu, 9 Jan 2020 16:10:01 +0000 (16:10 +0000)]
Auto merge of #68047 - pietroalbini:fix-toolstate-again, r=Mark-Simulacrum

ci: another take at fixing toolstate

Seems like the variable showed by `$(ciCheckoutPath)` on Azure Pipelines was wrong, making the toolstate script fail. This commit changes that function to return the variable previously used by the toolstate script. Other uses of the function were audited, and there should be no conflict.

Failure log: https://dev.azure.com/rust-lang/rust/_build/results?buildId=17933
r? @Mark-Simulacrum

4 years agodoc: add Null-unchecked version section to mut pointer as_mut method
Trevor Spiteri [Thu, 9 Jan 2020 13:51:58 +0000 (14:51 +0100)]
doc: add Null-unchecked version section to mut pointer as_mut method

The as_ref method already has a Null-unchecked version section, its
example is a modification of the example in the main as_ref section.
Similarly the example in this commit is a modification of the example
in main as_mut section.

4 years agoAuto merge of #67988 - Zoxc:prof-fix, r=michaelwoerister
bors [Thu, 9 Jan 2020 11:36:44 +0000 (11:36 +0000)]
Auto merge of #67988 - Zoxc:prof-fix, r=michaelwoerister

Change -Z time event naming scheme and make them generic activities

I made the `-Z time-passes` only events (which encodes argument in the event id) use a `extra_verbose_generic_activity` function which does not emit self-profiling events.

r? @michaelwoerister
cc @wesleywiser

4 years agoApply suggestions from code review
Stein Somers [Thu, 9 Jan 2020 11:03:49 +0000 (12:03 +0100)]
Apply suggestions from code review

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoSimplify into_key_slice_mut and document bits and bobs
Stein Somers [Thu, 2 Jan 2020 11:42:31 +0000 (12:42 +0100)]
Simplify into_key_slice_mut and document bits and bobs

4 years agoci: another take at fixing toolstate
Pietro Albini [Thu, 9 Jan 2020 08:49:25 +0000 (09:49 +0100)]
ci: another take at fixing toolstate

Seems like the variable showed by $(ciCheckoutPath) on Azure Pipelines
was wrong, making the toolstate script fail. This commit changes that
function to return the variable previously used by the toolstate script.
Other uses of the function were audited, and there should be no
conflict.

4 years agoMore comments
John Kåre Alsaker [Wed, 8 Jan 2020 20:32:00 +0000 (21:32 +0100)]
More comments

4 years agoChange -Z time event naming scheme and make them generic activities
John Kåre Alsaker [Tue, 7 Jan 2020 20:34:08 +0000 (21:34 +0100)]
Change -Z time event naming scheme and make them generic activities

4 years agoRemove unused dependencies
Shotaro Yamada [Thu, 9 Jan 2020 02:52:03 +0000 (11:52 +0900)]
Remove unused dependencies

4 years agoRemove unused `struct ClosureUpvar`
Shotaro Yamada [Thu, 9 Jan 2020 02:47:32 +0000 (11:47 +0900)]
Remove unused `struct ClosureUpvar`

4 years agoAuto merge of #68034 - Centril:rollup-3d9pq14, r=Centril
bors [Thu, 9 Jan 2020 02:05:15 +0000 (02:05 +0000)]
Auto merge of #68034 - Centril:rollup-3d9pq14, r=Centril

Rollup of 12 pull requests

Successful merges:

 - #67630 (Treat extern statics just like statics in the "const pointer to static" representation)
 - #67747 (Explain that associated types and consts can't be accessed directly on the trait's path)
 - #67884 (Fix incremental builds of core by allowing unused attribute.)
 - #67966 (Use matches macro in libcore and libstd)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)
 - #67986 (Display more informative ICE)
 - #67990 (slice patterns: harden match-based borrowck tests)
 - #68005 (Improve E0184 explanation)
 - #68009 (Spell check librustc_error_codes)
 - #68023 (Fix issue #68008)
 - #68024 (Remove `-Z continue-parse-after-error`)
 - #68026 (Small improvements in lexical_region_resolve)

Failed merges:

r? @ghost

4 years agoAdd HashSet::get_or_insert_owned
Josh Stone [Mon, 16 Dec 2019 18:53:50 +0000 (10:53 -0800)]
Add HashSet::get_or_insert_owned

4 years agoRollup merge of #68026 - llogiq:ch-ch-ch-ch-changes, r=varkor
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:21 +0000 (00:22 +0100)]
Rollup merge of #68026 - llogiq:ch-ch-ch-ch-changes, r=varkor

Small improvements in lexical_region_resolve

This just replaces a trivial `if` condition with a `|=` in two places.

I could even have used a `fold` in the first case, but I think it would be less readable.

4 years agoRollup merge of #68024 - petrochenkov:recoverall, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:20 +0000 (00:22 +0100)]
Rollup merge of #68024 - petrochenkov:recoverall, r=Centril

Remove `-Z continue-parse-after-error`

We are just always recovering and continuing now.

r? @estebank @Centril

4 years agoRollup merge of #68023 - FSciammarella:master, r=Centril,varkor
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:18 +0000 (00:22 +0100)]
Rollup merge of #68023 - FSciammarella:master, r=Centril,varkor

Fix issue #68008

Correcting Typo on error message. From "substract" to "subtract".

Fixes #68008.

4 years agoRollup merge of #68009 - wcampbell0x2a:spellcheck-librustc_error_codes, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:17 +0000 (00:22 +0100)]
Rollup merge of #68009 - wcampbell0x2a:spellcheck-librustc_error_codes, r=Centril

Spell check librustc_error_codes

Found one wrongly spelled error message and decided to check all the
error messages for wrongly spelled statements.

4 years agoRollup merge of #68005 - GuillaumeGomez:explanation-e0184, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:16 +0000 (00:22 +0100)]
Rollup merge of #68005 - GuillaumeGomez:explanation-e0184, r=Dylan-DPC

Improve E0184 explanation

r? @Dylan-DPC

4 years agoRollup merge of #67990 - Centril:slice-pats-move-tests-match, r=matthewjasper
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:14 +0000 (00:22 +0100)]
Rollup merge of #67990 - Centril:slice-pats-move-tests-match, r=matthewjasper

slice patterns: harden match-based borrowck tests

This hardens some move-checking tests wrt. slice patterns and `match` expressions.

r? @matthewjasper
cc @pnkfelix
cc https://github.com/rust-lang/rust/pull/67712
cc https://github.com/rust-lang/rust/issues/53114

4 years agoRollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:13 +0000 (00:22 +0100)]
Rollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor

Display more informative ICE

Fixes #66696

4 years agoRollup merge of #67979 - Centril:hir-cleanup, r=Zoxc
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:11 +0000 (00:22 +0100)]
Rollup merge of #67979 - Centril:hir-cleanup, r=Zoxc

Move `intravisit` => `rustc_hir` + misc cleanup

Working towards https://github.com/rust-lang/rust/issues/65031.
This should eventually enable getting rid of rustc as a dependency in various passes (e.g. lints).

cc https://github.com/rust-lang/rust/pull/67806 (this also facilitates liberating lints from tcx)
cc https://github.com/rust-lang/rust/pull/67922 (some other dep reductions)

r? @Zoxc

4 years agoRollup merge of #67966 - popzxc:core-std-matches, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:10 +0000 (00:22 +0100)]
Rollup merge of #67966 - popzxc:core-std-matches, r=Centril

Use matches macro in libcore and libstd

This PR replaces matches like

```rust
match var {
    value => true,
    _ => false,
}
```

with use of `matches!` macro.

r? @Centril

4 years agoRollup merge of #67884 - anp:allow-unused-const-attr, r=oli-obk
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:08 +0000 (00:22 +0100)]
Rollup merge of #67884 - anp:allow-unused-const-attr, r=oli-obk

Fix incremental builds of core by allowing unused attribute.

I *think* that the same problem as in https://github.com/rust-lang/rust/issues/65023 was introduced by https://github.com/rust-lang/rust/pull/67657. This works around the current incrcomp issue with these attributes by allowing it here. This resolves the near-term issue for me, at least.

4 years agoRollup merge of #67747 - estebank:bare-assoc-const, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:07 +0000 (00:22 +0100)]
Rollup merge of #67747 - estebank:bare-assoc-const, r=Centril

Explain that associated types and consts can't be accessed directly on the trait's path

Partially address #44539.

4 years agoRollup merge of #67630 - oli-obk:extern_ptr_dangling, r=spastorino
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:05 +0000 (00:22 +0100)]
Rollup merge of #67630 - oli-obk:extern_ptr_dangling, r=spastorino

Treat extern statics just like statics in the "const pointer to static" representation

fixes #67612

r? @spastorino

cc @RalfJung this does not affect runtime promotion at all. This is just about promotion within static item bodies.

4 years agoFix Typo on cannot "substract"
Felipe Sciammarella [Wed, 8 Jan 2020 21:49:15 +0000 (18:49 -0300)]
Fix Typo on cannot "substract"

Fix Typo on hir::BinOpKind::Sub

"substract" to "subtract"

Fix Typo on "Error cannot substract"

Fix Typo on cannot "substract"

4 years agoSmall improvements in lexical_region_resolve
Andre Bogus [Wed, 8 Jan 2020 20:12:21 +0000 (21:12 +0100)]
Small improvements in lexical_region_resolve

4 years agonormalize rustc::hir::intravisit imports
Mazdak Farrokhzad [Tue, 7 Jan 2020 17:12:06 +0000 (18:12 +0100)]
normalize rustc::hir::intravisit imports

4 years agointravisit: use walk_list! more
Mazdak Farrokhzad [Tue, 7 Jan 2020 16:38:38 +0000 (17:38 +0100)]
intravisit: use walk_list! more

4 years ago{rustc::hir -> rustc_hir}::intravisit
Mazdak Farrokhzad [Tue, 7 Jan 2020 16:30:29 +0000 (17:30 +0100)]
{rustc::hir -> rustc_hir}::intravisit

4 years agointravisit: abstract over HIR Map
Mazdak Farrokhzad [Tue, 7 Jan 2020 16:25:33 +0000 (17:25 +0100)]
intravisit: abstract over HIR Map

4 years agointravisit: .expect_item -> .item
Mazdak Farrokhzad [Tue, 7 Jan 2020 14:51:38 +0000 (15:51 +0100)]
intravisit: .expect_item -> .item

4 years agoNestedVisitorMap: reduce visibilities
Mazdak Farrokhzad [Tue, 7 Jan 2020 14:13:47 +0000 (15:13 +0100)]
NestedVisitorMap: reduce visibilities

4 years agohir::map: elide & simplify
Mazdak Farrokhzad [Tue, 7 Jan 2020 14:06:39 +0000 (15:06 +0100)]
hir::map: elide & simplify

4 years agocollector: clarify dependencies
Mazdak Farrokhzad [Tue, 7 Jan 2020 13:38:27 +0000 (14:38 +0100)]
collector: clarify dependencies

4 years agocollector: use impl Trait
Mazdak Farrokhzad [Tue, 7 Jan 2020 13:22:44 +0000 (14:22 +0100)]
collector: use impl Trait

4 years agocollector: extract upstream_crates
Mazdak Farrokhzad [Tue, 7 Jan 2020 13:19:35 +0000 (14:19 +0100)]
collector: extract upstream_crates

4 years agocanonicalize imports in map::block
Mazdak Farrokhzad [Tue, 7 Jan 2020 12:55:08 +0000 (13:55 +0100)]
canonicalize imports in map::block

4 years agoDelay bug to prevent ICE in MIR borrowck
Yuki Okushi [Tue, 7 Jan 2020 07:51:34 +0000 (16:51 +0900)]
Delay bug to prevent ICE in MIR borrowck

4 years agoAuto merge of #68011 - JohnTitor:rollup-44s8twu, r=JohnTitor
bors [Wed, 8 Jan 2020 19:46:58 +0000 (19:46 +0000)]
Auto merge of #68011 - JohnTitor:rollup-44s8twu, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #67774 (Try statx for all linux-gnu target.)
 - #67781 (Move `is_min_const_fn` query to librustc_mir.)
 - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs)
 - #67849 (Add a check for swapped words when we can't find an identifier)
 - #67875 (Distinguish between private items and hidden items in rustdoc)
 - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`)
 - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates)
 - #67977 (Updates for VxWorks)
 - #67985 (Remove insignificant notes from CStr documentation)
 - #68003 (ci: fix wrong shared.sh import for publish_toolstate)

Failed merges:

 - #67820 (Parse the syntax described in RFC 2632)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)

r? @ghost

4 years agoRemove `-Z continue-parse-after-error`
Vadim Petrochenkov [Wed, 8 Jan 2020 18:25:42 +0000 (21:25 +0300)]
Remove `-Z continue-parse-after-error`

4 years agomove code to method outside of happy path
Esteban Küber [Wed, 8 Jan 2020 18:10:51 +0000 (10:10 -0800)]
move code to method outside of happy path

4 years agoExplain that associated types and consts can't be accessed directly on the trait...
Esteban Küber [Tue, 31 Dec 2019 05:15:40 +0000 (21:15 -0800)]
Explain that associated types and consts can't be accessed directly on the trait's path

4 years agoRollup merge of #68003 - pietroalbini:yet-another-toolstate-fix, r=Mark-Simulacrum
Yuki Okushi [Wed, 8 Jan 2020 15:29:22 +0000 (00:29 +0900)]
Rollup merge of #68003 - pietroalbini:yet-another-toolstate-fix, r=Mark-Simulacrum

ci: fix wrong shared.sh import for publish_toolstate

r? @Mark-Simulacrum

4 years agoRollup merge of #67985 - dtolnay:cstr, r=Mark-Simulacrum
Yuki Okushi [Wed, 8 Jan 2020 15:29:20 +0000 (00:29 +0900)]
Rollup merge of #67985 - dtolnay:cstr, r=Mark-Simulacrum

Remove insignificant notes from CStr documentation

The to_str and to_string_lossy methods contain a note about the behavior possibly changing in the future. But those notes are referring to a distinction that is not observable in the API. Whether or not the UTF-8 check knows the string length ahead of time, these methods require linear time.

4 years agoRollup merge of #67977 - Wind-River:master_2020, r=alexcrichton
Yuki Okushi [Wed, 8 Jan 2020 15:29:18 +0000 (00:29 +0900)]
Rollup merge of #67977 - Wind-River:master_2020, r=alexcrichton

Updates for VxWorks

r? @alexcrichton

4 years agoRollup merge of #67955 - ollie27:rustdoc_cfg_dupes, r=GuillaumeGomez
Yuki Okushi [Wed, 8 Jan 2020 15:29:17 +0000 (00:29 +0900)]
Rollup merge of #67955 - ollie27:rustdoc_cfg_dupes, r=GuillaumeGomez

rustdoc: Remove more `#[doc(cfg(..))]` duplicates

This is a follow up to #66959.

r? @GuillaumeGomez

4 years agoRollup merge of #67887 - anp:tracked-std-panics, r=nagisa
Yuki Okushi [Wed, 8 Jan 2020 15:29:15 +0000 (00:29 +0900)]
Rollup merge of #67887 - anp:tracked-std-panics, r=nagisa

`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`

The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.

4 years agoRollup merge of #67875 - dtolnay:hidden, r=GuillaumeGomez
Yuki Okushi [Wed, 8 Jan 2020 15:29:13 +0000 (00:29 +0900)]
Rollup merge of #67875 - dtolnay:hidden, r=GuillaumeGomez

Distinguish between private items and hidden items in rustdoc

I believe rustdoc should not be conflating private items (visibility lower than `pub`) and hidden items (attribute `doc(hidden)`). This matters now that Cargo is passing --document-private-items by default for bin crates. In bin crates that rely on macros, intentionally hidden implementation details of the macros can overwhelm the actual useful internal API that one would want to document.

This PR restores the strip-hidden pass when documenting private items, and introduces a separate unstable --document-hidden-items option to skip the strip-hidden pass. The two options are orthogonal to one another.

Fixes #67851. Closes #60884.

4 years agoRollup merge of #67849 - cjkenn:check-sorted-words, r=estebank
Yuki Okushi [Wed, 8 Jan 2020 15:29:12 +0000 (00:29 +0900)]
Rollup merge of #67849 - cjkenn:check-sorted-words, r=estebank

Add a check for swapped words when we can't find an identifier

Fixes #66968

Couple things here:
1. The matches take the precedence of case insensitive match, then levenshtein match, then swapped words match. Doing this allows us to not even check for swapped words unless the other checks return `None`.
2. I've assumed that the swapped words check is not held to the limits of the max levenshtein distance threshold (ie. we want to try and find a match even if the levenshtein distance is very high). This means that we cannot perform this check in the `fold` that occurs after the `filter_map` call, because the candidate will be filtered out. So, I've split this into two separate `fold` calls, and had to collect the original iterator into a vec so it can be copied (I don't think we want to change the function signature to take a vec or require the `Copy` trait). An alternative implemenation may be to remove the `filter_map`, `fold` over the entire iterator, and do a check against `max_dist` inside the relevant cases there.

r? @estebank

4 years agoRollup merge of #67798 - matklad:spin-thouse-docs, r=Amanieu
Yuki Okushi [Wed, 8 Jan 2020 15:29:09 +0000 (00:29 +0900)]
Rollup merge of #67798 - matklad:spin-thouse-docs, r=Amanieu

Remove wrong advice about spin locks from `spin_loop_hint` docs

Using a pure spin lock for a critical section in a preemptable thread
is always wrong, however short the critical section may be. The thread
might be preempted, which will cause all other threads to hammer
busily at the core for the whole quant. Moreover, if threads have
different priorities, this might lead to a priority inversion problem
and a deadlock. More generally, a spinlock is not more efficient than
a well-written mutex, which typically does several spin iterations at
the start anyway.

The advise about UP vs SMP is also irrelevant in the context of
preemptive threads.

See also accompanying piece: https://matklad.github.io/2020/01/02/spinlocs-considered-harmful.html

And another, independent piece: https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is

EDIT: obligatory disclosure that I am not an expert in these things, and might be terribly wrong :)

4 years agoRollup merge of #67781 - cjgillot:passes-const, r=oli-obk
Yuki Okushi [Wed, 8 Jan 2020 15:29:08 +0000 (00:29 +0900)]
Rollup merge of #67781 - cjgillot:passes-const, r=oli-obk

Move `is_min_const_fn` query to librustc_mir.

The only two uses of the associated methods are in `librustc_mir` and
`librustdoc`. Please tell me if there is a better choice.

cc #65031

4 years agoRollup merge of #67774 - oxalica:more-statx, r=alexcrichton
Yuki Okushi [Wed, 8 Jan 2020 15:29:06 +0000 (00:29 +0900)]
Rollup merge of #67774 - oxalica:more-statx, r=alexcrichton

Try statx for all linux-gnu target.

After https://github.com/rust-lang/libc/pull/1577, which is contained in `libc` 0.2.66,  provides `SYS_statx` for all Linux platform, so we can try to use `statx` for ~all Linux target~ all linux-gnu targets.

Unfortunately, `struct statx` and `fn statx` is not a part of public interface of musl (currently), ~we still need to invoke it through `syscall`~ we does **not** support statx for musl or other libc impls currently.

Previous PR: #65094

cc @alexcrichton

4 years agoSpell check librustc_error_codes
wcampbell [Wed, 8 Jan 2020 15:12:29 +0000 (10:12 -0500)]
Spell check librustc_error_codes

Found one wrongly spelled error message and decided to check all the
error messages for wrongly spelled statements.

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
4 years agoRecognise riscv64 in compiletest
Ximin Luo [Wed, 8 Jan 2020 13:48:05 +0000 (13:48 +0000)]
Recognise riscv64 in compiletest

4 years agoImprove E0184 explanation
Guillaume Gomez [Wed, 8 Jan 2020 13:24:25 +0000 (14:24 +0100)]
Improve E0184 explanation

4 years agoAuto merge of #67770 - Centril:reduce-diversity-2, r=petrochenkov
bors [Wed, 8 Jan 2020 12:12:08 +0000 (12:12 +0000)]
Auto merge of #67770 - Centril:reduce-diversity-2, r=petrochenkov

More reductions in error handling diversity

In this follow up to https://github.com/rust-lang/rust/pull/67744, we:

- Remove all fatal / error / warning macros in `syntax` except for `struct_span_err`, which is moved to `rustc_errors`.

- Lintify some hard-coded warnings which used warning macros.

- Defatalize some errors.

In general, the goal here is to make it painful to use fatal or unstructured errors and so we hopefully won't see many of these creep in.

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

4 years agoci: fix wrong shared.sh import for publish_toolstate
Pietro Albini [Wed, 8 Jan 2020 11:24:01 +0000 (12:24 +0100)]
ci: fix wrong shared.sh import for publish_toolstate

4 years agoMove `is_min_const_fn` query to librustc_mir.
Camille GILLOT [Wed, 1 Jan 2020 17:06:00 +0000 (18:06 +0100)]
Move `is_min_const_fn` query to librustc_mir.

The only two uses of the associated methods are in librustc_mir and
librustdoc. Please tell me if there is a better choice.

4 years agoMove constness.rs to librustc_mir.
Camille GILLOT [Wed, 1 Jan 2020 16:40:05 +0000 (17:40 +0100)]
Move constness.rs to librustc_mir.

4 years agoCheck for the entry kind
maik [Wed, 8 Jan 2020 09:05:44 +0000 (10:05 +0100)]
Check for the entry kind

4 years agoAuto merge of #67760 - Mark-Simulacrum:rustc-dirty, r=alexcrichton
bors [Wed, 8 Jan 2020 09:03:46 +0000 (09:03 +0000)]
Auto merge of #67760 - Mark-Simulacrum:rustc-dirty, r=alexcrichton

Clear out target directory if compiler has changed

Previously, we relied fully on Cargo to detect that the compiler had changed and
it needed to rebuild the standard library (or later "components"). This used to
not quite be the case prior to moving to LLVM be a separate cargo invocation;
subsequent compiles would recompile std and friends if LLVM had changed
(#67077 is the PR that changes things here).

This PR moves us to clearing out libstd when it is being compiled if the rustc
we're using has changed. We fairly harshly limit the cases in which we do this
(e.g., ignoring dry run mode, and so forth, as well as rustdoc invocations).
This is primarily because when we're not using the compiler directly, so
clearing out in other cases is likely to lead to bugs, particularly as our
deletion scheme is pretty blunt today (basically removing more than is needed,
i.e., not just the rustc artifacts).

In practice, this targeted fix does fix the known bug, though it may not fully
resolve the problem here. It's also not clear that there is a full fix hiding
here that doesn't involve a more major change (like -Zbinary-dep-depinfo was).

As a drive-by fix, don't delete the compiler before calling Build::copy, as that
also deletes the compiler.

4 years agoRemove unnecessary global counting
maik [Wed, 8 Jan 2020 08:53:33 +0000 (09:53 +0100)]
Remove unnecessary global counting

4 years agoDisplay more informative ICE
Yuki Okushi [Tue, 7 Jan 2020 20:30:23 +0000 (05:30 +0900)]
Display more informative ICE

4 years agoTry statx for all linux-gnu targets
oxalica [Wed, 8 Jan 2020 06:18:42 +0000 (14:18 +0800)]
Try statx for all linux-gnu targets

4 years agoAuto merge of #67733 - pietroalbini:gha-2, r=alexcrichton
bors [Wed, 8 Jan 2020 05:05:06 +0000 (05:05 +0000)]
Auto merge of #67733 - pietroalbini:gha-2, r=alexcrichton

GitHub Actions: preparations, part 2

This PR adds the second batch of commits in preparation for GitHub Actions:

* Removed hardcoded Azure Pipelines variables from `publish_toolstate.sh`
* Fixed a bug in `shared.sh`'s GitHub Actions support
* Fixed binutils missing from MSYS2 on Windows 2019 (GitHub Actions-specific)
* Fixed wrong sysroot in macOS 10.15 onwards (GitHub Actions-specific)

This PR does **not** yet add any builders on GitHub Actions.

r? @alexcrichton

4 years agoUse matches macro in libcore and libstd
Igor Aleksanov [Tue, 7 Jan 2020 07:35:16 +0000 (10:35 +0300)]
Use matches macro in libcore and libstd

4 years agospan_to_lines: account for DUMMY_SP
Mazdak Farrokhzad [Mon, 6 Jan 2020 10:46:30 +0000 (11:46 +0100)]
span_to_lines: account for DUMMY_SP

4 years ago- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
Mazdak Farrokhzad [Tue, 31 Dec 2019 20:25:16 +0000 (21:25 +0100)]
- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors

4 years agoslice patterns: harden match-based borrowck tests
Mazdak Farrokhzad [Tue, 7 Jan 2020 23:42:53 +0000 (00:42 +0100)]
slice patterns: harden match-based borrowck tests

4 years agoAuto merge of #67970 - cjgillot:inherent, r=Centril
bors [Tue, 7 Jan 2020 21:23:19 +0000 (21:23 +0000)]
Auto merge of #67970 - cjgillot:inherent, r=Centril

Minimize dependencies on trait and infer inside librustc

Split from #67953

All commits should pass check on their own.

r? @Centril

4 years agoRemove insignificant notes from CStr documentation
David Tolnay [Tue, 7 Jan 2020 20:01:39 +0000 (12:01 -0800)]
Remove insignificant notes from CStr documentation

These notes are about a distinction that is not going to be observable
in the API. Whether or not the UTF-8 check knows the string length ahead
of time, these methods require linear time.

4 years agoFix indentation
Maik Klein [Tue, 7 Jan 2020 18:41:59 +0000 (19:41 +0100)]
Fix indentation

4 years agoAdd tests for static variables
Maik Klein [Tue, 7 Jan 2020 18:37:24 +0000 (19:37 +0100)]
Add tests for static variables

4 years agoRename traits::drop -> traits::misc.
Camille GILLOT [Tue, 7 Jan 2020 18:36:50 +0000 (19:36 +0100)]
Rename traits::drop -> traits::misc.

4 years agoAuto merge of #67312 - cuviper:clone-box-slice, r=SimonSapin
bors [Tue, 7 Jan 2020 18:10:56 +0000 (18:10 +0000)]
Auto merge of #67312 - cuviper:clone-box-slice, r=SimonSapin

Simplify Clone for Box<[T]>

The bespoke `BoxBuilder` was basically a very simple `Vec`. Instead,
let's clone to a real `Vec`, with all of its specialization for the
task, then convert back to `Box<[T]>`.

4 years agoMove magic traits queries to rustc::traits::drop.
Camille GILLOT [Sun, 5 Jan 2020 22:43:45 +0000 (23:43 +0100)]
Move magic traits queries to rustc::traits::drop.

4 years agoMove required_region_bounds to rustc::infer::opaque_types.
Camille GILLOT [Sun, 5 Jan 2020 22:28:45 +0000 (23:28 +0100)]
Move required_region_bounds to rustc::infer::opaque_types.

4 years agoMove free_region_map to rustc::ty.
Camille GILLOT [Sun, 5 Jan 2020 22:08:02 +0000 (23:08 +0100)]
Move free_region_map to rustc::ty.

4 years agoMove structural_match to rustc::traits.
Camille GILLOT [Sun, 5 Jan 2020 22:02:07 +0000 (23:02 +0100)]
Move structural_match to rustc::traits.

4 years agoMove ty::wf to traits.
Camille GILLOT [Sun, 5 Jan 2020 19:52:34 +0000 (20:52 +0100)]
Move ty::wf to traits.

4 years agoMake traits::util::* free functions.
Camille GILLOT [Sun, 5 Jan 2020 19:27:00 +0000 (20:27 +0100)]
Make traits::util::* free functions.

4 years agoMove subst_and_normalize_erasing_regionsto rustc::ty.
Camille GILLOT [Sun, 5 Jan 2020 18:52:56 +0000 (19:52 +0100)]
Move subst_and_normalize_erasing_regionsto rustc::ty.