]> git.lizzy.rs Git - rust.git/log
rust.git
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 agoAuto merge of #105686 - matthiaskrgr:rollup-bedfk3j, r=matthiaskrgr
bors [Wed, 14 Dec 2022 09:33:57 +0000 (09:33 +0000)]
Auto merge of #105686 - matthiaskrgr:rollup-bedfk3j, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #103644 (Add docs for question mark operator for Option)
 - #105161 (Refine when invalid prefix case error arises)
 - #105491 (Illegal sized bounds: only suggest mutability change if needed)
 - #105502 (Suggest impl in the scenario of typo with fn)
 - #105523 (Suggest `collect`ing into `Vec<_>`)
 - #105595 (Suggest dereferencing receiver arguments properly)
 - #105611 (fold instead of obliterating args)

Failed merges:

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

18 months agoRollup merge of #105611 - BoxyUwU:more_granular_placeholderification, r=wesleywiser
Matthias Krüger [Wed, 14 Dec 2022 09:31:08 +0000 (10:31 +0100)]
Rollup merge of #105611 - BoxyUwU:more_granular_placeholderification, r=wesleywiser

fold instead of obliterating args

Fixes #105608

we call `const_eval_resolve` on the following constant:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
  ConstKind::Unevaluated {
    def: playground::{impl#0}::and::{constant#0},
    substs: [
      ConstKind::Value(0x0),
      _,
    ]
  }
  _,
],
```
when expanded out to `ConstKind::Expr` there are no infer vars so we attempt to evaluate it after replacing infer vars with garbage, however the current logic for replacing with garbage replaces _the whole arg containing the infer var_ rather than just the infer var. This means that after garbage replacement has occured we attempt to evaluate:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
  PLACEHOLDER,
  PLACEHOLDER,
],
```
Which then leads to ctfe being unable to evaluate the const. With this PR we attempt to evaluate:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
  ConstKind::Unevaluated {
    def: playground::{impl#0}::and::{constant#0},
    substs: [
      ConstKind::Value(0x0),
      PLACEHOLDER,
    ]
  }
  PLACEHOLDER,
],
```
which ctfe _can_ handle.

I am not entirely sure why this function is supposed to replace params with placeholders rather than just inference vars :thinking:

18 months agoRollup merge of #105595 - TaKO8Ki:suggest-dereferencing-receiver-argument, r=compiler...
Matthias Krüger [Wed, 14 Dec 2022 09:31:07 +0000 (10:31 +0100)]
Rollup merge of #105595 - TaKO8Ki:suggest-dereferencing-receiver-argument, r=compiler-errors

Suggest dereferencing receiver arguments properly

Fixes #105429

18 months agoRollup merge of #105523 - estebank:suggest-collect-vec, r=compiler-errors
Matthias Krüger [Wed, 14 Dec 2022 09:31:07 +0000 (10:31 +0100)]
Rollup merge of #105523 - estebank:suggest-collect-vec, r=compiler-errors

Suggest `collect`ing into `Vec<_>`

Fix #105510.

18 months agoRollup merge of #105502 - chenyukang:yukang/fix-105366-impl, r=estebank
Matthias Krüger [Wed, 14 Dec 2022 09:31:06 +0000 (10:31 +0100)]
Rollup merge of #105502 - chenyukang:yukang/fix-105366-impl, r=estebank

Suggest impl in the scenario of typo with fn

Fixes #105366

18 months agoRollup merge of #105491 - sulami:master, r=compiler-errors
Matthias Krüger [Wed, 14 Dec 2022 09:31:05 +0000 (10:31 +0100)]
Rollup merge of #105491 - sulami:master, r=compiler-errors

Illegal sized bounds: only suggest mutability change if needed

In a scenario like

```rust
struct Type;

pub trait Trait {
    fn function(&mut self)
    where
        Self: Sized;
}

impl Trait for Type {
    fn function(&mut self) {}
}

