Commit Graph

212856 Commits

Author SHA1 Message Date
Oli Scherer
1bf80249ae Remove many more cases of mk_substs_trait that can now use the iterator scheme` 2022-12-14 15:36:39 +00:00
Oli Scherer
0fe86aa977 Let mk_fn_def take an iterator instead to simplify some call sites 2022-12-14 15:36:39 +00:00
Oli Scherer
7fd9beedc2 Rename to match similar methods 2022-12-14 15:36:39 +00:00
Oli Scherer
fef872a875 Guard AliasTy creation against passing the wrong number of substs 2022-12-14 15:36:39 +00:00
bjorn3
2bb3996244 Remove unnecessary git init 2022-12-14 15:23:24 +00:00
bjorn3
a45924cc21 Explicitly provide dummy git author name and email
This avoids the need to tell git beforehand about your name and email
2022-12-14 15:22:56 +00:00
bors
ba64ba8b0d 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
2022-12-14 12:46:08 +00:00
Deadbeef
060e033c9c Remove fee1-dead from reviewers
.. for now. I have been burned out a bit from reviews
and I think I should take a break.
2022-12-14 12:41:11 +00:00
Albert Larsan
f7db4f0a4c
Bless test 2022-12-14 13:40:34 +01:00
bjorn3
08ba5d4e80 Remove a couple of module.isa() calls 2022-12-14 12:25:53 +00:00
ouz-a
75cf31faa8 skip if val has ecaping bound vars 2022-12-14 14:05:44 +03:00
Albert Larsan
6844b17bbe
Add a test for #92481 2022-12-14 11:06:35 +01:00
Yuki Okushi
687b4d9bb2
Add regression test for #104678
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-14 19:00:08 +09:00
Matthias Krüger
b6d140e250
Rollup merge of #105676 - notriddle:notriddle/impl-docblock, r=GuillaumeGomez
rustdoc: add CSS margin between `impl` docblock and its items

## Before

![image](https://user-images.githubusercontent.com/1593513/207471025-c27c298b-4d48-461b-918b-a965b09db4f1.png)

## After

![image](https://user-images.githubusercontent.com/1593513/207471759-1bbabf71-0932-441c-b044-ad0e392ba552.png)
2022-12-14 10:58:49 +01:00
Matthias Krüger
6cd8d1d4e3
Rollup merge of #105665 - notriddle:notriddle/popover-css-merge, r=GuillaumeGomez
rustdoc: simplify popover CSS

* Merge the color-changing block into the regular rules, which was probably written that way because it used to be in the theme files, but has no reason to be written this way now that it's in rustdoc.css

* Get rid of redundant `display: block`, since `position: absolute` blockifies the layout anyway.
2022-12-14 10:58:48 +01:00
Matthias Krüger
a4f70fff20
Rollup merge of #105664 - notriddle:notriddle/linkwrap, r=GuillaumeGomez
rustdoc: apply `pre-wrap` CSS to code-wrapped links

This is common syntax used for intra-doc links, so fixing it should help with doc formatting.
2022-12-14 10:58:48 +01:00
Matthias Krüger
00852d12db
Rollup merge of #105663 - andrewpollack:patch-1, r=tmandry
Adjust log line in `fuchsia-test-runner.py`

* Adjusting log line in `fuchsia-test-runner.py` to refer to self

r? ``@tmandry``
2022-12-14 10:58:47 +01:00
Matthias Krüger
06372d4a0d
Rollup merge of #105658 - tronta:patch-2, r=Mark-Simulacrum
Remove ..X from RELEASES.md

this is not yet supported:
..X => https://github.com/rust-lang/rust/issues/37854 is still open
2022-12-14 10:58:47 +01:00
Matthias Krüger
549ba2e198
Rollup merge of #105642 - uberFoo:master, r=Dylan-DPC
Minor grammar nit.

I was browsing the documentation and noticed that this should be an adverb.
2022-12-14 10:58:46 +01:00
bors
7bdda8f801 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
2022-12-14 09:33:57 +00:00
Matthias Krüger
01469693de
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 🤔
2022-12-14 10:31:08 +01:00
Matthias Krüger
939880ab72
Rollup merge of #105595 - TaKO8Ki:suggest-dereferencing-receiver-argument, r=compiler-errors
Suggest dereferencing receiver arguments properly

Fixes #105429
2022-12-14 10:31:07 +01:00
Matthias Krüger
e5fde968db
Rollup merge of #105523 - estebank:suggest-collect-vec, r=compiler-errors
Suggest `collect`ing into `Vec<_>`

Fix #105510.
2022-12-14 10:31:07 +01:00
Matthias Krüger
c8fd654d7c
Rollup merge of #105502 - chenyukang:yukang/fix-105366-impl, r=estebank
Suggest impl in the scenario of typo with fn

Fixes #105366
2022-12-14 10:31:06 +01:00
Matthias Krüger
49b99078b0
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.
2022-12-14 10:31:05 +01:00
Matthias Krüger
8ed0384ca4
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.
2022-12-14 10:31:05 +01:00
Matthias Krüger
a270aeee7f
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.
2022-12-14 10:31:04 +01:00
Jakob Degen
b580f29b74 Address documentation suggestions 2022-12-14 01:10:43 -08:00
Jakob Degen
aca1bc5f37 Add documentation for custom mir 2022-12-14 01:10:41 -08:00
Jakob Degen
e59839454d Support more projections in custom mir 2022-12-14 01:10:19 -08:00
Jakob Degen
409f4d2adb Support common enum operations in custom mir 2022-12-14 01:10:16 -08:00
Jakob Degen
c1b27eea45 Fix unsafetyck disabling for custom MIR 2022-12-14 01:02:35 -08:00
bors
dc30b92cc5 Auto merge of #105221 - alex:fat-archive-cleanup, r=bjorn3
Avoid a temporary file when processing macOS fat archives

r? `@bjorn3`
2022-12-14 06:51:50 +00:00
bors
309c469eec 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`
2022-12-14 04:00:05 +00:00
bors
918d0ac38e 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`
2022-12-14 01:19:24 +00:00
Michael Howell
79bb6ec9ef rustdoc: add CSS margin between impl docblock and its items 2022-12-13 17:03:41 -07:00
bors
21ee03e062 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
2022-12-13 22:05:28 +00:00
Esteban Küber
40a62758a7 rename argument 2022-12-13 13:23:19 -08:00
Chris AtLee
e0fd37dcf7 Improve wording for Option and Result 2022-12-13 14:49:10 -05:00
Chris AtLee
b486fd5d83 Add docs for question mark operator for Option 2022-12-13 14:45:12 -05:00
Esteban Küber
165efabbee review comments 2022-12-13 11:36:43 -08:00
Matthias Krüger
e0e9f3a7b7
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``
2022-12-13 19:57:12 +01:00
Matthias Krüger
1c86de25f1
Rollup merge of #105628 - spastorino:small-doc-fixes, r=compiler-errors
Small doc fixes

r? `@compiler-errors`
2022-12-13 19:57:12 +01:00
Matthias Krüger
15b9e20640
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
2022-12-13 19:57:11 +01:00
Matthias Krüger
dcdbbd0471
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.
2022-12-13 19:57:11 +01:00
Matthias Krüger
5e38e702aa
Rollup merge of #105464 - nbdd0121:hir, r=compiler-errors
Support #[track_caller] on async closures

Follow up on #105180

r? ```@compiler-errors```
cc ```@cjgillot```
2022-12-13 19:57:10 +01:00
Matthias Krüger
51375dd7a8
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.
2022-12-13 19:57:10 +01:00
Matthias Krüger
7357cfbf3d
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
2022-12-13 19:57:09 +01:00
Takayuki Maeda
19fa5b381c suggest dereferencing receiver arguments properly
fix a stderr
2022-12-14 03:48:54 +09:00
bors
0f529f0f49 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?
a688a0305f/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)
2022-12-13 18:46:35 +00:00