Commit Graph

20696 Commits

Author SHA1 Message Date
Ezra Shaw
ae61c250cd
doc/test: add UI test and reword docs for E0013 and E0015 2023-01-08 13:33:09 +13:00
Matthias Krüger
1e6710da59
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco
Detect closures assigned to binding in block

Fix #58497.
2023-01-07 20:43:22 +01:00
Matthias Krüger
0c8d11b97c
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
Point out span where we could introduce higher-ranked lifetime

Somewhat addresses #105422, but not really. We don't have that much useful information here since we're still in resolution :^(

Maybe this suggestion isn't worth it. If the reviewer has an idea how we can get a more succinct binder information for a structured suggestion, it would be appreciated.
2023-01-07 20:43:21 +01:00
Matthias Krüger
771cfa5581
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](b6097f2e1b/compiler/rustc_middle/src/mir/interpret/error.rs (L475)): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](9a31b3cdda) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](64aee83e80)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``
2023-01-07 20:43:19 +01:00
Matthias Krüger
405e48f1ac
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors
Migrating rustc_infer to session diagnostics (part 3)

``@rustbot`` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717

Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support.
Other than that, there is only error_reporting/mod.rs left to migrate.
2023-01-07 20:43:18 +01:00
bors
b1691f6413 Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco
Perform SimplifyLocals before ConstProp.

MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work.

r? `@ghost`
2023-01-07 16:13:18 +00:00
bors
a2112fcb0a Auto merge of #106519 - estebank:tail-unit, r=cjgillot
Detect bindings assigned blocks without tail expressions

Fix #44173.
2023-01-07 13:24:12 +00:00
Ali MJ Al-Nasrawy
bf228ace5c don't eagerly normalize SelfCtor type
Delay until user annotations are registered.
See the added test.
2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
dca15fd5b9 rename create_raw_ty -> handle_raw_ty 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
8afd3c47a8 remove unnecessary normalize call 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
c6a17bf8bc make ascribe_user_type a TypeOp
Projection types in user annotations may contain inference variables.
This makes the normalization depend on the unification with the actual
type and thus requires a separate TypeOp to track the obligations.
Otherwise simply calling `TypeChecker::normalize` would ICE with
"unexpected ambiguity"
2023-01-07 13:41:41 +03:00
Ali MJ Al-Nasrawy
37b40e471a fix method substs 2023-01-07 13:38:40 +03:00
Ali MJ Al-Nasrawy
be5a45d392 fix struct path 2023-01-07 13:38:39 +03:00
Ali MJ Al-Nasrawy
34329d6f6c introduce AstConv::probe_adt 2023-01-07 13:38:38 +03:00
Ali MJ Al-Nasrawy
d227506683 don't normalize in astconv
We delay projection normalization to further stages in order to
register user type annotations before normalization in HIR typeck.

There are two consumers of astconv: ItemCtxt and FnCtxt.
The former already expects unnormalized types from astconv, see its
AstConv trait impl.
The latter needs `RawTy` for a cleaner interface.

Unfortunately astconv still needs the normalization machinery in
order to resolve enum variants that have projections in the self type,
e.g. `<<T as Trait>::Assoc>::StructVariant {}`.
This is why `AstConv::normalize_ty_2` is necessary.
2023-01-07 13:38:38 +03:00
bors
d72b7d2d2a Auto merge of #106283 - JulianKnodt:enum_err, r=cjgillot
Add help diag. for `const = Enum` missing braces around `Enum`

Previously it was not clear why this errored or if it was even supported, as there was no diagnostic that suggested wrapping it in braces.

Thus, add a simple diagnostic that suggests wrapping enum variants in braces.

Fixes #105927
2023-01-07 10:04:39 +00:00
Michael Goulet
01cb9dcd5b
Rollup merge of #106554 - LingMan:explanation_typo, r=compiler-errors
Fix a typo in the explanation of E0588
2023-01-06 21:54:01 -08:00
Michael Goulet
eeb76eb593
Rollup merge of #106533 - TaKO8Ki:use-smaller-span-for-missing-lifetime/generic-args, r=compiler-errors
Use smaller spans for missing lifetime/generic args

We can remove ident from suggestions.
2023-01-06 21:54:00 -08:00
Michael Goulet
258257a029
Rollup merge of #106525 - compiler-errors:new-solver-wf, r=jackh726
Report WF error for chalk *and* new solver

addressing this nit https://github.com/rust-lang/rust/pull/106385#discussion_r1062571070

