Commit graph

138257 commits

Author SHA1 Message Date
Thom Chiovoloni 2711b011e6 Rename Result::ok_or_err to Result::into_ok_or_err 2021-02-17 08:54:52 -08:00
Thom Chiovoloni 7d303661cd Fix doc link for slice::binary_search 2021-02-17 08:52:08 -08:00
Thom Chiovoloni f688bee4ec Add a Result::ok_or_err method to extract a T from Result<T, T> 2021-02-17 08:51:58 -08:00
bors ee88f46bb5 Auto merge of #82197 - tmiasko:try-get-cached, r=cjgillot
Inline try_get_cached
2021-02-17 04:07:35 +00:00
bors 8fe989dd76 Auto merge of #81611 - cjgillot:meowner, r=estebank
Only store a LocalDefId in some HIR nodes

Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef.
As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`.

This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16 22:14:32 +00:00
bors a143517d44 Auto merge of #82192 - GuillaumeGomez:rollup-gi1639b, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #82145 (Fix ES5 errors (IE11))
 - #82160 (Fix typo in rustc_infer::infer::UndoLog)
 - #82161 (Add long explanation for E0545)
 - #82163 (avoid full-slicing slices)
 - #82175 (validation: fix invalid-fn-ptr error message)
 - #82184 ([Minor] Update discriminant_value docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-16 19:21:22 +00:00
Guillaume Gomez 9502e5c4dc
Rollup merge of #82184 - petertodd:2021-discriminant-value-doc, r=nagisa
[Minor] Update discriminant_value docs

Updated for new `DiscriminantKind` trait.
2021-02-16 19:21:21 +01:00
Guillaume Gomez 866dc5aae5
Rollup merge of #82175 - RalfJung:invalid-fn-ptr, r=oli-obk
validation: fix invalid-fn-ptr error message

https://github.com/rust-lang/rust/pull/82061 changed the code here to print an `ImmTy` instead of a `ScalarMaybeUninit`; that was an accident. So go back to printing a `ScalarMaybeUninit`.

r? ```@oli-obk```
2021-02-16 19:21:21 +01:00
Guillaume Gomez 46b93b2e44
Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514
avoid full-slicing slices

If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
2021-02-16 19:21:20 +01:00
Guillaume Gomez cdab137bd4
Rollup merge of #82161 - jesusprubio:add-long-explanation-e0545, r=GuillaumeGomez
Add long explanation for E0545

Helps with #61137
2021-02-16 19:21:19 +01:00
Guillaume Gomez 73d6b603a7
Rollup merge of #82160 - pierwill:patch-2, r=lcnr
Fix typo in rustc_infer::infer::UndoLog

Also use double quotes.
2021-02-16 19:21:18 +01:00
Guillaume Gomez 4df040176d
Rollup merge of #82145 - GuillaumeGomez:es5-checks, r=Nemo157
Fix ES5 errors (IE11)

rustdoc is supposed to run on IE11 but someone reported me that it wasn't. I just confirmed it by using `es-check` with the `es5` option like this:

```
$ es-check es5 src/librustdoc/html/static/*.js
```

The PR fixes those issues and add CI checks to prevent regressions.

`@Mark-Simulacrum:` I added checks in the CI, but not sure if it's the correct way to do it. Any help on that side would be very appreciated!

r? `@Nemo157`
2021-02-16 19:21:14 +01:00
bors 9d3deed8a2 Auto merge of #82150 - RalfJung:miri, r=RalfJung
update Miri

This pulls in the recent cargo-miri fixes by `@hyd-dev.`
Cc `@rust-lang/miri` r? `@ghost`
Fixes https://github.com/rust-lang/rust/issues/82173
2021-02-16 16:22:56 +00:00
Peter Todd 3a03cbc9dd
[Minor] Update discriminant_value docs 2021-02-16 08:16:31 -05:00
Ralf Jung 92764acdea update Miri 2021-02-16 11:17:42 +01:00
Ralf Jung e5514efab2 add test 2021-02-16 11:14:34 +01:00
Ralf Jung 897cb61076 validation: fix invalid-fn-ptr error message 2021-02-16 09:58:35 +01:00
bors f1c47c79fe Auto merge of #82058 - gilescope:to_digit_speedup, r=lcnr
no need to check assertion on fast path as will always hold.

V small change. Easy to review though!
2021-02-16 08:38:11 +00:00
bors 090dac0c38 Auto merge of #81734 - richkadel:fixfordash, r=pnkfelix
Ensures `make` tests run under /bin/dash (if available), like CI, and fixes a Makefile

Note: This cherrypicks #81688 (`@pnkfelix)`

Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI uses `dash` but other environments (including developer local machines) may default to `bash`.

Replaces bash-specific shell command in one Makefile with a dash-compatible alternative, and re-enables the affected Makefile test.

Removes apparently redundant definition of `UNAME`.

Also see: [zulip discussion thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/how.20to.20run.2Fbless.20src.2Ftest.2Frun-make-fulldeps.2Fcoverage.20.3F)

r? `@pnkfelix`

FYI: `@wesleywiser` `@tmandry`
2021-02-16 05:45:10 +00:00
bors 42a4673fbd Auto merge of #82153 - jonas-schievink:rollup-ls5r943, r=jonas-schievink
Rollup of 19 pull requests

Successful merges:

 - #81503 (Suggest to create a new `const` item if the `fn` in the array is a `const fn`)
 - #81897 (Add match pattern diagnostics regression test)
 - #81975 (Seal the CommandExt, OsStrExt and OsStringExt traits)
 - #82009 (const_generics: Dont evaluate array length const when handling errors)
 - #82060 (Fix typos in BTreeSet::{first, last} docs)
 - #82061 (CTFE validation: catch ReadPointerAsBytes and better error)
 - #82063 (Fixed minor typo in catch_unwind docs)
 - #82067 (const_generics: Fix incorrect ty::ParamEnv::empty() usage)
 - #82077 (Edit `rustc_arena::DropArena` docs)
 - #82096 (Fix a typo)
 - #82106 (Remove unnecessary `Option` in `default_doc`)
 - #82107 (expand: Some cleanup)
 - #82118 (Add missing env!-decl variant)
 - #82119 (Fix typo in link to CreateSymbolicLinkW documentation.)
 - #82120 (Stabilize Arguments::as_str)
 - #82129 (Remove redundant bool_to_option feature gate)
 - #82133 (Update link for extern prelude.)
 - #82141 (32-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output register.)
 - #82147 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-16 02:14:13 +00:00
Tomasz Miąsko db36db2e81 Inline try_get_cached 2021-02-16 00:00:00 +00:00
Matthias Krüger 4390a61b64 avoid full-slicing slices
If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
2021-02-16 00:31:11 +01:00
Camille GILLOT 91d8e59cca Remove HirItemLike. 2021-02-15 19:36:13 +01:00
Camille GILLOT 7dd1e8cfdf Trait impls are Items, therefore HIR owners. 2021-02-15 19:36:13 +01:00
Camille GILLOT f395f2ea12 Use less HirId when referring to items. 2021-02-15 19:36:12 +01:00
Camille GILLOT c4e7427081 Only store a LocalDefId in hir::MacroDef. 2021-02-15 19:35:55 +01:00
Camille GILLOT ff14cac621 Index Modules using their LocalDefId. 2021-02-15 19:32:30 +01:00
Camille GILLOT 7878fa70d6 Fix E0657. 2021-02-15 19:32:29 +01:00
Camille GILLOT 996dc8d5c5 Only store a LocalDefId in hir::ForeignItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT 786a80e9ea Only store a LocalDefId in hir::ImplItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT a871a0f111 Only store a LocalDefId in hir::TraitItem. 2021-02-15 19:32:28 +01:00
Camille GILLOT cebbba081e Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
Camille GILLOT bd3cd5dbed Use an ItemId inside mir::GlobalAsm. 2021-02-15 19:24:58 +01:00
Camille GILLOT c676e358a5 Use ItemId as a strongly typed index. 2021-02-15 19:24:58 +01:00
Camille GILLOT ac8961fc04 Add assertions on HIR enum sizes. 2021-02-15 19:24:57 +01:00
Camille GILLOT 21b0cdc9c0 Remove useless Named trait. 2021-02-15 19:24:57 +01:00
Jesus Rubio 8192793d50 Add long explanation for E0545 2021-02-15 19:16:39 +01:00
pierwill f2f7ffecd7
Fix typo in rustc_infer::infer::UndoLog
Also use double quotes.
2021-02-15 10:02:03 -08:00
Jonas Schievink a105280a06
Rollup merge of #82147 - lnicola:rust-analyzer-2021-02-15, r=jonas-schievink
⬆️ rust-analyzer
2021-02-15 16:07:12 +01:00
Jonas Schievink 1a2675fe26
Rollup merge of #82141 - jrvanwhy:issue-82052, r=sanxiyn
32-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output register.

On 32-bit ARM platforms, the register `r14` has the alias `lr`. When used as an output register in `asm!`, rustc canonicalizes the name to `r14`. LLVM only knows the register by the name `lr`, and rejects it. This changes rustc's LLVM code generation to output `lr` instead.

closes #82052

r? ``@nagisa``
2021-02-15 16:07:11 +01:00
Jonas Schievink 1ee4a7bba6
Rollup merge of #82133 - ehuss:extern-prelude-link, r=jyn514
Update link for extern prelude.

There was some reorganization in the reference as part of https://github.com/rust-lang/reference/pull/937.
2021-02-15 16:07:10 +01:00
Jonas Schievink 1c75dfbce7
Rollup merge of #82129 - est31:master, r=jyn514
Remove redundant bool_to_option feature gate
2021-02-15 16:07:09 +01:00
Jonas Schievink c87ef218f9
Rollup merge of #82120 - sfackler:arguments-as-str, r=dtolnay
Stabilize Arguments::as_str

Closes #74442
2021-02-15 16:07:08 +01:00
Jonas Schievink 2030a54f9d
Rollup merge of #82119 - m-ou-se:typo, r=dtolnay
Fix typo in link to CreateSymbolicLinkW documentation.
2021-02-15 16:07:06 +01:00
Jonas Schievink b0bd056bc9
Rollup merge of #82118 - lukaslueg:env_decl, r=m-ou-se
Add missing env!-decl variant

Resolves #82117
2021-02-15 16:07:05 +01:00
Jonas Schievink 285ea2f80d
Rollup merge of #82107 - petrochenkov:minexpclean, r=Aaron1011
expand: Some cleanup

See individual commits for details.

r? ``@Aaron1011``
2021-02-15 16:07:04 +01:00
Jonas Schievink 40d85a5f7d
Rollup merge of #82106 - jyn514:cleanup-bootstrap, r=Mark-Simulacrum
Remove unnecessary `Option` in `default_doc`

Previously, there were two different ways to encode the same info: `None` or
`Some(&[])`. Now there is only one way, `&[]`.
2021-02-15 16:07:02 +01:00
Jonas Schievink db5ae6a626
Rollup merge of #82096 - TaKO8Ki:fix-typo, r=GuillaumeGomez
Fix a typo

This pull request fixes a typo.
2021-02-15 16:07:01 +01:00
Jonas Schievink 493c6c9f25
Rollup merge of #82077 - pierwill:edit-droparena, r=lcnr
Edit `rustc_arena::DropArena` docs

- Add a "Safety" section, edit formatting for clarity
- Add missing punctuation in code comments
2021-02-15 16:07:00 +01:00
Jonas Schievink 665bf9e35f
Rollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obk
const_generics: Fix incorrect ty::ParamEnv::empty() usage

Fixes #80561

Not sure if I should keep the `debug!(..)`s or not but its the second time I've needed them so they sure seem useful lol

cc ``@lcnr``
r? ``@oli-obk``
2021-02-15 16:06:59 +01:00