]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoremove confusing comment
lcnr [Fri, 25 Nov 2022 15:35:10 +0000 (16:35 +0100)]
remove confusing comment

`?0: CoerceUnsized<SomeTy>` can definitely apply because
`?0` matches any type, same for `SomeTy: CoerceUnsized<?0>`

18 months agoremove `TypeError::ObjectUnsafeCoercion`
lcnr [Fri, 25 Nov 2022 15:21:42 +0000 (16:21 +0100)]
remove `TypeError::ObjectUnsafeCoercion`

18 months agosmall method code cleanup
lcnr [Fri, 25 Nov 2022 14:51:46 +0000 (15:51 +0100)]
small method code cleanup

18 months agoAuto merge of #104650 - BlackHoleFox:stuck-with-xcode-13, r=Mark-Simulacrum
bors [Fri, 25 Nov 2022 09:44:16 +0000 (09:44 +0000)]
Auto merge of #104650 - BlackHoleFox:stuck-with-xcode-13, r=Mark-Simulacrum

Build macOS distribution artifacts with XCode 13

After all of the `rust-lang/rust` Apple runners started using macOS 12, the builds created by CI began to use XCode 14.0.1. Due to this (as far as we can tell), XCode's build tools started to ignore the `MACOSX_DEPLOYMENT_TARGET` being defined by us for the distributed builds that let both `rustc` and `libstd` work on older versions. The current idea is that since XCode 14's macOS SDK doesn't support deployment targets before 10.13, it uses some default of its own. You can see the difference between stable's and the most recent nighty's supported versions [here](https://github.com/rust-lang/rust/issues/104570#issuecomment-1321225907).

I wasn't able to confirm my SDK versioning hypothesis locally since I think there's something jammed with my XCode installation, but hopefully this should still fix it for releases.

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

r? `@Mark-Simulacrum`

18 months agoAuto merge of #104602 - petrochenkov:effvisperf5, r=oli-obk
bors [Fri, 25 Nov 2022 06:14:42 +0000 (06:14 +0000)]
Auto merge of #104602 - petrochenkov:effvisperf5, r=oli-obk

privacy: Fix more (potential) issues with effective visibilities

Continuation of https://github.com/rust-lang/rust/pull/103965.
See individual commits for more detailed description of the changes.

The shortcuts removed in https://github.com/rust-lang/rust/pull/104602/commits/4eb63f618e601efee657d24cd4e8833fb03fac4c and https://github.com/rust-lang/rust/pull/104602/commits/c7c7d1672739e38c8d39ae861b284486aefd5b48 could actually be correct (or correct after some tweaks), but they used global reasoning like "we can skip this update because if the code compiles then some other update should do the same thing eventually".
I have some expertise in this area, but I still have doubt whether such global reasoning was correct or not, especially in presence of all possible exotic cases with imports.
After this PR all table changes should be "locally correct" after every update, even if it may be overcautious.
If similar optimizations are introduced again they will need detailed comments explaining why it's legal to do what they do and providing proofs.

Fixes https://github.com/rust-lang/rust/issues/104249.
Fixes https://github.com/rust-lang/rust/issues/104539.

18 months agoAuto merge of #104855 - thomcc:revert-noinline-wintls, r=ChrisDenton
bors [Fri, 25 Nov 2022 03:17:25 +0000 (03:17 +0000)]
Auto merge of #104855 - thomcc:revert-noinline-wintls, r=ChrisDenton

Revert "Forbid inlining `thread_local!`'s `__getit` function on Windows"

Revert of #101368, fixes #104852.

I'd rather not do this since that's a soundness fix and this is hitting some compiler bug, but I don't really know an alternative.

r? `@ChrisDenton`

18 months agoRevert "Forbid inlining `thread_local!`'s `__getit` function on Windows"
Thom Chiovoloni [Fri, 25 Nov 2022 02:12:12 +0000 (18:12 -0800)]
Revert "Forbid inlining `thread_local!`'s `__getit` function on Windows"

This reverts commit 3099dfdd9fc1a331eb9c53200b310fa1a06e1573.

18 months agoAuto merge of #104845 - matthiaskrgr:rollup-tckj956, r=matthiaskrgr
bors [Thu, 24 Nov 2022 23:45:32 +0000 (23:45 +0000)]
Auto merge of #104845 - matthiaskrgr:rollup-tckj956, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #104514 (Use node_ty_opt to avoid ICE in visit_ty)
 - #104704 (Allow power10-vector feature in PowerPC)
 - #104747 (resolve: Don't use constructor def ids in the map for field names)
 - #104773 (OpaqueCast projections are always overlapping, they can't possibly be disjoint)
 - #104774 (Document split{_ascii,}_whitespace() for empty strings)
 - #104780 (make `error_reported` check for delayed bugs)
 - #104782 (Bump the const eval step limit)
 - #104792 (rustdoc: simplify `.search-results-title` CSS)
 - #104796 (lint: do not warn unused parens around higher-ranked function pointers)
 - #104820 (Remove normalize_projection_type)
 - #104822 (with_query_mode -> new)

