]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #82202 - kraj:kraj/riscv-musl, r=estebank
Yuki Okushi [Thu, 18 Feb 2021 06:57:28 +0000 (15:57 +0900)]
Rollup merge of #82202 - kraj:kraj/riscv-musl, r=estebank

add specs for riscv32/riscv64 musl targets

Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years agoRollup merge of #82155 - tmiasko:once, r=matthewjasper
Yuki Okushi [Thu, 18 Feb 2021 06:57:27 +0000 (15:57 +0900)]
Rollup merge of #82155 - tmiasko:once, r=matthewjasper

Use !Sync std::lazy::OnceCell in usefulness checking

The `rustc_data_structures::sync::OnceCell` is thread-safe when building
a parallel compiler. This is unnecessary for the purposes of pattern
usefulness checking. Use `!Sync` `std::lazy::OnceCell` instead.

3 years agoRollup merge of #82055 - JulianKnodt:ty_where_const, r=estebank
Yuki Okushi [Thu, 18 Feb 2021 06:57:26 +0000 (15:57 +0900)]
Rollup merge of #82055 - JulianKnodt:ty_where_const, r=estebank

Add diagnostics for specific cases for const/type mismatch err

For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors.

I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach

r? ```@lcnr```
cc: ```@estebank```

3 years agoAuto merge of #82241 - Dylan-DPC:rollup-munmzg5, r=Dylan-DPC
bors [Thu, 18 Feb 2021 01:31:10 +0000 (01:31 +0000)]
Auto merge of #82241 - Dylan-DPC:rollup-munmzg5, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #77728 (Expose force_quotes on Windows.)
 - #80572 (Add a `Result::into_ok_or_err` method to extract a `T` from `Result<T, T>`)
 - #81860 (Fix SourceMap::start_point)
 - #81869 (Simplify pattern grammar, improve or-pattern diagnostics)
 - #81898 (Fix debug information for function arguments of type &str or slice.)
 - #81972 (Placeholder lifetime error cleanup)
 - #82007 (Implement reborrow for closure captures)
 - #82021 (Spell out nested Self type in lint message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #82021 - csmoe:issue-78600, r=tmandry
Dylan DPC [Wed, 17 Feb 2021 22:51:20 +0000 (23:51 +0100)]
Rollup merge of #82021 - csmoe:issue-78600, r=tmandry

Spell out nested Self type in lint message

Closes #78600
r? `@tmandry`

3 years agoRollup merge of #82007 - sexxi-goose:reborrow, r=nikomatsakis
Dylan DPC [Wed, 17 Feb 2021 22:51:19 +0000 (23:51 +0100)]
Rollup merge of #82007 - sexxi-goose:reborrow, r=nikomatsakis

Implement reborrow for closure captures

The strategy for captures is detailed here with examples: https://hackmd.io/PzxYMPY4RF-B9iH9uj9GTA

Key points:
- We only need to reborrow a capture in case of move closures.
  - If we mutate something via a `&mut` we store it as a `MutBorrow`/`UniqueMuBorrow` of the path containing the `&mut`,
  - Similarly, if it's read via `&` ref we just store it as a `ImmBorrow` of the path containing the `&` ref.
  - If a path doesn't deref a `&mut`, `&`, then that path is captured by Move.
  - If the use of a path results in a move when the closure is called, then that path is truncated before any deref and the truncated path is moved into the closure.

- In the case of non-move closure if a use of a path results in a move, then the path is truncated before any deref and the truncated path is moved into the closure.

Note that the implementation differs a bit from the document to allow for truncated path to be used in the ClosureKind analysis that happens as part of the first capture analysis pass.

Closes: https://github.com/rust-lang/project-rfc-2229/issues/31
r? ````@nikomatsakis````

3 years agoRollup merge of #81972 - matthewjasper:hrtb-error-cleanup, r=nikomatsakis
Dylan DPC [Wed, 17 Feb 2021 22:51:18 +0000 (23:51 +0100)]
Rollup merge of #81972 - matthewjasper:hrtb-error-cleanup, r=nikomatsakis

Placeholder lifetime error cleanup

- Remove note of trait definition
- Avoid repeating the same self type
- Use original region names when possible
- Use this error kind more often
- Print closure signatures when they are suppose to implement `Fn*` traits

Works towards #57374

r? ```@nikomatsakis```

3 years agoRollup merge of #81898 - nanguye2496:nanguye2496/fix_str_and_slice_visualization...
Dylan DPC [Wed, 17 Feb 2021 22:51:17 +0000 (23:51 +0100)]
Rollup merge of #81898 - nanguye2496:nanguye2496/fix_str_and_slice_visualization, r=varkor