fn main() {
    (&mut Type as &mut dyn Trait).function();
}
```

the problem is Sized, not the mutability of self. Thus don't emit the "you need &T instead of &mut T" note, or the other way around, as all it does is just invert the mutability of whatever was supplied.

Fixes #103622.

18 months agoRollup merge of #105161 - cassaundra:numeric-literal-error, r=nnethercote
Matthias Krüger [Wed, 14 Dec 2022 09:31:05 +0000 (10:31 +0100)]
Rollup merge of #105161 - cassaundra:numeric-literal-error, r=nnethercote

Refine when invalid prefix case error arises

Fix cases where the "invalid base prefix for number literal" error arises with suffixes that look erroneously capitalized but which are actually invalid.

18 months agoRollup merge of #103644 - catlee:catlee/option-question-mark-docs, r=workingjubilee
Matthias Krüger [Wed, 14 Dec 2022 09:31:04 +0000 (10:31 +0100)]
Rollup merge of #103644 - catlee:catlee/option-question-mark-docs, r=workingjubilee

Add docs for question mark operator for Option

As a beginner learning rust, it took me a while to figure out what `?` was doing with Options. I think the documentation of this could be improved.

I've used the question mark documentation from the `Result` type as a template here, and tried to come up with a simple example as well.

18 months agoAuto merge of #105221 - alex:fat-archive-cleanup, r=bjorn3
bors [Wed, 14 Dec 2022 06:51:50 +0000 (06:51 +0000)]
Auto merge of #105221 - alex:fat-archive-cleanup, r=bjorn3

Avoid a temporary file when processing macOS fat archives

r? `@bjorn3`

18 months agoAuto merge of #104875 - chenyukang:yukang/fix-104867-inc, r=estebank
bors [Wed, 14 Dec 2022 04:00:05 +0000 (04:00 +0000)]
Auto merge of #104875 - chenyukang:yukang/fix-104867-inc, r=estebank

Properly handle postfix inc/dec in standalone and subexpr scenarios

Fixes #104867
r? `@estebank`

18 months agoAuto merge of #104986 - compiler-errors:opaques, r=oli-obk
bors [Wed, 14 Dec 2022 01:19:24 +0000 (01:19 +0000)]
Auto merge of #104986 - compiler-errors:opaques, r=oli-obk

Combine `ty::Projection` and `ty::Opaque` into `ty::Alias`

Implements https://github.com/rust-lang/types-team/issues/79.

This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so:

```
enum AliasKind {
  Projection,
  Opaque,
}

struct AliasTy<'tcx> {
  def_id: DefId,
  substs: SubstsRef<'tcx>,
}
```

Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example:

```diff
  match ty.kind() {
-   ty::Opaque(..) =>
+   ty::Alias(ty::Opaque, ..) => {}
    _ => {}
  }