Failed merges:

 - #104716 (move 2 candidates into builtin candidate)
 - #104841 (Assert that we don't capture escaping bound vars in `Fn` trait selection)

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

18 months agoRollup merge of #104822 - spastorino:selctx-new-instead-of-with_query_mode, r=lcnr
Matthias Krüger [Thu, 24 Nov 2022 20:34:57 +0000 (21:34 +0100)]
Rollup merge of #104822 - spastorino:selctx-new-instead-of-with_query_mode, r=lcnr

with_query_mode -> new

r? ```@lcnr```

18 months agoRollup merge of #104820 - spastorino:remove-normalize_projection_type, r=jackh726
Matthias Krüger [Thu, 24 Nov 2022 20:34:56 +0000 (21:34 +0100)]
Rollup merge of #104820 - spastorino:remove-normalize_projection_type, r=jackh726

Remove normalize_projection_type

r? ``@lcnr``

18 months agoRollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obk
Matthias Krüger [Thu, 24 Nov 2022 20:34:56 +0000 (21:34 +0100)]
Rollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obk

lint: do not warn unused parens around higher-ranked function pointers

Fixes #104397

18 months agoRollup merge of #104792 - notriddle:notriddle/crate-search-title-display, r=Guillaume...
Matthias Krüger [Thu, 24 Nov 2022 20:34:55 +0000 (21:34 +0100)]
Rollup merge of #104792 - notriddle:notriddle/crate-search-title-display, r=GuillaumeGomez

rustdoc: simplify `.search-results-title` CSS

By using `display: flex`, we still get the never-wrapping layout with `#crate-search-div` maxing out and truncating its text. The title itself winds up always filling its parent, but since `#crate-search` doesn't have `flex-grow` set, it won't fill available space.

18 months agoRollup merge of #104782 - oli-obk:const_eval_limit_bump, r=pnkfelix
Matthias Krüger [Thu, 24 Nov 2022 20:34:55 +0000 (21:34 +0100)]
Rollup merge of #104782 - oli-obk:const_eval_limit_bump, r=pnkfelix

Bump the const eval step limit

fixes https://github.com/rust-lang/rust/issues/103814

https://github.com/rust-lang/rust/pull/103877 has too much of an impact to beta backport. So let's just increase the limit, avoiding the immediate breakage.

r? ``@pnkfelix``

18 months agoRollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obk
Matthias Krüger [Thu, 24 Nov 2022 20:34:54 +0000 (21:34 +0100)]
Rollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obk

make `error_reported` check for delayed bugs

Fixes #104768

`error_reported()` was only checking if there were errors emitted, not for `delay_bug`s which can also be a source of `ErrorGuaranteed`. I assume the same is true of `lint_err_count` but i dont know

18 months agoRollup merge of #104774 - vojtechkral:doc-str-empty-split-whitespace, r=thomcc
Matthias Krüger [Thu, 24 Nov 2022 20:34:54 +0000 (21:34 +0100)]
Rollup merge of #104774 - vojtechkral:doc-str-empty-split-whitespace, r=thomcc

Document split{_ascii,}_whitespace() for empty strings

doc change only

18 months agoRollup merge of #104773 - oli-obk:overlap, r=lcnr
Matthias Krüger [Thu, 24 Nov 2022 20:34:53 +0000 (21:34 +0100)]
Rollup merge of #104773 - oli-obk:overlap, r=lcnr

OpaqueCast projections are always overlapping, they can't possibly be disjoint

r? ``@lcnr``

18 months agoRollup merge of #104747 - petrochenkov:ctorfields, r=cjgillot
Matthias Krüger [Thu, 24 Nov 2022 20:34:53 +0000 (21:34 +0100)]
Rollup merge of #104747 - petrochenkov:ctorfields, r=cjgillot

resolve: Don't use constructor def ids in the map for field names

Also do some minor cleanup to insertion of those field names.

Addresses a FIXME left in https://github.com/rust-lang/rust/pull/103578.

18 months agoRollup merge of #104704 - ecnelises:p10vec, r=jackh726
Matthias Krüger [Thu, 24 Nov 2022 20:34:52 +0000 (21:34 +0100)]
Rollup merge of #104704 - ecnelises:p10vec, r=jackh726

Allow power10-vector feature in PowerPC

Note that we don't have `power10-altivec`:

https://github.com/llvm/llvm-project/blob/57fd7ffefffae313de800fecdd9f095a17bfd4ea/llvm/lib/Target/PowerPC/PPC.td#L277-L280

18 months agoRollup merge of #104514 - chenyukang:yukang/fix-104513-ice, r=petrochenkov
Matthias Krüger [Thu, 24 Nov 2022 20:34:51 +0000 (21:34 +0100)]
Rollup merge of #104514 - chenyukang:yukang/fix-104513-ice, r=petrochenkov

Use node_ty_opt to avoid ICE in visit_ty

Fixes #104513

