Commit Graph

19346 Commits

Author SHA1 Message Date
Matthias Krüger
e86f1845ff
Rollup merge of #104497 - lyming2007:issue-104379-fix, r=fee1-dead
detect () to avoid redundant <> suggestion for type

fix #104379
2022-11-19 15:35:21 +01:00
Matthias Krüger
06707c073d
Rollup merge of #104469 - estebank:long-types, r=oli-obk
Make "long type" printing type aware and trim types in E0275

Instead of simple string cutting, use a custom printer to hide parts of long printed types.

On E0275, check for type length before printing.
2022-11-19 15:35:21 +01:00
Matthias Krüger
52cc0d5360
Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholk
Use `IsTerminal` in place of `atty`

In any crate that can use nightly features, use `IsTerminal` rather than
`atty`:

- Use `IsTerminal` in `rustc_errors`
- Use `IsTerminal` in `rustc_driver`
- Use `IsTerminal` in `rustc_log`
- Use `IsTerminal` in `librustdoc`
2022-11-19 15:35:18 +01:00
Ralf Jung
3338244f69 deduplicate constant evaluation in cranelift backend
also sync LLVM and cranelift structure a bit
2022-11-19 14:08:12 +01:00
bors
5e6de2369c Auto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obk
Revert "Normalize opaques with escaping bound vars"

This caused a perf regression in #103423, cc `@skyzh` this should fix #103423.

reverts #100980

r? `@oli-obk`
2022-11-19 09:30:35 +00:00
Dylan DPC
3cf3a65a71
Rollup merge of #104580 - notriddle:notriddle/issue-102354-hide-sugg, r=compiler-errors
diagnostics: only show one suggestion for method -> assoc fn

Fixes #102354
2022-11-19 11:54:47 +05:30
Dylan DPC
3c6fc06906
Rollup merge of #104566 - matthiaskrgr:clippy_perf_nov18, r=oli-obk
couple of clippy::perf fixes
2022-11-19 11:54:46 +05:30
Dylan DPC
7f35493e99
Rollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnr
Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less

there are only like 3 or 4 call sites left after this but it wasnt obvious to me how to remove them
2022-11-19 11:54:45 +05:30
Dylan DPC
00876c68c4
Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors
nll: correctly deal with bivariance

fixes #104409

when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions.

r? types cc ``@RalfJung``
2022-11-19 11:54:44 +05:30
Dylan DPC
aeeac5dd0c
Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3
Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-19 11:54:43 +05:30
Michael Goulet
5384af01e3 Probe + better error messsage for need_migrate_deref_output_trait_object 2022-11-19 06:09:29 +00:00
Michael Goulet
c36ff28d42 drive-by: PolyExistentialPredicate 2022-11-19 04:04:27 +00:00
Michael Goulet
9a9d0f40b8 Improve spans for RPITIT object-safety errors 2022-11-19 02:34:37 +00:00
bors
becc24a23a Auto merge of #97870 - eggyal:inplace_fold_spec, r=wesleywiser
Use liballoc's specialised in-place vec collection

liballoc already specialises in-place vector collection, so manually
reimplementing it in `IdFunctor::try_map_id` was superfluous.
2022-11-19 02:28:47 +00:00
Michael Goulet
c4165f3a96 drive-by: Add is_async fn to hir::IsAsync 2022-11-19 02:22:24 +00:00
bors
ff0ffda6b3 Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`)
 - #103378 (Fix mod_inv termination for the last iteration)
 - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS)
 - #103701 (Simplify some pointer method implementations)
 - #104047 (Diagnostics `icu4x` based list formatting.)
 - #104338 (Enforce that `dyn*` coercions are actually pointer-sized)
 - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`)
 - #104556 (rustdoc: use `code-header` class to format enum variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-18 23:20:53 +00:00
Manish Goregaokar
a065e97bdc
Rollup merge of #104498 - pierwill:stash-diag-docs, r=compiler-errors
Edit docs for `rustc_errors::Handler::stash_diagnostic`

Clarify that the diagnostic can be retrieved with `steal_diagnostic`.

r? ```@compiler-errors```
2022-11-18 17:48:19 -05:00
Manish Goregaokar
24ee599195
Rollup merge of #104338 - compiler-errors:pointer-sized, r=eholk
Enforce that `dyn*` coercions are actually pointer-sized

Implement a perma-unstable, rudimentary `PointerSized` trait to enforce `dyn*` casts are `usize`-sized for now, at least to prevent ICEs and weird codegen issues from cropping up after monomorphization since currently we enforce *nothing*.

This probably can/should be removed in favor of a more sophisticated trait for handling `dyn*` conversions when we decide on one, but I just want to get something up for discussion and experimentation for now.

r? ```@eholk``` cc ```@tmandry``` (though feel free to claim/reassign)

Fixes #102141
Fixes #102173
2022-11-18 17:48:18 -05:00
Charles Lew
b22cb90e0a Update crate documentation of rustc_baked_icu_data crate 2022-11-18 14:46:36 -08:00
Charles Lew
b21e0b82c5 Fix compilation issue after rebase 2022-11-18 14:46:36 -08:00
Charles Lew
707c035e00 Include zh locale in icu data 2022-11-18 14:46:35 -08:00
Charles Lew
d15b020278 Enable icu sync feature for parallel compiler 2022-11-18 14:46:35 -08:00
Charles Lew
bde2f9857b Import icu locale fallback data 2022-11-18 14:46:35 -08:00
Charles Lew
a775004322 Migrate diagnostics list output to use icu list formatter. 2022-11-18 14:46:35 -08:00
Charles Lew
42d3bda08c Add rustc_baked_icu_data crate. 2022-11-18 14:46:35 -08:00
bors
b833ad56f4 Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1)
 - #103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting))
 - #103405 (Detect incorrect chaining of if and if let conditions and recover)
 - #103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets)
 - #104006 (Add variant_name function to `LangItem`)
 - #104494 (Migrate GUI test to use functions)
 - #104516 (rustdoc: clean up sidebar width CSS)
 - #104550 (fix a typo)

Failed merges:

 - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-18 20:26:58 +00:00
Daniel Paoliello
67e746cc68 Workaround for private global symbol issue 2022-11-18 11:38:31 -08:00
Michael Goulet
39e076a2e7 Only enforce ABI-mandated align, not preferred align is compatible 2022-11-18 18:23:48 +00:00
Michael Goulet
b3da04aa52 Check both align and size in PointerSized 2022-11-18 18:23:48 +00:00
Michael Goulet
da3c5397a6 Enforce that dyn* casts are actually pointer-sized 2022-11-18 18:23:48 +00:00
Michael Goulet
b8a92c1dd6 Revert "Normalize opaques with escaping bound vars"
This reverts commit 43119d6438.
2022-11-18 17:40:14 +00:00
Michael Howell
df7ecbcb11 diagnostics: only show one suggestion for method -> assoc fn
Fixes #102354
2022-11-18 10:39:26 -07:00
Michael Goulet
bb0cb9ae9f Add a detailed note for missing comma in FRU syntax typo 2022-11-18 17:27:55 +00:00
bors
70fe5f08ff Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov
Shrink `ast::Expr` harder

r? `@ghost`
2022-11-18 16:56:12 +00:00
Esteban Küber
bcb2655a9a review comment 2022-11-18 08:46:48 -08:00
Esteban Küber
3debf5006a Only use ... instead of _ for type elision
`_` might confuse people into believing that the type isn't known,
while `...` is not used anywhere else for types and is not valid
syntax, making it more likely to convey the right understanding.
2022-11-18 08:46:47 -08:00
Esteban Küber
4ed1376490 On E0275 do not print out the full type in the msg
When printing requirement overflow errors, do not print out the full
type name when it is longer than 50 characters long.
2022-11-18 08:46:47 -08:00
Esteban Küber
787e633d1a On overflow errors, do not print out long types 2022-11-18 08:46:47 -08:00
Esteban Küber
d49c10ac62 Make "long type" printing type aware
Instead of simple string cutting, use a custom printer to hide parts of
long printed types.
2022-11-18 08:42:59 -08:00
Boxy
45a09a4683 review comments 2 electric boogalo 2022-11-18 13:45:47 +00:00
Boxy
9ed348376f require an ErrorGuaranteed to taint infcx with errors 2022-11-18 13:25:17 +00:00
Boxy
1c48039a87 rename is_tainted_by_errors 2022-11-18 13:25:17 +00:00
Boxy
3fca95a597 track_errors use a delay_span_bug 2022-11-18 13:25:17 +00:00
Boxy
95a267bb34 make replaced_with_error store ErrorGuaranteed 2022-11-18 13:25:17 +00:00
Boxy
9c510048fd InferCtxt::is_tainted_by_errors returns ErrorGuaranteed 2022-11-18 13:25:17 +00:00
Boxy
c1ec8ff14d dont unchecked create ErrorGuaranteed in BorrowckErrors 2022-11-18 13:25:17 +00:00
Ralf Jung
09a887cebf review feedback 2022-11-18 14:24:48 +01:00
Matthias Krüger
7e5e520c7d
Rollup merge of #104550 - RalfJung:typo, r=compiler-errors
fix a typo

