Commit Graph

20235 Commits

Author SHA1 Message Date
Oli Scherer
2d89027fac Make the test actually emit the future incompat lint 2022-12-15 16:54:00 +00:00
Ralf Jung
5a06b1e67c simplify alignment_check_failed a bit 2022-12-15 16:48:30 +00:00
Oli Scherer
2b2170384d Fix docs 2022-12-15 16:48:29 +00:00
Oli Scherer
b05c790fd6 Reuse the ctfe error emitting logic for the future incompat lint 2022-12-15 16:48:24 +00:00
Oli Scherer
dec05e9c73 Factor decorate closure out into a method 2022-12-15 16:25:50 +00:00
Oli Scherer
98dc76a374 Always report alignment failures in future incompat summaries 2022-12-15 16:24:11 +00:00
Oli Scherer
d9d92ed7da Move alignment failure error reporting to machine 2022-12-15 16:07:35 +00:00
Oli Scherer
d66824dbc4 Make alignment checks a future incompat lint 2022-12-15 16:07:28 +00:00
Oli Scherer
ed71e32e14 Always pass alignment and handle checking lazily 2022-12-15 15:51:43 +00:00
Ralf Jung
fa83763491 always check alignment during CTFE 2022-12-15 15:36:11 +00:00
bors
984eab57f7 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
2022-12-15 14:04:24 +00:00
Matthias Krüger
c0862f30bd
Rollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors
more clippy::complexity fixes