18 months agoAuto merge of #103693 - HKalbasi:master, r=oli-obk
bors [Thu, 24 Nov 2022 20:29:13 +0000 (20:29 +0000)]
Auto merge of #103693 - HKalbasi:master, r=oli-obk

Make rustc_target usable outside of rustc

I'm working on showing type size in rust-analyzer (https://github.com/rust-lang/rust-analyzer/pull/13490) and I currently copied rustc code inside rust-analyzer, which works, but is bad. With this change, I would become able to use `rustc_target` and `rustc_index` directly in r-a, reducing the amount of copy needed.

This PR contains some feature flag to put nightly features behind them to make crates buildable on the stable compiler + makes layout related types generic over index type + removes interning of nested layouts.

18 months agoAuto merge of #104321 - Swatinem:async-gen, r=oli-obk
bors [Thu, 24 Nov 2022 17:14:42 +0000 (17:14 +0000)]
Auto merge of #104321 - Swatinem:async-gen, r=oli-obk

Avoid `GenFuture` shim when compiling async constructs

Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`.

The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim.

The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.

---

Given this demo code:

```rust
pub async fn a(arg: u32) -> Backtrace {
    let bt = b().await;
    let _arg = arg;
    bt
}

pub async fn b() -> Backtrace {
    Backtrace::force_capture()
}
```

I would get the following with the latest stable compiler (on Windows):

```
   4: async_codegen::b::async_fn$0
             at .\src\lib.rs:10
   5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> >
             at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91
   6: async_codegen::a::async_fn$0
             at .\src\lib.rs:4
   7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> >
             at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91
```

whereas now I get a much cleaner stack trace:

```
   3: async_codegen::b::async_fn$0
             at .\src\lib.rs:10
   4: async_codegen::a::async_fn$0
             at .\src\lib.rs:4
