]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoPreserve the parent module of `DocFragment`s
Joshua Nelson [Sun, 4 Oct 2020 00:06:30 +0000 (20:06 -0400)]
Preserve the parent module of `DocFragment`s

- Add `parent_module` to `DocFragment`
- Require the `parent_module` of the item being inlined
- Preserve the hir_id for ExternCrates so rustdoc can find the parent module later
- Take an optional `parent_module` for `build_impl` and `merge_attrs`.
  Preserve the difference between parent modules for each doc-comment.
- Support arbitrarily many re-exports in from_ast. In retrospect this is
  probably not used and could be simplified to a single
  `Option<(Attrs, DefId)>`.
- Don't require the parent_module for all `impl`s, just inlined items

  In particular, this will be `None` whenever the attribute is not on a
  re-export.

- Only store the parent_module, not the HirId

  When re-exporting a re-export, the HirId is not available. Fortunately,
  `collect_intra_doc_links` doesn't actually need all the info from a
  HirId, just the parent module.

3 years agoAuto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk
bors [Wed, 7 Oct 2020 19:59:52 +0000 (19:59 +0000)]
Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk

Give `impl Trait` in a `const fn` its own feature gate

...previously it was gated under `#![feature(const_fn)]`.

I think we actually want to do this in all const-contexts? If so, this should be `#![feature(const_impl_trait)]` instead. I don't think there's any way to make use of `impl Trait` within a `const` initializer.

cc #77463

r? `@oli-obk`

3 years agoAuto merge of #77617 - AnthonyMikh:slice_windows_no_bounds_checking, r=lcnr
bors [Wed, 7 Oct 2020 17:31:56 +0000 (17:31 +0000)]
Auto merge of #77617 - AnthonyMikh:slice_windows_no_bounds_checking, r=lcnr

Eliminate bounds checking in slice::Windows

This is how `<core::slice::Windows as Iterator>::next` looks right now:

```rust
fn next(&mut self) -> Option<&'a [T]> {
    if self.size > self.v.len() {
        None
    } else {
        let ret = Some(&self.v[..self.size]);
        self.v = &self.v[1..];
        ret
    }
}
```

The line with `self.v = &self.v[1..];` relies on assumption that `self.v` is definitely not empty at this point. Else branch is taken when `self.size <= self.v.len()`, so `self.v` can be empty if `self.size` is zero. In practice, since `Windows` is never created directly but rather trough `[T]::windows` which panics when `size` is zero, `self.size` is never zero. However, the compiler doesn't know about this check, so it keeps the code which checks bounds and panics.