r? ```@compiler-errors```
2022-12-15 12:46:04 +01:00
Matthias Krüger
cb9bcafe0d
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.
2022-12-15 12:46:04 +01:00
Matthias Krüger
6cdc83b64e
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`
2022-12-15 12:46:02 +01:00
Matthias Krüger
78cf8cc02e
Rollup merge of #105633 - compiler-errors:term-agnostic, r=oli-obk
Make `report_projection_error` more `Term` agnostic

Fixes #105632
2022-12-15 12:46:01 +01:00
Matthias Krüger
a2c9f2a5e0
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...
2022-12-15 12:46:01 +01:00
Matthias Krüger
5d24760245
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
2022-12-15 12:46:00 +01:00
Matthias Krüger
c00eac3558
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
2022-12-15 12:46:00 +01:00
Deadbeef
5da1a04278 Allow impl ~const Trait opaque types 2022-12-15 11:26:15 +00:00
bors
397b66e77b 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
2022-12-15 11:11:49 +00:00
bors
d67000e44e 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
2022-12-15 07:23:38 +00:00
Jakob Degen
a5beb7abb9 Various cleanups to dest prop 2022-12-14 23:11:52 -08:00
bors
a8847df167 Auto merge of #105657 - oli-obk:mk_projection_ty, r=lcnr
Guard ProjectionTy creation against passing the wrong number of substs

r? `@lcnr`
2022-12-15 04:21:25 +00:00
Nicholas Nethercote
5258b655a2 Merge SimplifiedTypeGen<D> into SimplifiedType.
`SimplifiedTypeGen<DefId>` is the only instantiation used, so we don't
need the generic parameter.
2022-12-15 15:13:19 +11:00
Nicholas Nethercote
2a5aabdfc2 Remove SimplifiedTypeGen::map_def.
It's unused.
2022-12-15 15:04:09 +11:00
Esteban Küber
124f19485d Tweak output for bare dyn Trait in arguments
Fix #35825.
2022-12-14 18:51:55 -08:00
bors
939a3ddf94 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
2022-12-15 01:28:16 +00:00
Dan Johnson
da98ef9a5d 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
2022-12-14 16:38:21 -08:00
Matthias Krüger
de59844c98 more clippy::complexity fixes 2022-12-15 00:09:10 +01:00
b-naber
ff41359e65 address review 2022-12-14 21:32:42 +01:00
Rémy Rakic
b720847917 wrap output in BufWriter 2022-12-14 20:17:52 +00:00
Rémy Rakic
7611933e6a 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.
2022-12-14 20:17:52 +00:00
Rémy Rakic
74f4da44a5 add helper to get DefId from MonoItem 2022-12-14 20:17:52 +00:00
Michael Goulet
3eb5b62898 always use anonymize_bound_vars 2022-12-14 20:06:25 +00:00
Esteban Küber
2a0d7126e7 Do not mention long types in E0599 label
The type is already mentioned in the main message and the list of unmet
bounds.
2022-12-14 11:26:32 -08:00
bors
b70baa4f92 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
2022-12-14 19:14:39 +00:00
Oli Scherer
b41a483e8a Fix rustdoc 2022-12-14 18:55:55 +00:00
Michael Goulet
34d194d41c Highlight conflicting param-env candidates, again 2022-12-14 18:44:26 +00:00
Michael Goulet
cfa6a93a36 Auto traits in dyn are suggestable 2022-12-14 18:39:39 +00:00
Michael Goulet
7bf36de6ab Make report_projection_error more term agnostic 2022-12-14 18:32:31 +00:00
bjorn3
949699931e Merge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into sync_cg_clif-2022-12-14 2022-12-14 19:30:46 +01:00
Michael Goulet
1225a65389 drive-by: Fix path spans 2022-12-14 18:26:09 +00:00
Michael Goulet
ae60015e76 Use impl's def id when calculating type to specify UFCS 2022-12-14 18:26:09 +00:00
Michael Goulet
bcaf210575 bail in collect_trait_impl_trait_tys if signatures reference errors 2022-12-14 18:25:12 +00:00
Michael Goulet
d0db3279ab Don't bug if we're trying to cast dyn* to a nother type 2022-12-14 18:00:56 +00:00
Michael Goulet
5f5ae17f4e Consider discriminant fields that are ordered before variant fields 2022-12-14 17:50:20 +00:00
Matthias Krüger
ba71a63fde
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`
2022-12-14 17:17:57 +01:00
bors
fbf8b937b4 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
2022-12-14 16:16:50 +00:00
Oli Scherer
18373fae35 Debug assertions hate this trick 2022-12-14 15:37:47 +00:00
Oli Scherer
49536667ff Fix some comments and only get the generics in debug mode 2022-12-14 15:36:39 +00:00
Oli Scherer
9f6ae8828e Fix a freshly detected wrong TraitRef 2022-12-14 15:36:39 +00:00
Oli Scherer
0ae3da34c3 Remove TraitRef::new 2022-12-14 15:36:39 +00:00
Oli Scherer
6af3638709 Prevent the creation of TraitRef without dedicated methods 2022-12-14 15:36:39 +00:00
Oli Scherer
a5cd3bde95 Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
Oli Scherer
4ffe3bdf99 Remove one more usage of mk_substs_trait 2022-12-14 15:36:39 +00:00
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
ouz-a
75cf31faa8 skip if val has ecaping bound vars 2022-12-14 14:05:44 +03: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
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
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
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
Esteban Küber
7d1e47aeb0 Suggest : Type instead of : _ 2022-12-13 10:39:44 -08:00
Esteban Küber
3e25bcb020 Mention implementations that satisfy the trait 2022-12-13 10:39:44 -08:00
Esteban Küber
b3fba5e18a 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`.
2022-12-13 10:39:44 -08:00
Esteban Küber
9d5e7d3c04 Suggest collecting into Vec<_> 2022-12-13 10:39:44 -08:00
Esteban Küber
cf0b6b9337 Account for dereference expressions 2022-12-13 10:06:15 -08:00
Esteban Küber
b8bd1d0826 Fix span for &mut removal suggestion 2022-12-13 10:06:14 -08:00
Esteban Küber
dd72b1a0df Suggest ref for some patterns as a fallback 2022-12-13 10:06:14 -08:00
Esteban Küber
4f7c257fd8 Do not suggest borrowing binding in pattern in let else
Fix #104838.
2022-12-13 10:06:13 -08:00
Esteban Küber
e46416eed6 Change pattern borrowing suggestions to be verbose
Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.
2022-12-13 10:06:13 -08:00
Michael Goulet
99417d54af Address a few more nits 2022-12-13 17:56:04 +00:00
Michael Goulet
fbe66a6ef3 Address nits
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-12-13 17:56:04 +00:00
Michael Goulet
7196973c3e Remove chalk lowering for AliasTy 2022-12-13 17:48:55 +00:00
Michael Goulet
0f9e414092 nit: docs 2022-12-13 17:48:55 +00:00
Michael Goulet
4b19a2c119 Combine OfOpaque and OfProjection 2022-12-13 17:48:55 +00:00
Michael Goulet
96cb18e864 Combine identical alias arms 2022-12-13 17:48:55 +00:00
Michael Goulet
61adaf8187 Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
Michael Goulet
c13bd83528 squash OpaqueTy and ProjectionTy into AliasTy 2022-12-13 17:40:27 +00:00
Michael Goulet
5c6afb850c ProjectionTy.item_def_id -> ProjectionTy.def_id 2022-12-13 17:34:44 +00:00
Michael Goulet
7f3af72606 Use ty::OpaqueTy everywhere 2022-12-13 17:29:26 +00:00
Michael Goulet
918ede6474 make Opaque have one field: OpaqueTy 2022-12-13 17:27:41 +00:00
Jacob Bramley
73d374f3e7 bug! if branch-protection makes it to non-AArch64 codegen. 2022-12-13 17:04:02 +00:00
akida31
757396f5fe
tidy: ignore filelength 2022-12-13 16:37:44 +01:00
akida31
f780faa8c4
reduce to single suggestion for all arguments 2022-12-13 16:30:04 +01:00
akida31
4d87fb5d11
remove manual fn_decl extraction 2022-12-13 16:29:13 +01:00
akida31
7822822d51
change error message 2022-12-13 16:29:10 +01:00
akida31
b1d7430657
move changes to an extra function 2022-12-13 16:28:34 +01:00
akida31
e326e8c885
Remove hint from help message 2022-12-13 16:28:31 +01:00
akida31
1e5d772417
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.
2022-12-13 16:24:38 +01:00
bors
ed620cf969 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
2022-12-13 13:09:40 +00:00
Santiago Pastorino
b22769a7bd
Clarify explicit_predicates_of is_assoc_item_ty comment 2022-12-13 09:41:12 -03:00
Santiago Pastorino
4ae0c5518d
Make InternalSubsts rust docs a bit clearer 2022-12-13 09:28:25 -03:00
Jakob Degen
3522d48112 Don't require owned data in MaybeStorageLive 2022-12-13 04:22:47 -08:00
Oli Scherer
1f5cb9e50e Use a label instead of a note for the drop site to create denser diagnostics 2022-12-13 10:08:46 +00:00
Oli Scherer
6984085088 Stop pointing to operators if their libcore method source is not available 2022-12-13 10:06:11 +00:00
Oli Scherer
59554a2b54 Avoid rendering empty annotations 2022-12-13 10:06:08 +00:00
Oli Scherer
2e2a4797a2 Don't emit empty notes 2022-12-13 09:53:36 +00:00
Oli Scherer
063b1675b2 Clarify what "this" means 2022-12-13 09:51:03 +00:00
Oli Scherer
717294fa04 Inform the user which trait is meant in the diagnostic itself instead of relying on the span making it obvious 2022-12-13 09:48:26 +00:00
Oli Scherer
cb26b35b12 Make some diagnostics not depend on the source of what they reference being available 2022-12-13 09:48:22 +00:00
bors
109cccbe4f 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
2022-12-13 07:10:53 +00:00
Michael Goulet
a8a45100a0 Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa 2022-12-13 05:01:36 +00:00
Michael Goulet
f705d64673 Remove instantiate_type_scheme 2022-12-13 04:56:44 +00:00
Michael Goulet
5dea1d1c6e EarlyBinder nits 2022-12-13 04:53:36 +00:00
Cassaundra Smith
52a9280fb2
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.
2022-12-12 19:32:12 -08:00
bors
71ec1457ee 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`
2022-12-13 03:28:57 +00:00
Michael Goulet
2025a96ee1 Fast path some binder relations 2022-12-13 03:17:14 +00:00
Gary Guo
d6dc9124b7 Extract shared logic into a new function 2022-12-13 02:34:43 +00:00
Gary Guo
5c58a1b003 Remove unnecessary recursive call to parent unsafeck
All bodies are unsafe checked anyway. Current MIR unsafeck also just
returns for closures.
2022-12-13 01:38:38 +00:00
Gary Guo
adf1717219 Ensure valid local_data is set for custom mir building
MIR unsafety checking requires this to be valid
2022-12-13 01:38:38 +00:00
Gary Guo
aa5af2a003 Allow unsafe through inline const for THIR unsafety checker
The closure handling code is changed slightly to avoid allocation
when THIR building failed.
2022-12-13 01:38:38 +00:00
Gary Guo
9342d1e73e Allow unsafe through inline const
This is handled similar to closures
2022-12-13 01:38:38 +00:00
Matthias Krüger
2707801858
Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors
minor code cleanups