No test yet because new solver is currently unusable, lol

r? `@lcnr`
2023-01-06 21:53:59 -08:00
LingMan
dc0e4207d4 Fix a typo in the explanation of E0588 2023-01-07 05:10:53 +01:00
yukang
6082729646 use type_implements_trait to check Param clone 2023-01-07 09:20:05 +08:00
bors
84f22e44c5 Auto merge of #106544 - matthiaskrgr:rollup-e9prjed, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106287 (Add some docs to `bug`, `span_bug` and `delay_span_bug`)
 - #106341 (refactor: clean up `errors.rs` and `error_codes_check.rs`)
 - #106453 (Improve include macro documentation)
 - #106466 (Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links)
 - #106528 (Tiny formatting fix)
 - #106534 (rustdoc-gui: Use new block syntax for define-function in goml scripts)
 - #106542 (Add default and latest stable edition to --edition in rustc (attempt 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-07 00:53:19 +00:00
wcampbell
d0cf7e3bf5 Use fmt named parameters in rustc_borrowck 2023-01-06 19:34:45 -05:00
Esteban Küber
b693365b84 fix rebase 2023-01-06 21:08:56 +00:00
Esteban Küber
2631a5df61 Turn IllegalSizedBound into struct variant 2023-01-06 21:03:26 +00:00
Esteban Küber
670a6f1ef5 Change wording to avoid being misleading 2023-01-06 21:03:26 +00:00
Esteban Küber
1eb828ecb1 Structured suggestion for &mut dyn Iterator when possible
Fix #37914.
2023-01-06 21:03:26 +00:00
yukang
ce4afed2ef comments feedback 2023-01-07 05:00:49 +08:00
Yukang
1a0a6132a8 Apply suggestions from code review
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2023-01-07 04:44:04 +08:00
yukang
e7a777805a Suggest possible clone when we have &T 2023-01-07 04:43:57 +08:00
Matthias Krüger
a1b3393f5f
Rollup merge of #106542 - sigaloid:master, r=bjorn3
Add default and latest stable edition to --edition in rustc (attempt 2)

Fixes #106041

No longer leaks string like my first attempt PR, #106094 - uses LazyLock to construct a `&'static str`

It will now output the default edition and latest stable edition in the help message for the `--edition` flag.

Going to request the same reviewer as the first attempt for continuity - r? `@Nilstrieb`
2023-01-06 21:26:12 +01:00
Matthias Krüger
9a090edf2e
Rollup merge of #106528 - estebank:quick-fix, r=TaKO8Ki
Tiny formatting fix
2023-01-06 21:26:11 +01:00
Matthias Krüger
498216e9db
Rollup merge of #106341 - Ezrashaw:refactor-error-code-tidy-check, r=mejrs,klensy,GuillaumeGomez
refactor: clean up `errors.rs` and `error_codes_check.rs`

`errors.rs` is basically unused now, `error_codes_check.rs` is useful but not well commented, etc. It also doesn't check certain things which are certainly not correct. For example, `E0505` has a UI test in `src/test/ui/error-codes/` but that test actually outputs `E0504`?! Other issues like these exist. I've implemented these with "warnings" which are a bit rough around the edges but should be removed eventually.

r? `@GuillaumeGomez` (again not sure if you want to review but its relevant to you)
2023-01-06 21:26:10 +01:00
Matthias Krüger
7568c49bf0
Rollup merge of #106287 - Nilstrieb:its-bugging-me-how-we-dont-have-docs, r=jyn514
Add some docs to `bug`, `span_bug` and `delay_span_bug`

cc `@mejrs` as you wanted me to do this, does this look good and understandable?
2023-01-06 21:26:09 +01:00
Matthew E
893938f64f
Update compiler/rustc_session/src/config.rs
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2023-01-06 14:36:52 -05:00
Matthew Esposito
5cda0a2f39 Add default and latest stable edition to --edition in rustc 2023-01-06 14:07:12 -05:00
bors
0fb8b72ce4 Auto merge of #106501 - cjgillot:resolved-elided-apit, r=compiler-errors
Correct detection of elided lifetimes in impl-trait.

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

r? `@compiler-errors`
cc `@pnkfelix`
2023-01-06 18:15:56 +00:00
Paul Kirth
c5bde0699f Enable Shadow Call Stack for Fuchsia on AArch64
Fuchsia already uses SCS by default for C/C++ code on ARM hardware.
This patch allows SCS to be used for Rust code as well.
2023-01-06 17:42:20 +00:00
bors
afe8c4537c Auto merge of #106474 - erikdesjardins:noalias, r=bjorn3
cleanup: handle -Zmutable-noalias like -Zbox-noalias