r? `@lcnr`
2022-11-18 14:13:39 +01:00
Matthias Krüger
2ea012619e
Rollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk
Add variant_name function to `LangItem`

Clippy has an internal lint that checks for the usage of hardcoded def paths and suggests to replace them with a lang or diagnostic item, if possible. This was implemented with a hack, by getting all the variants of the `LangItem` enum and then index into it with the position of the `LangItem` in the `items` list. This is no longer possible, because the `items` list can't be accessed anymore.

Follow up to #103603

cc `@camsteffen`
r? `@oli-obk`

This is blocking the sync between Clippy and Rust. I'm not sure if this is the best solution here, or if I should add a method `items()` to `LanguageItems` and keep the code in Clippy unchanged.
2022-11-18 14:13:37 +01:00
Matthias Krüger
3efbf30220
Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errors
Detect incorrect chaining of if and if let conditions and recover

Fixes #103381
2022-11-18 14:13:36 +01:00
Matthias Krüger
741f3cf383
Rollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholk
Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting)

This makes sure we don't accidentally allow coercions like `Box<T>` -> `Box<dyn* Trait>`, or in the case of this ICE, `&T` to `&dyn* Trait`. These coercions don't make sense, at least not via the `CoerceUnsized` trait.

Fixes #102172
Fixes #102429
2022-11-18 14:13:35 +01:00
Matthias Krüger
3e5965722c
Rollup merge of #101162 - rajputrajat:master, r=davidtwco
Migrate rustc_resolve to use SessionDiagnostic, part # 1

crate a somewhat on larger size, so plz allow some time to get it finished.
2022-11-18 14:13:35 +01:00
bors
fd3bfb3551 Auto merge of #104330 - CastilloDel:ast_lowering, r=cjgillot
Remove allow(rustc::potential_query_instability) from rustc_ast_lowering

Related to https://github.com/rust-lang/rust/issues/84447.

`@cjgillot` Thanks for helping me!
2022-11-18 13:12:18 +00:00
Matthias Krüger
e3036df003 couple of clippy::perf fixes 2022-11-18 10:30:47 +01:00
Ralf Jung
4101889786 interpret: use Either over Result when it is not representing an error condition 2022-11-18 10:18:32 +01:00
Deadbeef
bc51f8783c rename to string_deref_patterns 2022-11-18 06:16:20 +00:00
Deadbeef
64a17a09a8 Rm diagnostic item, use lang item 2022-11-18 06:16:20 +00:00
Cameron Steffen
9cf6ce070d Remove more PlaceBuilder clones 2022-11-17 19:01:05 -06:00
Cameron Steffen
105abe39c0 Replace into_place with to_place 2022-11-17 19:01:05 -06:00
Cameron Steffen
be5b7778c8 Replace try_upvars_resolved with try_to_place 2022-11-17 19:01:05 -06:00
Cameron Steffen
1c819792a7 Introduce PlaceBuilder::resolve_upvar by ref 2022-11-17 19:01:05 -06:00
pierwill
19b63bc791 Edit docs for rustc_errors::Handler::stash_diagnostic
Clarify that the diagnostic can be retrieved with `steal_diagnostic`.
2022-11-17 15:45:46 -06:00
Matthias Krüger
239f84bc51
Rollup merge of #104545 - flip1995:diag_item_matches_macro, r=compiler-errors
Readd the matches_macro diag item

This is now used by Clippy

r? `@compiler-errors`

This was removed in #104383. But in the meantime Clippy now makes use of it dac600e32f/clippy_lints/src/manual_is_ascii_check.rs (L153)

---