r? `@compiler-errors`
2022-12-13 01:17:10 +01:00
Matthias Krüger
4069792d73
Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors
Remove unnecessary uses of `clone`
2022-12-13 01:17:10 +01:00
Matthias Krüger
8917cc0f23
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.
2022-12-13 01:17:09 +01:00
Matthias Krüger
6dbaf86672
Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank
Account for item-local in inner scope for E0425

Fixes #104700
2022-12-13 01:17:08 +01:00
Esteban Küber
f4ed2d1cca Do not skip_binders 2022-12-12 11:53:39 -08:00
Santiago Pastorino
b0c3228404
Join match arms since they do the same thing 2022-12-12 16:44:39 -03:00
Santiago Pastorino
893772025d
Fix typo 2022-12-12 16:43:38 -03:00
Matthias Krüger
2ea368e53c minor code cleanups 2022-12-12 19:49:53 +01:00
Matthias Krüger
666366444c
Rollup merge of #105615 - WaffleLapkin:remove_opt_scope_span_mention, r=compiler-errors
Fixup method doc that mentions removed param

The param was removed in https://github.com/rust-lang/rust/pull/61872 (101a2f59b4)
2022-12-12 19:20:36 +01:00
Matthias Krüger
c8b07c0529
Rollup merge of #105614 - lukas-code:ascription, r=Nilstrieb
delete mentions of type ascription from lint descriptions