r? `@bjorn3`

cc `@RalfJung` this will conflict with #106180
2023-01-06 15:20:58 +00:00
Takayuki Maeda
804dea9ca6 use smaller spans for missing lifetime/generic args
fix rustdoc ui test
2023-01-06 21:55:23 +09:00
bors
7bbbaabbb6 Auto merge of #105805 - yanchen4791:issue-105227-fix, r=estebank
Suggest adding named lifetime when the return contains value borrowed from more than one lifetimes of function inputs

fix for #105227.

The problem: The suggestion of adding an explicit `'_` lifetime bound is **incorrect** when the function's return type contains a value which could be borrowed from more than one lifetimes of the function's inputs. Instead, a named lifetime parameter can be introduced in such a case.

The solution: Checking the number of elided lifetimes in the function signature. If more than one lifetimes found in the function inputs when the suggestion of adding explicit `'_` lifetime, change it to using named lifetime parameter `'a` instead.
2023-01-06 12:08:49 +00:00
bors
1146560e1a Auto merge of #106529 - Dylan-DPC:rollup-mvncmrk, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #106400 (Point at expressions where inference refines an unexpected type)
 - #106491 (Fix error-index redirect to work with the back button.)
 - #106494 (Add regression test for #58355)
 - #106499 (fix [type error] for error E0029 and E0277)
 - #106502 (rustdoc: remove legacy user-select CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-06 09:17:14 +00:00
Dylan DPC
a8f7ec2c48
Rollup merge of #106499 - lyming2007:issue-105946-fix, r=estebank
fix [type error] for error E0029 and E0277

check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug() and prevent the error E0029 and E0277 from emitting out this fix #105946
2023-01-06 11:38:57 +05:30
Dylan DPC
6ae0f08c19
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors
Point at expressions where inference refines an unexpected type

Fix #106355. Fix #14007. (!)

```
error[E0308]: mismatched types
  --> src/test/ui/type/type-check/point-at-inference.rs:12:9
   |
9  |         foo.push(i);
   |                  - this is of type `&{integer}`, which makes `foo` to be inferred as `Vec<&{integer}>`
...
12 |     bar(foo);
   |     --- ^^^ expected `i32`, found `&{integer}`
   |     |
   |     arguments to this function are incorrect
   |
   = note: expected struct `Vec<i32>`
              found struct `Vec<&{integer}>`
note: function defined here
  --> src/test/ui/type/type-check/point-at-inference.rs:2:4
   |
2  | fn bar(_: Vec<i32>) {}
   |    ^^^ -----------
help: consider dereferencing the borrow
   |
9  |         foo.push(*i);
   |                  +
```
2023-01-06 11:38:56 +05:30
bors
ce8fbe7901 Auto merge of #106429 - djkoloski:add_vendor_to_fuchsia_target_triple, r=nagisa
Add vendor to Fuchsia's target triple

Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia and aarch64-fuchsia. However, they should technically contain vendor information. This CL changes Fuchsia's target triples to include the "unknown" vendor since Clang now does normalization and handles all triple spellings.

This was previously attempted in #90510, which was closed due to inactivity.
2023-01-06 06:05:40 +00:00
Esteban Küber
0edca66a90 Tiny formatting fix 2023-01-06 05:34:56 +00:00
Yiming Lei
10dbcf0630 fix [type error] for error E0029 and E0277
check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug()
and prevent the error E0029 and E0277 from emitting out
this fix #105946
2023-01-05 21:21:13 -08:00
yanchen4791
523fe7a121 Suggests adding named lifetime when the return contains value borrowed from more than one lifetimes of the function's inputs 2023-01-05 21:09:27 -08:00
Esteban Küber
031e085450 Tweak output 2023-01-06 04:37:29 +00:00
Michael Goulet
a9d093bd6b Report WF error for new solver too 2023-01-06 04:09:44 +00:00
bors
0853d9677c Auto merge of #105890 - Nilstrieb:inline-fmt-part-1, r=jackh726
Fix `uninlined_format_args` in compiler crates with the diagnostic migration completed

Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).