```

This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically.

r? `@ghost`

18 months agoAuto merge of #105667 - matthiaskrgr:rollup-fexlc0b, r=matthiaskrgr
bors [Tue, 13 Dec 2022 22:05:28 +0000 (22:05 +0000)]
Auto merge of #105667 - matthiaskrgr:rollup-fexlc0b, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #105147 (Allow unsafe through inline const)
 - #105438 (Move some codegen-y methods from `rustc_hir_analysis::collect` -> `rustc_codegen_ssa`)
 - #105464 (Support #[track_caller] on async closures)
 - #105476 (Change pattern borrowing suggestions to be verbose and remove invalid suggestion)
 - #105500 (Make some diagnostics not depend on the source of what they reference being available)
 - #105628 (Small doc fixes)
 - #105659 (Don't require owned data in `MaybeStorageLive`)

Failed merges:

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

18 months agorename argument
Esteban Küber [Tue, 13 Dec 2022 21:23:19 +0000 (13:23 -0800)]
rename argument

18 months agoImprove wording for Option and Result
Chris AtLee [Tue, 13 Dec 2022 19:49:10 +0000 (14:49 -0500)]
Improve wording for Option and Result

18 months agoAdd docs for question mark operator for Option
Chris AtLee [Thu, 27 Oct 2022 16:52:29 +0000 (12:52 -0400)]
Add docs for question mark operator for Option

18 months agoreview comments
Esteban Küber [Tue, 13 Dec 2022 19:36:43 +0000 (11:36 -0800)]
review comments

18 months agoRollup merge of #105659 - JakobDegen:storage-live-borrow, r=davidtwco
Matthias Krüger [Tue, 13 Dec 2022 18:57:12 +0000 (19:57 +0100)]
Rollup merge of #105659 - JakobDegen:storage-live-borrow, r=davidtwco

Don't require owned data in `MaybeStorageLive`

Small improvement that avoids a clone. I don't expect this to have any noticeable perf effects, but better to have it than not to.

r? ``@tmiasko``

18 months agoRollup merge of #105628 - spastorino:small-doc-fixes, r=compiler-errors
Matthias Krüger [Tue, 13 Dec 2022 18:57:12 +0000 (19:57 +0100)]
Rollup merge of #105628 - spastorino:small-doc-fixes, r=compiler-errors

Small doc fixes

r? `@compiler-errors`

18 months agoRollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebank
Matthias Krüger [Tue, 13 Dec 2022 18:57:11 +0000 (19:57 +0100)]
Rollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebank

Make some diagnostics not depend on the source of what they reference being available

r? `@estebank`

follow up to https://github.com/rust-lang/rust/pull/104449

18 months agoRollup merge of #105476 - estebank:moves-n-borrows, r=compiler-errors
Matthias Krüger [Tue, 13 Dec 2022 18:57:11 +0000 (19:57 +0100)]
Rollup merge of #105476 - estebank:moves-n-borrows, r=compiler-errors

Change pattern borrowing suggestions to be verbose and remove invalid suggestion

Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.

Do not suggest borrowing binding in pattern in let else. Fix #104838.

18 months agoRollup merge of #105464 - nbdd0121:hir, r=compiler-errors
Matthias Krüger [Tue, 13 Dec 2022 18:57:10 +0000 (19:57 +0100)]
Rollup merge of #105464 - nbdd0121:hir, r=compiler-errors

Support #[track_caller] on async closures

Follow up on #105180

r? ```@compiler-errors```
cc ```@cjgillot```

18 months agoRollup merge of #105438 - compiler-errors:move-methods, r=estebank
Matthias Krüger [Tue, 13 Dec 2022 18:57:10 +0000 (19:57 +0100)]
Rollup merge of #105438 - compiler-errors:move-methods, r=estebank

Move some codegen-y methods from `rustc_hir_analysis::collect` -> `rustc_codegen_ssa`

Unclear if they should live here, but they seem codegen-y enough, and `rustc_hir_analysis::collect` is extremely long, so it should probably lose some methods.

18 months agoRollup merge of #105147 - nbdd0121:inline_const_unsafe, r=oli-obk
Matthias Krüger [Tue, 13 Dec 2022 18:57:09 +0000 (19:57 +0100)]
Rollup merge of #105147 - nbdd0121:inline_const_unsafe, r=oli-obk

Allow unsafe through inline const

Handle similar to closures.

Address https://github.com/rust-lang/rust/pull/104087#issuecomment-1324173328

Note that this PR does not fix the issue for `unsafe { [0; function_requiring_unsafe()] }`. This is fundamentally unfixable for MIR unsafeck IMO.

This PR also does not fix unsafety checking for inline const in pattern position. It actually breaks it, allowing unsafe functions to be used in inline const in pattern position without unsafe blocks. Inline const in pattern position is not visible in MIR so ignored by MIR unsafety checking (currently it is also not checked by borrow checker, which is the reason why it's considered an incomplete feature).

`@rustbot` label: +T-lang +F-inline_const

18 months agosuggest dereferencing receiver arguments properly
Takayuki Maeda [Tue, 13 Dec 2022 18:18:02 +0000 (03:18 +0900)]
suggest dereferencing receiver arguments properly

fix a stderr

18 months agoAuto merge of #102813 - Akida31:issue-64915/simpler_diagnostic_when_passing_arg_to_cl...
bors [Tue, 13 Dec 2022 18:46:35 +0000 (18:46 +0000)]
Auto merge of #102813 - Akida31:issue-64915/simpler_diagnostic_when_passing_arg_to_closure_and_missing_borrow, r=estebank

Simpler diagnostic when passing arg to closure and missing borrow

fixes #64915

I followed roughly the instructions and the older PR #76362.
The number of references for the expected and the found types will be compared and depending on which has more the diagnostic will be emitted.

I'm not quite sure if my approach with the many `span_bug!`s is good, it could lead to some ICEs. Would it be better if  those errors are ignored?

As far as I know the following code works similarly but in a different context. Is this probably reusable since it looks like it would emit better diagnostics?
https://github.com/rust-lang/rust/blob/a688a0305fad9219505a8f2576446510601bafe8/compiler/rustc_hir_analysis/src/check/demand.rs#L713-L1061

When running the tests locally, a codegen test failed. Is there something I can/ should do about that?

If you have some improvements/ corrections please say so and I will happily include them.

r? `@estebank` (as you added the mentoring instructions to the issue)

18 months agoSuggest `: Type` instead of `: _`
Esteban Küber [Sun, 11 Dec 2022 02:40:04 +0000 (18:40 -0800)]
Suggest `: Type` instead of `: _`

18 months agoMention implementations that satisfy the trait
Esteban Küber [Sun, 11 Dec 2022 01:39:00 +0000 (17:39 -0800)]
Mention implementations that satisfy the trait

18 months agoRemove unnecessary code and account for turbofish suggestion
Esteban Küber [Sat, 10 Dec 2022 20:19:29 +0000 (12:19 -0800)]
Remove unnecessary code and account for turbofish suggestion

Remove previously existing fallback that tried to give a good turbofish
suggestion, `need_type_info` is already good enough.

Special case `::<Vec<_>` suggestion for `Iterator::collect`.

18 months agoSuggest `collect`ing into `Vec<_>`
Esteban Küber [Sat, 10 Dec 2022 06:31:16 +0000 (22:31 -0800)]
Suggest `collect`ing into `Vec<_>`

18 months agoAccount for dereference expressions
Esteban Küber [Fri, 9 Dec 2022 21:01:41 +0000 (13:01 -0800)]
Account for dereference expressions

18 months agoFix span for `&mut ` removal suggestion
Esteban Küber [Fri, 9 Dec 2022 05:09:56 +0000 (21:09 -0800)]
Fix span for `&mut ` removal suggestion

18 months agoSuggest `ref` for some patterns as a fallback
Esteban Küber [Fri, 9 Dec 2022 01:14:56 +0000 (17:14 -0800)]
Suggest `ref` for some patterns as a fallback

18 months agoDo not suggest borrowing binding in pattern in let else
Esteban Küber [Thu, 8 Dec 2022 17:31:57 +0000 (09:31 -0800)]
Do not suggest borrowing binding in pattern in let else

Fix #104838.

18 months agoChange pattern borrowing suggestions to be verbose
Esteban Küber [Thu, 8 Dec 2022 17:02:54 +0000 (09:02 -0800)]
Change pattern borrowing suggestions to be verbose

Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.

18 months agoAddress a few more nits
Michael Goulet [Tue, 13 Dec 2022 17:54:52 +0000 (17:54 +0000)]
Address a few more nits

18 months agoAddress nits
Michael Goulet [Tue, 13 Dec 2022 17:50:52 +0000 (09:50 -0800)]
Address nits

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
18 months agoRemove chalk lowering for AliasTy
Michael Goulet [Tue, 6 Dec 2022 03:35:47 +0000 (03:35 +0000)]
Remove chalk lowering for AliasTy

18 months agonit: docs
Michael Goulet [Tue, 6 Dec 2022 03:30:58 +0000 (03:30 +0000)]
nit: docs

18 months agoCombine OfOpaque and OfProjection
Michael Goulet [Tue, 6 Dec 2022 02:49:06 +0000 (02:49 +0000)]
Combine OfOpaque and OfProjection

18 months agoCombine identical alias arms
Michael Goulet [Sun, 27 Nov 2022 17:52:17 +0000 (17:52 +0000)]
Combine identical alias arms

18 months agoCombine projection and opaque into alias
Michael Goulet [Sat, 26 Nov 2022 21:51:55 +0000 (21:51 +0000)]
Combine projection and opaque into alias

18 months agosquash OpaqueTy and ProjectionTy into AliasTy
Michael Goulet [Sat, 26 Nov 2022 21:32:01 +0000 (21:32 +0000)]
squash OpaqueTy and ProjectionTy into AliasTy

18 months agoProjectionTy.item_def_id -> ProjectionTy.def_id
Michael Goulet [Sat, 26 Nov 2022 21:21:20 +0000 (21:21 +0000)]
ProjectionTy.item_def_id -> ProjectionTy.def_id

18 months agoUse ty::OpaqueTy everywhere
Michael Goulet [Sat, 26 Nov 2022 21:09:39 +0000 (21:09 +0000)]
Use ty::OpaqueTy everywhere

18 months agomake Opaque have one field: OpaqueTy
Michael Goulet [Sat, 26 Nov 2022 20:43:31 +0000 (20:43 +0000)]
make Opaque have one field: OpaqueTy

18 months agofix tests
akida31 [Tue, 13 Dec 2022 17:24:18 +0000 (18:24 +0100)]
fix tests

18 months agoAuto merge of #105646 - lqd:revert-thinlto, r=Mark-Simulacrum
bors [Tue, 13 Dec 2022 15:50:16 +0000 (15:50 +0000)]
Auto merge of #105646 - lqd:revert-thinlto, r=Mark-Simulacrum

Revert "enable ThinLTO for rustc on x86_64-apple-darwin dist builds"

Apparently ThinLTO on x64 mac can regress some of the ICEs' output. This reverts #103647 to allow for investigation, and helps with #105637 in the meantime.

18 months agotidy: ignore filelength
akida31 [Sun, 27 Nov 2022 19:58:01 +0000 (20:58 +0100)]
tidy: ignore filelength

18 months agoreduce to single suggestion for all arguments
akida31 [Sun, 13 Nov 2022 21:40:54 +0000 (22:40 +0100)]
reduce to single suggestion for all arguments

18 months agoremove manual `fn_decl` extraction
akida31 [Tue, 11 Oct 2022 15:48:46 +0000 (17:48 +0200)]
remove manual `fn_decl` extraction

18 months agochange error message
akida31 [Tue, 11 Oct 2022 15:02:56 +0000 (17:02 +0200)]
change error message

18 months agomove changes to an extra function
akida31 [Tue, 11 Oct 2022 14:20:52 +0000 (16:20 +0200)]
move changes to an extra function

18 months agoRemove `hint` from help message
akida31 [Sun, 9 Oct 2022 08:07:47 +0000 (10:07 +0200)]
Remove `hint` from help message

18 months agoFix stderr of tests which have improved diagnostics
akida31 [Sat, 8 Oct 2022 13:50:35 +0000 (15:50 +0200)]
Fix stderr of tests which have improved diagnostics

18 months agoImprove diagnostic when passing arg to closure and missing borrow.
akida31 [Sat, 8 Oct 2022 13:48:28 +0000 (15:48 +0200)]
Improve diagnostic when passing arg to closure and missing borrow.

This checks the number of references for the given and expected type and
shows hints to the user if the numbers don't match.

18 months agoAuto merge of #105612 - oli-obk:bind_rustdoc, r=GuillaumeGomez
bors [Tue, 13 Dec 2022 13:09:40 +0000 (13:09 +0000)]
Auto merge of #105612 - oli-obk:bind_rustdoc, r=GuillaumeGomez

use ty::Binder in rustdoc instead of `skip_binder`

r? `@GuillaumeGomez`

this is a preliminary cleanup required to be able to normalize correctly/conveniently in rustdoc

18 months agoClarify explicit_predicates_of is_assoc_item_ty comment
Santiago Pastorino [Mon, 12 Dec 2022 19:46:18 +0000 (16:46 -0300)]
Clarify explicit_predicates_of is_assoc_item_ty comment

18 months agoMake InternalSubsts rust docs a bit clearer
Santiago Pastorino [Mon, 12 Dec 2022 19:46:54 +0000 (16:46 -0300)]
Make InternalSubsts rust docs a bit clearer

18 months agoDon't require owned data in `MaybeStorageLive`
Jakob Degen [Tue, 13 Dec 2022 12:22:47 +0000 (04:22 -0800)]
Don't require owned data in `MaybeStorageLive`

18 months agobless fulldeps tests
Oli Scherer [Mon, 12 Dec 2022 17:32:20 +0000 (17:32 +0000)]
bless fulldeps tests

18 months agoUse a label instead of a note for the drop site to create denser diagnostics
Oli Scherer [Mon, 12 Dec 2022 15:57:31 +0000 (15:57 +0000)]
Use a label instead of a note for the drop site to create denser diagnostics

18 months agoStop pointing to operators if their libcore method source is not available
Oli Scherer [Mon, 12 Dec 2022 15:36:08 +0000 (15:36 +0000)]
Stop pointing to operators if their libcore method source is not available

18 months agoAvoid rendering empty annotations
Oli Scherer [Mon, 12 Dec 2022 15:25:04 +0000 (15:25 +0000)]
Avoid rendering empty annotations

18 months agoDon't emit empty notes
Oli Scherer [Mon, 12 Dec 2022 12:26:16 +0000 (12:26 +0000)]
Don't emit empty notes

18 months agoClarify what "this" means
Oli Scherer [Mon, 12 Dec 2022 12:07:09 +0000 (12:07 +0000)]
Clarify what "this" means

18 months agoInform the user which trait is meant in the diagnostic itself instead of relying...
Oli Scherer [Mon, 12 Dec 2022 11:55:46 +0000 (11:55 +0000)]
Inform the user which trait is meant in the diagnostic itself instead of relying on the span making it obvious

18 months agoMake some diagnostics not depend on the source of what they reference being available
Oli Scherer [Fri, 9 Dec 2022 15:56:23 +0000 (15:56 +0000)]
Make some diagnostics not depend on the source of what they reference being available

18 months agoAuto merge of #105350 - compiler-errors:faster-binder-relate, r=oli-obk
bors [Tue, 13 Dec 2022 07:10:53 +0000 (07:10 +0000)]
Auto merge of #105350 - compiler-errors:faster-binder-relate, r=oli-obk

Fast-path some binder relations

A simpler approach than #104598

Fixes #104583

r? types

18 months agoMove some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa
Michael Goulet [Thu, 8 Dec 2022 03:53:35 +0000 (03:53 +0000)]
Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa

18 months agoRefine when invalid prefix case error arises
Cassaundra Smith [Fri, 2 Dec 2022 03:17:03 +0000 (19:17 -0800)]
Refine when invalid prefix case error arises

Fix cases where the "invalid base prefix for number literal" error arises with
suffixes that look erroneously capitalized but which are in fact invalid.

18 months agoAuto merge of #105436 - nnethercote:inline-place_contents_drop_state_cannot_differ...
bors [Tue, 13 Dec 2022 03:28:57 +0000 (03:28 +0000)]
Auto merge of #105436 - nnethercote:inline-place_contents_drop_state_cannot_differ, r=spastorino

Inline and remove `place_contents_drop_state_cannot_differ`.

It has a single call site and is hot enough to be worth inlining. And make sure `is_terminal_path` is inlined, too.

r? `@ghost`

18 months agoFast path some binder relations
Michael Goulet [Tue, 6 Dec 2022 04:42:06 +0000 (04:42 +0000)]
Fast path some binder relations

18 months agoExtract shared logic into a new function
Gary Guo [Tue, 13 Dec 2022 02:34:43 +0000 (02:34 +0000)]
Extract shared logic into a new function

18 months agoAdd tests (currently broken) for unsafe + inline const pat
Gary Guo [Thu, 1 Dec 2022 23:54:06 +0000 (23:54 +0000)]
Add tests (currently broken) for unsafe + inline const pat

18 months agoRemove unnecessary recursive call to parent unsafeck
Gary Guo [Thu, 1 Dec 2022 23:51:03 +0000 (23:51 +0000)]
Remove unnecessary recursive call to parent unsafeck

All bodies are unsafe checked anyway. Current MIR unsafeck also just
returns for closures.

18 months agoEnsure valid local_data is set for custom mir building
Gary Guo [Thu, 1 Dec 2022 23:41:45 +0000 (23:41 +0000)]
Ensure valid local_data is set for custom mir building

MIR unsafety checking requires this to be valid

18 months agoAdd tests
Gary Guo [Thu, 1 Dec 2022 19:13:18 +0000 (19:13 +0000)]
Add tests

18 months agoAllow unsafe through inline const for THIR unsafety checker
Gary Guo [Thu, 1 Dec 2022 19:05:49 +0000 (19:05 +0000)]
Allow unsafe through inline const for THIR unsafety checker

The closure handling code is changed slightly to avoid allocation
when THIR building failed.

18 months agoAllow unsafe through inline const
Gary Guo [Thu, 1 Dec 2022 18:34:59 +0000 (18:34 +0000)]
Allow unsafe through inline const

This is handled similar to closures

18 months agoRevert "enable ThinLTO for rustc on x86_64-apple-darwin dist builds"
Rémy Rakic [Tue, 13 Dec 2022 01:11:54 +0000 (01:11 +0000)]
Revert "enable ThinLTO for rustc on x86_64-apple-darwin dist builds"

This reverts commit 3a085f769545e5f3327d29460060520d59766ba7.

18 months agoAuto merge of #105644 - matthiaskrgr:rollup-qc6hlzq, r=matthiaskrgr
bors [Tue, 13 Dec 2022 00:29:28 +0000 (00:29 +0000)]
Auto merge of #105644 - matthiaskrgr:rollup-qc6hlzq, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #104864 (Account for item-local in inner scope for E0425)
 - #105332 (Point out the type of associated types in every method call of iterator chains)
 - #105620 (Remove unnecessary uses of `clone`)
 - #105625 (minor code cleanups)
 - #105629 (rustdoc: stop treating everything in a trait item as a method)
 - #105636 (Add check for local-storage value when changing "display line numbers" settings)
 - #105639 (rustdoc: remove `type="text/css" from stylesheet links)
 - #105640 (Adjust miri to still be optional)

