Commit graph

138227 commits

Author SHA1 Message Date
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 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
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
Jonas Schievink 7842b5d2ec
Rollup merge of #82063 - NULLx76:fix-minor-typo, r=jonas-schievink
Fixed minor typo in catch_unwind docs

Changed "a an exception" to "an exception" inside of the `std::panic::catch_unwind` docs.
2021-02-15 16:06:58 +01:00
Jonas Schievink 5e8435abe0
Rollup merge of #82061 - RalfJung:ctfe-read-pointer-as-bytes, r=oli-obk
CTFE validation: catch ReadPointerAsBytes and better error

r? ``@oli-obk``
Fixes https://github.com/rust-lang/rust/issues/79690
Cc https://github.com/rust-lang/miri/issues/1706
2021-02-15 16:06:57 +01:00
Jonas Schievink c7ebc590da
Rollup merge of #82060 - taiki-e:typo, r=m-ou-se
Fix typos in BTreeSet::{first, last} docs

map -> set
2021-02-15 16:06:56 +01:00
Jonas Schievink 6fde3c5438
Rollup merge of #82009 - BoxyUwU:idontknooow, r=varkor
const_generics: Dont evaluate array length const when handling errors

Fixes #79518
Fixes #78246

cc ````@lcnr````

This was ICE'ing because we dont pass in the correct ``ParamEnv`` which meant that there was no ``Self: Foo`` predicate to make ``Self::Assoc`` well formed which caused an ICE when trying to normalize ``Self::Assoc`` in the mir interpreter

r? ````@varkor````
2021-02-15 16:06:55 +01:00
Jonas Schievink bd0e8a5df3
Rollup merge of #81975 - Amanieu:seal2, r=m-ou-se
Seal the CommandExt, OsStrExt and OsStringExt traits

