]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAdd associated consts MIN/MAX for Wrapping<Int>
Lzu Tao [Mon, 1 Jun 2020 17:03:47 +0000 (17:03 +0000)]
Add associated consts MIN/MAX for Wrapping<Int>

4 years agoAuto merge of #72844 - Dylan-DPC:rollup-i51qv5z, r=Dylan-DPC
bors [Mon, 1 Jun 2020 05:21:50 +0000 (05:21 +0000)]
Auto merge of #72844 - Dylan-DPC:rollup-i51qv5z, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #72776 (fulfill: try using SmallVec or Box for stalled_on)
 - #72818 (Clean up E0622 explanation)
 - #72823 (Add descriptions for all queries)
 - #72832 (RELEASES.md: Expand `cargo tree` note to mention `cargo tree -d`)
 - #72834 (Rephrase term 'non-pointer type')

Failed merges:

r? @ghost

4 years agoRollup merge of #72834 - JOE1994:correct_confusing_term, r=sfackler
Dylan DPC [Mon, 1 Jun 2020 01:14:16 +0000 (03:14 +0200)]
Rollup merge of #72834 - JOE1994:correct_confusing_term, r=sfackler

Rephrase term 'non-pointer type'

Hello :cat2: ,

If the reader assumes that 'pointer type's include 'smart pointer's,
the term 'non-pointer type' could mislead the reader to assume that
x should not be a smart pointer type. I tried to rephrase the term
'non-pointer type' to remove ambiguity in the doc comments.

closes #72335

Thank you for reviewing this PR! :superhero_woman:

4 years agoRollup merge of #72832 - joshtriplett:cargo-tree-d, r=Mark-Simulacrum
Dylan DPC [Mon, 1 Jun 2020 01:14:14 +0000 (03:14 +0200)]
Rollup merge of #72832 - joshtriplett:cargo-tree-d, r=Mark-Simulacrum

RELEASES.md: Expand `cargo tree` note to mention `cargo tree -d`

Useful feature that people might not automatically associate with `cargo
tree`.

4 years agoRollup merge of #72823 - matthewjasper:describe-queries, r=eddyb
Dylan DPC [Mon, 1 Jun 2020 01:14:12 +0000 (03:14 +0200)]
Rollup merge of #72823 - matthewjasper:describe-queries, r=eddyb

Add descriptions for all queries

This also removes the default description for queries with DefId keys and makes the macro validate that a description is provided.

cc  #72730
r? @eddyb

4 years agoRollup merge of #72818 - GuillaumeGomez:cleanup-e0622, r=Dylan-DPC
Dylan DPC [Mon, 1 Jun 2020 01:14:10 +0000 (03:14 +0200)]
Rollup merge of #72818 - GuillaumeGomez:cleanup-e0622, r=Dylan-DPC

Clean up E0622 explanation

r? @Dylan-DPC

4 years agoRollup merge of #72776 - lcnr:stalled_on-smallvec, r=nnethercote
Dylan DPC [Mon, 1 Jun 2020 01:14:05 +0000 (03:14 +0200)]
Rollup merge of #72776 - lcnr:stalled_on-smallvec, r=nnethercote

fulfill: try using SmallVec or Box for stalled_on

Tested both `Box` and `SmallVec` for `stalled_on`, with both resulting in a perf loss.
Adds a comment mentioning this and removes an now outdated FIXME.

Logging the length of `stalled_on` resulted in the following distribution while building a part of stage 1 libs:
```
22627647 counts:
(  1) 20983696 (92.7%, 92.7%): process_obligation_len: 1
(  2)   959711 ( 4.2%, 97.0%): process_obligation_len: 2
(  3)   682326 ( 3.0%,100.0%): process_obligation_len: 0
(  4)     1914 ( 0.0%,100.0%): process_obligation_len: 3
```
cc @eddyb
r? @nnethercote

4 years agoAuto merge of #72831 - Dylan-DPC:rollup-6rxjwt9, r=Dylan-DPC
bors [Sun, 31 May 2020 20:58:56 +0000 (20:58 +0000)]
Auto merge of #72831 - Dylan-DPC:rollup-6rxjwt9, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #72691 (Fix escape key handling)
 - #72807 (Avoid setting wrong obligation cause span of associated type mismatch)
 - #72812 (Miri tests: skip parts of test_char_range)
 - #72829 (Clarify terms in doc comments)
 - #72830 (Fix release notes for niche initialization change)

Failed merges:

r? @ghost

4 years agoRephrase term 'non-pointer type'
JOE1994 [Sun, 31 May 2020 19:58:06 +0000 (15:58 -0400)]
Rephrase term 'non-pointer type'
If the reader assumes that 'pointer type's include 'smart pointer's,
the term 'non-pointer type' could mislead the reader to assume that
x should not be a smart pointer type. I tried to rephrase the term
'non-pointer type' to remove ambiguity in the doc comments.

closes #72335

Thank you for reviewing this PR! :)

4 years agoRELEASES.md: Expand `cargo tree` note to mention `cargo tree -d`
Josh Triplett [Sun, 31 May 2020 19:39:28 +0000 (12:39 -0700)]
RELEASES.md: Expand `cargo tree` note to mention `cargo tree -d`

Useful feature that people might not automatically associate with `cargo
tree`.

4 years agoRollup merge of #72830 - rust-lang:sfackler-patch-1, r=Mark-Simulacrum
Dylan DPC [Sun, 31 May 2020 19:30:06 +0000 (21:30 +0200)]
Rollup merge of #72830 - rust-lang:sfackler-patch-1, r=Mark-Simulacrum

Fix release notes for niche initialization change

MaybeUninit is not affected by the linked PR.

4 years agoRollup merge of #72829 - JOE1994:clarify_terms, r=jonas-schievink
Dylan DPC [Sun, 31 May 2020 19:30:05 +0000 (21:30 +0200)]
Rollup merge of #72829 - JOE1994:clarify_terms, r=jonas-schievink

Clarify terms in doc comments

Doc comments of `copy_from_slice` say that people should use `clone_from_slice`
when 'src' doesn't implement `Copy`. However, 'src' is a reference and
it always implements `Copy`. The term 'src' should be fixed to `T`(element type of slice 'src') in
the doc comments.