Tracking Issue: https://github.com/rust-lang/rust/issues/101728
2022-12-12 19:20:36 +01:00
Matthias Krüger
38d97d3ea7
Rollup merge of #105593 - jruderman:patch-3, r=Dylan-DPC
Fix typo in comment: length_limit
2022-12-12 19:20:35 +01:00
Matthias Krüger
f4cca46078
Rollup merge of #105561 - TaKO8Ki:fix-105449, r=fee1-dead
Normalize receiver substs and erase the regions

Fixes #105449
2022-12-12 19:20:34 +01:00
Esteban Küber
348386985d Move logic to their own methods 2022-12-12 09:23:36 -08:00
Takayuki Maeda
ee40a67cd9 remove unnecessary uses of clone 2022-12-13 02:06:24 +09:00
Lukas Markeffsky
6abffffdff delete mentions of type ascription from lint descriptions
Move it to the historical context section instead.
2022-12-12 17:43:15 +01:00
Maybe Waffle
613c1216b7 Fixup method doc that mentions removed param 2022-12-12 15:43:04 +00:00
Oli Scherer
30754517d1 Avoid trying to normalize unnormalizable types 2022-12-12 14:39:08 +00:00
Boxy
dd19656df3 fold instead of obliterating args 2022-12-12 14:30:01 +00:00
Oli Scherer
21917b0866 Round 3: require binders for substs 2022-12-12 13:20:36 +00:00
Takayuki Maeda
3bc54baa61 normalize receiver substs and erase the regions
use a smaller example
2022-12-12 22:16:51 +09:00
Oli Scherer
dbf4b8a436 Round 1: add some binders (fails due to losing bound vars and then rebinding them with Binder::dummy) 2022-12-12 12:12:40 +00:00
bors
37d7de3379 Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
Use struct types during codegen in less places

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
2022-12-12 10:38:31 +00:00
bors
2176e3a7a4 Auto merge of #105592 - matthiaskrgr:rollup-1cazogq, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #104997 (Move tests)
 - #105569 (`bug!` with a better error message for failing `Instance::resolve`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-12 07:57:41 +00:00
Matthias Krüger
5877a3fce1
Rollup merge of #105569 - compiler-errors:resolve-bug-better, r=TaKO8Ki
`bug!` with a better error message for failing `Instance::resolve`