```

18 months agoDocument split{_ascii,}_whitespace() for empty strings
Vojtech Kral [Wed, 23 Nov 2022 14:36:51 +0000 (15:36 +0100)]
Document split{_ascii,}_whitespace() for empty strings

18 months agomove things from rustc_target::abi to rustc_abi
hkalbasi [Sun, 6 Nov 2022 21:06:11 +0000 (00:36 +0330)]
move things from rustc_target::abi to rustc_abi

18 months agomove some layout logic to rustc_target::abi::layout
hkalbasi [Tue, 1 Nov 2022 16:20:30 +0000 (19:50 +0330)]
move some layout logic to rustc_target::abi::layout

18 months agomake rustc_target usable outside of rustc
hkalbasi [Fri, 28 Oct 2022 15:15:55 +0000 (18:45 +0330)]
make rustc_target usable outside of rustc

18 months agowith_query_mode -> new
Santiago Pastorino [Thu, 24 Nov 2022 12:32:48 +0000 (09:32 -0300)]
with_query_mode -> new

18 months agoRemove normalize_projection_type
Santiago Pastorino [Wed, 23 Nov 2022 20:06:56 +0000 (17:06 -0300)]
Remove normalize_projection_type

18 months agomake `error_reported` check for delayed bugs
Boxy [Thu, 24 Nov 2022 11:12:34 +0000 (11:12 +0000)]
make `error_reported` check for delayed bugs

18 months agoAuto merge of #104809 - matthiaskrgr:rollup-8abjdwh, r=matthiaskrgr
bors [Thu, 24 Nov 2022 09:44:46 +0000 (09:44 +0000)]
Auto merge of #104809 - matthiaskrgr:rollup-8abjdwh, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #103908 (Suggest `.clone()` or `ref binding` on E0382)
 - #104517 (Throw error on failure in loading llvm-plugin)
 - #104594 (Properly handle `Pin<&mut dyn* Trait>` receiver in codegen)
 - #104742 (Make `deref_into_dyn_supertrait` lint the impl and not the usage)
 - #104753 (Pass `InferCtxt` to `DropRangeVisitor` so we can resolve vars)
 - #104771 (Add regression test for issue #99938)
 - #104772 (Small accessibility improvements)
 - #104775 (Use ObligationCtxt::normalize)
 - #104778 (:arrow_up: rust-analyzer)

Failed merges:

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

18 months agoAvoid `GenFuture` shim when compiling async constructs
Arpad Borsos [Fri, 18 Nov 2022 21:56:22 +0000 (22:56 +0100)]
Avoid `GenFuture` shim when compiling async constructs

Previously, async constructs would be lowered to "normal" generators,
with an additional `from_generator` / `GenFuture` shim in between to
convert from `Generator` to `Future`.

The compiler will now special-case these generators internally so that
async constructs will *directly* implement `Future` without the need
to go through the `from_generator` / `GenFuture` shim.

The primary motivation for this change was hiding this implementation
detail in stack traces and debuginfo, but it can in theory also help
the optimizer as there is less abstractions to see through.

18 months agoRollup merge of #104778 - lnicola:rust-analyzer-2022-11-23, r=lnicola
Matthias Krüger [Thu, 24 Nov 2022 07:42:37 +0000 (08:42 +0100)]
Rollup merge of #104778 - lnicola:rust-analyzer-2022-11-23, r=lnicola

:arrow_up: rust-analyzer

r? ```@ghost```

18 months agoRollup merge of #104775 - spastorino:use-obligation-ctxt-normalize, r=lcnr
Matthias Krüger [Thu, 24 Nov 2022 07:42:37 +0000 (08:42 +0100)]
Rollup merge of #104775 - spastorino:use-obligation-ctxt-normalize, r=lcnr

Use ObligationCtxt::normalize

r? ```@lcnr```

18 months agoRollup merge of #104772 - GuillaumeGomez:small-accessibility-improvement, r=notriddle
Matthias Krüger [Thu, 24 Nov 2022 07:42:36 +0000 (08:42 +0100)]
Rollup merge of #104772 - GuillaumeGomez:small-accessibility-improvement, r=notriddle

Small accessibility improvements

From this [reddit post](https://www.reddit.com/r/rust/comments/z1gyz7/accessible_documentation/), I started to check a bit how to improve accessibility and how we could add test for it.

So these two fixes come from the use of the [pa11y tool](https://github.com/pa11y/pa11y). To make it work, I had to update its puppeteer version to the last one but otherwise it seems to be quite nice. I didn't fix all the errors it reported because they were about colors. To get the same result as mine, you can use this config:

```json
{
    "ignore": [
"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail",
"WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2"
     ]
}
```

I think trying to improve accessibility is something we should definitely aim for. I'll try to integrate a tool to enforce this check (very likely `pa11y`) directly into the CI.

cc ``@jsha``
r? ``@notriddle``

18 months agoRollup merge of #104771 - est31:if_let_chain_broken_mir_test, r=davidtwco
Matthias Krüger [Thu, 24 Nov 2022 07:42:35 +0000 (08:42 +0100)]
Rollup merge of #104771 - est31:if_let_chain_broken_mir_test, r=davidtwco

Add regression test for issue #99938

That issue was a dupe of #99852, and it got fixed since, but it's always better to have multiple regression tests rather than one.

closes #99938

18 months agoRollup merge of #104753 - compiler-errors:drop-tracking-var-ice, r=oli-obk
Matthias Krüger [Thu, 24 Nov 2022 07:42:35 +0000 (08:42 +0100)]
Rollup merge of #104753 - compiler-errors:drop-tracking-var-ice, r=oli-obk

Pass `InferCtxt` to `DropRangeVisitor` so we can resolve vars

The types that we encounter in the  `TypeckResults` that we pass to the `DropRangeVisitor` are not yet fully resolved, since that only happens in writeback after type checking is complete.

Instead, pass down the whole `InferCtxt` so that we can resolve any inference vars that have been constrained since they were written into the results. This is similar to how the `MemCategorizationContext` in the `ExprUseVisitor` also needs to pass down both typeck results _and_ the inference context.

Fixes an ICE mentioned in this comment: https://github.com/rust-lang/rust/issues/104382#issuecomment-1324410781

18 months agoRollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errors
Matthias Krüger [Thu, 24 Nov 2022 07:42:34 +0000 (08:42 +0100)]
Rollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errors

Make `deref_into_dyn_supertrait` lint the impl and not the usage

Proposed by ``@compiler-errors`` in https://github.com/rust-lang/rust/issues/89460#issuecomment-1320806785
r? ``@crlf0710``

18 months agoRollup merge of #104594 - compiler-errors:dyn-star-rcvr, r=eholk,estebank
Matthias Krüger [Thu, 24 Nov 2022 07:42:34 +0000 (08:42 +0100)]
Rollup merge of #104594 - compiler-errors:dyn-star-rcvr, r=eholk,estebank

Properly handle `Pin<&mut dyn* Trait>` receiver in codegen

This ensures we can actually await a `dyn* Future`, which seems important for async fn in dyn trait.

Also, disable `dyn*` trait upcasting. It's not exactly complete right now, and can cause strange ICEs for no reason -- nobody's using it either. I thought it was cute to implement when I did it, but I didn't think about how it interacts structurally with `CoerceUnsized` correctly.

Fixes #104794, presumably removing `dyn*` upcasting and its `CoerceUnsized` issues does the trick.

18 months agoRollup merge of #104517 - dfordivam:patch-1, r=cuviper
Matthias Krüger [Thu, 24 Nov 2022 07:42:33 +0000 (08:42 +0100)]
Rollup merge of #104517 - dfordivam:patch-1, r=cuviper

Throw error on failure in loading llvm-plugin

The following code silently ignores the error as the `LLVMRustSetLastError` only tracks one error at a time. At all other places where `LLVMRustSetLastError` is used the code immediately returns.

https://github.com/rust-lang/rust/blob/251831ece9601d64172127b6caae9087358c2386/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L801-L804

18 months agoRollup merge of #103908 - estebank:consider-cloning, r=compiler-errors
Matthias Krüger [Thu, 24 Nov 2022 07:42:33 +0000 (08:42 +0100)]
Rollup merge of #103908 - estebank:consider-cloning, r=compiler-errors

Suggest `.clone()` or `ref binding` on E0382

18 months agoAuto merge of #103808 - cjgillot:vec-cache, r=TaKO8Ki
bors [Thu, 24 Nov 2022 06:32:23 +0000 (06:32 +0000)]
Auto merge of #103808 - cjgillot:vec-cache, r=TaKO8Ki

Use an IndexVec to cache queries with index-like key

Revival of an old idea. Let's see if it has more effect.

r? `@ghost`

18 months agofix #104513, Use node_ty_opt to avoid ICE in visit_ty
yukang [Thu, 17 Nov 2022 12:27:28 +0000 (20:27 +0800)]
fix #104513, Use node_ty_opt to avoid ICE in visit_ty

18 months agoAuto merge of #104610 - ouz-a:revert-overflow, r=compiler-errors
bors [Thu, 24 Nov 2022 03:29:04 +0000 (03:29 +0000)]
Auto merge of #104610 - ouz-a:revert-overflow, r=compiler-errors

Reverts check done by #100757

As my `fix` caused more issues than it resolved it's better to revert it.
( #103274 #104322 https://github.com/rust-lang/rust/issues/104606)

r? `@compiler-errors`

Reopens #95134

18 months agoAdjust tests
Michael Goulet [Thu, 24 Nov 2022 02:36:46 +0000 (02:36 +0000)]
Adjust tests

18 months agoProperly handle `Pin<&mut dyn* Trait>` receiver in codegen
Michael Goulet [Sat, 19 Nov 2022 03:06:21 +0000 (03:06 +0000)]
Properly handle `Pin<&mut dyn* Trait>` receiver in codegen

18 months agoDisable dyn* upcasting
Michael Goulet [Sat, 19 Nov 2022 04:48:01 +0000 (04:48 +0000)]
Disable dyn* upcasting

18 months agolint: do not warn unused parens around higher-ranked function pointers
Michael Howell [Thu, 24 Nov 2022 00:57:11 +0000 (17:57 -0700)]
lint: do not warn unused parens around higher-ranked function pointers

Fixes #104397

18 months agoAuto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiser
bors [Thu, 24 Nov 2022 00:17:35 +0000 (00:17 +0000)]
Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiser

Use `as_deref` in compiler (but only where it makes sense)

This simplifies some code :3

(there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")

18 months agoeffective visibility: Stop recalculating current private visibility
Vadim Petrochenkov [Wed, 23 Nov 2022 22:30:58 +0000 (01:30 +0300)]
effective visibility: Stop recalculating current private visibility

It becomes relatively expensive if done often and shows up during perf profiling.

18 months agoeffective visibility: Always add table entries for nodes used as parents
Vadim Petrochenkov [Wed, 23 Nov 2022 17:31:35 +0000 (20:31 +0300)]
effective visibility: Always add table entries for nodes used as parents

Previously if the parent was not in the table, and there was nothing to inherit from, the child's private visibility was used, but that's not correct - the parent may have a larger visibility so we should set it to at least the parent's private visibility.
That parent's private visibility is also inserted into the table for caching, so it's not recalculated later if used again.

18 months agorustdoc: simplify `.search-results-title` CSS
Michael Howell [Wed, 23 Nov 2022 20:28:06 +0000 (13:28 -0700)]
rustdoc: simplify `.search-results-title` CSS

By using `display: flex`, we still get the never-wrapping layout with
`#crate-search-div` maxing out and truncating its text. The title itself
winds up always filling its parent, but since `#crate-search` doesn't have
`flex-grow` set, it won't fill available space.