Fix debug information for function arguments of type &str or slice.

Issue details:
When lowering MIR to LLVM IR, the compiler decomposes every &str and slice argument into a data pointer and a usize. Then, the original argument is reconstructed from the pointer and the usize arguments in the body of the function that owns it. Since the original argument is declared in the body of a function, it should be marked as a LocalVariable instead of an ArgumentVairable. This confusion causes MSVC debuggers unable to visualize &str and slice arguments correctly. (See https://github.com/rust-lang/rust/issues/81894 for more details).

Fix details:
Making sure that the debug variable for every &str and slice argument is marked as LocalVariable instead of ArgumentVariable in computing_per_local_var_debug_info. This change has been verified on VS Code debugger, VS debugger, WinDbg and LLDB.

3 years agoRollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov
Dylan DPC [Wed, 17 Feb 2021 22:51:16 +0000 (23:51 +0100)]
Rollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov

Simplify pattern grammar, improve or-pattern diagnostics

This implements the change under FCP in https://github.com/rust-lang/rust/issues/81415. It allows nested or-patterns to contain a leading `|`, simplifying the [grammar for patterns](https://github.com/rust-lang/reference/pull/957/files?short_path=cc629f1#diff-cc629f15712821139bc706c63b3845ab59a008e2a998e08ffad42e3aebcbcbe2).

Along the way, we also improve the diagnostics around a few specially-handled cases, such as using `||` instead of `|`, using or-patterns in fn params, including the leading `|` in the pattern span, etc.

r? `@petrochenkov`

3 years agoRollup merge of #81860 - osa1:issue81800, r=estebank
Dylan DPC [Wed, 17 Feb 2021 22:51:14 +0000 (23:51 +0100)]
Rollup merge of #81860 - osa1:issue81800, r=estebank

Fix SourceMap::start_point

`start_point` needs to return the *first* character's span, but it would
previously call `find_width_of_character_at_span` which returns the span
of the *last* character. The implementation is now fixed.

Other changes:

- Docs for start_point, end_point, find_width_of_character_at_span
  updated

- Minor simplification in find_width_of_character_at_span code

Fixes #81800

3 years agoRollup merge of #80572 - thomcc:ok_or_err, r=m-ou-se
Dylan DPC [Wed, 17 Feb 2021 22:51:13 +0000 (23:51 +0100)]
Rollup merge of #80572 - thomcc:ok_or_err, r=m-ou-se

Add a `Result::into_ok_or_err` method to extract a `T` from `Result<T, T>`

When updating code to handle the semi-recent deprecation of `compare_and_swap` in favor of `compare_exchange`, which returns `Result<T, T>`, I wanted this. I've also wanted it with code using `slice::binary_search` before.

The name (and perhaps the documentation) is the hardest part here, but this name seems consistent with the other Result methods, and equivalently memorable.

3 years agoRollup merge of #77728 - lygstate:master, r=Amanieu
Dylan DPC [Wed, 17 Feb 2021 22:51:12 +0000 (23:51 +0100)]
Rollup merge of #77728 - lygstate:master, r=Amanieu

Expose force_quotes on Windows.

On Windows, the arg quotes and not quotes have different effect
for the program it called, if the program called are msys2/cygwin program.
Refer to
https://github.com/msys2/MSYS2-packages/issues/2176

This also solve the issues comes from

https://internals.rust-lang.org/t/std-process-on-windows-is-escaping-raw-literals-which-causes-problems-with-chaining-commands/8163

Tracking issue:
https://github.com/rust-lang/rust/issues/82227

3 years agoAuto merge of #81993 - flip1995:clippyup, r=Manishearth
bors [Wed, 17 Feb 2021 22:37:42 +0000 (22:37 +0000)]
Auto merge of #81993 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update

r? `@Manishearth`

3 years agoAuto merge of #82235 - GuillaumeGomez:rollup-oflxc08, r=GuillaumeGomez
bors [Wed, 17 Feb 2021 19:39:58 +0000 (19:39 +0000)]
Auto merge of #82235 - GuillaumeGomez:rollup-oflxc08, r=GuillaumeGomez

Rollup of 11 pull requests

Successful merges:

 - #79981 (Add 'consider using' message to overflowing_literals)
 - #82094 (To digit simplification)
 - #82105 (Don't fail to remove files if they are missing)
 - #82136 (Fix ICE: Use delay_span_bug for mismatched subst/hir arg)
 - #82169 (Document that `assert!` format arguments are evaluated lazily)
 - #82174 (Replace File::create and write_all with fs::write)
 - #82196 (Add caveat to Path::display() about lossiness)
 - #82198 (Use internal iteration in Iterator::is_sorted_by)
 - #82204 (Update books)
 - #82207 (rustdoc: treat edition 2021 as unstable)
 - #82231 (Add long explanation for E0543)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #82231 - jesusprubio:add-long-explanation-e0543, r=GuillaumeGomez
Guillaume Gomez [Wed, 17 Feb 2021 19:38:08 +0000 (20:38 +0100)]
Rollup merge of #82231 - jesusprubio:add-long-explanation-e0543, r=GuillaumeGomez

Add long explanation for E0543

Helps with #61137

3 years agoRollup merge of #82207 - ehuss:rustdoc-2021, r=jyn514
Guillaume Gomez [Wed, 17 Feb 2021 19:38:07 +0000 (20:38 +0100)]
Rollup merge of #82207 - ehuss:rustdoc-2021, r=jyn514

rustdoc: treat edition 2021 as unstable

This ensures that `--edition=2021` requires `-Z unstable-options` in rustdoc.

3 years agoRollup merge of #82204 - ehuss:update-books, r=ehuss
Guillaume Gomez [Wed, 17 Feb 2021 19:38:05 +0000 (20:38 +0100)]
Rollup merge of #82204 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in bbf06ad39d1f45654047e9596b750cc6e6d1b693..adca786547d08fe676b2fc7a6f08c2ed5280ca38
2021-01-22 07:07:31 -0800 to 2021-02-16 16:34:20 +0900
- Merge pull request rust-lang-nursery/nomicon#254 from mdaverde/ml/adds-compiler-err-lifetimes

## reference

9 commits in f02b09eb6e8af340ad1256a54adb7aae2ff3163e..361367c126290ac17cb4089f8d38fd8b2ac43f98
2021-01-22 01:53:02 -0800 to 2021-02-15 09:58:13 -0800
- Define turbofish in the glossary (rust-lang-nursery/reference#964)
- Remove enum variant expr (rust-lang-nursery/reference#963)
- One sentence is one line src/expressions/* (rust-lang-nursery/reference#962)
- Referencify bool type (rust-lang-nursery/reference#940)
- Fix typo in type cast expression table (rust-lang-nursery/reference#959)
- Define rust (rust-lang-nursery/reference#953)
- Remove "Memory Ownership" chapter (rust-lang-nursery/reference#952)
- Added setting nightly as a requirement for running tests (rust-lang-nursery/reference#955)
- Refactored build steps for better readability (rust-lang-nursery/reference#936)

## book

13 commits in e724bd826580ff95df48a8533af7dec1080693d4..db5e8a5105aa22979490dce30e33b68d8645761d
2021-01-20 08:19:49 -0600 to 2021-02-12 16:58:20 -0500
- Update to Rust 1.50
- Fix issue rust-lang/book#2574 - Improve the explanation about the behaviour of `read_line`. (rust-lang/book#2575)
- closures: replace "is called" with "is defined" (rust-lang/book#2556)
- Minor clarification: types -&gt; values in ch16-04 (rust-lang/book#2587)
- fixed hidden code listing (rust-lang/book#2610)
- Merge remote-tracking branch 'origin/pr/2604'
-  (rust-lang/book#2601)
- Merge remote-tracking branch 'origin/pr/2589'
- Fix text wrapping
- Some small rewordings I noticed while rereading just now
-  (rust-lang/book#2592)
- Removed 'of' between type alias in Ch 19-04. (rust-lang/book#2581)
- Merge remote-tracking branch 'origin/pr/2554'

## rust-by-example

2 commits in f633769acef68574427a6fae6c06f13bc2199573..551cc4bc8394feccea6acd21f86d9a4e1d2271a0
2021-01-13 20:58:25 -0300 to 2021-02-03 17:12:37 -0300
- remove // (rust-lang/rust-by-example#1409)
- Update arc.md (rust-lang/rust-by-example#1406)

## edition-guide

3 commits in b91a9a881ee007c12e74e844460ec407cf07a50f..1da3c411f17adb1ba5de1683bb6acee83362b54a
2020-11-02 11:02:03 -0600 to 2021-02-16 16:46:40 -0800
- Update link for no_std. (rust-lang-nursery/edition-guide#231)
- Add git link to the source. (rust-lang-nursery/edition-guide#228)
- Update musl libc link (rust-lang-nursery/edition-guide#230)

## embedded-book

1 commits in ceec19e873be87c6ee5666b030c6bb612f889a96..4cf7981696a85c3e633076c6401611bd3f6346c4
2021-01-03 13:13:10 +0000 to 2021-02-11 10:55:22 +0000
- Fix installing dateutil since it is now a dependency of the GHP import script  (rust-embedded/book#282)

3 years agoRollup merge of #82198 - SkiFire13:optimize-iter-is-sorted, r=sfackler
Guillaume Gomez [Wed, 17 Feb 2021 19:38:04 +0000 (20:38 +0100)]
Rollup merge of #82198 - SkiFire13:optimize-iter-is-sorted, r=sfackler

Use internal iteration in Iterator::is_sorted_by

3 years agoRollup merge of #82196 - Manishearth:display-caveat, r=m-ou-se
Guillaume Gomez [Wed, 17 Feb 2021 19:38:03 +0000 (20:38 +0100)]
Rollup merge of #82196 - Manishearth:display-caveat, r=m-ou-se

Add caveat to Path::display() about lossiness

It's worth calling out that this API may do a lossy display.

r? ```@m-ou-se```

3 years agoRollup merge of #82174 - est31:master, r=oli-obk
Guillaume Gomez [Wed, 17 Feb 2021 19:38:01 +0000 (20:38 +0100)]
Rollup merge of #82174 - est31:master, r=oli-obk

Replace File::create and write_all with fs::write

Also don't convert to u8 buffers and back
when we are only creating strings.

3 years agoRollup merge of #82169 - not-an-aardvark:assert-lazy-format-expressions, r=sfackler
Guillaume Gomez [Wed, 17 Feb 2021 19:38:00 +0000 (20:38 +0100)]
Rollup merge of #82169 - not-an-aardvark:assert-lazy-format-expressions, r=sfackler

Document that `assert!` format arguments are evaluated lazily

It can be useful to do some computation in `assert!` format arguments, in order to get better error messages. For example:

```rust
assert!(
    some_condition,
    "The state is invalid. Details: {}",
    expensive_call_to_get_debugging_info(),
);
```

It seems like `assert!` only evaluates the format arguments if the assertion fails, which is useful but doesn't appear to be documented anywhere. This PR documents the behavior and adds some tests.

3 years agoRollup merge of #82136 - edward-shen:mismatched-subst-and-hir, r=lcnr
Guillaume Gomez [Wed, 17 Feb 2021 19:37:58 +0000 (20:37 +0100)]
Rollup merge of #82136 - edward-shen:mismatched-subst-and-hir, r=lcnr

Fix ICE: Use delay_span_bug for mismatched subst/hir arg

Fixes #82126.

3 years agoRollup merge of #82105 - nagisa:nagisa/ensure-removed, r=petrochenkov
Guillaume Gomez [Wed, 17 Feb 2021 19:37:57 +0000 (20:37 +0100)]
Rollup merge of #82105 - nagisa:nagisa/ensure-removed, r=petrochenkov

Don't fail to remove files if they are missing

In the backend we may want to remove certain temporary files, but in
certain other situations these files might not be produced in the first
place. We don't exactly care about that, and the intent is really that
these files are gone after a certain point in the backend.

Here we unify the backend file removing calls to use `ensure_removed`
which will attempt to delete a file, but will not fail if it does not
exist (anymore).

The tradeoff to this approach is, of course, that we may miss instances
were we are attempting to remove files at wrong paths due to some bug –
compilation would silently succeed but the temporary files would remain
there somewhere.

3 years agoRollup merge of #82094 - gilescope:to_digit_speedup2, r=m-ou-se
Guillaume Gomez [Wed, 17 Feb 2021 19:37:55 +0000 (20:37 +0100)]
Rollup merge of #82094 - gilescope:to_digit_speedup2, r=m-ou-se

To digit simplification

I found out the other day that all the ascii digits have the first four bits as one would hope them to. (Eg. char `2` ends `0b0010`). There are two bits to indicate it's in the digit range ( `0b0011_0000`). If it is a true digit then all the higher bits aside from these two will be 0 (as ascii is the lowest part of the unicode u32 spectrum). So XORing with `0b11_0000` should mean we either get the number 0-9 or alternativly we get a larger number in the u32 space. If we get something that's not 0-9 then it will be discarded as it will be greater than the radix.

The code seems so fast though that there's quite a lot of noise in the benchmarks so it's not that easy to prove conclusively that it's faster as well as less instructions.

The non-fast path I was toying with as well wondering if we could do this as then we'd only have one return and less instructions still:
```
           match self {
                'a'..='z' => self as u32 - 'a' as u32 + 10,
                'A'..='Z' => self as u32 - 'A' as u32 + 10,
                _ => { radix = 10; self as u32 ^ ASCII_DIGIT_MASK},
            }
```

Here's the [godbolt](https://godbolt.org/z/883c9n).

( H/T to ``@byteshadow`` for pointing out xor was what I needed)

3 years agoRollup merge of #79981 - camelid:overflowing_literals-inference-error, r=lcnr
Guillaume Gomez [Wed, 17 Feb 2021 19:37:48 +0000 (20:37 +0100)]
Rollup merge of #79981 - camelid:overflowing_literals-inference-error, r=lcnr

Add 'consider using' message to overflowing_literals

Fixes #79744.

Ironically, the `overflowing_literals` handler for binary or hex already
had this message! You would think it would be the other way around :)

cc ```@scottmcm```

3 years agoExpose force_quotes on Windows.
Yonggang Luo [Thu, 8 Oct 2020 22:26:31 +0000 (22:26 +0000)]
Expose force_quotes on Windows.

Quotes the arg and not quotes the arg have different effect on Windows when the program called
are msys2/cygwin program.
Refer to https://github.com/msys2/MSYS2-packages/issues/2176

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
3 years agoAdd long explanation for E0543
Jesus Rubio [Wed, 17 Feb 2021 17:08:30 +0000 (18:08 +0100)]
Add long explanation for E0543

3 years agoAdd link to tracking issue #82223
Thom Chiovoloni [Wed, 17 Feb 2021 17:04:03 +0000 (09:04 -0800)]
Add link to tracking issue #82223

3 years agoRename Result::ok_or_err to Result::into_ok_or_err
Thom Chiovoloni [Wed, 17 Feb 2021 16:54:52 +0000 (08:54 -0800)]
Rename Result::ok_or_err to Result::into_ok_or_err

3 years agoFix doc link for slice::binary_search
Thom Chiovoloni [Fri, 1 Jan 2021 03:50:24 +0000 (19:50 -0800)]
Fix doc link for slice::binary_search

3 years agoAdd a `Result::ok_or_err` method to extract a `T` from `Result<T, T>`
Thom Chiovoloni [Fri, 1 Jan 2021 02:17:25 +0000 (18:17 -0800)]
Add a `Result::ok_or_err` method to extract a `T` from `Result<T, T>`

3 years agoAuto merge of #82116 - tmiasko:box-error, r=oli-obk
bors [Wed, 17 Feb 2021 16:47:18 +0000 (16:47 +0000)]
Auto merge of #82116 - tmiasko:box-error, r=oli-obk

Reduce size of InterpErrorInfo to 8 bytes

r? `@ghost`

3 years agoAuto merge of #82197 - tmiasko:try-get-cached, r=cjgillot
bors [Wed, 17 Feb 2021 04:07:35 +0000 (04:07 +0000)]
Auto merge of #82197 - tmiasko:try-get-cached, r=cjgillot

Inline try_get_cached

3 years agorustdoc: treat edition 2021 as unstable
Eric Huss [Wed, 17 Feb 2021 03:17:01 +0000 (19:17 -0800)]
rustdoc: treat edition 2021 as unstable

3 years agoUpdate books
Eric Huss [Wed, 17 Feb 2021 01:19:28 +0000 (17:19 -0800)]
Update books

3 years agoAdd riscv32 and riscv64 musl to supported platform targets
Khem Raj [Wed, 17 Feb 2021 00:44:39 +0000 (16:44 -0800)]
Add riscv32 and riscv64 musl to supported platform targets

Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years agoadd specs for riscv32/riscv64 musl targets
Khem Raj [Wed, 17 Feb 2021 00:18:53 +0000 (16:18 -0800)]
add specs for riscv32/riscv64 musl targets

Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years agoEnsure debug_assert! tests get run
Teddy Katz [Wed, 17 Feb 2021 00:05:30 +0000 (19:05 -0500)]
Ensure debug_assert! tests get run

3 years agoUse -Ccodegen-units=1 to make issue-23458 test deterministic
Tomasz Miąsko [Wed, 17 Feb 2021 00:00:00 +0000 (00:00 +0000)]
Use -Ccodegen-units=1 to make issue-23458 test deterministic

The test case fails with either one error or two errors.
Use a single code generation unit to avoid nondeterminism.

3 years agoReduce size of InterpErrorInfo to 8 bytes
Tomasz Miąsko [Sun, 14 Feb 2021 00:00:00 +0000 (00:00 +0000)]
Reduce size of InterpErrorInfo to 8 bytes

3 years agoAuto merge of #81611 - cjgillot:meowner, r=estebank
bors [Tue, 16 Feb 2021 22:14:32 +0000 (22:14 +0000)]
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.

3 years agoOptimize Iterator::is_sorted_by by using Iterator::all for internal iteration
Giacomo Stevanato [Tue, 16 Feb 2021 20:49:56 +0000 (21:49 +0100)]
Optimize Iterator::is_sorted_by by using Iterator::all for internal iteration

3 years agoAdd caveat to Path::display() about lossiness
Manish Goregaokar [Tue, 16 Feb 2021 19:45:46 +0000 (11:45 -0800)]
Add caveat to Path::display() about lossiness

3 years agoAuto merge of #82192 - GuillaumeGomez:rollup-gi1639b, r=GuillaumeGomez
bors [Tue, 16 Feb 2021 19:21:22 +0000 (19:21 +0000)]
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

3 years agoRemove ordering hint
kadmin [Tue, 16 Feb 2021 19:03:22 +0000 (19:03 +0000)]
Remove ordering hint

3 years agoRollup merge of #82184 - petertodd:2021-discriminant-value-doc, r=nagisa
Guillaume Gomez [Tue, 16 Feb 2021 18:21:21 +0000 (19:21 +0100)]
Rollup merge of #82184 - petertodd:2021-discriminant-value-doc, r=nagisa

[Minor] Update discriminant_value docs

Updated for new `DiscriminantKind` trait.

3 years agoRollup merge of #82175 - RalfJung:invalid-fn-ptr, r=oli-obk
Guillaume Gomez [Tue, 16 Feb 2021 18:21:21 +0000 (19:21 +0100)]
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```

3 years agoRollup merge of #82163 - matthiaskrgr:slice, r=jyn514
Guillaume Gomez [Tue, 16 Feb 2021 18:21:20 +0000 (19:21 +0100)]
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

3 years agoRollup merge of #82161 - jesusprubio:add-long-explanation-e0545, r=GuillaumeGomez
Guillaume Gomez [Tue, 16 Feb 2021 18:21:19 +0000 (19:21 +0100)]
Rollup merge of #82161 - jesusprubio:add-long-explanation-e0545, r=GuillaumeGomez

Add long explanation for E0545

Helps with #61137

3 years agoRollup merge of #82160 - pierwill:patch-2, r=lcnr
Guillaume Gomez [Tue, 16 Feb 2021 18:21:18 +0000 (19:21 +0100)]
Rollup merge of #82160 - pierwill:patch-2, r=lcnr

Fix typo in rustc_infer::infer::UndoLog

Also use double quotes.

3 years agoRollup merge of #82145 - GuillaumeGomez:es5-checks, r=Nemo157
Guillaume Gomez [Tue, 16 Feb 2021 18:21:14 +0000 (19:21 +0100)]
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`

3 years agoAuto merge of #82150 - RalfJung:miri, r=RalfJung
bors [Tue, 16 Feb 2021 16:22:56 +0000 (16:22 +0000)]
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

3 years agoReplace File::create and write_all with fs::write
est31 [Tue, 16 Feb 2021 07:09:07 +0000 (08:09 +0100)]
Replace File::create and write_all with fs::write

Also don't convert to u8 buffers and back
when we are only creating strings.

3 years ago[Minor] Update discriminant_value docs
Peter Todd [Tue, 16 Feb 2021 13:16:31 +0000 (08:16 -0500)]
[Minor] Update discriminant_value docs

3 years agoupdate Miri
Ralf Jung [Tue, 16 Feb 2021 10:17:42 +0000 (11:17 +0100)]
update Miri

3 years agoadd test
Ralf Jung [Tue, 16 Feb 2021 10:14:34 +0000 (11:14 +0100)]
add test

3 years agovalidation: fix invalid-fn-ptr error message
Ralf Jung [Tue, 16 Feb 2021 08:57:21 +0000 (09:57 +0100)]
validation: fix invalid-fn-ptr error message

3 years agoAuto merge of #82058 - gilescope:to_digit_speedup, r=lcnr
bors [Tue, 16 Feb 2021 08:38:11 +0000 (08:38 +0000)]
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!

3 years agoDocument that `assert!` format arguments are evaluated lazily
Teddy Katz [Tue, 16 Feb 2021 02:06:00 +0000 (21:06 -0500)]
Document that `assert!` format arguments are evaluated lazily

It can be useful to do some computation in `assert!` format arguments, in order to get better error messages. For example:

```rust
assert!(
    some_condition,
    "The state is invalid. Details: {}",
    expensive_call_to_get_debugging_info(),
);
```

It seems like `assert!` only evaluates the format arguments if the assertion fails, which is useful but doesn't appear to be documented anywhere. This PR documents the behavior and adds some tests.

3 years agoAuto merge of #81734 - richkadel:fixfordash, r=pnkfelix
bors [Tue, 16 Feb 2021 05:45:10 +0000 (05:45 +0000)]
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`

3 years agoUpdate w/ comments
kadmin [Sun, 14 Feb 2021 04:35:18 +0000 (04:35 +0000)]
Update w/ comments

3 years agoUse iter::position in truncate_capture_for_move
Aman Arora [Sat, 13 Feb 2021 06:59:35 +0000 (01:59 -0500)]
Use iter::position in truncate_capture_for_move

3 years agoTreat read of COpy types via refs as not move in move-closure
Aman Arora [Fri, 12 Feb 2021 00:36:05 +0000 (19:36 -0500)]
Treat read of COpy types via refs as not move in move-closure

3 years agoHandle restricting closure origin
Aman Arora [Tue, 9 Feb 2021 04:31:26 +0000 (23:31 -0500)]
Handle restricting closure origin

3 years agoImplement reborrow for closure captures
Aman Arora [Thu, 4 Feb 2021 07:12:31 +0000 (02:12 -0500)]
Implement reborrow for closure captures

3 years agoAuto merge of #82153 - jonas-schievink:rollup-ls5r943, r=jonas-schievink
bors [Tue, 16 Feb 2021 02:14:13 +0000 (02:14 +0000)]
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 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoInline try_get_cached
Tomasz Miąsko [Tue, 16 Feb 2021 00:00:00 +0000 (00:00 +0000)]
Inline try_get_cached

3 years agoavoid full-slicing slices
Matthias Krüger [Mon, 15 Feb 2021 23:30:06 +0000 (00:30 +0100)]
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

3 years agoRemove HirItemLike.
Camille GILLOT [Mon, 1 Feb 2021 10:32:26 +0000 (11:32 +0100)]
Remove HirItemLike.

3 years agoTrait impls are Items, therefore HIR owners.
Camille GILLOT [Mon, 1 Feb 2021 10:12:49 +0000 (11:12 +0100)]
Trait impls are Items, therefore HIR owners.

3 years agoUse less HirId when referring to items.
Camille GILLOT [Sun, 31 Jan 2021 17:21:04 +0000 (18:21 +0100)]
Use less HirId when referring to items.

3 years agoOnly store a LocalDefId in hir::MacroDef.
Camille GILLOT [Sun, 31 Jan 2021 17:20:18 +0000 (18:20 +0100)]
Only store a LocalDefId in hir::MacroDef.

3 years agoIndex Modules using their LocalDefId.
Camille GILLOT [Sun, 31 Jan 2021 16:58:57 +0000 (17:58 +0100)]
Index Modules using their LocalDefId.

3 years agoFix E0657.
Camille GILLOT [Sun, 31 Jan 2021 10:01:49 +0000 (11:01 +0100)]
Fix E0657.

3 years agoOnly store a LocalDefId in hir::ForeignItem.
Camille GILLOT [Sun, 31 Jan 2021 23:33:38 +0000 (00:33 +0100)]
Only store a LocalDefId in hir::ForeignItem.

3 years agoOnly store a LocalDefId in hir::ImplItem.
Camille GILLOT [Sat, 30 Jan 2021 22:25:03 +0000 (23:25 +0100)]
Only store a LocalDefId in hir::ImplItem.

3 years agoOnly store a LocalDefId in hir::TraitItem.
Camille GILLOT [Sat, 30 Jan 2021 19:46:50 +0000 (20:46 +0100)]
Only store a LocalDefId in hir::TraitItem.

3 years agoOnly store a LocalDefId in hir::Item.
Camille GILLOT [Sat, 30 Jan 2021 16:47:51 +0000 (17:47 +0100)]
Only store a LocalDefId in hir::Item.

Items are guaranteed to be HIR owner.

3 years agoUse an ItemId inside mir::GlobalAsm.
Camille GILLOT [Sat, 30 Jan 2021 18:18:48 +0000 (19:18 +0100)]
Use an ItemId inside mir::GlobalAsm.

3 years agoUse ItemId as a strongly typed index.
Camille GILLOT [Sat, 30 Jan 2021 11:06:04 +0000 (12:06 +0100)]
Use ItemId as a strongly typed index.

3 years agoAdd assertions on HIR enum sizes.
Camille GILLOT [Fri, 29 Jan 2021 18:27:56 +0000 (19:27 +0100)]
Add assertions on HIR enum sizes.

3 years agoRemove useless Named trait.
Camille GILLOT [Sat, 30 Jan 2021 10:28:28 +0000 (11:28 +0100)]
Remove useless Named trait.

3 years agoAdd long explanation for E0545
Jesus Rubio [Mon, 15 Feb 2021 18:16:39 +0000 (19:16 +0100)]
Add long explanation for E0545

3 years agoSimplify pattern grammar by allowing nested leading vert
mark [Mon, 8 Feb 2021 02:40:33 +0000 (20:40 -0600)]
Simplify pattern grammar by allowing nested leading vert

Along the way, we also implement a handful of diagnostics improvements
and fixes, particularly with respect to the special handling of `||` in
place of `|` and when there are leading verts in function params, which
don't allow top-level or-patterns anyway.

3 years agoFix typo in rustc_infer::infer::UndoLog
pierwill [Mon, 15 Feb 2021 18:02:03 +0000 (10:02 -0800)]
Fix typo in rustc_infer::infer::UndoLog

Also use double quotes.

3 years agoRollup merge of #82147 - lnicola:rust-analyzer-2021-02-15, r=jonas-schievink
Jonas Schievink [Mon, 15 Feb 2021 15:07:12 +0000 (16:07 +0100)]
Rollup merge of #82147 - lnicola:rust-analyzer-2021-02-15, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #82141 - jrvanwhy:issue-82052, r=sanxiyn
Jonas Schievink [Mon, 15 Feb 2021 15:07:11 +0000 (16:07 +0100)]
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``

3 years agoRollup merge of #82133 - ehuss:extern-prelude-link, r=jyn514
Jonas Schievink [Mon, 15 Feb 2021 15:07:10 +0000 (16:07 +0100)]
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.

3 years agoRollup merge of #82129 - est31:master, r=jyn514
Jonas Schievink [Mon, 15 Feb 2021 15:07:09 +0000 (16:07 +0100)]
Rollup merge of #82129 - est31:master, r=jyn514

Remove redundant bool_to_option feature gate

3 years agoRollup merge of #82120 - sfackler:arguments-as-str, r=dtolnay
Jonas Schievink [Mon, 15 Feb 2021 15:07:08 +0000 (16:07 +0100)]
Rollup merge of #82120 - sfackler:arguments-as-str, r=dtolnay

Stabilize Arguments::as_str

Closes #74442

3 years agoRollup merge of #82119 - m-ou-se:typo, r=dtolnay
Jonas Schievink [Mon, 15 Feb 2021 15:07:06 +0000 (16:07 +0100)]
Rollup merge of #82119 - m-ou-se:typo, r=dtolnay

Fix typo in link to CreateSymbolicLinkW documentation.

3 years agoRollup merge of #82118 - lukaslueg:env_decl, r=m-ou-se
Jonas Schievink [Mon, 15 Feb 2021 15:07:05 +0000 (16:07 +0100)]
Rollup merge of #82118 - lukaslueg:env_decl, r=m-ou-se

Add missing env!-decl variant

Resolves #82117

3 years agoRollup merge of #82107 - petrochenkov:minexpclean, r=Aaron1011
Jonas Schievink [Mon, 15 Feb 2021 15:07:04 +0000 (16:07 +0100)]
Rollup merge of #82107 - petrochenkov:minexpclean, r=Aaron1011

expand: Some cleanup

See individual commits for details.

r? ``@Aaron1011``

3 years agoRollup merge of #82106 - jyn514:cleanup-bootstrap, r=Mark-Simulacrum
Jonas Schievink [Mon, 15 Feb 2021 15:07:02 +0000 (16:07 +0100)]
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, `&[]`.

3 years agoRollup merge of #82096 - TaKO8Ki:fix-typo, r=GuillaumeGomez
Jonas Schievink [Mon, 15 Feb 2021 15:07:01 +0000 (16:07 +0100)]
Rollup merge of #82096 - TaKO8Ki:fix-typo, r=GuillaumeGomez

Fix a typo

This pull request fixes a typo.

3 years agoRollup merge of #82077 - pierwill:edit-droparena, r=lcnr
Jonas Schievink [Mon, 15 Feb 2021 15:07:00 +0000 (16:07 +0100)]
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

3 years agoRollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obk
Jonas Schievink [Mon, 15 Feb 2021 15:06:59 +0000 (16:06 +0100)]
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``

3 years agoRollup merge of #82063 - NULLx76:fix-minor-typo, r=jonas-schievink
Jonas Schievink [Mon, 15 Feb 2021 15:06:58 +0000 (16:06 +0100)]
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.

3 years agoRollup merge of #82061 - RalfJung:ctfe-read-pointer-as-bytes, r=oli-obk
Jonas Schievink [Mon, 15 Feb 2021 15:06:57 +0000 (16:06 +0100)]
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

3 years agoRollup merge of #82060 - taiki-e:typo, r=m-ou-se
Jonas Schievink [Mon, 15 Feb 2021 15:06:56 +0000 (16:06 +0100)]
Rollup merge of #82060 - taiki-e:typo, r=m-ou-se

Fix typos in BTreeSet::{first, last} docs

map -> set