Some of them have been reviewed by myself and they were all correct (though I still recommend going over all of them again for review).
2023-01-06 02:58:40 +00:00
Esteban Küber
1fa6ada9dd Detect bindings assigned blocks without tail expressions in trait errors
Address  #44173 for trait errors.
2023-01-06 02:43:16 +00:00
Esteban Küber
1983a627b3 Detect bindings assigned blocks without tail expressions
Address  #44173 for type check errors.
2023-01-06 00:45:10 +00:00
Esteban Küber
ce6b7179af Detect closures assigned to binding in block
Fix #58497.
2023-01-05 21:29:36 +00:00
Nilstrieb
5112f0281d Shrink ParseResult in the hot path.
A recent PR increased the size, which caused regressions. This uses the
existing generic infrastructure to differentiate between the hot path
and the diagnostics path.
2023-01-05 20:42:26 +01:00
nils
fd7a159710 Fix uninlined_format_args for some compiler crates
Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
2023-01-05 19:01:12 +01:00
Camille GILLOT
de1859fc32 Correct detection of elided lifetimes in impl-trait. 2023-01-05 18:00:45 +00:00
Esteban Küber
f98f2fcb5e fix rebase 2023-01-05 17:09:41 +00:00
clubby789
23c3a30730 Explain error with &mut self for unsized trait impls 2023-01-05 16:51:30 +00:00
Esteban Küber
b182259d39 review comments: reword 2023-01-05 16:51:17 +00:00
Esteban Küber
98f3936aa7 review comment: potentially produce more suggestions for arg type mismatch 2023-01-05 16:51:17 +00:00
Esteban Küber
c905f5e1b0 Account for type error on method arg caused by earlier inference
```rust
fn main() {
    let v = Vec::new();
    v.push(0);
    v.push(0);
    v.push("");
}
```

now produces

```
error[E0308]: mismatched types
  --> $DIR/point-at-inference-3.rs:6:12
   |
LL |     v.push(0);
   |            - this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>`
...
LL |     v.push("");
   |       ---- ^^ expected integer, found `&str`
   |       |
   |       arguments to this function are incorrect
   |
note: associated function defined here
  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
```
2023-01-05 16:51:17 +00:00
Esteban Küber
ad82eedfa1 Use BottomUpFolder 2023-01-05 16:51:16 +00:00
Esteban Küber
4ac7d1c3ab Formatting 2023-01-05 16:51:16 +00:00
Esteban Küber
9cc8d86190 Tweak output
- Only point at a the single expression where the found type was first
  inferred.
- Find method call argument that might have caused the found type to be
  inferred.
- Provide structured suggestion.
- Apply some review comments.
- Tweak wording.
2023-01-05 16:51:16 +00:00
Esteban Küber
6b0cce4b50 review comments: do not always point at init expr 2023-01-05 16:51:16 +00:00
Esteban Küber
48094a4a6f More eagerly resolve expr tys before writing them
This allows the expressions to have more accurate types
when showing inference steps.
2023-01-05 16:51:16 +00:00
Esteban Küber
05c30b0ca5 Skip macros to avoid talking about bindings the user can't see 2023-01-05 16:51:16 +00:00
Esteban Küber
ea43eb3721 Point at expressions where inference refines an unexpected type
Address #106355.
2023-01-05 16:51:16 +00:00
David Koloski
f6ef039775 Add vendor to Fuchsia's target triple
Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia
and aarch64-fuchsia. However, they should technically contain vendor
information. This CL changes Fuchsia's target triples to include the
"unknown" vendor since Clang now does normalization and handles all
triple spellings.

This was previously attempted in #90510, which was closed due to
inactivity.
2023-01-05 09:34:22 -05:00
bors
e94fab69d0 Auto merge of #106404 - tmiasko:dedup-box-derefs, r=wesleywiser
Remove duplicated elaborate box derefs pass

The pass runs earlier as a part of `run_runtime_lowering_passes`.

The duplicate was added in #99102.
2023-01-05 09:50:05 +00:00
bors
1429899700 Auto merge of #106482 - compiler-errors:rollup-g7n1p39, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #105846 (Account for return-position `impl Trait` in trait in `opt_suggest_box_span`)
 - #106385 (Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag)
 - #106403 (Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`)
 - #106462 (rustdoc: remove unnecessary wrapper around sidebar and mobile logos)
 - #106464 (Update Fuchsia walkthrough with new configs)
 - #106478 (Tweak wording of fn call with wrong number of args)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-05 06:47:02 +00:00