18 months agoFix rebase
Esteban Küber [Wed, 23 Nov 2022 20:15:22 +0000 (12:15 -0800)]
Fix rebase

18 months agoeffective visibility: Fix private visibility calculation for modules
Vadim Petrochenkov [Wed, 23 Nov 2022 17:13:44 +0000 (20:13 +0300)]
effective visibility: Fix private visibility calculation for modules

Optimizations removed in the previous commit required this function to behave incorrectly, but now those optimizations are gone so we can fix the bug.

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

18 months agoeffective visibility: Remove questionable optimizations
Vadim Petrochenkov [Wed, 23 Nov 2022 16:19:06 +0000 (19:19 +0300)]
effective visibility: Remove questionable optimizations

First, they require eagerly calculating private visibility (current normal module), which is somewhat expensive.
Private visibilities are also lost once calculated, instead of being cached in the table.

Second, I cannot prove that the optimizations are correct.
Maybe they can be partially reinstated in the future in cases when it's cheap and provably correct to do them.
They will also probably be merged into `fn update` in that case.

Partially fixes https://github.com/rust-lang/rust/issues/104249
Fixes https://github.com/rust-lang/rust/issues/104539

18 months agoeffective visibility: Satisfy borrow checker to use resolver lazily from a closure
Vadim Petrochenkov [Fri, 18 Nov 2022 22:52:49 +0000 (01:52 +0300)]
effective visibility: Satisfy borrow checker to use resolver lazily from a closure