Failed merges:

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

18 months agoRollup merge of #105640 - lukas-code:miri-beta, r=Mark-Simulacrum
Matthias Krüger [Tue, 13 Dec 2022 00:17:12 +0000 (01:17 +0100)]
Rollup merge of #105640 - lukas-code:miri-beta, r=Mark-Simulacrum

Adjust miri to still be optional

r? `@pietroalbini`

18 months agoRollup merge of #105639 - notriddle:notriddle/text-css, r=GuillaumeGomez
Matthias Krüger [Tue, 13 Dec 2022 00:17:12 +0000 (01:17 +0100)]
Rollup merge of #105639 - notriddle:notriddle/text-css, r=GuillaumeGomez

rustdoc: remove `type="text/css" from stylesheet links

MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web."

Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were missed the first time.

18 months agoRollup merge of #105636 - GuillaumeGomez:extend-gui-test, r=notriddle
Matthias Krüger [Tue, 13 Dec 2022 00:17:11 +0000 (01:17 +0100)]
Rollup merge of #105636 - GuillaumeGomez:extend-gui-test, r=notriddle

Add check for local-storage value when changing "display line numbers" settings

r? `@notriddle`

18 months agoRollup merge of #105629 - notriddle:notriddle/method-toggle-trait, r=GuillaumeGomez
Matthias Krüger [Tue, 13 Dec 2022 00:17:11 +0000 (01:17 +0100)]
Rollup merge of #105629 - notriddle:notriddle/method-toggle-trait, r=GuillaumeGomez

rustdoc: stop treating everything in a trait item as a method

This was added in 0b9b4b70683db6ef707755f520f139eb7b92a944 to fix the spacing on trait pages, but stopped being needed because 791f04e5a47ee78951552c7ed1545b2b01a44c74 stopped styling method-toggle. By only putting the method-toggle class on actual methods, the JS setting does the right thing.

18 months agoRollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors
Matthias Krüger [Tue, 13 Dec 2022 00:17:10 +0000 (01:17 +0100)]
Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors

minor code cleanups

r? `@compiler-errors`

18 months agoRollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors
Matthias Krüger [Tue, 13 Dec 2022 00:17:10 +0000 (01:17 +0100)]
Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors

Remove unnecessary uses of `clone`

18 months agoRollup merge of #105332 - estebank:iterator-chains, r=oli-obk
Matthias Krüger [Tue, 13 Dec 2022 00:17:09 +0000 (01:17 +0100)]
Rollup merge of #105332 - estebank:iterator-chains, r=oli-obk

Point out the type of associated types in every method call of iterator chains

Partially address #105184 by pointing out the type of associated types in every method call of iterator chains:

```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@src/test/ui/iterators/invalid-iterator-chain.rs:12:18: 12:21]>`
    --> src/test/ui/iterators/invalid-iterator-chain.rs:12:14
     |
10   |         vec![0, 1]
     |         ---------- this expression has type `Vec<{integer}>`
11   |             .iter()
     |              ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
12   |             .map(|x| { x; })
     |              ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```