Michael Goulet
e048ee2ac1
Rollup merge of #106478 - estebank:tweak-fn-mismatch, r=compiler-errors
Tweak wording of fn call with wrong number of args
2023-01-04 20:36:29 -08:00
Michael Goulet
5ce6311f34
Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillot
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`

The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`.

Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-04 20:36:28 -08:00
Michael Goulet
13bb8a8b15
Rollup merge of #106385 - compiler-errors:new-solver-flag, r=jackh726
Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag

We'll eventually need a way to select more than chalk + not-chalk.

Does this need an MCP since it's touching a `-Z` flag? Or perhaps I should preserve `-Zchalk` for the time being... maybe I could make it a warning to use that flag? cc ``@rust-lang/types``

r? types
2023-01-04 20:36:27 -08:00
Michael Goulet
f9ccbf084f
Rollup merge of #105846 - compiler-errors:issue-105838, r=jackh726
Account for return-position `impl Trait` in trait in `opt_suggest_box_span`

RPITITs are the only types where their opaque bounds might normalize to some other self type than the opaque type itself. To avoid needing to do normalization, let's just match on either alias kind.

Ideally, we'd just get rid of `opt_suggest_box_span`. It's kind of a wart on type-checking `if`/`match`. I've recently refactored this expression for being confusing/wrong, but moving it into the error path is pretty hard.

Fixes #105838
2023-01-04 20:36:27 -08:00
bors
03b9e1d154 Auto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726
Don't deduce a signature that makes a closure cyclic

Sometimes when elaborating supertrait bounds for closure signature inference, we end up deducing a closure signature that is cyclical because either a parameter or the return type references a projection mentioning `Self` that also has escaping bound vars, which means that it's not eagerly replaced with an inference variable.

Interestingly, this is not *just* related to my PR that elaborates supertrait bounds for closure signature deduction. The committed test `supertrait-hint-cycle-3.rs` shows **stable** code that is fixed by this PR:

```rust
trait Foo<'a> {
    type Input;
}

impl<F: Fn(u32)> Foo<'_> for F {
    type Input = u32;
}

fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}

fn main() {
    needs_super(|_: u32| {});
}
```

Fixes #105401
Fixes #105396

r? types
2023-01-05 03:59:31 +00:00
Esteban Küber
5393c6bbd1 Tweak wording of fn call with wrong number of args 2023-01-05 03:02:10 +00:00
bors
d26242d35f Auto merge of #106472 - matthiaskrgr:rollup-4w4v50e, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106391 (rustdoc: allow popover child links to work)
 - #106398 (Fix a few clippy lints in libtest)
 - #106412 (Fix link generation for local primitive types in rustdoc JSON output)
 - #106437 (rustdoc: fix buggy JS check for absolute URL)
 - #106451 (Merge borrowck permission checks)
 - #106460 (Move tests)
 - #106461 (docs: fix broken link "search bar")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-05 01:06:05 +00:00
Erik Desjardins
d165a6d708 cleanup: handle -Zmutable-noalias like -Zbox-noalias 2023-01-04 19:24:42 -05:00
Matthias Krüger
6feb1fedbc
Rollup merge of #106451 - Zeegomo:merge-borrowck-access, r=estebank
Merge borrowck permission checks

Merge `check_access_permission` and `check_if_reassignment_to_immutable_state`.
The goal of this commit is twofold:
* simplify the codebase by removing duplicate logic.
* avoid duplicate reporting of illegal reassignment errors by reusing the exiting de-duplicating logic of access_place.
2023-01-04 23:39:51 +01:00
Michael Goulet
21b078a64e Use FxIndexSet when updating obligation causes in adjust_fulfillment_errors_for_expr_obligation 2023-01-04 22:07:04 +00:00
bors
d9e317a176 Auto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiser
Small fixes for --crate-type staticlib

The first commit doesn't have an effect until we start translating error messages. The second commit fixes potential linker errors when combining `--crate-type staticlib` with another crate type and I think `-Cprefer-dynamic`.
2023-01-04 21:35:15 +00:00
Michael Goulet
8b0f43b19d Rename stock solver to classic 2023-01-04 18:40:02 +00:00
Michael Goulet
a4974fa9c7 Split -Zchalk flag into -Ztrait-solver=(stock|chalk|next) flag 2023-01-04 18:12:42 +00:00
bors
b7cdb635c4 Auto merge of #106382 - tmiasko:sdniwnu-daed, r=wesleywiser
Fix handling of dead unwinds in backward analyses