18 months agoAccount for closures
Esteban Küber [Wed, 16 Nov 2022 03:43:33 +0000 (19:43 -0800)]
Account for closures

18 months agoAccount for `x @ y` and suggest `ref x @ ref y`
Esteban Küber [Tue, 15 Nov 2022 17:01:20 +0000 (09:01 -0800)]
Account for `x @ y` and suggest `ref x @ ref y`

18 months agoreview comments: inline bindings and fix typo
Esteban Küber [Sat, 12 Nov 2022 00:57:01 +0000 (16:57 -0800)]
review comments: inline bindings and fix typo

18 months agoFix rebase
Esteban Küber [Thu, 3 Nov 2022 22:10:29 +0000 (15:10 -0700)]
Fix rebase

18 months agoTweak output to account for alternative bindings in the same pattern
Esteban Küber [Thu, 3 Nov 2022 22:08:38 +0000 (15:08 -0700)]
Tweak output to account for alternative bindings in the same pattern

18 months agoFix rustfmt
Esteban Küber [Thu, 3 Nov 2022 21:22:35 +0000 (14:22 -0700)]
Fix rustfmt

18 months agoFix wording
Esteban Küber [Thu, 3 Nov 2022 21:10:08 +0000 (14:10 -0700)]
Fix wording

18 months agoTweak output in for loops
Esteban Küber [Thu, 3 Nov 2022 20:51:44 +0000 (13:51 -0700)]
Tweak output in for loops

Do not suggest `.clone()` as we already suggest borrowing the iterated
value.

18 months agoRemove logic duplication
Esteban Küber [Thu, 3 Nov 2022 19:26:59 +0000 (12:26 -0700)]
Remove logic duplication

18 months agoExtract suggestion logic to its own method
Esteban Küber [Thu, 3 Nov 2022 18:52:26 +0000 (11:52 -0700)]
Extract suggestion logic to its own method

18 months agoUse `type_implements_trait`
Esteban Küber [Thu, 3 Nov 2022 18:06:25 +0000 (11:06 -0700)]
Use `type_implements_trait`

18 months agoFix clippy code
Esteban Küber [Thu, 3 Nov 2022 16:19:23 +0000 (09:19 -0700)]
Fix clippy code

18 months agoDo not suggest `ref` multiple times for the same binding
Esteban Küber [Thu, 3 Nov 2022 16:19:03 +0000 (09:19 -0700)]
Do not suggest `ref` multiple times for the same binding

18 months agoSuggest `.clone()` or `ref binding` on E0382
Esteban Küber [Thu, 3 Nov 2022 04:22:24 +0000 (21:22 -0700)]
Suggest `.clone()` or `ref binding` on E0382

18 months agoAuto merge of #104410 - WaffleLapkin:unregress, r=estebank
bors [Wed, 23 Nov 2022 19:52:43 +0000 (19:52 +0000)]
Auto merge of #104410 - WaffleLapkin:unregress, r=estebank

Fix perf regression by correctly matching keywords

This should (hopefully) fix regression from #99918

r? `@estebank`

18 months agoBump the const eval step limit
Oli Scherer [Wed, 23 Nov 2022 16:26:34 +0000 (16:26 +0000)]
Bump the const eval step limit

18 months agoAdd regression test for issue 99938
est31 [Wed, 23 Nov 2022 12:54:48 +0000 (13:54 +0100)]
Add regression test for issue 99938

That issue was a dupe of 99852, but it's always better to
have multiple regression tests rather than one.

18 months agoAuto merge of #104776 - Dylan-DPC:rollup-rf4c2u0, r=Dylan-DPC
bors [Wed, 23 Nov 2022 16:29:17 +0000 (16:29 +0000)]
Auto merge of #104776 - Dylan-DPC:rollup-rf4c2u0, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #104269 (Fix hang in where-clause suggestion with `predicate_can_apply`)
 - #104286 (copy doc output files by format)
 - #104509 (Use obligation ctxt instead of dyn TraitEngine)
 - #104721 (Remove more `ref` patterns from the compiler)
 - #104744 (rustdoc: give struct fields CSS `display: block`)
 - #104751 (Fix an ICE parsing a malformed attribute.)

Failed merges:

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

18 months agoUse nicer spans for `deref_into_dyn_supertrait`
Maybe Waffle [Wed, 23 Nov 2022 16:12:51 +0000 (16:12 +0000)]
Use nicer spans for `deref_into_dyn_supertrait`

18 months agoMake `deref_into_dyn_supertrait` lint the impl and not the usage
Maybe Waffle [Tue, 22 Nov 2022 21:33:19 +0000 (21:33 +0000)]
Make `deref_into_dyn_supertrait` lint the impl and not the usage