We also reduce the number of impls we mention when any of the candidates is an "exact match". This benefits the output of cases with numerics greatly.

Outstanding work would be to provide a structured suggestion for appropriate changes, like in this case detecting the spurious `;` in the closure.

18 months agoRollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank
Matthias Krüger [Tue, 13 Dec 2022 00:17:08 +0000 (01:17 +0100)]
Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank

Account for item-local in inner scope for E0425

Fixes #104700

18 months agoAdjust miri to still be optional
Mark Rousskov [Tue, 1 Nov 2022 00:52:55 +0000 (20:52 -0400)]
Adjust miri to still be optional

We don't distribute a miri build for beta/stable so it needs to be kept
optional. In the future it likely makes sense to switch the miri
*artifacts* to always be built, but the rustup component to not be
included -- this will avoid some of this pain.

18 months agorustdoc: remove `type="text/css" from stylesheet links
Michael Howell [Mon, 12 Dec 2022 22:17:49 +0000 (15:17 -0700)]
rustdoc: remove `type="text/css" from stylesheet links

MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>,
since "CSS is the only stylesheet language used on the web."

Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were
missed the first time.

18 months agoAdd check for local-storage value when changing "display line numbers" settings
Guillaume Gomez [Mon, 12 Dec 2022 21:49:19 +0000 (22:49 +0100)]
Add check for local-storage value when changing "display line numbers" settings