Better ICE message when `.unwrap().unwrap()` fails.
2022-12-12 08:21:32 +01:00
Jesse Ruderman
c27d7949a1
Fix typo in comment: length_limit 2022-12-11 23:21:10 -08:00
bors
2cd2070af7 Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov
Remove `token::Lit` from `ast::MetaItemLit`.

Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time.

r? `@petrochenkov`
2022-12-12 05:16:50 +00:00
Erik Desjardins
6085d33033 fix transmutes between pointers in different address spaces 2022-12-11 22:27:09 -05:00
bors
b397bc0727 Auto merge of #105485 - nnethercote:fix-lint-perf-regressions, r=cjgillot
Fix lint perf regressions

#104863 caused small but widespread regressions in lint performance. I tried to improve things in #105291 and #105416 with minimal success, before fully understanding what caused the regression. This PR effectively reverts all of #105291 and part of #104863 to fix the perf regression.

r? `@cjgillot`
2022-12-12 02:17:08 +00:00
Esteban Küber
2838b8e515 Point at method call when it is the source of the bound error 2022-12-11 14:49:50 -08:00
Matthias Krüger
79f99e7969
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
llvm-wrapper: adapt for LLVM API changes

This is a follow-up of 75aec4703d. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references.

Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
2022-12-11 23:36:47 +01:00
Matthias Krüger
6042f5bca7
Rollup merge of #105521 - tshepang:keep-heading-separate, r=nagisa
separate heading from body
2022-12-11 23:36:46 +01:00
Matthias Krüger
6ed8cb6616
Rollup merge of #105472 - spastorino:make-encoder-use-queries, r=oli-obk
Make encode_info_for_trait_item use queries instead of accessing the HIR

This change avoids accessing the HIR on `encode_info_for_trait_item` and uses queries. We will need to execute this function for elements that have no HIR and by using queries we will be able to feed for definitions that have no HIR.

r? ``@oli-obk``
2022-12-11 23:36:46 +01:00
Matthias Krüger
4154e14f9a
Rollup merge of #105369 - chenyukang:yukang/fix-105226, r=TaKO8Ki
Detect spurious ; before assoc fn body

Fixes #105226

r? ``@TaKO8Ki``
2022-12-11 23:36:46 +01:00
Matthias Krüger
aa7b5b32e3
Rollup merge of #105283 - compiler-errors:ty-var-in-hir-wfcheck, r=nagisa
Don't call `diagnostic_hir_wf_check` query if we have infer variables

Fixes #105260
2022-12-11 23:36:45 +01:00
Nicholas Nethercote
4ff5a3655f Speed up the "builtin lints only" case.
This commit partly undoes #104863, which combined the builtin lints pass
with other lints. This caused a slowdown, because often there are no
other lints, and it's faster to do a pass with a single lint directly
than it is to do a combined pass with a `passes` vector containing a
single lint.
2022-12-12 08:59:27 +11:00
Nicholas Nethercote
3c53781800 Reinstate {Early,Late}LintPassObjects.
I removed these in #105291, and subsequently learned they are necessary
for performance.

This commit reinstates them with the new and more descriptive names
`RuntimeCombined{Early,Late}LintPass`, similar to the existing passes
like `BuiltinCombinedEarlyLintPass`. It also adds some comments,
particularly emphasising how we have ways to combine passes at both
compile-time and runtime. And it moves some comments around.
2022-12-12 08:59:27 +11:00
Nicholas Nethercote
2b05f84115 Rename run_early_passes as lint_callback.
This matches the name used in `late.rs`.
2022-12-12 08:59:27 +11:00
Michael Goulet
bc293ed53e bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
Esteban Küber
ce486d538b Use with_forced_trimmed_paths 2022-12-11 11:38:43 -08:00
Esteban Küber
78f97595a3 Only point at methods that might be relevant 2022-12-11 09:46:02 -08:00
Esteban Küber
aff0ab43c8 Add label to method chains where assoc type remains the same 2022-12-11 09:46:02 -08:00
Esteban Küber
c77ad2d765 Remove mention of "assoc type" in label as it is already in the note message 2022-12-11 09:46:02 -08:00
Esteban Küber
71db025cfa Account for method call chains split across multiple bindings 2022-12-11 09:46:02 -08:00
Esteban Küber
64bc975d27 Mention only assoc types changes 2022-12-11 09:46:01 -08:00
Michael Goulet
bc60d50eaa Provide associated type information in method chains
When encountering an unmet obligation that affects a method chain, like
in iterator chains where one of the links has the wrong associated
type, we point at every method call and mention their evaluated
associated type at that point to give context to the user of where
expectations diverged from the code as written.