A crater run (https://github.com/rust-lang/rust/pull/81213#issuecomment-767651811) has shown that this does not break any existing code.

This also unblocks #77728.

Based on #81213.

r? ````@m-ou-se````
cc ````@lygstate````
2021-02-15 16:06:54 +01:00
Jonas Schievink cd27820b1a
Rollup merge of #81897 - vandenheuvel:match_exhaustive_diagnostics_regression_test, r=Mark-Simulacrum
Add match pattern diagnostics regression test

Closes #72377 by adding a regression test.

This test case fails on stable but now works on beta and nightly. It *should* have worked already for years, the crucial point whether it is mentioned that some uncovered patterns are not explicitly mentioned.
2021-02-15 16:06:53 +01:00
Jonas Schievink f02f7b05b2
Rollup merge of #81503 - henryboisdequin:fix-const-fn-arr-err-msg, r=estebank
Suggest to create a new `const` item if the `fn` in the array is a `const fn`

Fixes #73734. If the `fn` in the array repeat expression is a `const fn`, suggest creating a new `const` item. On nightly, suggest creating an inline `const` block. This PR also removes the `suggest_const_in_array_repeat_expressions` as it is no longer necessary.

Example:

```rust
fn main() {
    // Should not compile but hint to create a new const item (stable) or an inline const block (nightly)
    let strings: [String; 5] = [String::new(); 5];
    println!("{:?}", strings);
}

```

Gives this error:

```
error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
 --> $DIR/const-fn-in-vec.rs:3:32
  |
2 |     let strings: [String; 5] = [String::new(); 5];
  |                             ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `String`
  |
  = note: the `Copy` trait is required because the repeated element will be copied
```

With this change, this is the error message:

```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/const-fn-in-vec.rs:3:32
   |
LL |     let strings: [String; 5] = [String::new(); 5];
   |                                ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
   |
   = help: moving the function call to a new `const` item will resolve the error
```
2021-02-15 16:06:47 +01:00
Laurențiu Nicola 69310278cb ⬆️ rust-analyzer 2021-02-15 14:58:36 +02:00
bors d1206f950f Auto merge of #81855 - cjgillot:ensure-cache, r=oli-obk
Check the result cache before the DepGraph when ensuring queries

Split out of https://github.com/rust-lang/rust/pull/70951

Calling `ensure` on already forced queries is a common operation.
Looking at the results cache first is faster than checking the DepGraph for a green node.
2021-02-15 12:11:59 +00:00
Guillaume Gomez 719c8d40cc Fix ES5 errors (IE11) 2021-02-15 10:11:37 +01:00
Johnathan Van Why fd21eb18e9 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.
2021-02-14 23:41:10 -08:00
Eric Huss ec77574d13 Update link for extern prelude. 2021-02-14 19:38:40 -08:00
est31 63806cc919 Remove redundant bool_to_option feature gate 2021-02-15 04:27:57 +01:00
Steven Fackler 4613b3764c Stabilize Arguments::as_str
Closes #74442
2021-02-14 17:48:51 -05:00
lukaslueg 3d7fcfff76
Update library/core/src/macros/mod.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-14 23:33:43 +01:00
bors 9503ea19ed Auto merge of #82103 - Dylan-DPC:rollup-5wv8rid, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #80523 (#[doc(inline)] sym_generated)
 - #80920 (Visit more targets when validating attributes)
 - #81720 (Updated smallvec version due to RUSTSEC-2021-0003)
 - #81891 ([rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent)
 - #81912 (Implement the precise analysis pass for lint `disjoint_capture_drop_reorder`)
 - #81914 (Fixing bad suggestion for `_` in `const` type when a function #81885)
 - #81919 (BTreeMap: fix internal comments)
 - #81927 (Add a regression test for #32498)
 - #81965 (Fix MIR pretty printer for non-local DefIds)
 - #82029 (Use debug log level for developer oriented logs)
 - #82056 (fix ice (#82032))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-14 22:26:21 +00:00
Mara Bos 1aa965101c Fix typo in link to CreateSymbolicLinkW documentation. 2021-02-14 23:16:45 +01:00
Lukas Lueg dee54244a6 Add missing env!-decl variant
Resolves #82117
2021-02-14 22:39:47 +01:00
Vadim Petrochenkov 6e11a8b66a expand: Remove redundant calls to configure
Starting from https://github.com/rust-lang/rust/pull/63468 cfg attributes on variants, fields, fn params etc. are processed together with other attributes (via `configure!`).
2021-02-14 19:47:00 +03:00
Vadim Petrochenkov 18c94b3edd expand: Remove obsolete ExpansionConfig::keep_macs
Maybe it was used before the introduction of placeholders, but now it has no effect.
2021-02-14 19:43:54 +03:00
Vadim Petrochenkov 0038eaee6b rustc_span: Remove obsolete allow_internal_unstable_backcompat_hack 2021-02-14 19:42:55 +03:00
Joshua Nelson c583860126 Remove unnecessary Option in default_doc
Previously, there two different ways to encode the same info: `None` or
`Some(&[])`. Now there is only one way, `&[]`.
2021-02-14 11:31:35 -05:00
Dylan DPC bcb14035e9
Rollup merge of #82056 - b-naber:mut_for_loop_bug, r=oli-obk
fix ice (#82032)

Fixes https://github.com/rust-lang/rust/issues/82032
2021-02-14 16:54:53 +01:00
Dylan DPC c8dacf95ae
Rollup merge of #82029 - tmiasko:debug, r=matthewjasper
Use debug log level for developer oriented logs

The information logged here is of limited general interest, while at the
same times makes it impractical to simply enable logging and share the
resulting logs due to the amount of the output produced.

Reduce log level from info to debug for developer oriented information.

For example, when building cargo, this reduces the amount of logs
generated by `RUSTC_LOG=info cargo build` from 265 MB to 79 MB.

Continuation of changes from 81350.
2021-02-14 16:54:52 +01:00
Dylan DPC 2efde8c795
Rollup merge of #81965 - osa1:issue81200, r=oli-obk
Fix MIR pretty printer for non-local DefIds

Tries to fix #81200 -- the reproducer in the issue is not fixed yet.
Submitting PR to get feedback.

r? oli-obk
2021-02-14 16:54:51 +01:00
Dylan DPC 91889fc555
Rollup merge of #81927 - vandenheuvel:issue_32498, r=Mark-Simulacrum
Add a regression test for #32498

[This](https://github.com/rust-lang/rust/issues/32498#issuecomment-613626968) test mentioned at issue #32498 now passes. This PR adds this regression test.
2021-02-14 16:54:50 +01:00
Dylan DPC 4e888bf403
Rollup merge of #81919 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum
BTreeMap: fix internal comments

Salvaged from #81372

r? `@Mark-Simulacrum`
2021-02-14 16:54:49 +01:00
Dylan DPC a6809d00ae
Rollup merge of #81914 - kper:fixing-81885, r=estebank
Fixing bad suggestion for `_` in `const` type when a function #81885

Closes #81885

```
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> $DIR/typeck_type_placeholder_item_help.rs:13:22
   |
LL | const TEST4: fn() -> _ = 42;
   |                      ^
   |                      |
   |                      not allowed in type signatures
   |                      help: use type parameters instead: `T`
```

Do not show the suggestion `help: use type parameters instead: T` when `fn`
2021-02-14 16:54:47 +01:00
Dylan DPC 25315635ef
Rollup merge of #81912 - sexxi-goose:Migrations2_review, r=nikomatsakis
Implement the precise analysis pass for lint `disjoint_capture_drop_reorder`

The precision pass for the lint prevents the lint from triggering for a variable (that was previously entirely captured by the closure) if all paths that need Drop starting at root variable have been captured by the closure.

r? `@nikomatsakis`
2021-02-14 16:54:46 +01:00
Dylan DPC 641c3785dc
Rollup merge of #81891 - CraftSpider:fn-header, r=jyn514
[rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent

Bumps version number and adds tests, this is a breaking change. I can split this into two (`is_unsafe` -> `header` and `header: Vec<Modifiers>`) if desired.

Rationale: Modifiers are individual notes on a function, it makes more sense for them to be a list of an independent enum over a String which is inconsistently exposing the HIR representation (prefix_str vs custom literals).
Function pointers currently only support `unsafe`, but there has been talk on and off about allowing them to also support `const`, and this makes handling their modifiers consistent with handling those of a function, allowing better shared code.

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc
CC: `@HeroicKatora`
r? `@jyn514`
2021-02-14 16:54:45 +01:00