This is blocking the Clippy sync. (kinda. I could work around it, but I don't want to play ping-pong with this change.)
2022-11-17 22:33:22 +01:00
Matthias Krüger
58292874e1
Rollup merge of #104515 - chenyukang:yukang/fix-104510-ice, r=compiler-errors
ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug

Fixes #104510
2022-11-17 22:33:21 +01:00
Matthias Krüger
43fa2918d1
Rollup merge of #104508 - compiler-errors:dyn-return, r=oli-obk
Check `dyn*` return type correctly

In `check_fn`, if the declared return type is `dyn Trait`, then we check the return type separately to produce better diagnostics, because this is never valid -- however, when `dyn*` was introduced, this check was never adjusted to only account for *unsized* `dyn Trait` and not *sized* `dyn* Trait`.

Fixes #104501
2022-11-17 22:33:21 +01:00
Matthias Krüger
ed97f245f1
Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors
Convert predicates into Predicate in the Obligation constructor

instead of having almost all callers do that.

This reduces a bit of boilerplate, and also paves the way for my work towards https://github.com/rust-lang/compiler-team/issues/531 (as it makes it easier to accept both goals and clauses where right now it only accepts predicates).
2022-11-17 22:33:19 +01:00
Matthias Krüger
1c52c247f9
Rollup merge of #104444 - chenyukang:yukang/fix-104390, r=compiler-errors
Fix ICE in in_operand for ty error

Fixes #104390

By the way, moving some test cases to proper directory for tidy bless.
2022-11-17 22:33:19 +01:00
Matthias Krüger
c9ccb0ba28
Rollup merge of #104433 - TaKO8Ki:fix-104392, r=estebank
Fix `emit_unused_delims_expr` ICE

Fixes #104392
2022-11-17 22:33:18 +01:00
Matthias Krüger
1521795a7d
Rollup merge of #103852 - compiler-errors:rpitit-early-from-impl, r=lcnr
Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl`

long title 😓

We don't want to remap early-bound regions that originate from the `impl`s themselves, since they have no corresponding region in the trait. Not sure if there's a better condition than checking if the EBR's def-id's parent is the impl -- maybe we should be checking if the region comes from the method or RPITIT... 🤷

r? types

Fixes #103850
2022-11-17 22:33:17 +01:00
Ralf Jung
ff38c2891d fix a typo 2022-11-17 21:13:23 +01:00
Philipp Krones
4e65f5ea82
Add variant_name function to LangItem
Clippy has an internal lint that checks for the usage of hardcoded def
paths and suggests to replace them with a lang or diagnostic item, if
possible. This was implemented with a hack, by getting all the variants
of the `LangItem` enum and then index into it with the position of the
`LangItem` in the `items` list. This is no longer possible, because the
`items` list can't be accessed anymore.
2022-11-17 20:06:25 +01:00
Philipp Krones
34a14349b7
Readd the matches_macro diag item
This is now used by Clippy
2022-11-17 19:32:28 +01:00
bors
83356b78c4 Auto merge of #104361 - vladimir-ea:watchos_fix_linking, r=oli-obk
[watchos] Dynamic linking is not allowed for watchos targets

Dynamic linking of all apple targets was (re-) enabled in PR #100636. However, dynamic linking is not allowed on WatchOS so this broke the build of standard library for WatchOS.

This change disables dynamic linking for WatchOS non-simulator targets.
2022-11-17 17:15:31 +00:00
Yiming Lei
867582eb97 detect () to avoid redundant <> suggestion for type
fix #104379
2022-11-17 09:01:27 -08:00
bors
b6097f2e1b Auto merge of #104219 - bryangarza:async-track-caller-dup, r=eholk
Support `#[track_caller]` on async fns

Adds `#[track_caller]` to the generator that is created when we desugar the async fn.

Fixes #78840

Open questions:
- What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.
2022-11-17 13:47:03 +00:00
Deadbeef
0537d301c5 Add feature gate 2022-11-17 12:46:43 +00:00
Deadbeef
b2cb42d6a7 Minimal implementation of implicit deref patterns 2022-11-17 12:46:43 +00:00
Ayush Singh
2436dff772
Use custom entry name in cranelift
This is a continuation of 9f0a8620bd for
cranelift.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-17 15:28:47 +05:30
Qiu Chaofan
aef3d938e4 Add powerpc64-ibm-aix as Tier-3 target 2022-11-17 16:36:54 +08:00
Ralf Jung
99f7e9494e try_normalize_after_erasing_regions: promote an assertion to always run 2022-11-17 09:06:15 +01:00
bors
7c75fe4c85 Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
Record `LocalDefId` in HIR nodes instead of a side table

This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR.
This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed.

This first part adds the information to HIR nodes themselves instead of a table.
The second part is https://github.com/rust-lang/rust/pull/103902
The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter.
The fourth part will be to completely remove the side table.
2022-11-17 07:42:27 +00:00
Divam Narula
693c6311f0
Throw error on failure in loading llvm-plugin 2022-11-17 15:25:18 +09:00
Nicholas Nethercote
67d5cc0462 Use ThinVec in ast::Path. 2022-11-17 13:56:38 +11:00
Nicholas Nethercote
6b7ca2fcf2 Box ExprKind::{Closure,MethodCall}, and QSelf in expressions, types, and patterns. 2022-11-17 13:45:59 +11:00
bors
251831ece9 Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3
Merge basic blocks where possible when generating LLVM IR.

r? `@ghost`
2022-11-17 01:56:24 +00:00
bors
bebd57a960 Auto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petrochenkov
Use `token::Lit` in `ast::ExprKind::Lit`.

Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing.

r? `@petrochenkov`
2022-11-16 23:03:14 +00:00
Michael Goulet
75afb22331 Check dyn* return type correctly 2022-11-16 22:21:41 +00:00
Maybe Waffle
94470f4efd Use as_deref in compiler (but only where it makes sense) 2022-11-16 21:58:58 +00:00
Matthias Krüger
163a7090b8
Rollup merge of #104394 - oli-obk:suggest_method_call, r=lcnr
various cleanups to try to reduce the use of spans inside method resolution

definitely review commit by commit.
2022-11-16 15:39:46 +01:00
Matthias Krüger
e033a389e1
Rollup merge of #104335 - Nilstrieb:macrowo, r=compiler-errors
Only do parser recovery on retried macro matching

Eager parser recovery can break macros, so we don't do it at first. But when we already know that the macro failed, we can retry it with recovery enabled to still emit useful diagnostics.

Helps with #103534
2022-11-16 15:39:46 +01:00
Matthias Krüger
353b915fec
Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obk
cleanup and dedupe CTFE and Miri error reporting

It looks like most of the time, this error raised from const_prop_lint is just redundant -- it duplicates the error reported when evaluating the const-eval query. This lets us make `ConstEvalErr` private to the const_eval module which I think is a good step.

The Miri change mostly replaces a `match` by `if let`, and dedupes the "this error is impossible in Miri" checks.

r? ``@oli-obk``
Fixes https://github.com/rust-lang/rust/issues/75461
2022-11-16 15:39:45 +01:00
Matthias Krüger
fbcd751ea1
Rollup merge of #104137 - StackDoubleFlow:err-lsc-unsupported, r=bjorn3
Issue error when -C link-self-contained option is used on unsupported platforms

The documentation was also updated to reflect this.

I'm assuming the supported platforms are the same as initially written in [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-17).

Fixes #103576
2022-11-16 15:39:45 +01:00
Matthias Krüger
56a28a65f5
Rollup merge of #103750 - calebzulawski:master, r=workingjubilee
Fix some misleading target feature aliases

This is the first half of a fix for #100752.  It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512.  These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions.  A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features).  This PR allows using the names as defined by LLVM, which matches Intel documentation.

A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc.

r? ```@workingjubilee```

cc ```@Amanieu```
2022-11-16 15:39:44 +01:00
Maybe Waffle
e2a28165a3 Fix perf regression by correctly matching keywords 2022-11-16 13:42:30 +00:00
yukang
9c2d4dd529 fix #104510, Remove is_tainted_by_errors since we have ty_error for delay bug 2022-11-16 19:41:08 +08:00
yukang
20ea083d87 fix #104390, fix ICE in in_operand for ty error 2022-11-16 17:48:13 +08:00
Oli Scherer
4f11f3b257 Convert predicates into Predicate in the Obligation constructor 2022-11-16 09:25:19 +00:00
Oli Scherer
634df06fae Generalize the ToPredicate trait
Its name is now not accurate anymore, but we'll adjust that later
2022-11-16 09:20:28 +00:00
Ralf Jung
1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
Matthias Krüger
3a8cacd7fb
Rollup merge of #104348 - fmease:iat-vis-stab, r=cjgillot
Respect visibility & stability of inherent associated types

As discussed in #103621, this probably won't be the final location of the code that resolves inherent associated types. Still, I think it's valuable to push correctness fixes for this feature (in regards to visibility and stability).

Let me know if I should write a translatable diagnostic instead and if I should move the tests to `privacy/` and `stability-attribute/` respectively.

Fixes #104243.
````@rustbot```` label A-visibility F-inherent_associated_types
r? ````@cjgillot```` (since you reviewed #103621, feel free to reroll though)
2022-11-16 08:36:11 +01:00
Matthias Krüger
88a19197b9
Rollup merge of #104193 - TaKO8Ki:fix-104142, r=cjgillot
Shift no characters when using raw string literals

Fixes #104142

Given the following code:

```rust
fn main() {
    println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#);
}
```

The current output is:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:59
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                                           ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

The output should look like:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:45
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                             ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

This pull request fixes the wrong span for `invalid format string` error and also solves the ICE.
2022-11-16 08:36:11 +01:00
Matthias Krüger
5140bbd102
Rollup merge of #103484 - saschanaz:patch-2, r=ehuss
Add `rust` to `let_underscore_lock` example

Currently https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#let-underscore-lock has no colored grammar and raw `{{produces}}` command is exposed.
2022-11-16 08:36:10 +01:00
Nicholas Nethercote
54082dd216 Merge basic blocks where possible when generating LLVM IR.
In `codegen_assert_terminator` we decide if a BB's successor is a
candidate for merging, which requires that it be the only successor, and
that it only have one predecessor. That result then gets passed down,
and if it reaches `funclet_br` with the appropriate BB characteristics,
then no `br` instruction is issued, a `MergingSucc::True` result is
passed back, and the merging proceeds in `codegen_block`.

The commit also adds `CachedLlbb`, a new type to help keep track of
each BB that has been merged into its predecessor.
2022-11-16 15:46:39 +11:00
Nicholas Nethercote
68194aa8d5 Use &mut Bx more.
For the next commit, `FunctionCx::codegen_*_terminator` need to take a
`&mut Bx` instead of consuming a `Bx`. This triggers a cascade of
similar changes across multiple functions. The resulting code is more
concise and replaces many `&mut bx` expressions with `bx`.
2022-11-16 15:46:39 +11:00
bors
79146baa9c Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obk
Perform simple scalar replacement of aggregates (SROA) MIR opt

This is a re-open of https://github.com/rust-lang/rust/pull/85796

I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR.

This pass replaces plain field accesses by simple locals when possible.
To be eligible, the replaced locals:
- must not be enums or unions;
- must not be used whole;
- must not have their address taken.

The storage and deinit statements are duplicated on each created local.

cc `@tmiasko` who reviewed the former version of this PR.
2022-11-15 23:52:22 +00:00
Nicholas Nethercote
358a603f11 Use token::Lit in ast::ExprKind::Lit.
Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals
are lowered when HIR is crated. Attribute literals are lowered during
parsing.

This commit changes the language very slightly. Some programs that used
to not compile now will compile. This is because some invalid literals
that are removed by `cfg` or attribute macros will no longer trigger
errors. See this comment for more details:
https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16 09:41:28 +11:00
Kagami Sascha Rosylight
0a528b16fc
Merge branch 'master' into patch-2 2022-11-15 21:16:11 +01:00
Nilstrieb
b7b67228f9
Only do parser recovery on retried macro matching
This prevents issues with eager parser recovery during macro matching.
2022-11-15 19:34:35 +01:00
Camille GILLOT
779007da06 Enable SROA by at mir-opt level 3. 2022-11-15 17:59:36 +00:00
Camille GILLOT
e4f343191a Flatten aggregates into locals. 2022-11-15 17:55:11 +00:00
Camille GILLOT
b550eabfa6 Introduce composite debuginfo. 2022-11-15 17:53:50 +00:00
bors
a00f8ba7fc Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk
interpret: support for per-byte provenance

Also factors the provenance map into its own module.

The third commit does the same for the init mask. I can move it in a separate PR if you prefer.

Fixes https://github.com/rust-lang/miri/issues/2181

r? `@oli-obk`
2022-11-15 17:37:15 +00:00
Ayush Singh
6dfe2395c9
Use custom entry name in gcc
This is a continuation of 9f0a8620bd for
gcc.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-15 22:15:55 +05:30
lcnr
b2e6d08e3f use ocx type relation routines 2022-11-15 14:13:47 +01:00
Daniel del Castillo
557226348f Update compiler/rustc_ast_lowering/src/item.rs
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2022-11-15 13:57:25 +01:00
CastilloDel
fdb5fe2ed8 Change LoweringContext.children to Vec 2022-11-15 13:57:24 +01:00
CastilloDel
d1eab51f47 Make clobber_abis use an FxIndexMap
It seems to be used more for lookup than iteration, so this could be a
perf hit
2022-11-15 13:57:24 +01:00
CastilloDel
769cc733b1 Remove allow(rustc::potential_query_instability) from rustc_ast_lowering 2022-11-15 13:57:24 +01:00
lcnr
f5f67618e2 add comment about opaque types 2022-11-15 13:50:13 +01:00
lcnr
6aa611a84c mv utility methods into separate module 2022-11-15 13:50:13 +01:00
bors
6d651a295e Auto merge of #104437 - matthiaskrgr:rollup-n5jdg9v, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #103439 (Show note where the macro failed to match)
 - #103734 (Adjust stabilization version to 1.65.0 for wasi fds)
 - #104148 (Visit attributes of trait impl items during AST validation)
 - #104241 (Move most of unwind's build script to lib.rs)
 - #104258 (Deduce closure signature from a type alias `impl Trait`'s supertraits)
 - #104296 (Walk types more carefully in `ProhibitOpaqueTypes` visitor)
 - #104309 (Slightly improve error message for invalid identifier)
 - #104316 (Simplify suggestions for errors in generators.)
 - #104339 (Add `rustc_deny_explicit_impl`)

Failed merges:

 - #103484 (Add `rust` to `let_underscore_lock` example)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 12:35:57 +00:00
lcnr
45f441a7b4 nll: correctly deal with bivariance 2022-11-15 13:34:08 +01:00
Oli Scherer
e2fbd01ac3 Compare picks via Self type and associated item id 2022-11-15 11:26:17 +00:00
Oli Scherer
d06aac1783 Expose the fallibilty of the unstable lint emission in the method name 2022-11-15 11:26:12 +00:00
Oli Scherer
e65688386b Pull the unstable name collision hint emission out of method probing 2022-11-15 11:26:07 +00:00
Oli Scherer
e694ef5f20 Remove the fishy need for a PartialEq impl 2022-11-15 11:26:02 +00:00
Oli Scherer
c3c3719fdd Remove some redundant span arguments 2022-11-15 11:25:57 +00:00
Oli Scherer
44c4a7b6c4 Remove an unnecessary resolve_vars_if_possible 2022-11-15 11:05:59 +00:00
Oli Scherer
83cc6204ec Flip a boolean that was used wrongly (has no effect though) 2022-11-15 11:05:59 +00:00
Matthias Krüger
55ff8bf847
Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot
Add `rustc_deny_explicit_impl`

Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well.

Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.
2022-11-15 10:44:12 +01:00
Matthias Krüger
a9b92151b0
Rollup merge of #104316 - cjgillot:simplify-async-suggestion, r=estebank
Simplify suggestions for errors in generators.

Split from https://github.com/rust-lang/rust/pull/101692/
2022-11-15 10:44:11 +01:00
Matthias Krüger
769f231371
Rollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, r=davidtwco
Slightly improve error message for invalid identifier

fixes #104088
2022-11-15 10:44:11 +01:00
Matthias Krüger
d8b416db0a
Rollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, r=lcnr
Walk types more carefully in `ProhibitOpaqueTypes` visitor

The visitor didn't account for the case where you could have `<TAIT as Trait>::Assoc` normalize to itself, in the case of a `type TAIT = impl Trait` with an unconstrained associated type. That causes the visitor to loop on the same type over and over.

Fixes #104291
2022-11-15 10:44:10 +01:00
Matthias Krüger
34425c8c00
Rollup merge of #104258 - compiler-errors:tait-closure-deduce, r=oli-obk
Deduce closure signature from a type alias `impl Trait`'s supertraits

r? `@oli-obk`

Basically pass the TAIT's bounds through the same method that we're using to deduce a signature from infer var closure bounds.

Does this need a new FCP? I see it as a logical extension of #101834, but happy to rfcbot a new one if it does.
2022-11-15 10:44:10 +01:00
Matthias Krüger
47f9d89f9a
Rollup merge of #104148 - fmease:fix-104140, r=petrochenkov
Visit attributes of trait impl items during AST validation

Fixes #104140.

This fix might not be backward compatible (in practice) since we now validate more attributes than before.
Should I write more tests?

`@rustbot` label A-attributes
2022-11-15 10:44:09 +01:00
Matthias Krüger
1a6ed3050f
Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank
Show note where the macro failed to match

When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong.

```rust
macro_rules! uwu {
    (a a a b) => {};
}
uwu! { a a a c }
```

```diff
error: no rules expected the token `c`
 --> macros.rs:5:14
  |
1 | macro_rules! uwu {
  | ---------------- when calling this macro
...
4 | uwu! { a a a c }
  |              ^ no rules expected this token in macro call
  |
+note: while trying to match `b`
+ --> macros.rs:2:12
+  |
+2 |     (a a a b) => {};
+  |            ^
```
2022-11-15 10:44:07 +01:00
bors
357f660729 Auto merge of #101168 - jachris:dataflow-const-prop, r=oli-obk
Add new MIR constant propagation based on dataflow analysis

The current constant propagation in `rustc_mir_transform/src/const_prop.rs` fails to handle many cases that would be expected from a constant propagation optimization. For example:
```rust
let x = if true { 0 } else { 0 };
```
This pull request adds a new constant propagation MIR optimization pass based on the existing dataflow analysis framework. Since most of the analysis is not unique to constant propagation, a generic framework has been extracted. It works on top of the existing framework and could be reused for other optimzations.

Closes #80038. Closes #81605.

## Todo
### Essential
- [x] [Writes to inactive enum variants](https://github.com/rust-lang/rust/pull/101168#pullrequestreview-1089493974). Resolved by rejecting the registration of places with downcast projections for now. Could be improved by flooding other variants if mutable access to a variant is observed.
- [X] Handle [`StatementKind::CopyNonOverlapping`](https://github.com/rust-lang/rust/pull/101168#discussion_r957774914). Resolved by flooding the destination.
- [x] Handle `UnsafeCell` / `!Freeze` correctly.
- [X] Overflow propagation of `CheckedBinaryOp`: Decided to not propagate if overflow flag is `true` (`false` will still be propagated)
- [x] More documentation in general.
- [x] Arguments for correctness, documentation of necessary assumptions.
- [x] Better performance, or alternatively, require `-Zmir-opt-level=3` for now.

### Extra
- [x]  Add explicit unreachability, i.e. upgrading the lattice from $\mathbb{P} \to \mathbb{V}$ to $\set{\bot} \cup (\mathbb{P} \to \mathbb{V})$.
- [x] Use storage statements to improve precision.
- [ ] Consider opening issue for duplicate diagnostics: https://github.com/rust-lang/rust/pull/101168#issuecomment-1276609950
- [ ] Flood moved-from places with $\bot$ (requires some changes for places with tracked projections).
- [ ] Add downcast projections back in.
- [ ] [Algebraic simplifications](https://github.com/rust-lang/rust/pull/101168#discussion_r957967878) (possibly with a shared API; done by old const prop).
- [ ] Propagation through slices / arrays.
- [ ] Find other optimizations that are done by old `const_prop.rs`, but not by this one.
2022-11-15 09:38:05 +00:00
Takayuki Maeda
1cf4132a16 return when expr has errors
add ui tests
2022-11-15 17:22:40 +09:00
Takayuki Maeda
061610640c simplify emit_unused_delims_expr 2022-11-15 16:43:50 +09:00
bors
ca92d90b59 Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 06:43:28 +00:00
Takayuki Maeda
9857de218f shift no characters when using raw string literals
remove `find_skips`

remove unnecessary variables
2022-11-15 14:28:20 +09:00
StackDoubleFlow
0b6dce4309
Issue error when -C link-self-contained option is used on unsupported platforms
Document supported targets for `-C link-self-contained`

Move `LinkSelfContainedDefault::True` from wasm_base to wasm32_wasi
2022-11-14 22:21:24 -06:00
Michael Goulet
d8bd153ba5 Normalize types before looking for opaques 2022-11-15 03:44:45 +00:00
bors
101e1822c3 Auto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
 - #102470 (Stabilize const char convert)
 - #104223 (Recover from function pointer types with generic parameter list)
 - #104229 (Don't print full paths in overlap errors)
 - #104294 (Don't ICE with inline const errors during MIR build)
 - #104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
 - #104349 (fix some typos in comments)
 - #104350 (Fix x finding Python on Windows)
 - #104356 (interpret: make check_mplace public)
 - #104364 (rustdoc: Resolve doc links in external traits having local impls)
 - #104378 (Bump chalk to v0.87)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 03:37:07 +00:00
yukang
ff18c73065 comment feedback 2022-11-15 08:58:23 +08:00
yukang
9db8e183dc fix #104088, Slightly improve error message for invalid identifier 2022-11-15 08:58:19 +08:00
yukang
74c9a6c6df fix #103381, Detect incorrect chaining of if and if let conditions 2022-11-15 08:53:17 +08:00
Matthias Krüger
ce263b7350
Rollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU
Fix suggest associated call syntax

Fixes #104412
2022-11-15 01:40:47 +01:00
Matthias Krüger
f17828d938
Rollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic
[llvm-wrapper] adapt for LLVM API change

for feda983ff8.
2022-11-15 01:40:46 +01:00
Matthias Krüger
da2beab3f6
Rollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC
Specify language of code comment to generate document

Fix `let_underscore_drop` comment
https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#example-7
2022-11-15 01:40:45 +01:00
Matthias Krüger
aea4c0c1b8
Rollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726
Deriving cleanups

Fixing some minor problems `@RalfJung` found in #99046.

r? `@RalfJung`
2022-11-15 01:40:44 +01:00
Matthias Krüger
2c29b05fb2
Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors
Remove unused symbols and diagnostic items

As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere.

Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...
2022-11-15 01:40:44 +01:00
Matthias Krüger
0a3cb1ed81
Rollup merge of #104381 - mejrs:none_error, r=compiler-errors
Remove dead NoneError diagnostic handling

`NoneError` was removed some time ago, so this was dead code.
2022-11-15 01:40:44 +01:00
bors
dedfb9c214 Auto merge of #104091 - BelovDV:issue-103044, r=petrochenkov
Wrap bundled static libraries into object files

Fixes #103044 (not sure, couldn't test locally)

Bundled static libraries should be wrapped into object files as it's done for metadata file.

r? `@petrochenkov`
2022-11-15 00:38:08 +00:00
León Orell Valerian Liehr
70ad2f5344
respect visibility & stability of inherent associated types 2022-11-14 22:50:18 +01:00
Camille GILLOT
b37feca804 Give precendence to regions from member constaints when inferring concrete types. 2022-11-14 21:24:18 +00:00
Michael Goulet
5497317aa5 Do autoderef to match impl against rcvr 2022-11-14 19:29:37 +00:00
Michael Goulet
bf607dae3f Move logic into method 2022-11-14 19:29:37 +00:00
Michael Goulet
3f697b85f2 Drive-by: actual -> rcvr_ty 2022-11-14 19:29:36 +00:00
Nilstrieb
7e7c11cf56
Show a note where a macro failed to match
This shows a small note on what the macro matcher was currently
processing to aid with "no rules expected the token X" errors.
2022-11-14 19:59:15 +01:00
Matthias Krüger
c389097693
Rollup merge of #104378 - compiler-errors:chalk-up, r=jackh726
Bump chalk to v0.87

1. Removes `ReEmpty` from chalk
2. Adds support for the `std::marker::Tuple` trait
2022-11-14 19:26:19 +01:00
Matthias Krüger
dc869fcfb2
Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez
rustdoc: Resolve doc links in external traits having local impls

For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten.

Fixes https://github.com/rust-lang/rust/issues/104145.
2022-11-14 19:26:19 +01:00
Matthias Krüger
050ece6765
Rollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk
interpret: make check_mplace public

This helps avoid code duplication in https://github.com/rust-lang/miri/pull/2661.
2022-11-14 19:26:18 +01:00
Matthias Krüger
5763fa74f0
Rollup merge of #104349 - rustaceanclub:master, r=oli-obk
fix some typos in comments
2022-11-14 19:26:18 +01:00
Matthias Krüger
f8e5b1ce9e
Rollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco
Don't ICE with inline const errors during MIR build

Fixes #104277
2022-11-14 19:26:17 +01:00
Matthias Krüger
abda584a5a
Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco
Don't print full paths in overlap errors

We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message.

r? diagnostics
2022-11-14 19:26:16 +01:00
Matthias Krüger
a86bdb4c50
Rollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebank
Recover from function pointer types with generic parameter list

Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list.

I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case.

I am quite open to suggestions regarding the wording of the diagnostic messages.

Fixes #103487.
``@rustbot`` label A-diagnostics
r? diagnostics
2022-11-14 19:26:16 +01:00
Camille GILLOT
b552965a93 Typo. 2022-11-14 18:21:21 +00:00
Camille GILLOT
3afec247cb Deduplicate visitor. 2022-11-14 18:20:49 +00:00
Camille GILLOT
d470ac9334 Drop relate_opaque_item_substs. 2022-11-14 18:05:14 +00:00
clubby789
47eda6b7db Fix using include_bytes in pattern position 2022-11-14 17:43:21 +00:00
Ralf Jung
68af46c112 assert that we are (de)seiralizing ProvenanceMap correctly 2022-11-14 18:26:40 +01:00
Krasimir Georgiev
212ce1f10c [llvm-wrapper] adapt for LLVM API change 2022-11-14 14:59:32 +00:00
Jannis Christopher Köhl
c27ddc9a7f Remove redundant graphviz escaping 2022-11-14 15:11:18 +01:00
koka
a9e4176bc8
Specify language of code comment to generate document 2022-11-14 22:55:50 +09:00
Oli Scherer
03b2598924 Manually implement Encodable for ProvenanceMap to avoid serializing an always-none option 2022-11-14 09:49:32 +00:00
Daniil Belov
e16c77847d Wrap bundlen static libraries into object files 2022-11-14 12:01:49 +03:00
bors
96ddd32c4b Auto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0)
 - #103744 (Upgrade cc for working is_flag_supported on cross-compiles)
 - #104105 (llvm: dwo only emitted when object code emitted)
 - #104158 (Return .efi extension for EFI executable)
 - #104181 (Add a few known-bug tests)
 - #104266 (Regression test for coercion of mut-ref to dyn-star)
 - #104300 (Document `Path::parent` behavior around relative paths)
 - #104304 (Enable profiler in dist-s390x-linux)
 - #104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-14 06:30:18 +00:00
Nicholas Nethercote
111db7d3a8 Remove TraitDef::generics.
Because it's always empty.
2022-11-14 15:59:41 +11:00
Michael Goulet
b5b6467810 Add rustc_deny_explicit_impl 2022-11-14 03:23:41 +00:00
Nicholas Nethercote
96280b6a1d Remove addr_of argument from create_struct_pattern_fields.
Because it's always false.
2022-11-14 13:59:54 +11:00
Manish Goregaokar
4fdd944af4
Rollup merge of #104362 - WaffleLapkin:span_bug_won't_come_on_time_today, r=Aaron1011
Add `delay_span_bug` to `AttrWrapper::take_for_recovery`

`take_for_recovery` should only be used for recovery (when we should already have an error), so using `delay_span_bug` seems appropriate.

cc `@Aaron1011` (you've added the `FIXME` that this pr fixes)
2022-11-13 21:49:27 -05:00
Manish Goregaokar
e284780cf6
Rollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister
llvm: dwo only emitted when object code emitted

Fixes #103932.

`CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files).

r? ``````@michaelwoerister``````
2022-11-13 21:49:25 -05:00
Manish Goregaokar
1b91bdfda9
Rollup merge of #103709 - cuviper:netbsd-9, r=pietroalbini
ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0

This is another step in toolchain upgrades for LLVM 16, which will need at least GCC 7.1.

Our previous NetBSD 8.0 cross-toolchain used its system GCC 5.5. While there are newer versions available in pkgsrc, I could not get those working for cross-compilation. Upgrading to NetBSD 9.0 gets us GCC 7.4, which is sufficient for now.

This will affect the compatibility of the build we ship for `x86_64-unknown-netbsd`, but others may still build their own from source if that is needed. It is expected that NetBSD 8 will reach EOL soon anyway, approximately one month after 10 is released, but there is no firm date for that.
2022-11-13 21:49:24 -05:00
Nicholas Nethercote
9985f4611b Clarify expand_struct_method_body.
Spotted by @RalfJung. This causes no behavioural changes.
2022-11-14 13:49:08 +11:00
bors
338cfd3cce Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
Bump bootstrap compiler to 1.66

This PR:

- Bumps version placeholders to release
- Bumps to latest beta
- cfg-steps code

r? `@pietroalbini`
2022-11-14 00:07:19 +00:00
Maybe Waffle
29fe28fcfc Fix clippy and rustdoc
please, please, don't match on `Symbol::as_str`s, every time you do,
somewhere in the world another waffle becomes sad...
2022-11-13 22:58:20 +00:00
mejrs
25acee5494 Remove dead NoneError error handling 2022-11-13 22:48:27 +01:00
Maybe Waffle
4ed2bf6802 Remove unused symbols 2022-11-13 20:05:32 +00:00
Michael Goulet
36a106891a Make rustc build with new chalk 2022-11-13 19:53:44 +00:00
Michael Goulet
6de5f6277e Bump chalk to v0.87 2022-11-13 19:29:38 +00:00
Maybe Waffle
409c3ce441 Remove unused diagnostic items 2022-11-13 18:49:21 +00:00
Matthias Krüger
8076b5903a
Rollup merge of #104357 - RalfJung:is-sized, r=cjgillot
add is_sized method on Abi and Layout, and use it

This avoids the double negation of `!is_unsized()` that we have quite a lot.
2022-11-13 17:37:38 +01:00
Matthias Krüger
eefea28dea
Rollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obk
Use `derive_const` and rm manual StructuralEq impl

This does not change any semantics of the impl except for the const stability. It should be fine because trait methods and const bounds can never be used in stable without enabling `const_trait_impl`.

cc `@oli-obk`
2022-11-13 17:37:37 +01:00
Matthias Krüger
5c764da9b0
Rollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot
Improve spans with `use crate::{self}`

Fixes #104276.

The error becomes:
```
error: crate root imports need to be explicitly named: `use crate as name;`
 --> src/lib.rs.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^

warning: unused import: `self`
 --> src/lib.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
```
2022-11-13 17:37:37 +01:00
Vadim Petrochenkov
8e81cc262e rustdoc: Resolve doc links in external traits having local impls 2022-11-13 17:20:24 +03:00
Camille GILLOT
df5c11a069 Do not use local_def_id in node_to_string. 2022-11-13 14:15:23 +00:00
Rajput, Rajat
269ce369fe migrating rustc_resolve to SessionDiagnostic. work in progress. start
implement binding_shadows

migrate till self-in-generic-param-default

use braces in fluent message as suggested by @compiler-errors.

to fix lock file issue reported by CI

migrate 'unreachable label' error

run formatter

name the variables correctly in fluent file

SessionDiagnostic -> Diagnostic

test "pattern/pat-tuple-field-count-cross.rs" passed

test "resolve/bad-env-capture2.rs" passed

test "enum/enum-in-scope.rs" and other depended on "resolve_binding_shadows_something_unacceptable" should be passed now.

fix crash errors while running test-suite. there might be more.

then_some(..) suits better here.

all tests passed

convert TraitImpl and InvalidAsm. TraitImpl is buggy yet. will fix after receiving help from Zulip

migrate "Ralative-2018"

migrate "ancestor only"

migrate "expected found"

migrate "Indeterminate"

migrate "module only"

revert to the older implementation for now. since this is failing at the moment.

follow the convension for fluent variable

order the diag attribute as suggested in review comment

fix merge error. migrate trait-impl-duplicate

make the changes compatible with "Flatten diagnostic slug modules #103345"

fix merge

remove commented code

merge issues

fix review comments

fix tests
2022-11-13 19:39:26 +05:30
Camille GILLOT
9d20aca983 Store a LocalDefId in hir::Variant & hir::Field. 2022-11-13 14:06:51 +00:00
Camille GILLOT
607d0c2a14 Store a LocalDefId in hir::AnonConst. 2022-11-13 14:06:11 +00:00
Camille GILLOT
18482f7b23 Store a LocalDefId in hir::GenericParam. 2022-11-13 14:05:30 +00:00
Camille GILLOT
e82c08f58e Refactor rustc_hir_typeck::closure. 2022-11-13 14:05:12 +00:00
Camille GILLOT
2c4b0b29cf Make user_provided_sigs a LocalDefIdMap. 2022-11-13 14:04:42 +00:00
Camille GILLOT
290f0781b4 Store LocalDefId in hir::Closure. 2022-11-13 14:04:02 +00:00
Camille GILLOT
dba1503ed3 Ensure codegen_fn_attrs during collection. 2022-11-13 14:02:15 +00:00
Vladimir Michael Eatwell
db99a89e38 [watchos] Dynamic linking is not allowed for watchos targets 2022-11-13 13:57:31 +00:00
Maybe Waffle
df86ad8d36 Add delay_span_bug to AttrWrapper::take_for_recovery 2022-11-13 13:09:23 +00:00
Ralf Jung
7982d6ac64 interpret: make check_mplace public 2022-11-13 12:56:48 +01:00
Ralf Jung
c78021709a add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
bors
928d14bcd1 Auto merge of #104351 - JohnTitor:rollup-ikh2dzr, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #103650 (rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`)
 - #104177 (rustdoc: use consistent "popover" styling for notable traits)
 - #104318 (Move tests)
 - #104323 (rustdoc: remove no-op CSS `.scrape-help { background: transparent }`)
 - #104345 (Fix up a Fluent message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-13 09:13:41 +00:00
Camille GILLOT
c5949c8bee Create bidirectional bounds between original and duplicated parameters. 2022-11-13 09:01:29 +00:00
SparkyPotato
c7b2891315 move span to self instead of crate 2022-11-13 13:46:11 +05:30
Yuki Okushi
05cd26b22d
Rollup merge of #104345 - fmease:fix-up-a-fluent-message, r=compiler-errors
Fix up a Fluent message

Fix up a Fluent message which contained arrows `->` after [selectors](https://projectfluent.org/fluent/guide/selectors.html). The original author probably thought that they were required as part of the selector syntax but in reality they were interpreted as literal text and actually showed up in the emitted diagnostic.

This wasn't caught during the diagnostic migration since the branch constructing the diagnostic in question (`rustc_infer::errors::LifetimeMismatchLabels::Normal`) was not exercised by the UI test suite. I've added two more test cases to do so (one testing `LifetimeMismatchLabels::Normal` where `hir_equal == true` and one where `hir_equal == false`).

Diff visualizing the `->` bug (`master` vs `fix-up-a-fluent-message`):

```diff
 error[E0623]: lifetime mismatch
   --> src/test/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs:39:30
    |
 39 | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) {
    |                              ^^^^^^^^^^^^^^^^^-------^^-------^^
    |                              |                |
    |                              |                these two types are declared with different lifetimes...
-   |                              ...but data->  from `a` flows->  into `a` here
+   |                              ...but data from `a` flows into `a` here
```
2022-11-13 16:41:46 +09:00
cui fliter
442f848d74 fix some typos in comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-13 15:26:17 +08:00
bors
3be81dd0ce Auto merge of #104282 - cjgillot:intern-span, r=compiler-errors
Hash spans when interning types

Ignoring hash for spans creates an inconsistency between the `Hash` impl for `WithStableHash`, which takes them into account, and the `HashStable` impl which does not.

cc `@compiler-errors`

Fixes https://github.com/rust-lang/rust/issues/104271
Fixes https://github.com/rust-lang/rust/issues/104255
Fixes https://github.com/rust-lang/rust/issues/104238
2022-11-13 06:23:18 +00:00
León Orell Valerian Liehr
23dadb5617
fix up a fluent message 2022-11-13 04:16:08 +01:00
Caleb Zulawski
11224000e8 Update compiler/rustc_codegen_llvm/src/llvm_util.rs
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2022-11-12 18:46:39 -05:00
Caleb Zulawski
d7152f8eec Allow actual AVX512-related feature names in the case of some misleading aliases 2022-11-12 18:46:21 -05:00
bors
fb6667a233 Auto merge of #103311 - petrochenkov:pblfix, r=bjorn3
linker: Refactoring and fixes to native library linking

This PR contains a bunch of code cleanup and comment rearrangements + 2 fixes for `-Zpacked-bundled-libs`.
It's better to look at individual commits.
2022-11-12 23:29:11 +00:00
Vadim Petrochenkov
c2358a15f3 linker: Link profiler_builtins even if it's marked as NotLinked 2022-11-12 23:02:33 +03:00
Vadim Petrochenkov
82ecfd4ed6 linker: Support mixing crates built with different values of -Zpacked_bundled_libs
So you can change the value of `-Zpacked_bundled_libs` without rebuilding standard library
2022-11-12 23:02:33 +03:00
Vadim Petrochenkov
fe7aab13b1 linker: Move some inner functions to the outside
Inline `fn unlib`
2022-11-12 23:02:33 +03:00
Vadim Petrochenkov
e792de28c8 linker: Simplify linking of compiler_builtins and profiler_builtins
This also fixes linking of native libraries bundled into these crates when `-Zpacked-bundled-libs` is enabled
2022-11-12 23:02:33 +03:00
Vadim Petrochenkov
cae3c936eb linker: Factor out native library linking to a separate function 2022-11-12 23:02:32 +03:00
Jannis Christopher Köhl
108790b8dc Remove log statement that was commented out 2022-11-12 20:32:09 +01:00
Jannis Christopher Köhl
ea23585c91 Disable limits if mir-opt-level >= 4 2022-11-12 20:14:34 +01:00
Jannis Christopher Köhl
d66a00a7b1 Expand upon comment regarding self-assignment 2022-11-12 20:05:52 +01:00
bors
cd128880b1 Auto merge of #104325 - GuillaumeGomez:rollup-19bzwoa, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #104110 (prevent uninitialized access in black_box for zero-sized-types)
 - #104117 (Mark `trait_upcasting` feature no longer incomplete.)
 - #104144 (Suggest removing unnecessary `.` to use a floating point literal)
 - #104250 (Migrate no result page link color to CSS variables)
 - #104261 (More accurately report error when formal and expected signature types differ)
 - #104263 (Add a reference to ilog2 in leading_zeros integer docs)
 - #104308 (Remove the old `ValidAlign` name)
 - #104319 (Fix non clickable source link)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-12 17:39:11 +00:00
Guillaume Gomez
fe80364500
Rollup merge of #104261 - compiler-errors:formal-and-expected-differ, r=estebank
More accurately report error when formal and expected signature types differ

Fixes #104242
2022-11-12 17:25:02 +01:00
Guillaume Gomez
55ae6516f9
Rollup merge of #104144 - TaKO8Ki:suggest-removing-unnecessary-dot, r=fee1-dead
Suggest removing unnecessary `.` to use a floating point literal

Fixes a part of #101883
2022-11-12 17:25:01 +01:00
Guillaume Gomez
bef2da0629
Rollup merge of #104117 - crlf0710:update_feature_gate, r=jackh726
Mark `trait_upcasting` feature no longer incomplete.

This marks the `trait_upcasting` feature no longer incomplete since #101336 has been settled for a little while.

r? ``````@jackh726``````
2022-11-12 17:25:01 +01:00
Guillaume Gomez
798815aec5
Rollup merge of #104110 - krasimirgg:msan-16, r=nagisa
prevent uninitialized access in black_box for zero-sized-types

Don't read the pointer location in black_box for zero sized types, just emit a memory clobber instead. Addresses  https://github.com/rust-lang/rust/issues/103304 when rust is build against LLVM at HEAD.

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/.28with.20llvm.20at.20HEAD.29.3A.20msan.20error.20in.20core.3A.3Ahint.3A.3Ablack_box
2022-11-12 17:25:00 +01:00
bors
8ef2485bd5 Auto merge of #103812 - clubby789:improve-include-bytes, r=petrochenkov
Delay `include_bytes` to AST lowering

Hopefully addresses #65818.
This PR introduces a new `ExprKind::IncludedBytes` which stores the path and bytes of a file included with `include_bytes!()`. We can then create a literal from the bytes during AST lowering, which means we don't need to escape the bytes into valid UTF8 which is the cause of most of the overhead of embedding large binary blobs.
2022-11-12 14:30:34 +00:00
Jannis Christopher Köhl
74d53ab912 Require -Zmir-opt-level >= 3 for now 2022-11-12 15:24:23 +01:00
Jannis Christopher Köhl
2e034dc68c Exclude locals completely, instead of individual places 2022-11-12 14:57:14 +01:00
Jannis Christopher Köhl
b3f648958d Add comment for guessed constants 2022-11-12 14:07:54 +01:00
Deadbeef
4b217e4624 Use derive_const and rm manual StructuralEq impl 2022-11-12 12:57:10 +00:00
Camille GILLOT
3a05db66e2 Simplify suggestions for errors in generators. 2022-11-12 12:10:33 +00:00
bors
aa05f99001 Auto merge of #102701 - flba-eb:add_qnx_nostd_support, r=cjgillot
Add tier 3 no_std AArch64/x86_64 support for the QNX Neutrino RTOS

This change allows to compile `no_std` applications for the QNX Neutrino Real-time operating system for ARM 64 bit CPUs.
Tested with QNX Neutrino 7.1.

Partially discussed in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Adding.20QNX.20as.20target).

---

> ## Tier 3 target policy
>
> At this tier, the Rust project provides no official support for a target, so we
place minimal requirements on the introduction of targets.
>
>A proposed new tier 3 target must be reviewed and approved by a member of the
compiler team based on these requirements. The reviewer may choose to gauge
broader compiler team consensus via a [Major Change Proposal (MCP)][MCP].
>
>A proposed target or target-specific patch that substantially changes code
shared with other targets (not just target-specific code) must be reviewed and
approved by the appropriate team for that shared code before acceptance.
>
>- A tier 3 target must have a designated developer or developers (the "target
  maintainers") on record to be CCed when issues arise regarding the target.
  (The mechanism to track and CC such developers may evolve over time.)

See also nto-qnx.md; designated developers are:

- Florian Bartels, `Florian.Bartels@elektrobit.com`, https://github.com/flba-eb
- Tristan Roach, `TRoach@blackberry.com`, https://github.com/gh-tr

> - Targets must use naming consistent with any existing targets; for instance, a
  target for the same CPU or OS as an existing Rust target should use the same
  name for that CPU or OS. Targets should normally use the same names and
  naming conventions as used elsewhere in the broader ecosystem beyond Rust
  (such as in other toolchains), unless they have a very good reason to
  diverge. Changing the name of a target can be highly disruptive, especially
  once the target reaches a higher tier, so getting the name right is important
  even for a tier 3 target.
>  - Target names should not introduce undue confusion or ambiguity unless
    absolutely necessary to maintain ecosystem compatibility. For example, if
    the name of the target makes people extremely likely to form incorrect
    beliefs about what it targets, the name should be changed or augmented to
    disambiguate it.

`aarch64-unknown-nto-qnx7.1.0` and `x86_64-pc-nto-qnx7.1.0` have been chosen as these
strings are used in the official QNX Neutrino toolchain (for `C`/`C++`). It should also
harmonize with the other Rust targets.

The version (`7.1.0 `) is needed because libc needs to distinguish between different
versions (`target_env` is set to `710` for QNX Neutrino 7.1): For example, functions are removed from 7.0
to 7.1, sometimes the signature of functions is slightly changed or size/alignment of structs.
I'm expecting the same for future versions.
This works very well in e.g. `libc` (tested with 7.0 which I'm not going to support).

> - Tier 3 targets may have unusual requirements to build or use, but must not
  create legal issues or impose onerous legal terms for the Rust project or for
  Rust developers or users.
>  - The target must not introduce license incompatibilities.

No issue as far as I can see.

>  - Anything added to the Rust repository must be under the standard Rust
    license (`MIT OR Apache-2.0`).

Ok

>  - The target must not cause the Rust tools or libraries built for any other
    host (even when supporting cross-compilation to the target) to depend
    on any new dependency less permissive than the Rust licensing policy. This
    applies whether the dependency is a Rust crate that would require adding
    new license exceptions (as specified by the `tidy` tool in the
    rust-lang/rust repository), or whether the dependency is a native library
    or binary. In other words, the introduction of the target must not cause a
    user installing or running a version of Rust or the Rust tools to be
    subject to any new license requirements.

No change for host tools. When cross-compiling for QNX Neutrino, the compiler/linker
driver "qcc" is called. It should be possible (but not tested) to use other
(OSS) compilers/linkers to produce working binaries.

>  - Compiling, linking, and emitting functional binaries, libraries, or other
    code for the target (whether hosted on the target itself or cross-compiling
    from another target) must not depend on proprietary (non-FOSS) libraries.
    Host tools built for the target itself may depend on the ordinary runtime
    libraries supplied by the platform and commonly used by other applications
    built for the target, but those libraries must not be required for code
    generation for the target; cross-compilation to the target must not require
    such libraries at all. For instance, `rustc` built for the target may
    depend on a common proprietary C runtime library or console output library,
    but must not depend on a proprietary code generation library or code
    optimization library. Rust's license permits such combinations, but the
    Rust project has no interest in maintaining such combinations within the
    scope of Rust itself, even at tier 3.

Only rustc is required for code generation (i.e. no additional libraries to
generate code). Linking of executables requires the ordinary runtime libraries
`crt` and `libc`.

>  - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
    legal/licensing terms include but are *not* limited to: non-disclosure
    requirements, non-compete requirements, contributor license agreements
    (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
    requirements conditional on the employer or employment of any particular
    Rust developers, revocable terms, any requirements that create liability
    for the Rust project or its developers or users, or any requirements that
    adversely affect the livelihood or prospects of the Rust project or its
    developers or users.
>- Neither this policy nor any decisions made regarding targets shall create any
  binding agreement or estoppel by any party. If any member of an approving
  Rust team serves as one of the maintainers of a target, or has any legal or
  employment requirement (explicit or implicit) that might affect their
  decisions regarding a target, they must recuse themselves from any approval
  decisions regarding the target's tier status, though they may otherwise
  participate in discussions.
>  - This requirement does not prevent part or all of this policy from being
    cited in an explicit contract or work agreement (e.g. to implement or
    maintain support for a target). This requirement exists to ensure that a
    developer or team responsible for reviewing and approving a target does not
    face any legal threats or obligations that would prevent them from freely
    exercising their judgment in such approval, even if such judgment involves
    subjective matters or goes beyond the letter of these requirements.

I see no issues with any of the above.

>- Tier 3 targets should attempt to implement as much of the standard libraries
  as possible and appropriate (`core` for most targets, `alloc` for targets
  that can support dynamic memory allocation, `std` for targets with an
  operating system or equivalent layer of system-provided functionality), but
  may leave some code unimplemented (either unavailable or stubbed out as
  appropriate), whether because the target makes it impossible to implement or
  challenging to implement. The authors of pull requests are not obligated to
  avoid calling any portions of the standard library on the basis of a tier 3
  target not implementing those portions.

`core` and `alloc` should be working (no change required). `std` implementation
is ongoing and will be provided separately.

>- The target must provide documentation for the Rust community explaining how
  to build for the target, using cross-compilation if possible. If the target
  supports running binaries, or running tests (even if they do not pass), the
  documentation must explain how to run such binaries or tests for the target,
  using emulation if possible or dedicated hardware if necessary.

see nto-qnx.md

>- Tier 3 targets must not impose burden on the authors of pull requests, or
  other developers in the community, to maintain the target. In particular,
  do not post comments (automated or manual) on a PR that derail or suggest a
  block on the PR based on a tier 3 target. Do not send automated messages or
  notifications (via any medium, including via ``@`)` to a PR author or others
  involved with a PR regarding a tier 3 target, unless they have opted into
  such messages.
>  - Backlinks such as those generated by the issue/PR tracker when linking to
    an issue or PR are not considered a violation of this policy, within
    reason. However, such messages (even on a separate repository) must not
    generate notifications to anyone involved with a PR who has not requested
    such notifications.

Ok

>- Patches adding or updating tier 3 targets must not break any existing tier 2
  or tier 1 target, and must not knowingly break another tier 3 target without
  approval of either the compiler team or the maintainers of the other tier 3
  target.
>  - In particular, this may come up when working on closely related targets,
    such as variations of the same architecture with different features. Avoid
    introducing unconditional uses of features that another variation of the
    target may not have; use conditional compilation or runtime detection, as
    appropriate, to let each target run code supported by that target.

Ok
2022-11-12 11:03:33 +00:00
Camille GILLOT
49a5aa4f0c Verify predicates on RPIT and async opaques. 2022-11-12 10:03:28 +00:00
Camille GILLOT
da9dca7040 Retire error code. 2022-11-12 10:03:13 +00:00
Camille GILLOT
af06960b2a Add tracking issue number. 2022-11-12 10:02:26 +00:00
Camille GILLOT
94234065cf Explain redundant mapping. 2022-11-12 10:01:50 +00:00
Camille GILLOT
b77674d254 Make impl_trait_projections a feature gate. 2022-11-12 10:01:07 +00:00
Camille GILLOT
47de11f1ed Use variances for defining use diag. 2022-11-12 10:00:28 +00:00
Camille GILLOT
5fc261e9a0 Inherit generics for impl-trait. 2022-11-12 09:59:36 +00:00
Camille GILLOT
b95650930b Compute variance for opaques too. 2022-11-12 09:56:23 +00:00
bors
5f4e73c4a4 Auto merge of #104310 - Dylan-DPC:rollup-wgt1z4a, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #102049 (Add the `#[derive_const]` attribute)
 - #103970 (Unhide unknown spans)
 - #104206 (Remove `save_and_restore_in_snapshot_flag`, use `ObligationCtxt` more)
 - #104214 (Emit error in `collecting_trait_impl_trait_tys` on mismatched signatures)
 - #104267 (rustdoc: use checkbox instead of switch for settings toggles)
 - #104302 (Update cargo)
 - #104303 (UI tests can be assigned to T-compiler)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-12 08:03:01 +00:00
Dylan DPC
35816ff52a
Rollup merge of #104214 - Nilstrieb:returns_impl_Ice, r=compiler-errors
Emit error in `collecting_trait_impl_trait_tys` on mismatched signatures

Previously, a `delay_span_bug` was isssued, failing normalization. This create a `TyKind::Error` in the signature, which caused `compare_predicate_entailment` to swallow its signature mismatch error, causing ICEs because no error was emitted.

fixes #104183

r? ``@compiler-errors``
2022-11-12 12:02:52 +05:30
Dylan DPC
662df1ec86
Rollup merge of #104206 - compiler-errors:ocx-more-2, r=lcnr
Remove `save_and_restore_in_snapshot_flag`, use `ObligationCtxt` more

r? ```@lcnr```
2022-11-12 12:02:52 +05:30