Dead unwinds set contains a head of an unreachable unwind edge.
2023-01-04 15:48:47 +00:00
Giacomo Pasini
ac4426c093
Merge borrowck permission checks
Merge `check_access_permission` and
`check_if_reassignment_to_immutable_state`.
The goal of this commit is twofold:
First, we simplify the codebase by removing duplicate logic.
Second, we avoid duplicate reporting of illegal reassignment
errors by reusing the exiting de-duplicating logic of
access_place.
2023-01-04 15:25:45 +01:00
bjorn3
7705116708 Fix each_linked_rlib when the current crate has 0 crate types 2023-01-04 13:58:08 +00:00
bors
5c18bc6137 Auto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106200 (Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions)
 - #106274 (Add JSON output to -Zdump-mono-stats)
 - #106292 (Add codegen test for `Box::new(uninit)` of big arrays)
 - #106327 (Add tidy check for dbg)
 - #106361 (Note maximum integer literal for `IntLiteralTooLarge`)
 - #106396 (Allow passing a specific date to `bump-stage0`)
 - #106436 (Enable doctests for rustc_query_impl)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-04 09:41:43 +00:00
Matthias Krüger
4e590b3ee9
Rollup merge of #106436 - CarsonV:doctest_query_impl, r=jyn514
Enable doctests for rustc_query_impl

doctests worked out of the box for query_impl on my local machine. Working towards #99144
2023-01-04 07:28:57 +01:00
Matthias Krüger
11020b93b6
Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebank
Note maximum integer literal for `IntLiteralTooLarge`

Closes #105908

`@rustbot` label +A-diagnostics
2023-01-04 07:28:56 +01:00
Matthias Krüger
fbfaeb6795
Rollup merge of #106274 - jyn514:dump-mono-stats, r=lqd
Add JSON output to -Zdump-mono-stats

Follow-up to https://github.com/rust-lang/rust/pull/105481

r? `@lqd` cc `@wesleywiser`
2023-01-04 07:28:54 +01:00
Matthias Krüger
70468af591
Rollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebank
Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions

Follow-up to #106172, only the last commit is relevant. Can rebase once that PR is landed for easier review.

Suggests `impl Future` and `impl Fn{,Mut,Once}` in `-> _` return suggestions.

r? `@estebank`
2023-01-04 07:28:54 +01:00
bors
ddad1e1f15 Auto merge of #104376 - compiler-errors:thin-metadata-implies-thin-ptr, r=wesleywiser
layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`

Use the `<T as Pointee>::Metadata` associated type to calculate the layout of a pointee's metadata, instead of hard-coding rules about certain types.

Maybe this approach is overkill -- we could instead hard-code this approach as a fallback, with the matching on `Slice`/`Dynamic`/etc. happening first

Fixes this issue here https://github.com/rust-lang/rust/pull/104338#issuecomment-1312595844 .. But is also useful with transmutes, for example, given the UI test I added below.
2023-01-04 06:28:05 +00:00
bors
c361616c3c Auto merge of #106432 - compiler-errors:rollup-lzj0lnp, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #104748 (Ensure `lld` is supported with `download-ci-llvm`)
 - #105541 (Simplify some iterator combinators)
 - #106045 (default OOM handler: use non-unwinding panic, to match std handler)
 - #106157 (Don't trim path for `unsafe_op_in_unsafe_fn` lints)
 - #106353 (Reduce spans for `unsafe impl` errors)
 - #106381 (Jsondoclint: Add `--verbose` and `--json-output` options)
 - #106411 (rustdoc: remove legacy font-feature-settings CSS)
 - #106414 (Add cuviper to the review rotation for libs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-04 03:37:21 +00:00
CarsonV
f98adb32f5 Enable query_impl doctests 2023-01-03 20:38:28 -06:00
Michael Goulet
5d828d2440
Rollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser
Reduce spans for `unsafe impl` errors

Because huge spans aren't great for IDEs.

Prior art: https://github.com/rust-lang/rust/pull/103749
2023-01-03 17:19:27 -08:00
Michael Goulet
dc5247bf29
Rollup merge of #106157 - LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2, r=compiler-errors
Don't trim path for `unsafe_op_in_unsafe_fn` lints

Fixes #106126, alternative to #106127.
r? `@ghost` for now.
2023-01-03 17:19:26 -08:00
Michael Goulet
a5d39cf290 review comment: Deduplicate dyn ty_and_layout_field code 2023-01-04 01:03:04 +00:00
Michael Goulet
2011316e59 Mirror metadata changes in layout sanity check 2023-01-04 00:56:05 +00:00