18 months agoMove `get_associated_type` from `clippy` to `rustc_lint`
Maybe Waffle [Tue, 22 Nov 2022 19:52:46 +0000 (19:52 +0000)]
Move `get_associated_type` from `clippy` to `rustc_lint`

18 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 23 Nov 2022 15:24:03 +0000 (17:24 +0200)]
:arrow_up: rust-analyzer

18 months agoRollup merge of #104751 - nnethercote:fix-104620, r=petrochenkov
Dylan DPC [Wed, 23 Nov 2022 15:02:38 +0000 (20:32 +0530)]
Rollup merge of #104751 - nnethercote:fix-104620, r=petrochenkov

Fix an ICE parsing a malformed attribute.

Fixes #104620.

r? `@petrochenkov`

18 months agoRollup merge of #104744 - notriddle:notriddle/struct-fields-display-block, r=Guillaum...
Dylan DPC [Wed, 23 Nov 2022 15:02:37 +0000 (20:32 +0530)]
Rollup merge of #104744 - notriddle:notriddle/struct-fields-display-block, r=GuillaumeGomez

rustdoc: give struct fields CSS `display: block`

Fixes #104737

18 months agoRollup merge of #104721 - WaffleLapkin:deref-harder, r=oli-obk
Dylan DPC [Wed, 23 Nov 2022 15:02:37 +0000 (20:32 +0530)]
Rollup merge of #104721 - WaffleLapkin:deref-harder, r=oli-obk

Remove more `ref` patterns from the compiler

r? `@oli-obk`
Previous PR: https://github.com/rust-lang/rust/pull/104500

18 months agoRollup merge of #104509 - spastorino:use-obligation-ctxt, r=lcnr
Dylan DPC [Wed, 23 Nov 2022 15:02:36 +0000 (20:32 +0530)]
Rollup merge of #104509 - spastorino:use-obligation-ctxt, r=lcnr

Use obligation ctxt instead of dyn TraitEngine

r? `@lcnr`

18 months agoRollup merge of #104286 - ozkanonur:fix-doc-bootstrap-recompilation, r=jyn514
Dylan DPC [Wed, 23 Nov 2022 15:02:36 +0000 (20:32 +0530)]
Rollup merge of #104286 - ozkanonur:fix-doc-bootstrap-recompilation, r=jyn514

copy doc output files by format

This pr provides copying doc outputs by checking output format without removing output directory on each trigger.

Resolves #103785

18 months agoRollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnr
Dylan DPC [Wed, 23 Nov 2022 15:02:35 +0000 (20:32 +0530)]
Rollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnr

Fix hang in where-clause suggestion with `predicate_can_apply`

Using `predicate_may_hold` during error reporting causes an evaluation overflow, which (because we use `evaluate_obligation_no_overflow`) then causes the predicate to need to be re-evaluated locally, which results in a hang.

... but since the "add a where clause" suggestion is best-effort, just throw any overflow errors. No need for 100% accuracy.

r? `@lcnr` who has been thinking about overflows... Let me know if you want more context about this issue, and as always, feel free to reassign.

Fixes #104225

18 months agoOpaqueCast projections are always overlapping, they can't possibly be disjoint
Oli Scherer [Wed, 23 Nov 2022 14:37:13 +0000 (14:37 +0000)]
OpaqueCast projections are always overlapping, they can't possibly be disjoint

18 months agoUse ObligationCtxt::normalize
Santiago Pastorino [Wed, 23 Nov 2022 14:27:07 +0000 (11:27 -0300)]
Use ObligationCtxt::normalize

18 months agoImprove accessibility:
Guillaume Gomez [Wed, 23 Nov 2022 14:05:50 +0000 (15:05 +0100)]
Improve accessibility:
 * Set aria-label attribute on search input
 * Put anchor text directly into the DOM and not in the CSS

18 months agoAuto merge of #103947 - camsteffen:place-clones, r=cjgillot
bors [Wed, 23 Nov 2022 13:13:50 +0000 (13:13 +0000)]
Auto merge of #103947 - camsteffen:place-clones, r=cjgillot

Reduce `PlaceBuilder` cloning

Some API tweaks with an eye towards reducing clones.

18 months agoPass ObligationCtxt from enter_canonical_trait_query and use ObligationCtxt API
Santiago Pastorino [Wed, 16 Nov 2022 22:40:55 +0000 (19:40 -0300)]
Pass ObligationCtxt from enter_canonical_trait_query and use ObligationCtxt API

18 months agoCall fully_solve_obligations instead of repeating code
Santiago Pastorino [Thu, 17 Nov 2022 14:44:24 +0000 (11:44 -0300)]
Call fully_solve_obligations instead of repeating code

18 months agoUse ObligationCtxt intead of dyn TraitEngine
Santiago Pastorino [Wed, 16 Nov 2022 18:58:48 +0000 (15:58 -0300)]
Use ObligationCtxt intead of dyn TraitEngine

18 months agoAuto merge of #102750 - the8472:opt-field-order, r=wesleywiser
bors [Wed, 23 Nov 2022 10:01:48 +0000 (10:01 +0000)]
Auto merge of #102750 - the8472:opt-field-order, r=wesleywiser

optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones

```rust
use std::ptr::addr_of;
use std::mem;

struct Foo {
    word: u32,
    byte: u8,
    ary: [u8; 4]
}

fn main() {
    let foo: Foo = unsafe { mem::zeroed() };

    println!("base: {:p}\nword: {:p}\nbyte: {:p}\nary:  {:p}", &foo, addr_of!(foo.word), addr_of!(foo.byte), addr_of!(foo.ary));
}
```

prints

```
base: 0x7fffc1a8a668
word: 0x7fffc1a8a668
byte: 0x7fffc1a8a66c
ary:  0x7fffc1a8a66d
```

I.e. the `u8` in the middle causes the array to sit at an odd offset, which might prevent optimizations, especially on architectures where unaligned loads are costly.

Note that this will make field ordering niche-dependent, i.e. a `Bar<T>` with `T=char` and `T=u32` may result in different field order, this may break some code that makes invalid assumptions about `repr(Rust)` types.

18 months agoAuto merge of #104758 - Manishearth:rollup-rh1tfum, r=Manishearth
bors [Wed, 23 Nov 2022 06:48:56 +0000 (06:48 +0000)]
Auto merge of #104758 - Manishearth:rollup-rh1tfum, r=Manishearth

Rollup of 6 pull requests

Successful merges:

 - #103488 (Allow opaque types in trait impl headers and rely on coherence to reject unsound cases)
 - #104359 (Refactor must_use lint into two parts)
 - #104612 (Lower return type outside async block creation)
 - #104621 (Fix --extern library finding errors)
 - #104647 (enable fuzzy_provenance_casts lint in liballoc and libstd)
 - #104750 (Bump `fd-lock` in `bootstrap` again)

Failed merges:

 - #104732 (Refactor `ty::ClosureKind` related stuff)

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

18 months agoAdd fatal overflow test
Michael Goulet [Fri, 18 Nov 2022 17:23:10 +0000 (17:23 +0000)]
Add fatal overflow test

18 months agoDrive-by: Don't manually call evaluate_obligation_no_overflow
Michael Goulet [Fri, 11 Nov 2022 03:37:04 +0000 (03:37 +0000)]
Drive-by: Don't manually call evaluate_obligation_no_overflow
18 months agoDo not need to account for overflow in predicate_can_apply
Michael Goulet [Fri, 11 Nov 2022 03:19:02 +0000 (03:19 +0000)]
Do not need to account for overflow in predicate_can_apply

18 months agoRollup merge of #104750 - mati865:bump-fd-lock-again, r=jyn514
Manish Goregaokar [Wed, 23 Nov 2022 03:54:41 +0000 (22:54 -0500)]
Rollup merge of #104750 - mati865:bump-fd-lock-again, r=jyn514

Bump `fd-lock` in `bootstrap` again

Followup to https://github.com/rust-lang/rust/pull/103778
Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.

18 months agoRollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc
Manish Goregaokar [Wed, 23 Nov 2022 03:54:41 +0000 (22:54 -0500)]
Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc

enable fuzzy_provenance_casts lint in liballoc and libstd

r? ````@thomcc````

18 months agoRollup merge of #104621 - YC:master, r=davidtwco
Manish Goregaokar [Wed, 23 Nov 2022 03:54:40 +0000 (22:54 -0500)]
Rollup merge of #104621 - YC:master, r=davidtwco

Fix --extern library finding errors

- `crate_name` is not specified/passed to `metadata_crate_location_unknown_type`
https://github.com/rust-lang/rust/blob/c493bae0d8efd75723460ce5c371f726efa93f15/compiler/rustc_error_messages/locales/en-US/metadata.ftl#L274-L275
- `metadata_lib_filename_form` is missing `$`
- Add additional check to ensure that library is file

Testing
1. Create file `a.rs`
```rust
extern crate t;
fn main() {}
```
1. Create empty file `x`
1. Create empty directory `y`
1. Run
```sh
$ rustc -o a a.rs --extern t=x
$ rustc -o a a.rs --extern t=y
```
Both currently panic with stable.

18 months agoRollup merge of #104612 - Swatinem:async-ret-y, r=estebank
Manish Goregaokar [Wed, 23 Nov 2022 03:54:39 +0000 (22:54 -0500)]
Rollup merge of #104612 - Swatinem:async-ret-y, r=estebank

Lower return type outside async block creation

This allows feeding a different output type to async blocks with a different `ImplTraitContext`. Spotted this while working on #104321

18 months agoRollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
Manish Goregaokar [Wed, 23 Nov 2022 03:54:39 +0000 (22:54 -0500)]
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead

Refactor must_use lint into two parts

Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.

Also fixes an integer overflow in the array length pluralization
calculation.

fixes #104352

18 months agoRollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Manish Goregaokar [Wed, 23 Nov 2022 03:54:38 +0000 (22:54 -0500)]
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr

Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840