```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/invalid-iterator-chain.rs:12:18: 12:21]>`
  --> $DIR/invalid-iterator-chain.rs:12:14
   |
LL |         vec![0, 1]
   |         ---------- this expression has type `Vec<{integer}>`
LL |             .iter()
   |              ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
LL |             .map(|x| { x; })
   |              ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```
2022-12-11 09:46:01 -08:00
bors
d137783642 Auto merge of #102900 - abrachet:master, r=bjorn3
Don't internalize __llvm_profile_counter_bias

Currently, LLVM profiling runtime counter relocation cannot be used by rust during LTO because symbols are being internalized before all symbol information is known.

This mode makes LLVM emit a __llvm_profile_counter_bias symbol which is referenced by the profiling initialization, which itself is pulled in by the rust driver here [1].

It is enabled with -Cllvm-args=-runtime-counter-relocation for platforms which are opt-in to this mode like Linux. On these platforms there will be no link error, rather just surprising behavior for a user which request runtime counter relocation. The profiling runtime will not see that symbol go on as if it were never there. On Fuchsia, the profiling runtime must have this symbol which will cause a hard link error.

As an aside, I don't have enough context as to why rust's LTO model is how it is. AFAICT, the internalize pass is only safe to run at link time when all symbol information is actually known, this being an example as to why. I think special casing this symbol as a known one that LLVM can emit which should not have it's visbility de-escalated should be fine given how seldom this pattern of defining an undefined symbol to get initilization code pulled in is. From a quick grep, __llvm_profile_runtime is the only symbol that rustc does this for.

[1] 0265a3e93b/compiler/rustc_codegen_ssa/src/back/linker.rs (L598)
2022-12-11 14:42:45 +00:00
Krasimir Georgiev
cbdc00f6e6 llvm-wrapper: adapt for LLVM API changes
This is a follow-up of
75aec4703d.
There, I updated the wrapper to only include llvm/ADT/Optional.h for
LLVM version below 16. But I missed updating some of the None references.

Found by our experimental rust + llvm at HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
2022-12-11 09:14:50 +00:00
Matthias Krüger
2daa3bcbc2
Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead
compiler: remove unnecessary imports and qualified paths

Some of these imports were necessary before Edition 2021, others were already in the prelude.

I hope it's fine that this PR is so spread-out across files :/
2022-12-11 09:51:57 +01:00
Matthias Krüger
cb4753135e
Rollup merge of #105411 - estebank:short-names, r=oli-obk
Introduce `with_forced_trimmed_paths`

Built on top of https://github.com/rust-lang/rust/pull/104922, only last commit is relevant.
2022-12-11 09:51:56 +01:00
Matthias Krüger
30db3a7d25
Rollup merge of #105542 - compiler-errors:confirm-nits, r=jackh726
Some method confirmation code nits

1. Make some pick methods take `&self` instead of `&mut` to avoid some cloning
2. Pass some values by reference to avoid some cloning
3. Rename a few variables here and there
2022-12-11 00:30:21 +01:00
Esteban Küber
3ad7131aa1 Introduce with_forced_trimmed_paths 2022-12-10 14:35:40 -08:00
Michael Goulet
11ad94d87a Some method confirmation code nits 2022-12-10 21:26:40 +00:00
bors
c6fcdb6906 Auto merge of #105416 - nnethercote:more-linting-tweaks, r=cjgillot
More linting tweaks

Squeeze a little more blood from this stone.

r? `@cjgillot`
2022-12-10 19:49:51 +00:00
KaDiWa
9bc69925cb
compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Matthias Krüger
ab505298ea
Rollup merge of #105482 - wesleywiser:fix_debuginfo_ub, r=tmiasko
Fix invalid codegen during debuginfo lowering

In order for LLVM to correctly generate debuginfo for msvc, we sometimes need to spill arguments to the stack and perform some direct & indirect offsets into the value. Previously, this code always performed those actions, even when not required as LLVM would clean it up during optimization.

However, when MIR inlining is enabled, this can cause problems as the operations occur prior to the spilled value being initialized. To solve this, we first calculate the necessary offsets using just the type which is side-effect free and does not alter the LLVM IR. Then, if we are in a situation which requires us to generate the LLVM IR (and this situation only occurs for arguments, not local variables) then we perform the same calculation again, this time generating the appropriate LLVM IR as we go.

r? `@tmiasko` but feel free to reassign if you want 🙂

Fixes #105386
2022-12-10 15:01:45 +01:00
Matthias Krüger
62160cba7b
Rollup merge of #105410 - TaKO8Ki:fix-105257, r=BoxyUwU
Consider `parent_count` for const param defaults

Fixes #105257
2022-12-10 15:01:44 +01:00
Matthias Krüger
b66e123677
Rollup merge of #105234 - JakobDegen:unneeded-field, r=oli-obk
Remove unneeded field from `SwitchTargets`

This had a fixme already. The only change in behavior is that the mir dumps now no longer contains labels for the types of the integers on the edges of a switchint:

Before:
![image](https://user-images.githubusercontent.com/51179609/205467622-34401a68-dca6-43eb-915e-b9fda1988860.png)

After:
![image](https://user-images.githubusercontent.com/51179609/205467634-b5b2a259-9cb4-4843-845c-592c500f0f9c.png)

I don't think that's a problem though. The information is still available to a user that really cares by checking the type of `_2`, so it honestly feels like a bit of an improvement to me.

r? mir
2022-12-10 15:01:43 +01:00
Matthias Krüger
7e1857db1e
Rollup merge of #105192 - estebank:point-at-lhs-on-binop, r=fee1-dead
Point at LHS on binop type err if relevant
2022-12-10 15:01:43 +01:00
Matthias Krüger
3b7a1593f5
Rollup merge of #104460 - Nilstrieb:expand-the-translation, r=davidtwco
Migrate parts of `rustc_expand` to session diagnostics

This migrates everything but the `mbe` and `proc_macro` modules. It also contains a few cleanups and drive-by/accidental diagnostic improvements which can be seen in the diff for the UI tests.
2022-12-10 15:01:42 +01:00
bors
b12b83674f Auto merge of #105525 - matthiaskrgr:rollup-ricyw5s, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #98391 (Reimplement std's thread parker on top of events on SGX)
 - #104019 (Compute generator sizes with `-Zprint_type_sizes`)
 - #104512 (Set `download-ci-llvm = "if-available"` by default when `channel = dev`)
 - #104901 (Implement masking in FileType comparison on Unix)
 - #105082 (Fix Async Generator ABI)
 - #105109 (Add LLVM KCFI support to the Rust compiler)
 - #105505 (Don't warn about unused parens when they are used by yeet expr)
 - #105514 (Introduce `Span::is_visible`)
 - #105516 (Update cargo)
 - #105522 (Remove wrong note for short circuiting operators)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-10 11:16:18 +00:00
nils
2f9f097cb8 Migrate parts of rustc_expand to session diagnostics
This migrates everything but the `mbe` and `proc_macro` modules. It also
contains a few cleanups and drive-by/accidental diagnostic improvements
which can be seen in the diff for the UI tests.
2022-12-10 11:02:41 +01:00
Matthias Krüger
cf840069f3
Rollup merge of #105514 - estebank:is_visible, r=oli-obk
Introduce `Span::is_visible`

r? `@oli-obk`
2022-12-10 09:24:44 +01:00
Matthias Krüger
9e87dd907e
Rollup merge of #105505 - WaffleLapkin:yeet_unused_parens_lint, r=fee1-dead
Don't warn about unused parens when they are used by yeet expr

Don't even get me started on how I've found this.
2022-12-10 09:24:44 +01:00
Matthias Krüger
947fe7e341
Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3
Add LLVM KCFI support to the Rust compiler

This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.)

Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-10 09:24:43 +01:00