Using `NonZeroUsize` lets the compiler know about this invariant and reliably eliminate bounds checking without `unsafe` on `-O2`. Here is assembly of `Windows<'a, u32>::next` before and after this change ([goldbolt](https://godbolt.org/z/xrefzx)):

<details>
<summary>Before</summary>

```
example::next:
        push    rax
        mov     rcx, qword ptr [rdi + 8]
        mov     rdx, qword ptr [rdi + 16]
        cmp     rdx, rcx
        jbe     .LBB0_2
        xor     eax, eax
        pop     rcx
        ret
.LBB0_2:
        test    rcx, rcx
        je      .LBB0_5
        mov     rax, qword ptr [rdi]
        mov     rsi, rax
        add     rsi, 4
        add     rcx, -1
        mov     qword ptr [rdi], rsi
        mov     qword ptr [rdi + 8], rcx
        pop     rcx
        ret
.LBB0_5:
        lea     rdx, [rip + .L__unnamed_1]
        mov     edi, 1
        xor     esi, esi
        call    qword ptr [rip + core::slice::slice_index_order_fail@GOTPCREL]
        ud2

.L__unnamed_2:
        .ascii  "./example.rs"

.L__unnamed_1:
        .quad   .L__unnamed_2
        .asciz  "\f\000\000\000\000\000\000\000\016\000\000\000\027\000\000"
```

</details>

<details>
<summary>After</summary>

```
example::next:
        mov     rcx, qword ptr [rdi + 8]
        mov     rdx, qword ptr [rdi + 16]
        cmp     rdx, rcx
        jbe     .LBB0_2
        xor     eax, eax
        ret
.LBB0_2:
        mov     rax, qword ptr [rdi]
        lea     rsi, [rax + 4]
        add     rcx, -1
        mov     qword ptr [rdi], rsi
        mov     qword ptr [rdi + 8], rcx
        ret
```

</details>

Note the lack of call to `core::slice::slice_index_order_fail` in second snippet.

#### Possible reasons _not_ to merge this PR:

* this changes the error message on panic in `[T]::windows`. However, AFAIK this messages are not covered by backwards compatibility policy.

3 years agoAuto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, r=estebank
bors [Wed, 7 Oct 2020 15:37:47 +0000 (15:37 +0000)]
Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, r=estebank

resolve: improve "try using the enum's variant"

Fixes #73427.

This PR improves the "try using the enum's variant" suggestion:

- Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only   emitted for variants that have no fields (since the suggestion can't know what value fields would have).
- Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided.
- A help message is added which mentions the variants which are no longer suggested.

All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation.

r? `@estebank`

3 years agoAdd codegen test
AnthonyMikh [Tue, 6 Oct 2020 17:18:10 +0000 (20:18 +0300)]
Add codegen test

3 years agoAuto merge of #77595 - petrochenkov:asmident, r=oli-obk
bors [Wed, 7 Oct 2020 11:51:51 +0000 (11:51 +0000)]
Auto merge of #77595 - petrochenkov:asmident, r=oli-obk

builtin_macros: Fix use of interpolated identifiers in `asm!`

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

3 years agoAuto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514
bors [Wed, 7 Oct 2020 09:56:51 +0000 (09:56 +0000)]
Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514

Unclosed html tag lint

Part of #67799.

I think `@ollie27` will be interested (`@Manishearth` too since they opened the issue ;) ).

r? `@jyn514`

3 years agoAuto merge of #77637 - ehuss:update-cargo, r=ehuss
bors [Wed, 7 Oct 2020 05:12:28 +0000 (05:12 +0000)]
Auto merge of #77637 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 75615f8e69f748d7ef0df7bc0b064a9b1f5c78b2..9d1a4863abd9237dbf9d1b74c78632b6a205f6bb
2020-09-29 18:42:19 +0000 to 2020-10-05 18:29:52 +0000
- Add LTO to the metadata filename hash. (rust-lang/cargo#8755)
- Fix dylib+rlib with LTO. (rust-lang/cargo#8754)
- Homepage doc cargo metadata (rust-lang/cargo#8744)

3 years agoAuto merge of #77626 - tamird:parse-scope-id, r=dtolnay
bors [Wed, 7 Oct 2020 03:11:06 +0000 (03:11 +0000)]
Auto merge of #77626 - tamird:parse-scope-id, r=dtolnay

Parse SocketAddrV6::scope_id

r? `@dtolnay`

3 years agoAuto merge of #74194 - mbrubeck:slice-eq, r=sfackler
bors [Wed, 7 Oct 2020 01:20:11 +0000 (01:20 +0000)]
Auto merge of #74194 - mbrubeck:slice-eq, r=sfackler

Add PartialEq impls for Vec <-> slice

This is a follow-up to #71660 and rust-lang/rfcs#2917 to add two more missing vec/slice PartialEq impls:

```
impl<A, B> PartialEq<[B]> for Vec<A> where A: PartialEq<B> { .. }
impl<A, B> PartialEq<Vec<B>> for [A] where A: PartialEq<B> { .. }
```

Since this is insta-stable, it should go through the `@rust-lang/libs` FCP process.  Note that I used version 1.47.0 for the `stable` attribute because I assume this will not merge before the 1.46.0 branch is cut next week.

3 years agoUpdate cargo
Eric Huss [Wed, 7 Oct 2020 00:45:56 +0000 (17:45 -0700)]
Update cargo

3 years agoAuto merge of #77630 - Dylan-DPC:rollup-kfwl55z, r=Dylan-DPC
bors [Tue, 6 Oct 2020 23:07:17 +0000 (23:07 +0000)]
Auto merge of #77630 - Dylan-DPC:rollup-kfwl55z, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #76784 (Add some docs to rustdoc::clean::inline and def_id functions)
 - #76911 (fix VecDeque::iter_mut aliasing issues)
 - #77400 (Fix suggestions for x.py setup)
 - #77515 (Update to chalk 0.31)
 - #77568 (inliner: use caller param_env)
 - #77571 (Use matches! for core::char methods)
 - #77582 (Move `EarlyOtherwiseBranch` to mir-opt-level 2)
 - #77590 (Update RLS and Rustfmt)
 - #77605 (Fix rustc_def_path to show the full path and not the trimmed one)
 - #77614 (Let backends access span information)
 - #77624 (Add c as a shorthand check alternative for new options #77603)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77624 - akoptelov:c-all-targets-fix, r=jyn514
Dylan DPC [Tue, 6 Oct 2020 22:16:16 +0000 (00:16 +0200)]
Rollup merge of #77624 - akoptelov:c-all-targets-fix, r=jyn514

Add c as a shorthand check alternative for new options #77603

There is a missing "c" that is a shorthand for "check" in newly added match arm for handling check-specific options.

3 years agoRollup merge of #77614 - khyperia:set_span, r=eddyb
Dylan DPC [Tue, 6 Oct 2020 22:16:14 +0000 (00:16 +0200)]
Rollup merge of #77614 - khyperia:set_span, r=eddyb

Let backends access span information

Sometimes, a backend may need to emit warnings, errors, or otherwise need to know the span of the current item in a basic block. So, add a `set_span` method to give the backend that information.

The `set_source_location` method already partially does this, however, it's disabled when debug info is disabled. There needs to be a way to unconditionally provide the span.

3 years agoRollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkov
Dylan DPC [Tue, 6 Oct 2020 22:16:12 +0000 (00:16 +0200)]
Rollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkov

Fix rustc_def_path to show the full path and not the trimmed one

Follow-up fix for #73996.

3 years agoRollup merge of #77590 - Xanewok:update-rls, r=dtolnay
Dylan DPC [Tue, 6 Oct 2020 22:16:10 +0000 (00:16 +0200)]
Rollup merge of #77590 - Xanewok:update-rls, r=dtolnay

Update RLS and Rustfmt

refs: https://github.com/rust-lang/rls/pull/1701

cc @calebcartwright

r? @dtolnay

3 years agoRollup merge of #77582 - ecstatic-morse:disable-early-otherwise-branch, r=wesleywiser
Dylan DPC [Tue, 6 Oct 2020 22:16:08 +0000 (00:16 +0200)]
Rollup merge of #77582 - ecstatic-morse:disable-early-otherwise-branch, r=wesleywiser

Move `EarlyOtherwiseBranch` to mir-opt-level 2

cc #75119

This didn't have an [effect in most cases](https://perf.rust-lang.org/compare.html?start=81e02708f1f4760244756548981277d5199baa9a&end=2e0edc0f28c5647141bedba02e7a222d3a5dc9c3&stat=instructions:u), and is not trivially sound. Let it bake at `mir-opt-level=2` for a while.

Also, this missed the cutoff for beta, so we'll have to backport this.
r? @wesleywiser

3 years agoRollup merge of #77571 - pickfire:patch-6, r=cramertj
Dylan DPC [Tue, 6 Oct 2020 22:16:07 +0000 (00:16 +0200)]
Rollup merge of #77571 - pickfire:patch-6, r=cramertj

Use matches! for core::char methods

3 years agoRollup merge of #77568 - lcnr:mir-inline-def-id, r=ecstatic-morse
Dylan DPC [Tue, 6 Oct 2020 22:16:05 +0000 (00:16 +0200)]
Rollup merge of #77568 - lcnr:mir-inline-def-id, r=ecstatic-morse

inliner: use caller param_env

We used the callee param env instead of the caller param env by accident in #77430, this PR fixes that and caches it in the `Inliner` struct.

fixes #77564

r? @ecstatic-morse

3 years agoRollup merge of #77515 - jackh726:chalk-0.31, r=matthewjasper
Dylan DPC [Tue, 6 Oct 2020 22:16:03 +0000 (00:16 +0200)]
Rollup merge of #77515 - jackh726:chalk-0.31, r=matthewjasper

Update to chalk 0.31

Gonna assign @nikomatsakis to the review here, but since he is pretty busy recently, if anyone else wants to review this, that would be much appreciated.

r? @nikomatsakis

3 years agoRollup merge of #77400 - alarsyo:xpy-setup-suggestions, r=jyn514
Dylan DPC [Tue, 6 Oct 2020 22:16:01 +0000 (00:16 +0200)]
Rollup merge of #77400 - alarsyo:xpy-setup-suggestions, r=jyn514

Fix suggestions for x.py setup

#76631 introduced a new `setup` command to x.py

By default the command prompts for a profile to use:

```
Welcome to the Rust project! What do you want to do with x.py?
a) Contribute to the standard library
b) Contribute to the compiler
c) Contribute to the compiler, and also modify LLVM or codegen
d) Install Rust from source
```

and then displays command suggestions, depending on which profile was chosen. However [the mapping between chosen profile](https://github.com/rust-lang/rust/blob/9cba260df0f1c67ea3690035cd5611a7465a1560/src/bootstrap/setup.rs#L75-L85) and [suggestion](https://github.com/rust-lang/rust/blob/9cba260df0f1c67ea3690035cd5611a7465a1560/src/bootstrap/setup.rs#L42-L47) isn't exact, leading to suggestions not being shown if the user presses `c` or `d`. (because "c" is translated to "llvm" and "d" to "maintainer", but suggestions trigger for "codegen" and "user" respectively)

A more thorough refactor would stop using "strings-as-type" to make sure this kind of error doesn't happen, but it may be overkill for that kind of "script" program?

Tagging the setup command author: @jyn514

3 years agoRollup merge of #76911 - RalfJung:vecdeque-aliasing, r=oli-obk
Dylan DPC [Tue, 6 Oct 2020 22:15:59 +0000 (00:15 +0200)]
Rollup merge of #76911 - RalfJung:vecdeque-aliasing, r=oli-obk

fix VecDeque::iter_mut aliasing issues

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

3 years agoRollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomez
Dylan DPC [Tue, 6 Oct 2020 22:15:58 +0000 (00:15 +0200)]
Rollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomez

Add some docs to rustdoc::clean::inline and def_id functions

Split from #76571 .

3 years agoParse SocketAddrV6::scope_id
Tamir Duberstein [Sun, 4 Oct 2020 21:56:48 +0000 (21:56 +0000)]
Parse SocketAddrV6::scope_id

3 years agoAvoid unused return
Tamir Duberstein [Sun, 4 Oct 2020 21:46:49 +0000 (21:46 +0000)]
Avoid unused return

3 years agoAuto merge of #77386 - joshtriplett:static-glibc, r=petrochenkov
bors [Tue, 6 Oct 2020 21:11:04 +0000 (21:11 +0000)]
Auto merge of #77386 - joshtriplett:static-glibc, r=petrochenkov

Support static linking with glibc and target-feature=+crt-static

With this change, it's possible to build on a linux-gnu target and pass
RUSTFLAGS='-C target-feature=+crt-static' or the equivalent via a
`.cargo/config.toml` file, and get a statically linked executable.

Update to libc 0.2.78, which adds support for static linking with glibc.

Add `crt_static_respected` to the `linux_base` target spec.

Update `android_base` and `linux_musl_base` accordingly. Avoid enabling
crt_static_respected on Android platforms, since that hasn't been
tested.

Closes https://github.com/rust-lang/rust/issues/65447.

3 years agoAdd c as a shorthand check alternative for new options #77603
Alexander Koptelov [Tue, 6 Oct 2020 19:04:14 +0000 (22:04 +0300)]
Add c as a shorthand check alternative for new options #77603

3 years agoUpdate error code page
Dylan MacKenzie [Tue, 6 Oct 2020 04:45:55 +0000 (21:45 -0700)]
Update error code page

3 years agoUpdate to chalk 0.31. Implement some unimplemented. Ignore some tests in compare...
Jack Huey [Sun, 4 Oct 2020 00:45:12 +0000 (20:45 -0400)]
Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish.

3 years agoEliminate bounds checking in slice::Windows
AnthonyMikh [Tue, 6 Oct 2020 15:23:37 +0000 (18:23 +0300)]
Eliminate bounds checking in slice::Windows

3 years agoAuto merge of #76356 - caass:hooks, r=jyn514
bors [Tue, 6 Oct 2020 14:51:51 +0000 (14:51 +0000)]
Auto merge of #76356 - caass:hooks, r=jyn514

Add a command to install a git hook to automatically run `x.py test tidy --bless`

Some folks (such as myself) would probably find a lot of convenience in a pre-commit hook that automatically runs tidy before committing, to avoid burning CI time learning that your commit wasn't tidy.

I'm absolutely positive I have missed some stuff. I basically just got this to where you can run `./x.py run install-git-hook` and then clicked the commit button. Please let me know what else you'd like me to add before this can be merged!

[rustc-dev-guide companion PR](https://github.com/rust-lang/rustc-dev-guide/pull/848)

3 years agoUse String type for Profile parse error
Antoine Martin [Mon, 5 Oct 2020 16:03:54 +0000 (18:03 +0200)]
Use String type for Profile parse error

3 years agoShow available profiles on error
Antoine Martin [Mon, 5 Oct 2020 15:55:14 +0000 (17:55 +0200)]
Show available profiles on error

3 years agoUse Profile enum for x.py setup
Antoine Martin [Mon, 5 Oct 2020 15:27:42 +0000 (17:27 +0200)]
Use Profile enum for x.py setup

3 years agoFix suggestions for x.py setup
Antoine Martin [Thu, 1 Oct 2020 14:08:05 +0000 (16:08 +0200)]
Fix suggestions for x.py setup

3 years agoLet backends access span information
khyperia [Tue, 6 Oct 2020 13:39:12 +0000 (15:39 +0200)]
Let backends access span information

Sometimes, a backend may need to emit warnings, errors, or otherwise
need to know the span of the current item in a basic block. So, add a
set_span method to give the backend that information.

3 years agoAuto merge of #73905 - matthewjasper:projection-bounds-2, r=nikomatsakis
bors [Tue, 6 Oct 2020 12:26:54 +0000 (12:26 +0000)]
Auto merge of #73905 - matthewjasper:projection-bounds-2, r=nikomatsakis

Separate projection bounds and predicates

Follow up to #72788.

- Rename `projection_predicates` to `item_bounds`
- Separate bounds on associated types (the things after the `:` in `type X: ...`) and opaque types (the things after `impl`)  from predicates.
- Projection candidates now have the correct nested obligations
- Trait object candidates now check that the associated types on the trait object satisfy their bounds as nested obligations
- Type alias impl trait types are now checked (#73035)
- `feature(generic_associated_types)` no longer changes how we handle bounds (#73816)

Opening for a perf and crater runs.

r? `@nikomatsakis`

3 years agoFix NLL compare mode tests
Matthew Jasper [Tue, 6 Oct 2020 07:39:49 +0000 (08:39 +0100)]
Fix NLL compare mode tests

3 years agoDeduplicate some code
Matthew Jasper [Mon, 5 Oct 2020 16:19:24 +0000 (17:19 +0100)]
Deduplicate some code

3 years agoFix tests from rebase
Matthew Jasper [Mon, 7 Sep 2020 09:01:45 +0000 (10:01 +0100)]
Fix tests from rebase

3 years agoAvoid creating useless projection predicate
Matthew Jasper [Mon, 7 Sep 2020 08:38:09 +0000 (09:38 +0100)]
Avoid creating useless projection predicate

3 years agoFix rebase
Matthew Jasper [Sun, 6 Sep 2020 19:04:52 +0000 (20:04 +0100)]
Fix rebase

3 years agoDeduplicate item bounds after normalization
Matthew Jasper [Sat, 15 Aug 2020 19:31:07 +0000 (20:31 +0100)]
Deduplicate item bounds after normalization

3 years agoDon't require lifetime super-bounds on traits apply to trait objects of that trait
Matthew Jasper [Sat, 15 Aug 2020 11:29:23 +0000 (12:29 +0100)]
Don't require lifetime super-bounds on traits apply to trait objects of that trait

3 years agoNormalize super trait bounds when confirming object candidates
Matthew Jasper [Fri, 14 Aug 2020 20:51:28 +0000 (21:51 +0100)]
Normalize super trait bounds when confirming object candidates

3 years agoFix rebase
Matthew Jasper [Fri, 14 Aug 2020 20:41:20 +0000 (21:41 +0100)]
Fix rebase

3 years agoDon't immediately error for recursive projections
Matthew Jasper [Sat, 25 Jul 2020 20:27:34 +0000 (21:27 +0100)]
Don't immediately error for recursive projections

3 years agoFix bootstrap
Matthew Jasper [Sat, 25 Jul 2020 14:14:12 +0000 (15:14 +0100)]
Fix bootstrap

3 years agoHandle multiple trait-def projection candidates
Matthew Jasper [Sat, 25 Jul 2020 13:00:13 +0000 (14:00 +0100)]
Handle multiple trait-def projection candidates

3 years agoAvoid cycles from projection bounds
Matthew Jasper [Sat, 25 Jul 2020 12:41:53 +0000 (13:41 +0100)]
Avoid cycles from projection bounds

Only check the own predicates of associated types when confirming
projection candidates.
Also consider implied bounds when comparing trait and impl methods.

3 years agoAvoid cycle with projections from object types
Matthew Jasper [Fri, 24 Jul 2020 20:59:43 +0000 (21:59 +0100)]
Avoid cycle with projections from object types

Normalizing `<dyn Iterator<Item = ()> as Iterator>::Item` no longer
requires selecting `dyn Iterator<Item = ()>: Iterator`. This was
previously worked around by using a special type-folder to normalize
things.

3 years agoNormalize projection bounds when considering candidates
Matthew Jasper [Fri, 24 Jul 2020 18:10:22 +0000 (19:10 +0100)]
Normalize projection bounds when considering candidates

This unfortunately requires some winnowing hacks to avoid
now ambiguous candidates.

3 years agoHandle multiple applicable projection candidates
Matthew Jasper [Thu, 23 Jul 2020 20:59:20 +0000 (21:59 +0100)]
Handle multiple applicable projection candidates

3 years agoFix bugs in evaluating WellFormed predicates
Matthew Jasper [Wed, 22 Jul 2020 21:43:18 +0000 (22:43 +0100)]
Fix bugs in evaluating WellFormed predicates

- List the nestsed obligations in an order that works with the
  single pass used by evaluation
- Propagate recursion depth correctly

3 years agoAvoid cycle in nested obligations for object candidate
Matthew Jasper [Sun, 5 Jul 2020 11:16:25 +0000 (12:16 +0100)]
Avoid cycle in nested obligations for object candidate

Bounds of the form `type Future: Future<Result=Self::Result>` exist in
some ecosystem crates. To validate these bounds for trait objects we
need to normalize `Self::Result` in a way that doesn't cause a cycle.

3 years agoRemove predicates on associated types from traits
Matthew Jasper [Sat, 4 Jul 2020 11:15:04 +0000 (12:15 +0100)]
Remove predicates on associated types from traits

These need to only be bounds to avoid cycle errors in trait checking.

3 years agoAddress review comments
Matthew Jasper [Thu, 2 Jul 2020 20:45:28 +0000 (21:45 +0100)]
Address review comments

3 years agoFix ICE
Matthew Jasper [Wed, 1 Jul 2020 20:56:35 +0000 (21:56 +0100)]
Fix ICE

3 years agoFix tools
Matthew Jasper [Tue, 30 Jun 2020 21:41:57 +0000 (22:41 +0100)]
Fix tools

3 years agoFix tests and bootstrap
Matthew Jasper [Mon, 29 Jun 2020 21:15:11 +0000 (22:15 +0100)]
Fix tests and bootstrap

3 years agoEnsure that associated types for trait objects satisfy their bounds
Matthew Jasper [Sun, 28 Jun 2020 19:34:56 +0000 (20:34 +0100)]
Ensure that associated types for trait objects satisfy their bounds

3 years agoMove some code from rustc_typeck to rustc_trait_selection
Matthew Jasper [Sun, 28 Jun 2020 19:29:08 +0000 (20:29 +0100)]
Move some code from rustc_typeck to rustc_trait_selection

3 years agoRemove unused part of return value from `replace_bound_vars_with_placeholders`
Matthew Jasper [Sun, 28 Jun 2020 19:27:59 +0000 (20:27 +0100)]
Remove unused part of return value from `replace_bound_vars_with_placeholders`

3 years agoCheck associated type bounds for object safety violations
Matthew Jasper [Sun, 28 Jun 2020 16:36:41 +0000 (17:36 +0100)]
Check associated type bounds for object safety violations

3 years agoCheck opaque types satisfy their bounds
Matthew Jasper [Sun, 28 Jun 2020 15:46:02 +0000 (16:46 +0100)]
Check opaque types satisfy their bounds

3 years agoCheck projections are well-formed when using projection candidates
Matthew Jasper [Sun, 28 Jun 2020 11:41:46 +0000 (12:41 +0100)]
Check projections are well-formed when using projection candidates

3 years agoMake projection wf check the predicates for the projection
Matthew Jasper [Sun, 28 Jun 2020 09:51:32 +0000 (10:51 +0100)]
Make projection wf check the predicates for the projection

3 years agoSeparate bounds and predicates for associated/opaque types
Matthew Jasper [Sat, 27 Jun 2020 20:36:35 +0000 (21:36 +0100)]
Separate bounds and predicates for associated/opaque types

3 years agoSplit bounds from predicates
Matthew Jasper [Wed, 24 Jun 2020 18:13:44 +0000 (19:13 +0100)]
Split bounds from predicates

3 years agoMove item_bounds to typeck::collect
Matthew Jasper [Tue, 23 Jun 2020 17:18:06 +0000 (18:18 +0100)]
Move item_bounds to typeck::collect

3 years agoRename projection_predicates to item_bounds
Matthew Jasper [Tue, 23 Jun 2020 16:57:24 +0000 (17:57 +0100)]
Rename projection_predicates to item_bounds

3 years agoAuto merge of #77594 - timvermeulen:chain_advance_by, r=scottmcm
bors [Tue, 6 Oct 2020 10:17:48 +0000 (10:17 +0000)]
Auto merge of #77594 - timvermeulen:chain_advance_by, r=scottmcm

Implement advance_by, advance_back_by for iter::Chain

Part of #77404.

This PR does two things:
- implement `Chain::advance[_back]_by` in terms of `advance[_back]_by` on `self.a` and `advance[_back]_by` on `self.b`
- change `Chain::nth[_back]` to use `advance[_back]_by` on `self.a` and `nth[_back]` on `self.b`

This ensures that `Chain::nth` can take advantage of an efficient `nth` implementation on the second iterator, in case it doesn't implement `advance_by`.

cc `@scottmcm` in case you want to review this

3 years agoAdd some docs to rustdoc::clean::inline and def_id functions
Lzu Tao [Wed, 16 Sep 2020 09:15:51 +0000 (09:15 +0000)]
Add some docs to rustdoc::clean::inline and def_id functions

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoavoid unnecessary intermediate reference and improve safety comments
Ralf Jung [Tue, 6 Oct 2020 07:40:48 +0000 (09:40 +0200)]
avoid unnecessary intermediate reference and improve safety comments

3 years agoAuto merge of #77606 - JohnTitor:rollup-7rgahdt, r=JohnTitor
bors [Tue, 6 Oct 2020 08:05:27 +0000 (08:05 +0000)]
Auto merge of #77606 - JohnTitor:rollup-7rgahdt, r=JohnTitor

Rollup of 13 pull requests

Successful merges:

 - #76388 (Add a note about the panic behavior of math operations on time objects)
 - #76855 (Revamp rustdoc docs about documentation using `cfg`)
 - #76995 (Reduce boilerplate with the matches! macro)
 - #77228 (Add missing examples for MaybeUninit)
 - #77528 (Avoid unchecked casts in net parser)
 - #77534 (Disallow overriding forbid in same scope)
 - #77555 (Allow anyone to set regression labels)
 - #77558 (Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml})
 - #77559 (Fix rustdoc warnings about invalid Rust syntax)
 - #77560 (Fix LitKind's byte buffer to use refcounted slice)
 - #77573 (Hint doc use convert::identity relative link)
 - #77587 (Fix span for unicode escape suggestion.)
 - #77591 (Record `expansion_that_defined` into crate metadata)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebank
Yuki Okushi [Tue, 6 Oct 2020 07:26:16 +0000 (16:26 +0900)]
Rollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebank

Record `expansion_that_defined` into crate metadata

Fixes #77523

Now that hygiene serialization is implemented, we also need to record
`expansion_that_defined` so that we properly handle a foreign
`SyntaxContext`.

3 years agoRollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse
Yuki Okushi [Tue, 6 Oct 2020 07:26:14 +0000 (16:26 +0900)]
Rollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse

Fix span for unicode escape suggestion.

If a unicode escape is missing the curly braces, the suggested fix is to add the curly braces, but the span for the fix was incorrect. It was not covering the `\u`, but the suggested text includes the `\u`, causing the resulting fix to be `"\u\u{1234}"`. This changes it so that the span includes the `\u`. An alternate fix would be to remove `\u` from the suggested fix, but I think the error message reads better if the entire escape is included.

3 years agoRollup merge of #77573 - pickfire:patch-7, r=jyn514
Yuki Okushi [Tue, 6 Oct 2020 07:26:12 +0000 (16:26 +0900)]
Rollup merge of #77573 - pickfire:patch-7, r=jyn514

Hint doc use convert::identity relative link

r? @jyn514

3 years agoRollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:11 +0000 (16:26 +0900)]
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr

Fix LitKind's byte buffer to use refcounted slice

While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.

This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).

3 years agoRollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:09 +0000 (16:26 +0900)]
Rollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr

Fix rustdoc warnings about invalid Rust syntax

3 years agoRollup merge of #77558 - thomcc:defaults-toml-extension, r=jyn514
Yuki Okushi [Tue, 6 Oct 2020 07:26:07 +0000 (16:26 +0900)]
Rollup merge of #77558 - thomcc:defaults-toml-extension, r=jyn514

Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}

This allows these files to have okay syntax highlighting in editors, and helps avoid nagging from editors which want to suggest that I install a plugin for `*.library` files to view the `config.toml.library` or whatever.

It's a very minor change.

r?@jyn514

3 years agoRollup merge of #77555 - camelid:patch-8, r=Mark-Simulacrum
Yuki Okushi [Tue, 6 Oct 2020 07:26:05 +0000 (16:26 +0900)]
Rollup merge of #77555 - camelid:patch-8, r=Mark-Simulacrum

Allow anyone to set regression labels

Cc https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/improve.20reporting.20of.20regressions/near/212245535

r? @Mark-Simulacrum

3 years agoRollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in...
Yuki Okushi [Tue, 6 Oct 2020 07:26:04 +0000 (16:26 +0900)]
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov

Disallow overriding forbid in same scope

Rebased #73379.

Fixes #70819.

3 years agoRollup merge of #77528 - tamird:avoid-cast-net-parser, r=dtolnay
Yuki Okushi [Tue, 6 Oct 2020 07:26:02 +0000 (16:26 +0900)]
Rollup merge of #77528 - tamird:avoid-cast-net-parser, r=dtolnay

Avoid unchecked casts in net parser

Once this and #77426 are in, I'll send another PR adding scope id parsing.

r? @dtolnay

3 years agoRollup merge of #77228 - GuillaumeGomez:maybeuninit-examples, r=pickfire
Yuki Okushi [Tue, 6 Oct 2020 07:26:00 +0000 (16:26 +0900)]
Rollup merge of #77228 - GuillaumeGomez:maybeuninit-examples, r=pickfire

Add missing examples for MaybeUninit

r? @Dylan-DPC

3 years agoRollup merge of #76995 - LingMan:middle_matches, r=varkor
Yuki Okushi [Tue, 6 Oct 2020 07:25:58 +0000 (16:25 +0900)]
Rollup merge of #76995 - LingMan:middle_matches, r=varkor

Reduce boilerplate with the matches! macro

Replaces simple bool `match`es of the form

    match $expr {
        $pattern => true
        _ => false
    }

and their inverse with invocations of the matches! macro.

Limited to rustc_middle for now to get my feet wet.

3 years agoRollup merge of #76855 - jyn514:platform-specific, r=ollie27
Yuki Okushi [Tue, 6 Oct 2020 07:25:55 +0000 (16:25 +0900)]
Rollup merge of #76855 - jyn514:platform-specific, r=ollie27

Revamp rustdoc docs about documentation using `cfg`

- Move `cfg(doc)` out of `unstable-features`. It's not unstable.
- Remove outdated reference to `everybody_loops`.
- Improve wording in various places
- Give an example of code this allows (and does not allow)
- Link to `cfg(doc)` in `doc(cfg)` documentation. Since one is stable
and the other is not, don't combine them.
- Cleanup wording for `doc(cfg)`
- Incorporate changes from #76849
- Mention that `doc(cfg)` is also for features

Addresses https://github.com/rust-lang/rust/pull/76849#issuecomment-694516199.
Obsoletes https://github.com/rust-lang/rust/pull/76849 (I made sure to fix the weird dashes too).
r? @steveklabnik

3 years agoRollup merge of #76388 - poliorcetics:system-time-document-panic, r=KodrAus
Yuki Okushi [Tue, 6 Oct 2020 07:25:53 +0000 (16:25 +0900)]
Rollup merge of #76388 - poliorcetics:system-time-document-panic, r=KodrAus

Add a note about the panic behavior of math operations on time objects

Fixes #71226.

3 years agoFix rustc_def_path to show the full path and not the trimmed one
Dan Aloni [Tue, 6 Oct 2020 06:00:55 +0000 (09:00 +0300)]
Fix rustc_def_path to show the full path and not the trimmed one

3 years agoMake `impl Trait` unstable in all contexts
Dylan MacKenzie [Tue, 6 Oct 2020 03:30:32 +0000 (20:30 -0700)]
Make `impl Trait` unstable in all contexts

3 years agoRemove `fn` from feature name
Dylan MacKenzie [Tue, 6 Oct 2020 03:30:13 +0000 (20:30 -0700)]
Remove `fn` from feature name

3 years agoMake `min_const_fn` `impl Trait` test into a gate test
Dylan MacKenzie [Fri, 2 Oct 2020 21:57:12 +0000 (14:57 -0700)]
Make `min_const_fn` `impl Trait` test into a gate test

3 years agoBless test outupt
Dylan MacKenzie [Fri, 2 Oct 2020 19:12:57 +0000 (12:12 -0700)]
Bless test outupt

3 years agoUse new feature gate in `impl-trait` tests
Dylan MacKenzie [Fri, 2 Oct 2020 19:12:02 +0000 (12:12 -0700)]
Use new feature gate in `impl-trait` tests

3 years agoAdd requisite feature gates in the standard library
Dylan MacKenzie [Fri, 2 Oct 2020 19:11:24 +0000 (12:11 -0700)]
Add requisite feature gates in the standard library

3 years agoAdd `#![feature(const_fn_impl)]`
Dylan MacKenzie [Fri, 2 Oct 2020 19:02:41 +0000 (12:02 -0700)]
Add `#![feature(const_fn_impl)]`

3 years agoMake changes based on @jyn514's comments
Cassandra Fridkin [Tue, 6 Oct 2020 02:00:43 +0000 (22:00 -0400)]
Make changes based on @jyn514's comments

3 years agoAdd install_git_hook_maybe to setup.rs
Cassandra Fridkin [Tue, 6 Oct 2020 00:14:11 +0000 (20:14 -0400)]
Add install_git_hook_maybe to setup.rs

3 years agoClean up pre-commit.sh
Cassandra Fridkin [Mon, 5 Oct 2020 23:35:06 +0000 (19:35 -0400)]
Clean up pre-commit.sh

3 years agoRevamp rustdoc docs about documentation using `cfg`
Joshua Nelson [Thu, 17 Sep 2020 22:05:56 +0000 (18:05 -0400)]
Revamp rustdoc docs about documentation using `cfg`

- Move `cfg(doc)` out of `unstable-features`. It's not unstable.
- Remove outdated reference to `everybody_loops`.
- Improve wording in various places
- Give an example of code this allows (and does not allow)
- Link to `cfg(doc)` in `doc(cfg)` documentation. Since one is stable
and the other is not, don't combine them.
- Cleanup wording for `doc(cfg)`
- Incorporate changes from #76849
- Mention that `doc(cfg)` is also for features