18 months agoAuto merge of #105622 - matthiaskrgr:rollup-a6i81q7, r=matthiaskrgr
bors [Mon, 12 Dec 2022 21:34:28 +0000 (21:34 +0000)]
Auto merge of #105622 - matthiaskrgr:rollup-a6i81q7, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #104405 (1.66.0 release notes)
 - #105561 (Normalize receiver substs and erase the regions)
 - #105593 (Fix typo in comment: length_limit)
 - #105597 (Correct typos in `core::sync::Exclusive::get_{pin_mut, mut}`)
 - #105614 (delete mentions of type ascription from lint descriptions)
 - #105615 (Fixup method doc that mentions removed param)
 - #105616 (Add a "the" to proc_macro documentation)
 - #105619 (rustdoc: remove no-op CSS `.source pre { overflow: auto }`)

Failed merges:

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

18 months agoDo not `skip_binder`s
Esteban Küber [Mon, 12 Dec 2022 19:53:39 +0000 (11:53 -0800)]
Do not `skip_binder`s

18 months agorustdoc: stop treating everything in a trait item as a method
Michael Howell [Mon, 12 Dec 2022 19:46:11 +0000 (12:46 -0700)]
rustdoc: stop treating everything in a trait item as a method

This was added in 0b9b4b70683db6ef707755f520f139eb7b92a944 to fix the
spacing on trait pages, but stopped being needed because
791f04e5a47ee78951552c7ed1545b2b01a44c74 stopped styling method-toggle.
By only putting the method-toggle class on actual methods, the JS setting
does the right thing.

18 months agoJoin match arms since they do the same thing
Santiago Pastorino [Mon, 12 Dec 2022 19:44:39 +0000 (16:44 -0300)]
Join match arms since they do the same thing

18 months agoFix typo
Santiago Pastorino [Mon, 12 Dec 2022 19:43:38 +0000 (16:43 -0300)]
Fix typo