Thank you for reviewing this PR :)  :smiley_cat:

4 years agoRollup merge of #72812 - RalfJung:miri-char-test, r=jonas-schievink
Dylan DPC [Sun, 31 May 2020 19:30:03 +0000 (21:30 +0200)]
Rollup merge of #72812 - RalfJung:miri-char-test, r=jonas-schievink

Miri tests: skip parts of test_char_range

The new `test_char_range` test takes forever in Miri as it loops over all values of `char`. This makes it skip most of them when being run in Miri.

4 years agoRollup merge of #72807 - xiaotianrandom:fix-assoc-type-diagnostics, r=estebank
Dylan DPC [Sun, 31 May 2020 19:30:01 +0000 (21:30 +0200)]
Rollup merge of #72807 - xiaotianrandom:fix-assoc-type-diagnostics, r=estebank

Avoid setting wrong obligation cause span of associated type mismatch

Removes code that sets wrong obligation cause span of associated type mismatch. See the linked issue for details.

Closes #72806.

4 years agoRollup merge of #72691 - GuillaumeGomez:escape-key-handling, r=kinnison
Dylan DPC [Sun, 31 May 2020 19:30:00 +0000 (21:30 +0200)]
Rollup merge of #72691 - GuillaumeGomez:escape-key-handling, r=kinnison

Fix escape key handling

Fixes #72647.

The problem was that you could have a timeout just after the moment you press "escape", putting back the results.

r? @kinnison

4 years agoAdd descriptions for all queries
Matthew Jasper [Sun, 31 May 2020 15:11:51 +0000 (16:11 +0100)]
Add descriptions for all queries

4 years agoFix release notes for niche initialization change
Steven Fackler [Sun, 31 May 2020 18:51:08 +0000 (14:51 -0400)]
Fix release notes for niche initialization change

MaybeUninit is not affected by the linked PR.

4 years agoClarify terms in doc comments
JOE1994 [Sun, 31 May 2020 18:37:26 +0000 (14:37 -0400)]
Clarify terms in doc comments
Doc comments of 'copy_from_slice' say that people should use 'clone_from_slice'
when 'src' doesn't implement 'Copy'. However, 'src' is a reference and
it always implements 'Copy'. The term 'src' should be fixed to 'T' in
the doc comments.

Thank you for reviewing this PR :)

4 years agoAuto merge of #72767 - pnkfelix:track-devirtualized-filenames-issue-70924, r=eddyb
bors [Sun, 31 May 2020 17:14:44 +0000 (17:14 +0000)]
Auto merge of #72767 - pnkfelix:track-devirtualized-filenames-issue-70924, r=eddyb

Track devirtualized filenames

Split payload of FileName::Real to track both real and virtualized paths.

(Such splits arise from metadata refs into libstd; the virtualized paths look like `/rustc/1.45.0/src/libstd/io/cursor.rs` rather than `/Users/felixklock/Dev/Mozilla/rust.git/src/libstd/io/cursor.rs`)

