]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoAuto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebank
bors [Fri, 16 Dec 2022 03:57:10 +0000 (03:57 +0000)]
Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebank

Use impl's def id when calculating type to specify in UFCS

Fixes #104327
Fixes #104328

Also addresses https://github.com/rust-lang/rust/pull/102670#discussion_r987381197

18 months agoAuto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgr
bors [Thu, 15 Dec 2022 22:53:03 +0000 (22:53 +0000)]
Auto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #105481 (Start improving monomorphization items stats)
 - #105674 (Point at method chains on `E0271` errors)
 - #105679 (Suggest constraining type parameter with `Clone`)
 - #105694 (Don't create dummy if val has escaping bounds var)
 - #105727 (Tweak output for bare `dyn Trait` in arguments)
 - #105739 (Migrate Jump to def links background to CSS variable)
 - #105743 (`SimplifiedType` cleanups)
 - #105758 (Move `TypeckResults` to separate module)

Failed merges:

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

18 months agoRollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 21:03:01 +0000 (22:03 +0100)]
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors

Move `TypeckResults` to separate module

`ty::context` is really big and the typeck results aren't directly related to `TyCtxt`, so move them to a separate module. Also contains a small drive-by macro "improvement".

18 months agoRollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnr
Matthias Krüger [Thu, 15 Dec 2022 21:03:01 +0000 (22:03 +0100)]
Rollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnr

`SimplifiedType` cleanups

r? `@lcnr`

18 months agoRollup merge of #105739 - GuillaumeGomez:migrate-jump-to-def-link-to-css-var, r=notriddle
Matthias Krüger [Thu, 15 Dec 2022 21:03:00 +0000 (22:03 +0100)]
Rollup merge of #105739 - GuillaumeGomez:migrate-jump-to-def-link-to-css-var, r=notriddle

Migrate Jump to def links background to CSS variable

It's already tested in `src/test/rustdoc-gui/jump-to-def-background.goml`.

r? `@notriddle`

18 months agoRollup merge of #105727 - estebank:use-impl-trait, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 21:02:59 +0000 (22:02 +0100)]
Rollup merge of #105727 - estebank:use-impl-trait, r=oli-obk

Tweak output for bare `dyn Trait` in arguments

Fix #35825.

18 months agoRollup merge of #105694 - ouz-a:issue_105689, r=estebank
Matthias Krüger [Thu, 15 Dec 2022 21:02:59 +0000 (22:02 +0100)]
Rollup merge of #105694 - ouz-a:issue_105689, r=estebank

Don't create dummy if val has escaping bounds var

Skips creating/pushing obligations if val has escaping bounds vars.

Fixes #105689

18 months agoRollup merge of #105679 - estebank:suggest-clone, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 21:02:58 +0000 (22:02 +0100)]
Rollup merge of #105679 - estebank:suggest-clone, r=compiler-errors

Suggest constraining type parameter with `Clone`

Fix #34896.

18 months agoRollup merge of #105674 - estebank:iterator-chains, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 21:02:58 +0000 (22:02 +0100)]
Rollup merge of #105674 - estebank:iterator-chains, r=oli-obk

Point at method chains on `E0271` errors

Follow up to #105332. Fix #33941. CC #9082.

r? `@oli-obk`

18 months agoRollup merge of #105481 - lqd:mono-stats, r=wesleywiser
Matthias Krüger [Thu, 15 Dec 2022 21:02:57 +0000 (22:02 +0100)]
Rollup merge of #105481 - lqd:mono-stats, r=wesleywiser

Start improving monomorphization items stats

As described in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Compile-time.20case-study.3A.20AWS.20crates/near/314560832), some stats about monomorphization collection would be interesting to have, in a different form than `-Zprint-mono-items`: to have some visibility into the cost of the mono items, we'd like to know how many are instantiated and what is their estimated size.

That can be a proxy to analyze sources of slow compile times, although in the future, we'd also like to add more realistic stats from the actual backend's lowering.

This PR adds a new `-Z dump-mono-stats` flag which will output some stats in a `{crate_name}.mono-items.md` file (the flag optionally takes an output directory parameter, for easier use within a workspace than printing to stdout).

For example,

```rust
fn compute<T>(collection: Vec<T>) -> usize {
    collection.len() + 19 - 0 * 9 - 18 - 1 * 1 // random code to increase the function's size
}

fn main() {
    dbg!(compute(vec![0u8, 1, 2]));
    dbg!(compute(vec![0u64, 1, 2]));
    dbg!(compute(vec!["0", "1", "2", "3"]));
}
```

will output a file with this markdown table (abridged for readability), for a debug build:

| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
...

<details>
<summary>Click for full output</summary>

| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
| std::boxed::Box::<T, A>::into_unique | 3 | 48 | 144 |
| std::boxed::Box::<T, A>::leak | 3 | 39 | 117 |
| std::alloc::Layout::array::inner | 1 | 107 | 107 |
| std::ptr::align_offset::mod_inv | 1 | 103 | 103 |
| std::boxed::Box::<T, A>::into_raw_with_allocator | 3 | 31 | 93 |
| std::fmt::Arguments::<'a>::new_v1 | 1 | 80 | 80 |
| <alloc::raw_vec::RawVec<T, A> as std::ops::Drop>::drop | 3 | 26 | 78 |
| alloc::raw_vec::RawVec::<T, A>::from_raw_parts_in | 3 | 26 | 78 |
| alloc::alloc::exchange_malloc | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_null | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_aligned_to | 1 | 64 | 64 |
| compute | 3 | 20 | 60 |
| std::ptr::const_ptr::<impl *const T>::align_offset | 1 | 55 | 55 |
| std::ptr::read | 1 | 52 | 52 |
| <std::alloc::Global as std::alloc::Allocator>::deallocate | 1 | 50 | 50 |
| std::ptr::mut_ptr::<impl *mut T>::guaranteed_eq | 1 | 48 | 48 |
| std::fmt::ArgumentV1::<'a>::new_display | 2 | 22 | 44 |
| std::ptr::Alignment::new_unchecked | 1 | 42 | 42 |
| core::fmt::num::<impl std::fmt::Debug for usize>::fmt | 1 | 40 | 40 |
| std::result::Result::<T, E>::unwrap_unchecked | 1 | 37 | 37 |
| std::cmp::Ord::min | 1 | 32 | 32 |
| std::cmp::impls::<impl std::cmp::Ord for usize>::cmp | 1 | 31 | 31 |
| std::intrinsics::is_aligned_and_not_null | 1 | 27 | 27 |
| std::rt::lang_start | 1 | 27 | 27 |
| std::ptr::NonNull::<T>::new | 1 | 24 | 24 |
| std::fmt::ArgumentV1::<'a>::new_debug | 1 | 22 | 22 |
| std::fmt::Arguments::<'a>::new_v1_formatted | 1 | 19 | 19 |
| std::rt::lang_start::{closure#0} | 1 | 17 | 17 |
| std::sys_common::backtrace::__rust_begin_short_backtrace | 1 | 16 | 16 |
| std::slice::<impl [T]>::into_vec | 3 | 5 | 15 |
| <std::ptr::NonNull<T> as std::convert::From<std::ptr::Unique<T>>>::from | 1 | 14 | 14 |
| <&T as std::fmt::Debug>::fmt | 1 | 12 | 12 |
| <&T as std::fmt::Display>::fmt | 1 | 12 | 12 |
| std::vec::Vec::<T, A>::len | 3 | 2 | 6 |
| <T as std::convert::Into<U>>::into | 1 | 5 | 5 |
| <T as std::convert::From<T>>::from | 1 | 2 | 2 |
| <() as std::process::Termination>::report | 1 | 2 | 2 |
| std::hint::unreachable_unchecked | 1 | 2 | 2 |
| core::fmt::UnsafeArg::new | 1 | 1 | 1 |

</details>

Since we discussed it together, r? `@wesleywiser.`

18 months agoAuto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obk
bors [Thu, 15 Dec 2022 19:59:48 +0000 (19:59 +0000)]
Auto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obk

Custom MIR: Many more improvements

Commits are each atomic changes, best reviewed one at a time, with the exception that the last commit includes all the documentation.

### First commit

Unsafetyck was not correctly disabled before for `dialect = "built"` custom MIR. This is fixed and a regression test is added.

### Second commit

Implements `Discriminant`, `SetDiscriminant`, and `SwitchInt`.

### Third commit

Implements indexing, field, and variant projections.

### Fourth commit

Documents the previous commits and everything else.

There is some amount of weirdness here due to having to beat Rust syntax into cooperating with MIR concepts, but it hopefully should not be too much. All of it is documented.

r? `@oli-obk`

18 months agoConsider lifetimes when comparing assoc types in method chain
Esteban Küber [Wed, 14 Dec 2022 02:00:24 +0000 (18:00 -0800)]
Consider lifetimes when comparing assoc types in method chain

Do not say "Type changed to X here" when the only difference is caused
by lifetimes.

18 months agoTrim paths in E0599
Esteban Küber [Wed, 14 Dec 2022 00:57:34 +0000 (16:57 -0800)]
Trim paths in E0599

18 months agoMove `TypeckResults` to seperate module
Nilstrieb [Thu, 15 Dec 2022 19:40:16 +0000 (20:40 +0100)]
Move `TypeckResults` to seperate module

18 months agoSmall cleanup in parameterized
Nilstrieb [Thu, 15 Dec 2022 19:40:10 +0000 (20:40 +0100)]
Small cleanup in parameterized

18 months agoShorten trimmed display of closures
Esteban Küber [Wed, 14 Dec 2022 00:34:04 +0000 (16:34 -0800)]
Shorten trimmed display of closures

When `with_forced_trimmed_paths` is used, only print filename and start
of the closure's span, to reduce their verbosity.

18 months agoUse `with_forced_trimmed_paths` more
Esteban Küber [Tue, 13 Dec 2022 23:52:16 +0000 (15:52 -0800)]
Use `with_forced_trimmed_paths` more

18 months agoPoint at method chains on `E0271` errors
Esteban Küber [Tue, 13 Dec 2022 01:39:08 +0000 (17:39 -0800)]
Point at method chains on `E0271` errors

18 months agoMigrate Jump to def links background to CSS variable
Guillaume Gomez [Thu, 15 Dec 2022 07:55:23 +0000 (08:55 +0100)]
Migrate Jump to def links background to CSS variable

18 months agoSuggest `#[derive(Clone)]`
Esteban Küber [Wed, 14 Dec 2022 03:52:42 +0000 (19:52 -0800)]
Suggest `#[derive(Clone)]`

18 months agoSuggest constraining type parameter with `Clone`
Esteban Küber [Wed, 14 Dec 2022 02:55:00 +0000 (18:55 -0800)]
Suggest constraining type parameter with `Clone`

Fix #34896.

18 months agoAuto merge of #104616 - RalfJung:ctfe-alignment, r=oli-obk,RalfJung
bors [Thu, 15 Dec 2022 17:04:25 +0000 (17:04 +0000)]
Auto merge of #104616 - RalfJung:ctfe-alignment, r=oli-obk,RalfJung

always check alignment during CTFE

We originally disabled alignment checks because they got in the way -- there are some things we do with the interpreter during CTFE which does not correspond to actually running user-written code, but is purely administrative, and we didn't want alignment checks there, so we just disabled them entirely. But with `-Zextra-const-ub-checks` we anyway had to figure out how to disable those alignment checks while doing checks in regular code. So now it is easy to enable CTFE alignment checking by default. Let's see what the perf consequences of that are.

r? `@oli-obk`

18 months agoMake the test actually emit the future incompat lint
Oli Scherer [Wed, 23 Nov 2022 14:41:06 +0000 (14:41 +0000)]
Make the test actually emit the future incompat lint

18 months agosimplify alignment_check_failed a bit
Ralf Jung [Tue, 22 Nov 2022 21:04:08 +0000 (22:04 +0100)]
simplify alignment_check_failed a bit

18 months agoFix docs
Oli Scherer [Tue, 22 Nov 2022 13:55:37 +0000 (13:55 +0000)]
Fix docs

18 months agoReuse the ctfe error emitting logic for the future incompat lint
Oli Scherer [Tue, 22 Nov 2022 12:06:17 +0000 (12:06 +0000)]
Reuse the ctfe error emitting logic for the future incompat lint

18 months agoFactor decorate closure out into a method
Oli Scherer [Tue, 22 Nov 2022 12:00:07 +0000 (12:00 +0000)]
Factor decorate closure out into a method

18 months agoAlways report alignment failures in future incompat summaries
Oli Scherer [Tue, 22 Nov 2022 11:52:26 +0000 (11:52 +0000)]
Always report alignment failures in future incompat summaries

18 months agoMove alignment failure error reporting to machine
Oli Scherer [Tue, 22 Nov 2022 11:16:33 +0000 (11:16 +0000)]
Move alignment failure error reporting to machine

18 months agoMake alignment checks a future incompat lint
Oli Scherer [Mon, 21 Nov 2022 16:51:16 +0000 (16:51 +0000)]
Make alignment checks a future incompat lint

18 months agoAlways pass alignment and handle checking lazily
Oli Scherer [Mon, 21 Nov 2022 14:56:12 +0000 (14:56 +0000)]
Always pass alignment and handle checking lazily

18 months agoadjust tests
Ralf Jung [Sun, 20 Nov 2022 08:54:45 +0000 (09:54 +0100)]
adjust tests

18 months agoalways check alignment during CTFE
Ralf Jung [Sat, 19 Nov 2022 22:36:20 +0000 (23:36 +0100)]
always check alignment during CTFE

18 months agoAuto merge of #105746 - matthiaskrgr:rollup-sz3grbv, r=matthiaskrgr
bors [Thu, 15 Dec 2022 14:04:24 +0000 (14:04 +0000)]
Auto merge of #105746 - matthiaskrgr:rollup-sz3grbv, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #104592 (Ensure async trait impls are async (or otherwise return an opaque type))
 - #105623 (Fix `-Z print-type-sizes` for generators with discriminant field ordered first)
 - #105627 (Auto traits in `dyn Trait + Auto` are suggestable)
 - #105633 (Make `report_projection_error` more `Term` agnostic)
 - #105683 (Various cleanups to dest prop)
 - #105692 (Add regression test for #104678)
 - #105707 (rustdoc: remove unnecessary CSS `kbd { cursor: default }`)
 - #105715 (Do not mention long types in E0599 label)
 - #105722 (more clippy::complexity fixes)
 - #105724 (rustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`)
 - #105730 (rustdoc: remove no-op CSS `.item-info:before { color }`)

Failed merges:

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

18 months agoRollup merge of #105730 - notriddle:notriddle/item-info-before, r=GuillaumeGomez
Matthias Krüger [Thu, 15 Dec 2022 11:46:05 +0000 (12:46 +0100)]
Rollup merge of #105730 - notriddle:notriddle/item-info-before, r=GuillaumeGomez

rustdoc: remove no-op CSS `.item-info:before { color }`

No content is set, so this pseudo-element does not exist. The CSS was obsoleted by 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0.

18 months agoRollup merge of #105724 - notriddle:notriddle/scrape-example-src-line-numbers, r...
Matthias Krüger [Thu, 15 Dec 2022 11:46:05 +0000 (12:46 +0100)]
Rollup merge of #105724 - notriddle:notriddle/scrape-example-src-line-numbers, r=GuillaumeGomez

rustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`

This is the default CSS for `<pre>` tags in `.code-wrapper` anyway, so this line does nothing.

18 months agoRollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:04 +0000 (12:46 +0100)]
Rollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors

more clippy::complexity fixes

r? ```@compiler-errors```

18 months agoRollup merge of #105715 - estebank:unsatisfied-bounds-label, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:04 +0000 (12:46 +0100)]
Rollup merge of #105715 - estebank:unsatisfied-bounds-label, r=compiler-errors

Do not mention long types in E0599 label

The type is already mentioned in the main message and the list of unmet bounds.

18 months agoRollup merge of #105707 - notriddle:notriddle/kbd-cursor, r=jhpratt,GuillaumeGomez
Matthias Krüger [Thu, 15 Dec 2022 11:46:03 +0000 (12:46 +0100)]
Rollup merge of #105707 - notriddle:notriddle/kbd-cursor, r=jhpratt,GuillaumeGomez

rustdoc: remove unnecessary CSS `kbd { cursor: default }`

Added along with theme picker changes in https://github.com/rust-lang/rust/pull/47686/files#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413R1144, but no reason seems to have been given at the time for why this particular rule was added.

Removing this rule results in `<kbd>` elements getting an I-bar, while the rule causes them to use the "default" arrow, but since selecting the text in these elements works fine, the I-bar is not misleading.

18 months agoRollup merge of #105692 - JohnTitor:issue-104678, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:03 +0000 (12:46 +0100)]
Rollup merge of #105692 - JohnTitor:issue-104678, r=compiler-errors

Add regression test for #104678

Closes #104678
r? `````@compiler-errors`````

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
18 months agoRollup merge of #105683 - JakobDegen:dest-prop-storage, r=tmiasko
Matthias Krüger [Thu, 15 Dec 2022 11:46:02 +0000 (12:46 +0100)]
Rollup merge of #105683 - JakobDegen:dest-prop-storage, r=tmiasko

Various cleanups to dest prop

This makes fixing the issues identified in #105577 easier. A couple changes

 - Use an enum with names instead of a bool
 - Only call `remove_candidates_if` from one place instead of two. Doing it from two places is far too fragile, since any divergence in the behavior between those callsites is likely to be unsound.
 - Remove `is_constant`. Right now we only merge locals, so this doesn't do anything, and the logic would be wrong if it did.

r? `@tmiasko`

18 months agoRollup merge of #105633 - compiler-errors:term-agnostic, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 11:46:01 +0000 (12:46 +0100)]
Rollup merge of #105633 - compiler-errors:term-agnostic, r=oli-obk

Make `report_projection_error` more `Term` agnostic

Fixes #105632

18 months agoRollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwco
Matthias Krüger [Thu, 15 Dec 2022 11:46:01 +0000 (12:46 +0100)]
Rollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwco

Auto traits in `dyn Trait + Auto` are suggestable

Not  sure why I had made the `IsSuggestableVisitor` have that rule to not consider `dyn Trait + Auto` to be suggestable.

It's possible that this was done because of the fact that we don't print the right parentheses for `&(dyn Trait + Auto)`, but that's a problem with printing these types in general that we probably have tracked somewhere else...

18 months agoRollup merge of #105623 - compiler-errors:generator-type-size-fix, r=Nilstrieb
Matthias Krüger [Thu, 15 Dec 2022 11:46:00 +0000 (12:46 +0100)]
Rollup merge of #105623 - compiler-errors:generator-type-size-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes #105589
Fixes #105591

18 months agoRollup merge of #104592 - ComputerDruid:async_check, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:00 +0000 (12:46 +0100)]
Rollup merge of #104592 - ComputerDruid:async_check, r=compiler-errors

Ensure async trait impls are async (or otherwise return an opaque type)

As a workaround for the full `#[refine]` semantics not being implemented
yet, forbit returning a concrete future type like `Box<dyn Future>` or a
manually implemented Future.

`-> impl Future` is still permitted; while that can also cause
accidental refinement, that's behind a different feature gate
(`return_position_impl_trait_in_trait`) and that problem exists
regardless of whether the trait method is async, so will have to be
solved more generally.

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

18 months agoAuto merge of #105285 - compiler-errors:conflicting-param-env-2, r=estebank
bors [Thu, 15 Dec 2022 11:11:49 +0000 (11:11 +0000)]
Auto merge of #105285 - compiler-errors:conflicting-param-env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts #98794 (i.e. reverts #99290).

The previous time I attempted to land this PR, it was because of an incremental issue (#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by `@lcnr)` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes #105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes #105131.
Fixes (again) #98786

18 months agoAuto merge of #105713 - bjorn3:sync_cg_clif-2022-12-14, r=bjorn3
bors [Thu, 15 Dec 2022 07:23:38 +0000 (07:23 +0000)]
Auto merge of #105713 - bjorn3:sync_cg_clif-2022-12-14, r=bjorn3

Sync rustc_codegen_cranelift

This time there are a bunch of bugfixes, some new llvm intrinsic implementations and refactorings to the build system in preparation for running cg_clif tests as part of `./x.py test`.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

18 months agoVarious cleanups to dest prop
Jakob Degen [Wed, 14 Dec 2022 05:30:42 +0000 (21:30 -0800)]
Various cleanups to dest prop

18 months agorustdoc: remove no-op CSS `.item-info:before { color }`
Michael Howell [Thu, 15 Dec 2022 05:11:59 +0000 (22:11 -0700)]
rustdoc: remove no-op CSS `.item-info:before { color }`

No content is set, so this pseudo-element does not exist. The CSS was
obsoleted by 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0.

18 months agoAuto merge of #105657 - oli-obk:mk_projection_ty, r=lcnr
bors [Thu, 15 Dec 2022 04:21:25 +0000 (04:21 +0000)]
Auto merge of #105657 - oli-obk:mk_projection_ty, r=lcnr

Guard ProjectionTy creation against passing the wrong number of substs

r? `@lcnr`

18 months agoMerge `SimplifiedTypeGen<D>` into `SimplifiedType`.
Nicholas Nethercote [Thu, 15 Dec 2022 04:13:19 +0000 (15:13 +1100)]
Merge `SimplifiedTypeGen<D>` into `SimplifiedType`.

`SimplifiedTypeGen<DefId>` is the only instantiation used, so we don't
need the generic parameter.

18 months agoRemove `SimplifiedTypeGen::map_def`.
Nicholas Nethercote [Thu, 15 Dec 2022 04:04:09 +0000 (15:04 +1100)]
Remove `SimplifiedTypeGen::map_def`.

It's unused.

18 months agoTweak output for bare `dyn Trait` in arguments
Esteban Küber [Thu, 15 Dec 2022 02:51:55 +0000 (18:51 -0800)]
Tweak output for bare `dyn Trait` in arguments

Fix #35825.

18 months agoAuto merge of #104765 - chenyukang:yukang-fix-104639-lifetime-check, r=oli-obk
bors [Thu, 15 Dec 2022 01:28:16 +0000 (01:28 +0000)]
Auto merge of #104765 - chenyukang:yukang-fix-104639-lifetime-check, r=oli-obk

Find the right lower bound region in the scenario of partial order relations

Fixes #104639

18 months agoEnsure async trait impls are async (or otherwise return an opaque type)
Dan Johnson [Thu, 3 Nov 2022 00:45:08 +0000 (17:45 -0700)]
Ensure async trait impls are async (or otherwise return an opaque type)

As a workaround for the full `#[refine]` semantics not being implemented
yet, forbit returning a concrete future type like `Box<dyn Future>` or a
manually implemented Future.

`-> impl Future` is still permitted; while that can also cause
accidental refinement, that's behind a different feature gate
(`return_position_impl_trait_in_trait`) and that problem exists
regardless of whether the trait method is async, so will have to be
solved more generally.

Fixes #102745

18 months agorustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`
Michael Howell [Wed, 14 Dec 2022 23:25:26 +0000 (16:25 -0700)]
rustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`

This is the default CSS for `<pre>` tags in `.code-wrapper` anyway, so this
line does nothing.

18 months agomore clippy::complexity fixes
Matthias Krüger [Wed, 14 Dec 2022 23:06:34 +0000 (00:06 +0100)]
more clippy::complexity fixes

18 months agoAuto merge of #105704 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 14 Dec 2022 22:24:31 +0000 (22:24 +0000)]
Auto merge of #105704 - weihanglo:update-cargo, r=weihanglo

Update cargo

8 commits in 70898e522116f6c23971e2a554b2dc85fd4c84cd..cc0a320879c17207bbfb96b5d778e28a2c62030d 2022-12-05 19:43:44 +0000 to 2022-12-14 14:46:57 +0000
- artifact deps should works when target field specified coexists with `optional = true` (rust-lang/cargo#11434)
- Add `home` crate to cargo crates (rust-lang/cargo#11359)
- Use proper git URL for GitHub repos (rust-lang/cargo#11475)
- Fixes flock(fd, LOCK_UN) emulation on Solaris. (rust-lang/cargo#11474)
- Allow Check targets needed for optional doc-scraping to fail without killing the build (rust-lang/cargo#11450)
- fix: gleaning rustdocflags from `target.cfg(…)` is not supported (rust-lang/cargo#11323)
- Fix typo (rust-lang/cargo#11470)
- resolver.md: Fix naming in example (rust-lang/cargo#11469)

r? `@ghost`

18 months agowrap output in BufWriter
Rémy Rakic [Wed, 14 Dec 2022 20:15:58 +0000 (20:15 +0000)]
wrap output in BufWriter

18 months agobless rustdoc test for unstable options
Rémy Rakic [Fri, 9 Dec 2022 01:55:03 +0000 (01:55 +0000)]
bless rustdoc test for unstable options

18 months agoadd `-Z dump-mono-stats`
Rémy Rakic [Thu, 8 Dec 2022 19:21:08 +0000 (19:21 +0000)]
add `-Z dump-mono-stats`

This option will output some stats from the monomorphization collection
pass to a file, to show estimated sizes from each instantiation.

18 months agoadd helper to get DefId from MonoItem
Rémy Rakic [Thu, 8 Dec 2022 19:20:16 +0000 (19:20 +0000)]
add helper to get DefId from MonoItem

18 months agoDo not mention long types in E0599 label
Esteban Küber [Wed, 14 Dec 2022 19:26:32 +0000 (11:26 -0800)]
Do not mention long types in E0599 label

The type is already mentioned in the main message and the list of unmet
bounds.

18 months agoAuto merge of #105703 - matthiaskrgr:rollup-tfpeam2, r=matthiaskrgr
bors [Wed, 14 Dec 2022 19:14:39 +0000 (19:14 +0000)]
Auto merge of #105703 - matthiaskrgr:rollup-tfpeam2, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #105399 (Use more LFS functions.)
 - #105578 (Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR))
 - #105598 (explain mem::forget(env_lock) in fork/exec)
 - #105624 (Fix unsoundness in bootstrap cache code)
 - #105630 (Add a test for #92481)
 - #105684 (Improve rustdoc markdown variable naming)
 - #105697 (Remove fee1-dead from reviewers)

Failed merges:

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

18 months agoFix rustdoc
Oli Scherer [Wed, 14 Dec 2022 18:55:55 +0000 (18:55 +0000)]
Fix rustdoc

18 months agoAdd tidy exceptions
bjorn3 [Wed, 14 Dec 2022 18:47:46 +0000 (19:47 +0100)]
Add tidy exceptions

18 months agoAdd test
Michael Goulet [Mon, 5 Dec 2022 04:38:58 +0000 (04:38 +0000)]
Add test

18 months agoHighlight conflicting param-env candidates, again
Michael Goulet [Tue, 15 Nov 2022 23:11:11 +0000 (23:11 +0000)]
Highlight conflicting param-env candidates, again

18 months agoAuto traits in dyn are suggestable
Michael Goulet [Mon, 12 Dec 2022 19:23:20 +0000 (19:23 +0000)]
Auto traits in dyn are suggestable

18 months agoMake report_projection_error more term agnostic
Michael Goulet [Mon, 12 Dec 2022 21:03:00 +0000 (21:03 +0000)]
Make report_projection_error more term agnostic

18 months agoMerge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into sync_cg_clif-2022-12-14
bjorn3 [Wed, 14 Dec 2022 18:30:46 +0000 (19:30 +0100)]
Merge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into sync_cg_clif-2022-12-14

18 months agodrive-by: Fix path spans
Michael Goulet [Sat, 12 Nov 2022 20:03:20 +0000 (20:03 +0000)]
drive-by: Fix path spans

18 months agoUse impl's def id when calculating type to specify UFCS
Michael Goulet [Sat, 12 Nov 2022 19:42:06 +0000 (19:42 +0000)]
Use impl's def id when calculating type to specify UFCS

18 months agorustdoc: remove unnecessary CSS `kbd { cursor: default }`
Michael Howell [Wed, 14 Dec 2022 17:26:39 +0000 (10:26 -0700)]
rustdoc: remove unnecessary CSS `kbd { cursor: default }`

Added along with theme picker changes in
e78f1392b79779fa184f9a63e7be04ac7074a1c2, but no reason seems to have been
given at the time for why this particular rule was added.

Removing this rule results in `<kbd>` elements getting an I-bar, while the
rule causes them to use the "default" arrow, but since selecting the text in
these elements works fine, the I-bar is not misleading.

18 months agoMake print_type_sizes test not use feature(start)
Michael Goulet [Mon, 12 Dec 2022 20:09:34 +0000 (20:09 +0000)]
Make print_type_sizes test not use feature(start)

18 months agoConsider discriminant fields that are ordered before variant fields
Michael Goulet [Mon, 12 Dec 2022 18:21:10 +0000 (18:21 +0000)]
Consider discriminant fields that are ordered before variant fields

18 months agoUpdate cargo
Weihang Lo [Wed, 14 Dec 2022 16:20:45 +0000 (16:20 +0000)]
Update cargo

8 commits in 70898e522116f6c23971e2a554b2dc85fd4c84cd..cc0a320879c17207bbfb96b5d778e28a2c62030d
2022-12-05 19:43:44 +0000 to 2022-12-14 14:46:57 +0000
- artifact deps should works when target field specified coexists with `optional = true` (rust-lang/cargo#11434)
- Add `home` crate to cargo crates (rust-lang/cargo#11359)
- Use proper git URL for GitHub repos (rust-lang/cargo#11475)
- Fixes flock(fd, LOCK_UN) emulation on Solaris. (rust-lang/cargo#11474)
- Allow Check targets needed for optional doc-scraping to fail without killing the build (rust-lang/cargo#11450)
- fix: gleaning rustdocflags from `target.cfg(…)` is not supported (rust-lang/cargo#11323)
- Fix typo (rust-lang/cargo#11470)
- resolver.md: Fix naming in example (rust-lang/cargo#11469)

18 months agoRollup merge of #105697 - fee1-dead-contrib:rm-fee1-dead, r=Mark-Simulacrum
Matthias Krüger [Wed, 14 Dec 2022 16:17:59 +0000 (17:17 +0100)]
Rollup merge of #105697 - fee1-dead-contrib:rm-fee1-dead, r=Mark-Simulacrum

Remove fee1-dead from reviewers

.. for now. I have been burned out a bit from reviews and I think I should take a break.

18 months agoRollup merge of #105684 - GuillaumeGomez:improve-rustdoc-var-name, r=notriddle
Matthias Krüger [Wed, 14 Dec 2022 16:17:59 +0000 (17:17 +0100)]
Rollup merge of #105684 - GuillaumeGomez:improve-rustdoc-var-name, r=notriddle

Improve rustdoc markdown variable naming

Opened on the right repository this time. :laughing:

r? `@notriddle`

18 months agoRollup merge of #105630 - albertlarsan68:test-92481, r=TaKO8Ki
Matthias Krüger [Wed, 14 Dec 2022 16:17:58 +0000 (17:17 +0100)]
Rollup merge of #105630 - albertlarsan68:test-92481, r=TaKO8Ki

Add a test for #92481

The test was copied ad-hoc from #92481, but I can't get the test to pass, because of needing to get twice the same error on the last line of the source.

Closes #92481

18 months agoRollup merge of #105624 - compiler-errors:cache-unsound, r=jyn514
Matthias Krüger [Wed, 14 Dec 2022 16:17:58 +0000 (17:17 +0100)]
Rollup merge of #105624 - compiler-errors:cache-unsound, r=jyn514

Fix unsoundness in bootstrap cache code

Discovered via #105575, which showed that rustc was failing to build during a perf run.

18 months agoRollup merge of #105598 - RalfJung:more-comments, r=the8472
Matthias Krüger [Wed, 14 Dec 2022 16:17:57 +0000 (17:17 +0100)]
Rollup merge of #105598 - RalfJung:more-comments, r=the8472

explain mem::forget(env_lock) in fork/exec

I stumbled upon this while doing triage for https://github.com/rust-lang/rust/issues/64718.

18 months agoRollup merge of #105578 - erikdesjardins:addrspacecast, r=bjorn3
Matthias Krüger [Wed, 14 Dec 2022 16:17:57 +0000 (17:17 +0100)]
Rollup merge of #105578 - erikdesjardins:addrspacecast, r=bjorn3

Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR)

Currently, this causes a verifier error (https://godbolt.org/z/YYohed4bj), since it uses `bitcast`, which can't convert between address spaces.

Uncovered due to https://github.com/rust-lang/rust/pull/105545#discussion_r1045269309

r? `@bjorn3`

18 months agoRollup merge of #105399 - mikebenfield:lfs, r=thomcc
Matthias Krüger [Wed, 14 Dec 2022 16:17:56 +0000 (17:17 +0100)]
Rollup merge of #105399 - mikebenfield:lfs, r=thomcc

Use more LFS functions.

On Linux, use mmap64, open64, openat64, and sendfile64 in place of their non-LFS counterparts.

This is relevant to #94173.

With these changes (together with rust-lang/backtrace-rs#501), the simple binaries I produce with rustc seem to have no non-LFS functions, so maybe #94173 is fixed. But I can't be sure if I've missed something and maybe some non-LFS functions could sneak in somehow.

18 months agoAuto merge of #105233 - mejrs:always_eager, r=estebank
bors [Wed, 14 Dec 2022 16:16:50 +0000 (16:16 +0000)]
Auto merge of #105233 - mejrs:always_eager, r=estebank

Always evaluate vecs of subdiagnostics eagerly

See https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/310186705 for context

18 months agoDebug assertions hate this trick
Oli Scherer [Wed, 14 Dec 2022 15:37:47 +0000 (15:37 +0000)]
Debug assertions hate this trick

18 months agoFix some comments and only get the generics in debug mode
Oli Scherer [Wed, 14 Dec 2022 14:37:16 +0000 (14:37 +0000)]
Fix some comments and only get the generics in debug mode

18 months agoFix a freshly detected wrong TraitRef
Oli Scherer [Tue, 13 Dec 2022 11:59:15 +0000 (11:59 +0000)]
Fix a freshly detected wrong TraitRef

18 months agoRemove TraitRef::new
Oli Scherer [Tue, 13 Dec 2022 11:25:31 +0000 (11:25 +0000)]
Remove TraitRef::new

18 months agoPrevent the creation of `TraitRef` without dedicated methods
Oli Scherer [Tue, 13 Dec 2022 11:18:58 +0000 (11:18 +0000)]
Prevent the creation of `TraitRef` without dedicated methods

18 months agoEnsure no one constructs `AliasTy`s themselves
Oli Scherer [Tue, 13 Dec 2022 11:07:42 +0000 (11:07 +0000)]
Ensure no one constructs `AliasTy`s themselves

18 months agoRemove one more usage of `mk_substs_trait`
Oli Scherer [Tue, 13 Dec 2022 10:49:30 +0000 (10:49 +0000)]
Remove one more usage of `mk_substs_trait`

18 months agoRemove many more cases of `mk_substs_trait` that can now use the iterator scheme`
Oli Scherer [Tue, 13 Dec 2022 10:44:35 +0000 (10:44 +0000)]
Remove many more cases of `mk_substs_trait` that can now use the iterator scheme`

18 months agoLet `mk_fn_def` take an iterator instead to simplify some call sites
Oli Scherer [Tue, 13 Dec 2022 10:37:19 +0000 (10:37 +0000)]
Let `mk_fn_def` take an iterator instead to simplify some call sites

18 months agoRename to match similar methods
Oli Scherer [Tue, 13 Dec 2022 10:26:11 +0000 (10:26 +0000)]
Rename to match similar methods

18 months agoGuard `AliasTy` creation against passing the wrong number of substs
Oli Scherer [Tue, 13 Dec 2022 10:25:21 +0000 (10:25 +0000)]
Guard `AliasTy` creation against passing the wrong number of substs

18 months agoRemove unnecessary git init
bjorn3 [Wed, 14 Dec 2022 15:23:24 +0000 (15:23 +0000)]
Remove unnecessary git init

18 months agoExplicitly provide dummy git author name and email
bjorn3 [Wed, 14 Dec 2022 15:21:18 +0000 (15:21 +0000)]
Explicitly provide dummy git author name and email

This avoids the need to tell git beforehand about your name and email

18 months agoAuto merge of #105690 - matthiaskrgr:rollup-khtq97k, r=matthiaskrgr
bors [Wed, 14 Dec 2022 12:46:08 +0000 (12:46 +0000)]
Auto merge of #105690 - matthiaskrgr:rollup-khtq97k, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105642 (Minor grammar nit.)
 - #105658 (Remove ..X from RELEASES.md)
 - #105663 (Adjust log line in `fuchsia-test-runner.py`)
 - #105664 (rustdoc: apply `pre-wrap` CSS to code-wrapped links)
 - #105665 (rustdoc: simplify popover CSS)
 - #105676 (rustdoc: add CSS margin between `impl` docblock and its items)

Failed merges:

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

18 months agoRemove fee1-dead from reviewers
Deadbeef [Wed, 14 Dec 2022 12:41:11 +0000 (12:41 +0000)]
Remove fee1-dead from reviewers

.. for now. I have been burned out a bit from reviews
and I think I should take a break.