This way, we can emit the virtual name into things like the like the StableSourceFileId (as was done back before PR #70642) that ends up in incremental build artifacts, while still using the devirtualized file path when we want to access the file.

Fix #70924

4 years agoAuto merge of #72813 - RalfJung:rollup-4ko6q8j, r=RalfJung
bors [Sun, 31 May 2020 13:39:05 +0000 (13:39 +0000)]
Auto merge of #72813 - RalfJung:rollup-4ko6q8j, r=RalfJung

Rollup of 5 pull requests

Successful merges:

 - #72683 (from_u32_unchecked: check validity, and fix UB in Wtf8)
 - #72715 (Account for trailing comma when suggesting `where` clauses)
 - #72745 (generalize Borrow<[T]> for Interned<'tcx, List<T>>)
 - #72749 (Update stdarch submodule to latest head)
 - #72781 (Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`)

Failed merges:

r? @ghost

4 years agoPut input timeout clearance inside a function
Guillaume Gomez [Sun, 31 May 2020 12:27:33 +0000 (14:27 +0200)]
Put input timeout clearance inside a function

4 years agoClean up E0622 explanation
Guillaume Gomez [Sun, 31 May 2020 12:09:15 +0000 (14:09 +0200)]
Clean up E0622 explanation

4 years agoMiri tests: skip parts of test_char_range
Ralf Jung [Sun, 31 May 2020 09:58:15 +0000 (11:58 +0200)]
Miri tests: skip parts of test_char_range

4 years agoRollup merge of #72781 - marmeladema:rustdoc-def-id-resolve-str-path-error, r=petroch...
Ralf Jung [Sun, 31 May 2020 10:03:30 +0000 (12:03 +0200)]
Rollup merge of #72781 - marmeladema:rustdoc-def-id-resolve-str-path-error, r=petrochenkov

Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`

Together with https://github.com/rust-lang/rust/pull/72777 this should remove all uses of `NodeId` in `rustdoc`.

cc #50928

r? @petrochenkov

4 years agoRollup merge of #72749 - vertexclique:vcq/update-stdarch, r=Amanieu
Ralf Jung [Sun, 31 May 2020 10:03:28 +0000 (12:03 +0200)]
Rollup merge of #72749 - vertexclique:vcq/update-stdarch, r=Amanieu

Update stdarch submodule to latest head

Includes avx512 work & aarch64 tme.

4 years agoRollup merge of #72745 - lcnr:interned-cleanup, r=petrochenkov
Ralf Jung [Sun, 31 May 2020 10:03:26 +0000 (12:03 +0200)]
Rollup merge of #72745 - lcnr:interned-cleanup, r=petrochenkov

generalize Borrow<[T]> for Interned<'tcx, List<T>>

4 years agoRollup merge of #72715 - estebank:trailing-comma-where, r=petrochenkov
Ralf Jung [Sun, 31 May 2020 10:03:24 +0000 (12:03 +0200)]
Rollup merge of #72715 - estebank:trailing-comma-where, r=petrochenkov

Account for trailing comma when suggesting `where` clauses

Fix #72693.

4 years agoRollup merge of #72683 - RalfJung:char-debug-check, r=Mark-Simulacrum
Ralf Jung [Sun, 31 May 2020 10:03:22 +0000 (12:03 +0200)]
Rollup merge of #72683 - RalfJung:char-debug-check, r=Mark-Simulacrum

from_u32_unchecked: check validity, and fix UB in Wtf8

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

4 years agoAuto merge of #72759 - alexcrichton:update-compiler-builtins, r=Mark-Simulacrum
bors [Sun, 31 May 2020 09:54:44 +0000 (09:54 +0000)]
Auto merge of #72759 - alexcrichton:update-compiler-builtins, r=Mark-Simulacrum

Update compiler-builtins

Pulls in a fix for #72758, more details on the linked issue.

[Crate changes included here][changes]

[changes]: https://github.com/rust-lang/compiler-builtins/compare/0.1.28...0.1.31

Closes #72758

4 years agoremove fixme for `stalled_on`
Bastian Kauschke [Sun, 31 May 2020 07:58:28 +0000 (09:58 +0200)]
remove fixme for `stalled_on`

4 years agoAuto merge of #72743 - lcnr:predicate_f, r=nikomatsakis
bors [Sun, 31 May 2020 04:44:38 +0000 (04:44 +0000)]
Auto merge of #72743 - lcnr:predicate_f, r=nikomatsakis

fix EncodeWithShorthand for Predicate

r? @nikomatsakis

4 years agoFix associate type diagnostics
XIAO Tian [Sat, 30 May 2020 03:26:46 +0000 (11:26 +0800)]
Fix associate type diagnostics

4 years agoAdd a test for wrong assoc type diagnostics
XIAO Tian [Sat, 30 May 2020 03:28:33 +0000 (11:28 +0800)]
Add a test for wrong assoc type diagnostics

4 years agoAuto merge of #72116 - petrhosek:fuchsia-ld-flags, r=tmandry
bors [Sun, 31 May 2020 01:07:37 +0000 (01:07 +0000)]
Auto merge of #72116 - petrhosek:fuchsia-ld-flags, r=tmandry

Update the Fuchsia linker defaults

This updates the linker defaults aligning them with Clang. Specifically,
we use 4K pages on all platforms, we always use BIND_NOW, we prefer all
loadable segments be separate and page aligned, and we support RELR
relocations.

4 years agoUpdate stdarch submodule to latest head
Mahmut Bulut [Fri, 29 May 2020 18:28:18 +0000 (20:28 +0200)]
Update stdarch submodule to latest head

4 years agoAuto merge of #72794 - RalfJung:rollup-gzs4nl4, r=RalfJung
bors [Sat, 30 May 2020 21:23:19 +0000 (21:23 +0000)]
Auto merge of #72794 - RalfJung:rollup-gzs4nl4, r=RalfJung

Rollup of 13 pull requests

Successful merges:

 - #72543 (Account for missing lifetime in opaque and trait object return types)
 - #72625 (Improve inline asm error diagnostics)
 - #72637 (expand `env!` with def-site context)
 - #72650 (Sort sidebar elements)
 - #72657 (Allow types (with lifetimes/generics) in impl_lint_pass)
 - #72666 (Add -Z profile-emit=<path> for Gcov gcda output.)
 - #72668 (Fix missing parentheses Fn notation error)
 - #72669 (rustc_session: Cleanup session creation)
 - #72728 (Make bootstrap aware of relative libdir in stage0 compiler)
 - #72757 (rustc_lexer: Optimize shebang detection slightly)
 - #72772 (miri validation: clarify valid values of 'char')
 - #72773 (Fix is_char_boundary documentation)
 - #72777 (rustdoc: remove calls to `local_def_id_from_node_id`)

Failed merges:

r? @ghost

4 years agoRollup merge of #72777 - marmeladema:rustdoc-remove-local-def-id-from-node-id, r...
Ralf Jung [Sat, 30 May 2020 21:09:04 +0000 (23:09 +0200)]
Rollup merge of #72777 - marmeladema:rustdoc-remove-local-def-id-from-node-id, r=petrochenkov

rustdoc: remove calls to `local_def_id_from_node_id`

rustdoc calls `local_def_id_from_node_id(CRATE_NODE_ID)` when it can just creates a top level `DefId` using `DefId::local(CRATE_DEF_INDEX)`.

cc #50928

r? @petrochenkov

4 years agoRollup merge of #72773 - Rantanen:is_char_boundary-docs, r=joshtriplett
Ralf Jung [Sat, 30 May 2020 21:09:02 +0000 (23:09 +0200)]
Rollup merge of #72773 - Rantanen:is_char_boundary-docs, r=joshtriplett

Fix is_char_boundary documentation

Given the "start _and/or end_" wording in the original, the way I understood it was that the `str::is_char_boundary` method would also return `true` for the last byte in a UTF-8 code point sequence. (Which would have meant that for a string consisting of nothing but 1 and 2 byte UTF-8 code point sequences, it would return nothing but `true`.)

In practice the method returns `true` only for the starting byte of each sequence and the end of the string: [Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e9f5fc4d6bf2f1bf57a75f3c9a180770)

I was also somewhat tempted to remove the _The start and end of the string are considered to be boundaries_, since that's implied by the first sentence, but I decided to avoid bikeshedding over it and left it as it was since it's not wrong in relation to how the method behaves.

4 years agoRollup merge of #72772 - RalfJung:valid-char, r=petrochenkov
Ralf Jung [Sat, 30 May 2020 21:09:00 +0000 (23:09 +0200)]
Rollup merge of #72772 - RalfJung:valid-char, r=petrochenkov

miri validation: clarify valid values of 'char'

The old text said "expected a valid unicode codepoint", which is not actually correct -- it has to be a scalar value (which is a code point that is not part of a surrogate pair).

4 years agoRollup merge of #72757 - petrochenkov:shebang, r=varkor
Ralf Jung [Sat, 30 May 2020 21:08:58 +0000 (23:08 +0200)]
Rollup merge of #72757 - petrochenkov:shebang, r=varkor

rustc_lexer: Optimize shebang detection slightly

Sorry, I just couldn't resist.
It shouldn't make any difference in practice.

Also, documented a previously unnoticed case with doc comments treated as regular comments during shebang detection.

4 years agoRollup merge of #72728 - o01eg:fix-72661, r=Mark-Simulacrum
Ralf Jung [Sat, 30 May 2020 21:08:57 +0000 (23:08 +0200)]
Rollup merge of #72728 - o01eg:fix-72661, r=Mark-Simulacrum

Make bootstrap aware of relative libdir in stage0 compiler

Follows up #72692

Fixes #72661

4 years agoRollup merge of #72669 - petrochenkov:smclean, r=Mark-Simulacrum
Ralf Jung [Sat, 30 May 2020 21:08:55 +0000 (23:08 +0200)]
Rollup merge of #72669 - petrochenkov:smclean, r=Mark-Simulacrum

rustc_session: Cleanup session creation

Noticed while reviewing https://github.com/rust-lang/rust/pull/72618.

4 years agoRollup merge of #72668 - awoimbee:give-fn-parenthetical-notation-parentheses, r=estebank
Ralf Jung [Sat, 30 May 2020 21:08:53 +0000 (23:08 +0200)]
Rollup merge of #72668 - awoimbee:give-fn-parenthetical-notation-parentheses, r=estebank

Fix missing parentheses Fn notation error

Fixes  #72611
Well, fixes the error output, I think E0658 is the right error to throw in this case so I didn't change that

4 years agoRollup merge of #72666 - ivanloz:profile_emit_flag, r=matthewjasper
Ralf Jung [Sat, 30 May 2020 21:08:51 +0000 (23:08 +0200)]
Rollup merge of #72666 - ivanloz:profile_emit_flag, r=matthewjasper

Add -Z profile-emit=<path> for Gcov gcda output.

Adds a -Z flag to control the file path that the Gcov gcda output is
written to during runtime. This flag expects a path and filename, e.g.
-Z profile-emit=gcov/out/lib.gcda.

This works similar to GCC/Clang's -fprofile-dir flag which allows
control over the output path for gcda coverage files.

4 years agoRollup merge of #72657 - flip1995:impl_lint_pass-ty, r=matthewjasper
Ralf Jung [Sat, 30 May 2020 21:08:49 +0000 (23:08 +0200)]
Rollup merge of #72657 - flip1995:impl_lint_pass-ty, r=matthewjasper

Allow types (with lifetimes/generics) in impl_lint_pass

cc https://github.com/rust-lang/rust-clippy/pull/5279#discussion_r430790267

This allows to implement `LintPass` for types with lifetimes and/or generics. The only thing, I'm not sure of is the `LintPass::name` function, which now includes the lifetime(s) (which will be `'_` most of the time) in the name returned for the lint pass, if it exists. But I don't think that this should be a problem, since the `LintPass::name` is never used for output for the user (?).

4 years agoRollup merge of #72650 - GuillaumeGomez:sort-sidebar-elements, r=kinnison
Ralf Jung [Sat, 30 May 2020 21:08:47 +0000 (23:08 +0200)]
Rollup merge of #72650 - GuillaumeGomez:sort-sidebar-elements, r=kinnison

Sort sidebar elements

r? @kinnison

4 years agoRollup merge of #72637 - euclio:env-hygiene, r=davidtwco
Ralf Jung [Sat, 30 May 2020 21:08:46 +0000 (23:08 +0200)]
Rollup merge of #72637 - euclio:env-hygiene, r=davidtwco

expand `env!` with def-site context

Similar to #66349.

Fixes rust-lang/rust-clippy#5619.

4 years agoRollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkov
Ralf Jung [Sat, 30 May 2020 21:08:44 +0000 (23:08 +0200)]
Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkov

Improve inline asm error diagnostics

Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics.

The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code.

Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate.

Fixes #72664
Fixes #71639

r? @petrochenkov

### Old style

```rust
#![feature(llvm_asm)]

fn main() {
    unsafe {
        let _x: i32;
        llvm_asm!(
            "mov $0, $1
             invalid_instruction $0, $1
             mov $0, $1"
             : "=&r" (_x)
             : "r" (0)
             :: "intel"
        );
    }
}
```

```
error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction'
             invalid_instruction ecx, eax
             ^~~~~~~~~~~~~~~~~~~

  --> src/main.rs:6:9
   |
6  | /         llvm_asm!(
7  | |             "mov $0, $1
8  | |              invalid_instruction $0, $1
9  | |              mov $0, $1"
...  |
12 | |              :: "intel"
13 | |         );
   | |__________^
```

### New style

```rust
#![feature(asm)]

fn main() {
    unsafe {
        asm!(
            "mov {0}, {1}
             invalid_instruction {0}, {1}
             mov {0}, {1}",
            out(reg) _,
            in(reg) 0i64,
        );
    }
}
```

```
error: invalid instruction mnemonic 'invalid_instruction'
 --> test.rs:7:14
  |
7 |              invalid_instruction {0}, {1}
  |              ^
  |
note: instantiated into assembly here
 --> <inline asm>:3:14
  |
3 |              invalid_instruction rax, rcx
  |              ^^^^^^^^^^^^^^^^^^^
```

4 years agoRollup merge of #72543 - estebank:opaque-missing-lts-in-fn, r=nikomatsakis
Ralf Jung [Sat, 30 May 2020 21:08:42 +0000 (23:08 +0200)]
Rollup merge of #72543 - estebank:opaque-missing-lts-in-fn, r=nikomatsakis

Account for missing lifetime in opaque and trait object return types

When encountering an opaque closure return type that needs to bound a
lifetime to the function's arguments, including borrows and type params,
provide appropriate suggestions that lead to working code.

Get the user from

```rust
fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
where
    G: Get<T>
{
    move || {
        *dest = g.get();
    }
}
```

to

```rust
fn foo<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() +'a
where
    G: Get<T>
{
    move || {
        *dest = g.get();
    }
}
```

4 years agoTweak wording and spans of `'static` `dyn Trait`/`impl Trait` requirements
Esteban Küber [Thu, 28 May 2020 18:54:40 +0000 (11:54 -0700)]
Tweak wording and spans of `'static` `dyn Trait`/`impl Trait` requirements

4 years agoConsider all possible one letter lifetimes in suggestion
Esteban Küber [Wed, 27 May 2020 22:44:42 +0000 (15:44 -0700)]
Consider all possible one letter lifetimes in suggestion

4 years agoAccount for enclosing item when suggesting new lifetime name
Esteban Küber [Wed, 27 May 2020 22:33:23 +0000 (15:33 -0700)]
Account for enclosing item when suggesting new lifetime name

4 years agoTweak type parameter errors to reduce verbosity
Esteban Küber [Wed, 27 May 2020 18:15:58 +0000 (11:15 -0700)]
Tweak type parameter errors to reduce verbosity

4 years agoUpdate nll tests
Esteban Küber [Wed, 27 May 2020 00:22:47 +0000 (17:22 -0700)]
Update nll tests

4 years agoreview comment: tweak wording and account for span overlap
Esteban Küber [Wed, 27 May 2020 00:20:08 +0000 (17:20 -0700)]
review comment: tweak wording and account for span overlap

4 years agoAccount for returned `dyn Trait` evaluating to `'static` lifetime
Esteban Küber [Tue, 26 May 2020 20:13:19 +0000 (13:13 -0700)]
Account for returned `dyn Trait` evaluating to `'static` lifetime

Provide a suggestion for `dyn Trait + '_` when possible.

4 years agoFix NLL output
Esteban Küber [Sun, 24 May 2020 19:00:40 +0000 (12:00 -0700)]
Fix NLL output

4 years agoImprove output of argument anonymous borrow missing annotation involving opaque retur...
Esteban Küber [Sun, 24 May 2020 18:52:12 +0000 (11:52 -0700)]
Improve output of argument anonymous borrow missing annotation involving opaque return type

Go from

```
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> file8.rs:22:5
   |
22 | /     move || {
23 | |         *dest = g.get();
24 | |     }
   | |_____^
   |
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1...
  --> file8.rs:18:1
   |
18 | / fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
19 | | where
20 | |     G: Get<T>
21 | | {
...  |
24 | |     }
25 | | }
   | |_^
note: ...so that the types are compatible
  --> file8.rs:22:5
   |
22 | /     move || { //~ ERROR cannot infer an appropriate lifetime
23 | |         *dest = g.get();
24 | |     }
   | |_____^
   = note: expected  `&mut T`
              found  `&mut T`
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 18:8...
  --> file8.rs:18:8
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |        ^^
note: ...so that return value is valid for the call
  --> file8.rs:18:45
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^
```

to

```
error[E0621]: explicit lifetime required in the type of `dest`
  --> file8.rs:18:45
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                  ------     ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
   |                                  |
   |                                  help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T`
   ```

4 years agoAccount for missing lifetime in opaque return type
Esteban Küber [Sun, 24 May 2020 17:34:03 +0000 (10:34 -0700)]
Account for missing lifetime in opaque return type

When encountering an opaque closure return type that needs to bound a
lifetime to the function's arguments, including borrows and type params,
provide appropriate suggestions that lead to working code.

Get the user from

```rust
fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
where
    G: Get<T>
{
    move || {
        *dest = g.get();
    }
}
```

to

```rust
fn foo<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() +'a
where
    G: Get<T>
{
    move || {
        *dest = g.get();
    }
}
```

4 years agoTest ui suggestion fn trait notation
Arthur Woimbée [Sat, 30 May 2020 16:29:45 +0000 (18:29 +0200)]
Test ui suggestion fn trait notation

4 years agoFix missing parentheses Fn notation error
Arthur Woimbée [Wed, 27 May 2020 16:31:22 +0000 (18:31 +0200)]
Fix missing parentheses Fn notation error

4 years agoencode_utf8_raw is not always valid UTF-8; clarify comments
Ralf Jung [Sat, 30 May 2020 15:13:07 +0000 (17:13 +0200)]
encode_utf8_raw is not always valid UTF-8; clarify comments

4 years agoUse `LocalDefId` instead of `NodeId` in `resolve_str_path_error`
marmeladema [Sat, 30 May 2020 13:38:46 +0000 (14:38 +0100)]
Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`

4 years agoAuto merge of #72778 - RalfJung:rollup-f01z68m, r=RalfJung
bors [Sat, 30 May 2020 12:49:47 +0000 (12:49 +0000)]
Auto merge of #72778 - RalfJung:rollup-f01z68m, r=RalfJung

Rollup of 9 pull requests

Successful merges:

 - #72299 (more `LocalDefId`s)
 - #72368 (Resolve overflow behavior for RangeFrom)
 - #72441 (Fix ICE with explicit late-bound lifetimes)
 - #72499 (Override Box::<[T]>::clone_from)
 - #72521 (Properly handle InlineAsmOperand::SymFn when collecting monomorphized items)
 - #72540 (mir: adjust conditional in recursion limit check)
 - #72563 (multiple Return terminators are possible)
 - #72585 (Only capture tokens for items with outer attributes)
 - #72607 (Eagerly lower asm sub-expressions to HIR even if there is an error)

Failed merges:

r? @ghost

4 years agoadd fixme suggested by eddyb
Felix S Klock II [Sat, 30 May 2020 12:19:35 +0000 (08:19 -0400)]
add fixme suggested by eddyb

4 years agoRollup merge of #72607 - Amanieu:fix-72570, r=oli-obk
Ralf Jung [Sat, 30 May 2020 11:45:15 +0000 (13:45 +0200)]
Rollup merge of #72607 - Amanieu:fix-72570, r=oli-obk

Eagerly lower asm sub-expressions to HIR even if there is an error

Fixes #72570

r? @oli-obk

4 years agoRollup merge of #72585 - Aaron1011:feature/opt-item-tokens, r=petrochenkov
Ralf Jung [Sat, 30 May 2020 11:45:13 +0000 (13:45 +0200)]
Rollup merge of #72585 - Aaron1011:feature/opt-item-tokens, r=petrochenkov

Only capture tokens for items with outer attributes

Suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/43081#issuecomment-633389225

4 years agoRollup merge of #72563 - RalfJung:multi-return, r=matthewjasper
Ralf Jung [Sat, 30 May 2020 11:45:11 +0000 (13:45 +0200)]
Rollup merge of #72563 - RalfJung:multi-return, r=matthewjasper

multiple Return terminators are possible

@ecstatic-morse mentioned in https://github.com/rust-lang/rust/issues/72515 that multiple `Return` terminators are possible. Update the docs accordingly.

Cc @rust-lang/wg-mir-opt

4 years agoRollup merge of #72540 - davidtwco:issue-67552-mono-collector-comparison, r=varkor
Ralf Jung [Sat, 30 May 2020 11:45:10 +0000 (13:45 +0200)]
Rollup merge of #72540 - davidtwco:issue-67552-mono-collector-comparison, r=varkor

mir: adjust conditional in recursion limit check

Fixes #67552.

This PR adjusts the condition used in the recursion limit check of
the monomorphization collector, from `>` to `>=`.

In #67552, the test case had infinite indirect recursion, repeating a
handful of functions (from the perspective of the monomorphization
collector): `rec` -> `identity` -> `Iterator::count` -> `Iterator::fold`
-> `Iterator::next` -> `rec`.

During this process, `resolve_associated_item` was invoked for
`Iterator::fold` (during the construction of an `Instance`), and
ICE'd due to substitutions needing inference. However, previous
iterations of this recursion would have called this function for
`Iterator::fold` - and did! - and succeeded in doing so (trivially
checkable from debug logging, `()` is present where `_` is in the substs
of the failing execution).

The expected outcome of this test case would be a recursion limit error
(which is present when the `identity` fn indirection is removed), and
the recursion depth of `rec` is increasing (other functions finish
collecting their neighbours and thus have their recursion depths reset).

When the ICE occurs, the recursion depth of `rec` is 256 (which matches
the recursion limit), which suggests perhaps that a different part of
the compiler is using a `>=` comparison and returning a different result
on this recursion rather than what it returned in every previous
recursion, thus stopping the monomorphization collector from reporting
an error on the next recursion, where `recursion_depth_of_rec > 256`
would have been true.

With grep and some educated guesses, we can determine that
the recursion limit check at line 818 in
`src/librustc_trait_selection/traits/project.rs` is the other check that
is using a different comparison. Modifying either comparison to be `>` or
`>=` respectively will fix the error, but changing the monomorphization
collector produces the nicer error.

4 years agoRollup merge of #72521 - Amanieu:fix-72484, r=petrochenkov
Ralf Jung [Sat, 30 May 2020 11:45:08 +0000 (13:45 +0200)]
Rollup merge of #72521 - Amanieu:fix-72484, r=petrochenkov

Properly handle InlineAsmOperand::SymFn when collecting monomorphized items

Fixes #72484

4 years agoRollup merge of #72499 - mendess:master, r=dtolnay
Ralf Jung [Sat, 30 May 2020 11:45:06 +0000 (13:45 +0200)]
Rollup merge of #72499 - mendess:master, r=dtolnay

Override Box::<[T]>::clone_from

Avoid dropping and reallocating when cloning to an existing box if the lengths are the same.

It would be nice if this could also be specialized for `Copy` but I don't know how that works since it's not on stable. Will gladly look into it if it's deemed as a good idea.

This is my first PR with code, hope I did everything right :smile:

4 years agoRollup merge of #72441 - doctorn:late-bound-lifetime-ice, r=nikomatsakis
Ralf Jung [Sat, 30 May 2020 11:45:04 +0000 (13:45 +0200)]
Rollup merge of #72441 - doctorn:late-bound-lifetime-ice, r=nikomatsakis

Fix ICE with explicit late-bound lifetimes

Rather than returning an explicit late-bound lifetime as a generic argument count mismatch (which is not necessarily true), this PR propagates the presence of explicit late-bound lifetimes.

This avoids an ICE that can occur due to the presence of explicit late-bound lifetimes when building generic substitutions by explicitly ignoring them.

r? @varkor

cc @davidtwco (this removes a check you introduced in #60892)

Resolves #72278

4 years agoRollup merge of #72368 - CAD97:rangeto, r=dtolnay
Ralf Jung [Sat, 30 May 2020 11:45:02 +0000 (13:45 +0200)]
Rollup merge of #72368 - CAD97:rangeto, r=dtolnay

Resolve overflow behavior for RangeFrom

This specifies a documented unspecified implementation detail of `RangeFrom` and makes it consistently implement the specified behavior.

Specifically, `(u8::MAX).next()` is defined to cause an overflow, and resolve that overflow in the same manner as the `Step::forward` implementation.

The inconsistency that has existed is `<RangeFrom as Iterator>::nth`. The existing behavior should be plain to see after #69659: the skipping part previously always panicked if it caused an overflow, but the final step (to set up the state for further iteration) has always been debug-checked.

The inconsistency, then, is that `RangeFrom::nth` does not implement the same behavior as the naive (and default) implementation of just calling `next` multiple times. This PR aligns `RangeFrom::nth` to have identical behavior to the naive implementation. It also lines up with the standard behavior of primitive math in Rust everywhere else in the language: debug checked overflow.

cc @Amanieu

---

Followup to #69659. Closes #25708 (by documenting the panic as intended).

The documentation wording is preliminary and can probably be improved.

This will probably need an FCP, as it changes observable stable behavior.

4 years agoRollup merge of #72299 - lcnr:sized_help, r=petrochenkov
Ralf Jung [Sat, 30 May 2020 11:45:00 +0000 (13:45 +0200)]
Rollup merge of #72299 - lcnr:sized_help, r=petrochenkov

more `LocalDefId`s

4 years agorustdoc: remove calls to `local_def_id_from_node_id`
marmeladema [Sat, 30 May 2020 11:30:58 +0000 (12:30 +0100)]
rustdoc: remove calls to `local_def_id_from_node_id`

4 years agomore `LocalDefId`s
Bastian Kauschke [Sun, 17 May 2020 15:02:57 +0000 (17:02 +0200)]
more `LocalDefId`s

4 years agoalso expose and use encode_utf16_raw for wtf8
Ralf Jung [Sat, 30 May 2020 10:08:55 +0000 (12:08 +0200)]
also expose and use encode_utf16_raw for wtf8

4 years agowtf8: use encode_utf8_raw
Ralf Jung [Sat, 30 May 2020 09:53:50 +0000 (11:53 +0200)]
wtf8: use encode_utf8_raw

4 years agoexpose char::encode_utf8_raw for libstd
Ralf Jung [Sat, 30 May 2020 09:49:31 +0000 (11:49 +0200)]
expose char::encode_utf8_raw for libstd

4 years agomultiple Return terminators are possible
Ralf Jung [Mon, 25 May 2020 09:41:58 +0000 (11:41 +0200)]
multiple Return terminators are possible

4 years agoAuto merge of #72768 - JohnTitor:rollup-6kwokh6, r=JohnTitor
bors [Sat, 30 May 2020 07:56:05 +0000 (07:56 +0000)]
Auto merge of #72768 - JohnTitor:rollup-6kwokh6, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #72033 (Update RELEASES.md for 1.44.0)
 - #72162 (Add Extend::{extend_one,extend_reserve})
 - #72419 (Miri read_discriminant: return a scalar instead of raw underlying bytes)
 - #72621 (Don't bail out of trait selection when predicate references an error)
 - #72677 (Fix diagnostics for `@ ..` binding pattern in tuples and tuple structs)
 - #72710 (Add test to make sure -Wunused-crate-dependencies works with tests)
 - #72724 (Revert recursive `TokenKind::Interpolated` expansion for now)
 - #72741 (Remove unused mut from long-linker-command-lines test)
 - #72750 (Remove remaining calls to `as_local_node_id`)
 - #72752 (remove mk_bool)

Failed merges:

r? @ghost

4 years agomiri validation: clarify valid values of 'char'
Ralf Jung [Sat, 30 May 2020 07:33:05 +0000 (09:33 +0200)]
miri validation: clarify valid values of 'char'

4 years agoUse the virtual name for libstd files in StableSourceFileId and also in the
Felix S. Klock II [Fri, 29 May 2020 18:04:03 +0000 (14:04 -0400)]
Use the virtual name for libstd files in StableSourceFileId and also in the
encoded build artifacts.

Fix #70924.

4 years agoSplit payload of FileName::Real to track both real and virutalized paths.
Felix S. Klock II [Fri, 29 May 2020 15:31:55 +0000 (11:31 -0400)]
Split payload of FileName::Real to track both real and virutalized paths.

Such splits arise from metadata refs into libstd.

This way, we can (in a follow on commit) continue to emit the virtual name into
things like the like the StableSourceFileId that ends up in incremetnal build
artifacts, while still using the devirtualized file path when we want to access
the file.

Note that this commit is intended to be a refactoring; the actual fix to the bug
in question is in a follow-on commit.

4 years agoRollup merge of #72752 - lcnr:remove-mk_bool, r=estebank
Yuki Okushi [Sat, 30 May 2020 03:39:24 +0000 (12:39 +0900)]
Rollup merge of #72752 - lcnr:remove-mk_bool, r=estebank

remove mk_bool

4 years agoRollup merge of #72750 - marmeladema:remove-as-local-node-id, r=petrochenkov
Yuki Okushi [Sat, 30 May 2020 03:39:23 +0000 (12:39 +0900)]
Rollup merge of #72750 - marmeladema:remove-as-local-node-id, r=petrochenkov

Remove remaining calls to `as_local_node_id`

Split out from https://github.com/rust-lang/rust/pull/72552

cc https://github.com/rust-lang/rust/issues/50928

4 years agoRollup merge of #72741 - tmiasko:unused-mut, r=Mark-Simulacrum
Yuki Okushi [Sat, 30 May 2020 03:39:21 +0000 (12:39 +0900)]
Rollup merge of #72741 - tmiasko:unused-mut, r=Mark-Simulacrum

Remove unused mut from long-linker-command-lines test

4 years agoRollup merge of #72724 - Aaron1011:revert-tokenstream-expand, r=petrochenkov
Yuki Okushi [Sat, 30 May 2020 03:39:19 +0000 (12:39 +0900)]
Rollup merge of #72724 - Aaron1011:revert-tokenstream-expand, r=petrochenkov

Revert recursive `TokenKind::Interpolated` expansion for now

The crater run https://github.com/rust-lang/rust/issues/72622 revealed many root regressions, at least one of which is going to take some time to fix.

For now, let's revert https://github.com/rust-lang/rust/pull/72388 to allow the 709 affected crates to continue building on the latest nightly.

4 years agoRollup merge of #72710 - jsgf:unused-deps-test, r=jsgf
Yuki Okushi [Sat, 30 May 2020 03:39:18 +0000 (12:39 +0900)]
Rollup merge of #72710 - jsgf:unused-deps-test, r=jsgf

Add test to make sure -Wunused-crate-dependencies works with tests

Make sure code in `#[test]` blocks counts as a use of a crate.

4 years agoRollup merge of #72677 - chrissimpkins:fix-72574, r=estebank
Yuki Okushi [Sat, 30 May 2020 03:39:16 +0000 (12:39 +0900)]
Rollup merge of #72677 - chrissimpkins:fix-72574, r=estebank

Fix diagnostics for `@ ..` binding pattern in tuples and tuple structs

Fixes #72574
Associated https://github.com/rust-lang/rust/pull/72534 https://github.com/rust-lang/rust/issues/72373

Includes a new suggestion with `Applicability::MaybeIncorrect` confidence level.

### Before

#### tuple

```
error: `..` patterns are not allowed here
 --> src/main.rs:4:19
  |
4 |         (_a, _x @ ..) => {}
  |                   ^^
  |
  = note: only allowed in tuple, tuple struct, and slice patterns

error[E0308]: mismatched types
 --> src/main.rs:4:9
  |
3 |     match x {
  |           - this expression has type `({integer}, {integer}, {integer})`
4 |         (_a, _x @ ..) => {}
  |         ^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 2 elements
  |
  = note: expected tuple `({integer}, {integer}, {integer})`
             found tuple `(_, _)`

error: aborting due to 2 previous errors
```

#### tuple struct

```
error: `..` patterns are not allowed here
 --> src/main.rs:6:25
  |
6 |         Binder(_a, _x @ ..) => {}
  |                         ^^
  |
  = note: only allowed in tuple, tuple struct, and slice patterns

error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has 3 fields
 --> src/main.rs:6:9
  |
1 | struct Binder(i32, i32, i32);
  | ----------------------------- tuple struct defined here
...
6 |         Binder(_a, _x @ ..) => {}
  |         ^^^^^^^^^^^^^^^^^^^ expected 3 fields, found 2

error: aborting due to 2 previous errors
```

### After

*Note: final output edited during source review discussion, see thread for details*

#### tuple

```
error: `_x @` is not allowed in a tuple
 --> src/main.rs:4:14
  |
4 |         (_a, _x @ ..) => {}
  |              ^^^^^^^ is only allowed in a slice
  |
help: replace with `..` or use a different valid pattern
  |
4 |         (_a, ..) => {}
  |              ^^

error[E0308]: mismatched types
 --> src/main.rs:4:9
  |
3 |     match x {
  |           - this expression has type `({integer}, {integer}, {integer})`
4 |         (_a, _x @ ..) => {}
  |         ^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 1 element
  |
  = note: expected tuple `({integer}, {integer}, {integer})`
             found tuple `(_,)`

error: aborting due to 2 previous errors
```

#### tuple struct

```
error: `_x @` is not allowed in a tuple struct
 --> src/main.rs:6:20
  |
6 |         Binder(_a, _x @ ..) => {}
  |                    ^^^^^^^ is only allowed in a slice
  |
help: replace with `..` or use a different valid pattern
  |
6 |         Binder(_a, ..) => {}
  |                    ^^

error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 3 fields
 --> src/main.rs:6:9
  |
1 | struct Binder(i32, i32, i32);
  | ----------------------------- tuple struct defined here
...
6 |         Binder(_a, _x @ ..) => {}
  |         ^^^^^^^^^^^^^^^^^^^ expected 3 fields, found 1

error: aborting due to 2 previous errors
```

r? @estebank

4 years agoRollup merge of #72621 - Aaron1011:fix/trait-select-error, r=nikomatsakis
Yuki Okushi [Sat, 30 May 2020 03:39:14 +0000 (12:39 +0900)]
Rollup merge of #72621 - Aaron1011:fix/trait-select-error, r=nikomatsakis

Don't bail out of trait selection when predicate references an error

Fixes #72590

With PR #70551, observing a `ty::Error` guarantees that compilation is
going to fail. Therefore, there are no soundness impliciations to
continuing on when we encounter a `ty::Error` - we can only affect
whether or not additional error messags are emitted.

By not bailing out, we avoid incorrectly determining that types are
`!Sized` when a type error is present, which allows us to avoid emitting
additional spurious error messages.

The original comment mentioned this code being shared by coherence -
howver, this change resulted in no diagnostic changes in any of the
existing tests.

4 years agoRollup merge of #72419 - RalfJung:read-discriminant, r=oli-obk,eddyb
Yuki Okushi [Sat, 30 May 2020 03:39:12 +0000 (12:39 +0900)]
Rollup merge of #72419 - RalfJung:read-discriminant, r=oli-obk,eddyb

Miri read_discriminant: return a scalar instead of raw underlying bytes

r? @oli-obk @eddyb

4 years agoRollup merge of #72162 - cuviper:extend_one, r=Mark-Simulacrum
Yuki Okushi [Sat, 30 May 2020 03:39:10 +0000 (12:39 +0900)]
Rollup merge of #72162 - cuviper:extend_one, r=Mark-Simulacrum

Add Extend::{extend_one,extend_reserve}

This adds new optional methods on `Extend`: `extend_one` add a single
element to the collection, and `extend_reserve` pre-allocates space for
the predicted number of incoming elements. These are used in `Iterator`
for `partition` and `unzip` as they shuffle elements one-at-a-time into
their respective collections.

4 years agoRollup merge of #72033 - XAMPPRocky:relnotes-1.44.0, r=Mark-Simulacrum
Yuki Okushi [Sat, 30 May 2020 03:39:09 +0000 (12:39 +0900)]
Rollup merge of #72033 - XAMPPRocky:relnotes-1.44.0, r=Mark-Simulacrum

Update RELEASES.md for 1.44.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.44.0/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release

4 years ago`StableSourceFileId::new_from_pieces` does not need to be public.
Felix S. Klock II [Fri, 29 May 2020 15:47:17 +0000 (11:47 -0400)]
`StableSourceFileId::new_from_pieces` does not need to be public.

(and I want to discourage further use of it if possible.)

4 years agoAdd extend_one tracking issue 72631
Josh Stone [Tue, 26 May 2020 21:15:29 +0000 (14:15 -0700)]
Add extend_one tracking issue 72631

4 years agoRemove an old comment from HashMap::extend_reserve
Josh Stone [Tue, 26 May 2020 21:03:34 +0000 (14:03 -0700)]
Remove an old comment from HashMap::extend_reserve

4 years agoUse a canonical name for extend_reserve(additional)
Josh Stone [Tue, 26 May 2020 21:01:26 +0000 (14:01 -0700)]
Use a canonical name for extend_reserve(additional)

Co-authored-by: David Tolnay <dtolnay@gmail.com>
4 years agoAdd Extend::{extend_one,extend_reserve}
Josh Stone [Wed, 13 May 2020 03:09:55 +0000 (20:09 -0700)]
Add Extend::{extend_one,extend_reserve}

This adds new optional methods on `Extend`: `extend_one` add a single
element to the collection, and `extend_reserve` pre-allocates space for
the predicted number of incoming elements. These are used in `Iterator`
for `partition` and `unzip` as they shuffle elements one-at-a-time into
their respective collections.

4 years agoAuto merge of #72756 - RalfJung:rollup-tbjmtx2, r=RalfJung
bors [Fri, 29 May 2020 23:43:20 +0000 (23:43 +0000)]
Auto merge of #72756 - RalfJung:rollup-tbjmtx2, r=RalfJung

Rollup of 9 pull requests

Successful merges:

 - #67460 (Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes)
 - #71095 (impl From<[T; N]> for Box<[T]>)
 - #71500 (Make pointer offset methods/intrinsics const)
 - #71804 (linker: Support `-static-pie` and `-static -shared`)
 - #71862 (Implement RFC 2585: unsafe blocks in unsafe fn)
 - #72103 (borrowck `DefId` -> `LocalDefId`)
 - #72407 (Various minor improvements to Ipv6Addr::Display)
 - #72413 (impl Step for char (make Range*<char> iterable))
 - #72439 (NVPTX support for new asm!)

Failed merges:

r? @ghost