Commit Graph

24142 Commits

Author SHA1 Message Date
Camille GILLOT
76d573b656 Add info for no_hash panic. 2023-04-20 18:56:12 +00:00
Maybe Waffle
96905d568a Use impl Tag for $T syntax for impl_tag! 2023-04-20 18:49:40 +00:00
Michael Goulet
3206100ed9 Result is just bool but special 2023-04-20 18:40:34 +00:00
Kyle Matsuda
e54854f6a9 add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls 2023-04-20 12:36:50 -06:00
Kyle Matsuda
f3b279fcc5 add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query 2023-04-20 12:36:50 -06:00
Kyle Matsuda
0892a7380b change usages of explicit_item_bounds to bound_explicit_item_bounds 2023-04-20 12:36:50 -06:00
Camille GILLOT
a395d2a5de Give more descriptive names to queries. 2023-04-20 18:01:07 +00:00
Camille GILLOT
f65f506d60 Remove opt_const_param_of. 2023-04-20 17:48:52 +00:00
Camille GILLOT
b275d2c30b Remove WithOptconstParam. 2023-04-20 17:48:32 +00:00
Maybe Waffle
77c83c0965 Add impl_tag! macro to implement Tag for tagged pointer easily 2023-04-20 17:14:32 +00:00
Camille GILLOT
0e017fc94a Feed type_of query instead of using WithOptconstParam. 2023-04-20 17:13:39 +00:00
Camille GILLOT
4224b4b1f5 Re-allow computing fed queries. 2023-04-20 17:09:26 +00:00
Michael Goulet
4fd7739aac Track if EvalCtxt has been tainted, make sure it can't be used to make query responses after 2023-04-20 16:54:39 +00:00
Mara Bos
441682cca9 Update comments in format args lowering.
These lang items have been moved/renamed.
2023-04-20 18:09:32 +02:00
Matthias Krüger
c430d6111a
Rollup merge of #110599 - WaffleLapkin:bonk_tygenericarg_transmutes, r=compiler-errors
Remove an unused `&[Ty]` <-> `&[GenericArg]`

Missed this one in #110496, oops.

r? `@compiler-errors`
2023-04-20 17:59:55 +02:00
Matthias Krüger
462461699a
Rollup merge of #110558 - spastorino:smir-call-terminator, r=oli-obk
Add Call terminator to SMIR

This adds internal MIR `TerminatorKind::Call` to SMIR `Terminator::Call` conversion.

r? `@oli-obk`
2023-04-20 17:59:54 +02:00
Matthias Krüger
7dc211f5ce
Rollup merge of #108795 - thomcc:x86_64h-target, r=wesleywiser
Add support for the x86_64h-apple-darwin target

See https://github.com/rust-lang/compiler-team/issues/599 for MCP.

r? compiler-team

CC `@BlackHoleFox` who recently overhauled the apple target code in `rustc-target`.

## Target Support Checklist

> - 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.)

I'm the designated developer.

> - 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.

This uses the same naming conventions used for the other macOS targets (`-apple-darwin`), combined with the convention used by LLVM for the `x86_64h` targets. LLVM's convention matches the architecture name used when invoking various tools such as `lipo`, `arch`, and (IMO) there's not really a compelling reason to depart from it.

> - 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.

I don't think this is especially likely, although I suppose someone could mistake it for `x86_64-apple-darwin`.

> - If possible, use only letters, numbers, dashes and underscores for the name.
>   Periods (`.`) are known to cause issues in Cargo.

👍

> - 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.

It does not.

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

It is.

> - 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.

There are no new dependencies that don't also apply to `x86_64-apple-darwin`.

> - 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.

This has the same requirements as the other macOS targets (e.g. `x86_64-apple-darwin` and similar).

> - "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.

No change here.

> - 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.

👍

> - 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.

The standard library tests seem to pass.

> - 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.

Documentation is provided.

> - 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.

Noted. This target is nearly identical to `x86_64-apple-darwin`, so this is
unlikely to cause issues anyway.

> - 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.

👍

> - 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.

👍
2023-04-20 17:59:53 +02:00
Santiago Pastorino
2f503345b4
Add Call terminator to SMIR 2023-04-20 12:00:41 -03:00
bors
791a7f22e3 Auto merge of #110598 - matthiaskrgr:rollup-0ybd9i3, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #110240 (Add `indent_style = tab` for `Makefile`s to `.editorconfig`)
 - #110545 (Add `GenericArgKind::as_{type,const,region}`)
 - #110574 ( fix out-of-date comment about rpath in bootstrap)
 - #110581 (Style fix for loongarch-linux.md)
 - #110584 (Allow overwriting the sysroot compile flag in compile tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-20 13:03:31 +00:00
Maybe Waffle
6d4b7fe9ed Remove an unused &[Ty] <-> &[GenericArg] 2023-04-20 12:41:46 +00:00
Matthias Krüger
17f6763a14
Rollup merge of #110545 - WaffleLapkin:generic_arg_as_x, r=cjgillot
Add `GenericArgKind::as_{type,const,region}`

This allows to make code nicer in some cases
2023-04-20 14:36:54 +02:00
lcnr
82cb8a2933 more msg removal 2023-04-20 14:17:52 +02:00
lcnr
4f757af176 remove unused message 2023-04-20 14:09:41 +02:00
bors
7e23d180c1 Auto merge of #109993 - scottmcm:transmute-niches, r=oli-obk
`assume` value ranges in `transmute`

Fixes #109958
2023-04-20 10:46:13 +00:00
bors
13fc33e3f2 Auto merge of #110585 - JohnTitor:rollup-gfffoiv, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #102341 (Implement `Neg` for signed non-zero integers.)
 - #110424 (Spelling misc)
 - #110448 (cmp doc examples improvements)
 - #110516 (bootstrap: Update linux-raw-sys to 0.3.2)
 - #110548 (Make `impl Debug for Span` not panic on not having session globals.)
 - #110554 (`deny(unsafe_op_in_unsafe_fn)` in `rustc_data_structures`)
 - #110575 (fix lint regression in `non_upper_case_globals`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-20 08:33:33 +00:00
Yuki Okushi
a2826dc4d4
Rollup merge of #110575 - Ezrashaw:fix-regression-110573, r=compiler-errors
fix lint regression in `non_upper_case_globals`

Fixes #110573

The issue also exists for inherent associated types (where I copied my impl from). `EarlyContext` is more involved to fix in this way, so I'll leave it be for now (note it's unstable so that's not urgent).

r? `@compiler-errors`
2023-04-20 17:03:26 +09:00
Yuki Okushi
a496ae6ac3
Rollup merge of #110554 - WaffleLapkin:rustc_data_structures_unsafe_op_in_unsafe_fn, r=Nilstrieb
`deny(unsafe_op_in_unsafe_fn)` in `rustc_data_structures`

r? `@Nilstrieb`

I couldn't bring myself to document the safety in big `unsafe` functions but ehh
2023-04-20 17:03:26 +09:00
Yuki Okushi
615669dbb2
Rollup merge of #110548 - kpreid:span, r=WaffleLapkin
Make `impl Debug for Span` not panic on not having session globals.

I hit the panic that this patch avoids while messing with the early lints in `rustc_session::config::build_session_options()`. The rest of that project is not finished, but this seemed like a self-contained improvement.

(Should changes like this add tests? I don't see similar unit tests.)
2023-04-20 17:03:25 +09:00
Scott McMurray
baf98e7515 Add transmute optimization tests and some extra comments 2023-04-19 23:17:35 -07:00
bors
23a76a8ab5 Auto merge of #110527 - nnethercote:lazy-graph, r=lqd
In `LexicalResolver`, don't construct graph unless necessary.

A small but easy perf win.

r? `@jackh726`
2023-04-20 06:14:55 +00:00
Ezra Shaw
8cad917e68
reimpl make non_upper_case_globals lint not report trait impls 2023-04-20 16:28:49 +12:00
bors
7fde08365c Auto merge of #110399 - cjgillot:infer-variance, r=aliemjay
Account for opaque variance in outlives

Fixes https://github.com/rust-lang/rust/issues/108591
Fixes https://github.com/rust-lang/rust/issues/108592
cc `@aliemjay`
2023-04-20 04:08:03 +00:00
Qiu Chaofan
1a44694713 Remove deprecated LLVM any_isa 2023-04-20 10:44:41 +08:00
John Bobbo
8a7a020a2a
Remove a few uses of dynamic dispatch during
monomorphization/partitioning with the use of
an enum.
2023-04-19 18:21:40 -07:00
bors
b9fd498fa7 Auto merge of #110061 - WaffleLapkin:duality_of_myself_and_this, r=cjgillot
Add suggestion to use closure argument instead of a capture on borrowck error

Fixes #109271
r? `@compiler-errors`

This should probably be refined a bit, but opening a PR so that I don't forget anything.
2023-04-19 23:39:03 +00:00
Michael Goulet
f362f6e9e6 Format missing GATs correctly 2023-04-19 23:37:41 +00:00
bors
39c6804b92 Auto merge of #106704 - ecnelises:big_archive, r=bjorn3
Support AIX-style archive type

Reading facility of AIX big archive has been supported by `object` since 0.30.0.

Writing facility of AIX big archive has already been supported by `ar_archive_writer`, but we need to bump the version to support the new archive type enum.
2023-04-19 21:21:17 +00:00
Maybe Waffle
cac143f0e3 Extend and use hir::Node::body_id 2023-04-19 19:13:45 +00:00
Maybe Waffle
102c0af5a7 Add suggestion to use a closure arg instead of a capture on bck error 2023-04-19 19:13:35 +00:00
bors
9c51cf7e7f Auto merge of #110546 - matthiaskrgr:rollup-346kik6, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #110123 ('./configure' now checks if 'config.toml' exists before writing to that destination)
 - #110429 (Spelling src bootstrap)
 - #110430 (Spelling src ci)
 - #110515 (Don't special-case download-rustc in `maybe_install_llvm`)
 - #110521 (Fix `x test lint-docs linkchecker` when download-rustc is enabled)
 - #110525 (Fix `tests/run-make-translation` when download-rustc is enabled)
 - #110531 (small type system cleanup)
 - #110533 (Missing blanket impl trait not public)
 - #110540 (Fix wrong comment in rustc_hir/src/hir.rs)
 - #110541 (Fix various configure bugs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-19 19:11:05 +00:00
Maybe Waffle
cfe5c3ca6c Add #[track_caller] to struct_span_err_with_code (drive-by cleanup)
We use caller information to track where a diagnostic was created,
so all "helper" diagnostic functions should use `#[track_caller]`
2023-04-19 19:10:37 +00:00
Maybe Waffle
ceabcd83e6 Remove useless check (drive-by cleanup)
While it might *seem* that this does something, it actually doesn't.
`mut_borrow_of_mutable_ref` returns a `bool` that is ignored by the
let-else. This was basically
```rust
if !self.body.local_decls.get(local).is_some() {
    return
}
```
Which is pretty useless
2023-04-19 19:10:25 +00:00
Maybe Waffle
f79df7d2a4 deny(unsafe_op_in_unsafe_fn) in rustc_data_structures 2023-04-19 18:00:48 +00:00
Maybe Waffle
25b9263b34 Move GenericArgKind::as_{type,const,region} to GenericArg 2023-04-19 17:59:30 +00:00
Michael Goulet
73038d3a64 Make missing impl item suggestions more obvious that they're missing 2023-04-19 17:57:37 +00:00
Michael Goulet
204c516293 Substitute missing item suggestion correctly 2023-04-19 17:47:39 +00:00
Kevin Reid
883606f2c0 fmt fix 2023-04-19 10:06:30 -07:00
bors
df0d9b492d Auto merge of #110496 - WaffleLapkin:🏳️‍⚧️sound, r=compiler-errors
Don't transmute `&List<GenericArg>` <-> `&List<Ty>`

In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`.

While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see https://github.com/rust-lang/rust/pull/94799#issuecomment-1064340003, https://github.com/rust-lang/rust/pull/94841, https://github.com/rust-lang/rust/pull/110496#issuecomment-1513799140).

Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler).

Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc.

r? `@compiler-errors`
2023-04-19 17:01:06 +00:00
Michael Goulet
b0a7d6e4b7 Suggest deref on comparison binop RHS even if type is not Copy 2023-04-19 16:47:11 +00:00
Kevin Reid
f17c805701 Make impl Debug for Span not panic on not having session globals. 2023-04-19 08:55:21 -07:00
Matthias Krüger
b59658c990
Rollup merge of #110540 - safinaskar:patch-1, r=WaffleLapkin
Fix wrong comment in rustc_hir/src/hir.rs
2023-04-19 17:54:43 +02:00
Matthias Krüger
75de33cd1d
Rollup merge of #110531 - lcnr:type-system-stuff, r=aliemjay
small type system cleanup
2023-04-19 17:54:42 +02:00
Maybe Waffle
3f15521396 Add GenericArgKind::as_{type,const,region} 2023-04-19 14:54:31 +00:00
Askar Safin
0b6b72e198
Fix wrong comment in rustc_hir/src/hir.rs 2023-04-19 16:38:04 +03:00
Vadim Petrochenkov
53c71b6ab3 resolve: Remove module_children_untracked 2023-04-19 16:35:08 +03:00
bors
3a5c8e91f0 Auto merge of #110393 - fee1-dead-contrib:rm-const-traits, r=oli-obk
Rm const traits in libcore

See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60const.20Trait.60.20removal.20or.20rework)

* [x] Bless ui tests
* [ ] Re constify some unstable functions with workarounds if they are needed
2023-04-19 13:03:40 +00:00
Michael van Straten
342c5fb6c5 Fixed bad formating 2023-04-19 13:04:01 +02:00
Michael van Straten
3d49cc1198 Translated absolute byte offset to relative 2023-04-19 13:02:30 +02:00
lcnr
16d061ea77 small type system cleanup 2023-04-19 10:30:30 +02:00
bors
d7f9e81650 Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwco
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`

Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-19 08:26:47 +00:00
Nicholas Nethercote
8e6c9e0694 In LexicalResolver, don't construct graph unless necessary.
A small but easy perf win.
2023-04-19 16:17:29 +10:00
bors
c781584079 Auto merge of #110522 - matthiaskrgr:rollup-9m7rw3u, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110432 (Report more detailed reason why `Index` impl is not satisfied)
 - #110451 (Minor changes to `IndexVec::ensure_contains_elem` & related methods)
 - #110476 (Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug))
 - #110498 (Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`)
 - #110507 (boostrap: print output during building tools)
 - #110510 (Fix ICE for transmutability in candidate assembly)
 - #110513 (make `non_upper_case_globals` lint not report trait impls)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-19 05:08:54 +00:00
Qiu Chaofan
7c8c9cf470 Bump version of object and related crates 2023-04-19 12:42:20 +08:00
Matthias Krüger
78490ada7c
Rollup merge of #110513 - Ezrashaw:fix-trait-const-name-lint, r=compiler-errors
make `non_upper_case_globals` lint not report trait impls

We should not lint on trait `impl`s for `non_upper_case_globals`; the user doesn't have control over the name. This brings `non_upper_case_globals` into consistency with other `nonstandard_style` lints.
2023-04-19 06:35:36 +02:00
Matthias Krüger
fdd2f4bde8
Rollup merge of #110510 - bryangarza:issue-110467-safe-transmute, r=compiler-errors
Fix ICE for transmutability in candidate assembly

Don't skip transmutability check just because there may be generics in the ParamEnv.

Fixes #110467
2023-04-19 06:35:36 +02:00
Matthias Krüger
9f0b16b2bb
Rollup merge of #110498 - kylematsuda:earlybinder-rpitit-tys, r=compiler-errors
Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`

Part of the work to finish https://github.com/rust-lang/rust/issues/105779.

This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`.

r? `@lcnr`
2023-04-19 06:35:35 +02:00
Matthias Krüger
f20da94ccf
Rollup merge of #110476 - compiler-errors:ty-err-ctxt-good-path, r=lcnr
Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug)

r? `@lcnr`
Perhaps we should just delete the `Drop` impl altogether though?

Fixes rust-lang/rust-clippy#10645

`@matthiaskrgr:` I don't know how to make a clippy test for this. Any idea? Clippy's UI tests run with `-D warnings` and I have no idea how to switch it off to make a test that triggers this ICE in the clippy test suite 🤣
2023-04-19 06:35:35 +02:00
Matthias Krüger
a184557d1d
Rollup merge of #110451 - WaffleLapkin:ensure_return_elem, r=scottmcm
Minor changes to `IndexVec::ensure_contains_elem` & related methods

r? `@scottmcm`
2023-04-19 06:35:34 +02:00
Matthias Krüger
3320b2a59a
Rollup merge of #110432 - compiler-errors:unsatisfied-index-impl, r=cjgillot
Report more detailed reason why `Index` impl is not satisfied

Fixes #110373
2023-04-19 06:35:34 +02:00
Qiu Chaofan
7037ff99af Recognize AIX style archive kind 2023-04-19 11:10:47 +08:00
bors
9e7f72c57d Auto merge of #110477 - miguelraz:canoodling2-electric-boogaloo, r=compiler-errors
Don't allocate on SimplifyCfg/Locals/Const on every MIR pass

Hey! 👋🏾 This is a first PR attempt to see if I could speed up some rustc internals.

Thought process:

```rust
pub struct SimplifyCfg {
    label: String,
}
```
in [compiler/src/rustc_mir_transform/simplify.rs](7908a1d654/compiler/rustc_mir_transform/src/simplify.rs (L39)) fires multiple times per MIR analysis. This means that a likely string allocation is happening in each of these runs, which may add up, as they are not being  lazily allocated or cached in between the different passes.

...yes, I know that adding a global static array is probably not the future-proof solution, but I wanted to lob this now as a proof of concept to see if it's worth shaving off a few cycles and then making more robust.
2023-04-19 02:57:19 +00:00
Michael Goulet
14678778dc Remove find_map_relevant_impl 2023-04-19 02:01:55 +00:00
Ezra Shaw
625619551d
make non_upper_case_globals lint not report trait impls 2023-04-19 12:47:35 +12:00
Bryan Garza
238756e45d Fix ICE for transmutability in candidate assembly
Don't skip transmutability check just because there may be generics in the
ParamEnv.

Fixes #110467
2023-04-18 17:33:46 -07:00
Kyle Matsuda
522bc5f817 add EarlyBinder to return type of collect_return_position_impl_trait_in_trait_tys query; remove bound_X version 2023-04-18 16:33:06 -06:00
bors
b3f1379509 Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillot
Encode hashes as bytes, not varint

In a few places, we store hashes as `u64` or `u128` and then apply `derive(Decodable, Encodable)` to the enclosing struct/enum. It is more efficient to encode hashes directly than try to apply some varint encoding. This PR adds two new types `Hash64` and `Hash128` which are produced by `StableHasher` and replace every use of storing a `u64` or `u128` that represents a hash.

Distribution of the byte lengths of leb128 encodings, from `x build --stage 2` with `incremental = true`

Before:
```
(  1) 373418203 (53.7%, 53.7%): 1
(  2) 196240113 (28.2%, 81.9%): 3
(  3) 108157958 (15.6%, 97.5%): 2
(  4)  17213120 ( 2.5%, 99.9%): 4
(  5)    223614 ( 0.0%,100.0%): 9
(  6)    216262 ( 0.0%,100.0%): 10
(  7)     15447 ( 0.0%,100.0%): 5
(  8)      3633 ( 0.0%,100.0%): 19
(  9)      3030 ( 0.0%,100.0%): 8
( 10)      1167 ( 0.0%,100.0%): 18
( 11)      1032 ( 0.0%,100.0%): 7
( 12)      1003 ( 0.0%,100.0%): 6
( 13)        10 ( 0.0%,100.0%): 16
( 14)        10 ( 0.0%,100.0%): 17
( 15)         5 ( 0.0%,100.0%): 12
( 16)         4 ( 0.0%,100.0%): 14
```

After:
```
(  1) 372939136 (53.7%, 53.7%): 1
(  2) 196240140 (28.3%, 82.0%): 3
(  3) 108014969 (15.6%, 97.5%): 2
(  4)  17192375 ( 2.5%,100.0%): 4
(  5)       435 ( 0.0%,100.0%): 5
(  6)        83 ( 0.0%,100.0%): 18
(  7)        79 ( 0.0%,100.0%): 10
(  8)        50 ( 0.0%,100.0%): 9
(  9)         6 ( 0.0%,100.0%): 19
```

The remaining 9 or 10 and 18 or 19 are `u64` and `u128` respectively that have the high bits set. As far as I can tell these are coming primarily from `SwitchTargets`.
2023-04-18 22:27:15 +00:00
bors
c609da59d9 Auto merge of #109772 - petrochenkov:slimchild, r=cjgillot
rustc_metadata: Remove `Span` from `ModChild`

It can be decoded on demand from regular `def_span` tables.

Partially mitigates perf regressions from https://github.com/rust-lang/rust/pull/109500.
2023-04-18 20:16:56 +00:00
Michael Howell
df8a48fc8a rustdoc: fix ICE from rustc_resolve and librustdoc parse divergence 2023-04-18 12:22:13 -07:00
Nilstrieb
b5d3d970fa Add rustc_fluent_macro to decouple fluent from rustc_macros
Fluent, with all the icu4x it brings in, takes quite some time to
compile. `fluent_messages!` is only needed in further downstream rustc
crates, but is blocking more upstream crates like `rustc_index`. By
splitting it out, we allow `rustc_macros` to be compiled earlier, which
speeds up `x check compiler` by about 5 seconds (and even more after the
needless dependency on `serde_json` is removed from
`rustc_data_structures`).
2023-04-18 18:56:22 +00:00
Michael Goulet
d84b5f9b3d Use a diagnostic item instead of filtering for Index::Output 2023-04-18 18:55:17 +00:00
Michael Goulet
770c303c00 Report reason why index impl is not satisfied deeply 2023-04-18 18:50:18 +00:00
miguelraz
fc27ae14f6 refactor SimlifyCfg and friends - no globals, just enums 2023-04-18 12:30:00 -06:00
Ben Kimock
073d99b25d
Add #[inline] to some new functions
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2023-04-18 14:13:19 -04:00
Camille GILLOT
99962a8418 Refactor SyntaxContext::ctxt logic. 2023-04-18 18:00:21 +00:00
Maybe Waffle
10ec03c3fb Don't transmute &List<GenericArg> <-> &List<Ty> 2023-04-18 17:42:30 +00:00
Maybe Waffle
cddc7743a3 Remove as_substs usage 2023-04-18 17:38:28 +00:00
Ben Kimock
a04c09ade8 Document how the HashN types are different from Fingerprint 2023-04-18 10:52:47 -04:00
Ben Kimock
0445fbdd83 Store hashes in special types so they aren't accidentally encoded as numbers 2023-04-18 10:52:47 -04:00
Vadim Petrochenkov
ec8f68859a rustc_metadata: Remove Span from ModChild
It can be decoded on demand from regular `def_span` tables.

Partially mitigates perf regressions from #109500.
2023-04-18 17:25:04 +03:00
Maybe Waffle
bd1dfcebe3 Don't allocate it IndexVec::remove 2023-04-18 12:55:54 +00:00
Guillaume Gomez
e6b607335a
Rollup merge of #110441 - kadiwa4:typos, r=thomcc
5 little typos
2023-04-18 14:50:51 +02:00
Guillaume Gomez
aa87addfb3
Rollup merge of #110417 - jsoref:spelling-compiler, r=Nilstrieb
Spelling compiler

This is per https://github.com/rust-lang/rust/pull/110392#issuecomment-1510193656

I'm going to delay performing a squash because I really don't expect people to be perfectly happy w/ my changes, I really am a human and I really do make mistakes.

r? Nilstrieb

I'm going to be flying this evening, but I should be able to squash / respond to reviews w/in a day or two.

I tried to be careful about dropping changes to `tests`, afaict only two files had changes that were likely related to the changes for a given commit (this is where not having eagerly squashed should have given me an advantage), but, that said, picking things apart can be error prone.
2023-04-18 14:50:51 +02:00
bors
74864fa496 Auto merge of #110481 - matthiaskrgr:rollup-phkkgm9, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109981 (Set commit information environment variables when building tools)
 - #110348 (Add list of supported disambiguators and suffixes for intra-doc links in the rustdoc book)
 - #110409 (Don't use `serde_json` to serialize a simple JSON object)
 - #110442 (Avoid including dry run steps in the build metrics)
 - #110450 (rustdoc: Fix invalid handling of nested items with `--document-private-items`)
 - #110461 (Use `Item::expect_*` and `ImplItem::expect_*` more)
 - #110465 (Assure everyone that `has_type_flags` is fast)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-18 05:28:44 +00:00
Matthias Krüger
5606653f01
Rollup merge of #110465 - WaffleLapkin:assure_everyone_that_has_type_flags_is_fast, r=oli-obk
Assure everyone that `has_type_flags` is fast

`number_of_people_who_tripped_on_this += 1`

r? ``@oli-obk``
2023-04-18 06:44:48 +02:00
Matthias Krüger
d97b39d3a0
Rollup merge of #110461 - WaffleLapkin:expect_, r=Nilstrieb
Use `Item::expect_*` and `ImplItem::expect_*` more

r? ``@Nilstrieb``
2023-04-18 06:44:47 +02:00
Matthias Krüger
41ae7fcf9b
Rollup merge of #110409 - Nilstrieb:some-manual-javascript-object-notationing, r=fee1-dead
Don't use `serde_json` to serialize a simple JSON object

This avoids `rustc_data_structures` depending on `serde_json` which allows it to be compiled much earlier, unlocking most of rustc.

This used to not matter, but after #110407 we're not blocked on fluent anymore, which means that it's now a blocking edge.
![image](https://user-images.githubusercontent.com/48135649/232313178-e0150420-3020-4eb6-98d3-fe5294a8f947.png)

This saves a few more seconds.

cc ````@Zoxc```` who added it recently
2023-04-18 06:44:46 +02:00
Michael Goulet
556062ea6e Delay a good path bug for TypeErrCtxt 2023-04-18 04:06:27 +00:00
bors
386025117a Auto merge of #110410 - saethlin:hash-u128-as-u64s, r=oli-obk
Implement StableHasher::write_u128 via write_u64

In https://github.com/rust-lang/rust/pull/110367#issuecomment-1510114777 the cachegrind diffs indicate that nearly all the regression is from this:
```
22,892,558  ???:<rustc_data_structures::sip128::SipHasher128>::slice_write_process_buffer
-9,502,262  ???:<rustc_data_structures::sip128::SipHasher128>::short_write_process_buffer::<8>
```
Which happens because the diff for that perf run swaps a `Hash::hash` of a `u64` to a `u128`. But `slice_write_process_buffer` is a `#[cold]` function, and is for handling hashes of arbitrary-length byte arrays.

Using the much more optimizer-friendly `u64` path twice to hash a `u128` provides a nice perf boost in some benchmarks.
2023-04-18 03:11:18 +00:00
bors
7908a1d654 Auto merge of #110243 - WaffleLapkin:bless_tagged_pointers🙏, r=Nilstrieb
Tagged pointers, now with strict provenance!

This is a big refactor of tagged pointers in rustc, with three main goals:
1. Porting the code to the strict provenance
2. Cleanup the code
3. Document the code (and safety invariants) better

This PR has grown quite a bit (almost a complete rewrite at this point...), so I'm not sure what's the best way to review this, but reviewing commit-by-commit should be fine.

r? `@Nilstrieb`
2023-04-17 21:50:13 +00:00
Josh Soref
e09d0d2a29 Spelling - compiler
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04:00
bors
56e28e904d Auto merge of #110343 - saethlin:encode-initmask, r=lqd
Bypass the varint path when encoding InitMask

The data in a `InitMask` is stored as `u64` but it is a large bitmask (not numbers) so varint encoding doesn't make sense.
2023-04-17 19:31:45 +00:00
Maybe Waffle
c960a043e3 Assure everyone that has_type_flags is fast 2023-04-17 19:19:59 +00:00
Maybe Waffle
880da9fca9 doc fix
I think those don't make sense here, ig they were left from me copying the defs.
2023-04-17 18:00:27 +00:00
Maybe Waffle
9534541dd4 Use Item::expect_* and ImplItem::expect_* more 2023-04-17 18:00:27 +00:00
Matthias Krüger
a76b157624
Rollup merge of #110434 - compiler-errors:issue-110171, r=oli-obk
Check freeze with right param-env in `deduced_param_attrs`

We're checking if a trait (`Freeze`) holds in a polymorphic function, but not using that function's own (reveal-all) param-env. This causes us to try to eagerly normalize a specializable projection type that has no default value, which causes an ICE.

Fixes #110171
2023-04-17 18:13:36 +02:00
Matthias Krüger
d01c62bcef
Rollup merge of #110425 - compiler-errors:def-span-for-ct-param, r=petrochenkov
Encode def span for `ConstParam`

Fixes #110206

r? ``@petrochenkov``
2023-04-17 18:13:36 +02:00
Matthias Krüger
0790996a07
Rollup merge of #110394 - scottmcm:less-idx-new, r=WaffleLapkin
Various minor Idx-related tweaks

Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.

cc https://github.com/rust-lang/compiler-team/issues/606
r? `@WaffleLapkin`
2023-04-17 18:13:35 +02:00
Matthias Krüger
a6c1fa5056
Rollup merge of #110386 - nnethercote:clean-up-traversal-macros, r=lcnr
Clean up traversal macros

The declarative macros relating to type folding and visiting can be simplified.

r? ``@lcnr``
2023-04-17 18:13:35 +02:00
Matthias Krüger
eb0524615c
Rollup merge of #110313 - fee1-dead-contrib:repr_align_method, r=WaffleLapkin
allow `repr(align = x)` on inherent methods

Discussion: https://github.com/rust-lang/rust/issues/82232#issuecomment-905929314
2023-04-17 18:13:34 +02:00
Matthias Krüger
06d12f668e
Rollup merge of #110257 - lukas-code:why-would-anyone-write-code-like-that-anyway, r=oli-obk
fix false positives for `unused_parens` around unary and binary operations

fix https://github.com/rust-lang/rust/issues/110251
2023-04-17 18:13:33 +02:00
Matthias Krüger
91fe117418
Rollup merge of #104055 - AndyJado:bck_errors, r=davidtwco
Migrate diagnostics in `rustc_borrowck`

sorry for making a new PR, [#103559](https://github.com/rust-lang/rust/pull/103559) and [#103960](https://github.com/rust-lang/rust/pull/103960).

I am crawling, joyfully.
2023-04-17 18:13:33 +02:00
Maybe Waffle
e1cd99f6ff Make IndexVec::ensure_contains_elem return a reference to the element 2023-04-17 14:23:46 +00:00
Ben Kimock
69279c0584 Bypass the varint path when encoding InitMask 2023-04-17 09:44:43 -04:00
Mara Bos
2cd5ce08ba Update test. 2023-04-17 14:13:37 +02:00
clubby789
f7581d8d21 Suggest using integration tests for proc-macros 2023-04-17 13:01:03 +01:00
bors
e49122fb1c Auto merge of #110367 - saethlin:no-truncations, r=oli-obk
Remove some suspicious cast truncations

These truncations were added a long time ago, and as best I can tell without a perf justification. And with rust-lang/rust#110410 it has become perf-neutral to not truncate anymore. We worked hard for all these bits, let's use them.
2023-04-17 09:38:31 +00:00
bors
bdb32bd4bb Auto merge of #110440 - matthiaskrgr:rollup-eit19vi, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110038 (Erase regions when confirming transmutability candidate)
 - #110341 (rustdoc: stop passing a title to `replaceState` second argument)
 - #110388 (Add a message for if an overflow occurs in `core::intrinsics::is_nonoverlapping`.)
 - #110404 (fix clippy::toplevel_ref_arg and ::manual_map)
 - #110421 (Spelling librustdoc)
 - #110423 (Spelling srcdoc)
 - #110433 (Windows: map a few more error codes to ErrorKind)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-17 07:25:01 +00:00
kadiwa
85653831f7
typos 2023-04-17 09:16:07 +02:00
Matthias Krüger
1795bf8222
Rollup merge of #110404 - matthiaskrgr:mapmap, r=Nilstrieb
fix clippy::toplevel_ref_arg and ::manual_map

r? ``@Nilstrieb``
2023-04-17 08:09:40 +02:00
Matthias Krüger
f5222cdbd3
Rollup merge of #110038 - compiler-errors:infer-regions-in-transmutability, r=lcnr
Erase regions when confirming transmutability candidate

Fixes an ICE where we call `layout_of` on a type with infer regions.
2023-04-17 08:09:39 +02:00
bors
53ac4f8e2f Auto merge of #109588 - Nilstrieb:dropless-expr, r=compiler-errors
Alloc `hir::Lit` in an arena to remove the destructor from `Expr`

This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena.
2023-04-17 05:12:12 +00:00
Michael Goulet
1ee189cde5 Encode def span for ConstParam 2023-04-17 02:57:23 +00:00
bors
5546cb64f6 Auto merge of #109247 - saethlin:inline-without-inline, r=oli-obk
Permit MIR inlining without #[inline]

I noticed that there are at least a handful of portable-simd functions that have no `#[inline]` but compile to an assign + return.

I locally benchmarked inlining thresholds between 0 and 50 in increments of 5, and 50 seems to be the best. Interesting. That didn't include check builds though, ~maybe perf will have something to say about that~.

Perf has little useful to say about this. We generally regress all the check builds, as best as I can tell, due to a number of small codegen changes in a particular hot function in the compiler. Probably this is because we've nudged the inlining outcomes all over, and uses of `#[inline(always)]`/`#[inline(never)]` might need to be adjusted.
2023-04-17 02:36:38 +00:00
bors
23eb90ffa7 Auto merge of #109061 - saethlin:leak-backtraces, r=oli-obk
Add a backtrace to Allocation, display it in leak reports

This addresses https://github.com/rust-lang/miri/issues/2813

Information like this from diagnostics is indispensable for diagnosing problems that are difficult to reproduce such as https://github.com/rust-lang/miri-test-libstd/actions/runs/4395316008/jobs/7697019211#step:4:770 (which has not been reproduced or diagnosed).
2023-04-17 00:22:28 +00:00
Ben Kimock
84facac97a Remove some unnecessary hash truncations 2023-04-16 20:05:02 -04:00
Michael Goulet
e28e19034f Check freeze with right param-env 2023-04-16 23:09:57 +00:00
Michael Goulet
f6bfb4bf8e Erase regions when confirming transmutability candidate 2023-04-16 19:12:34 +00:00
Amanieu d'Antras
4b981c2648 Rename -Zoom=panic to -Zoom=unwind 2023-04-16 11:50:32 -07:00
Camille GILLOT
8fc1d68413 Account for variance in outlives verification. 2023-04-16 17:39:52 +00:00
Nilstrieb
34ed5c3efc Alloc hir::Lit in an arena to remove the destructor from Expr
This allows allocating `Expr`s into a dropless arena, which is useful
for using length prefixed thing slices in HIR, since these can only be
allocated in the dropless arena and not in a typed arena. This is
something I'm working on.
2023-04-16 15:35:51 +00:00
Amanieu d'Antras
abc0660118 Remove #[alloc_error_handler] from the compiler and library 2023-04-16 08:35:50 -07:00
Ben Kimock
ad8d304163 Implement StableHasher::write_u128 via write_u64 2023-04-16 09:44:03 -04:00
bors
8a778ca1e3 Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-dead
Rollup of 4 pull requests

Successful merges:

 - #110397 (Move some utils out of `rustc_const_eval`)
 - #110398 (use matches! macro in more places)
 - #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…)
 - #110402 (Remove the loop in `Align::from_bytes`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-16 13:12:53 +00:00
Nilstrieb
7859a8e9a5 Don't use serde_json to serialize a simple JSON object
This avoids `rustc_data_structures` depending on `serde_json` which
allows it to be compiled much earlier, unlocking most of rustc.
2023-04-16 15:00:06 +02:00
Ben Kimock
606ca4da7e Report a backtrace for memory leaks under Miri 2023-04-16 08:52:00 -04:00
fee1-dead
38215fb77a
Rollup merge of #110402 - scottmcm:align-tz, r=fee1-dead
Remove the loop in `Align::from_bytes`

Perf is almost certainly irrelevant, but might as well simplify it, since `trailing_zeros` does exactly what's needed.
2023-04-16 19:36:03 +08:00
fee1-dead
1d30adb068
Rollup merge of #110400 - matthiaskrgr:style_mix, r=fee1-dead
more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…

…lt, option_map_or_none}

r? `@Nilstrieb`
2023-04-16 19:36:02 +08:00
fee1-dead
fba49a7ee2
Rollup merge of #110398 - matthiaskrgr:clippy_match, r=Nilstrieb,fee1-dead
use matches! macro in more places

r? `@Nilstrieb`
2023-04-16 19:36:02 +08:00
Matthias Krüger
543f8bc38c fix clippy::toplevel_ref_arg and ::manual_map 2023-04-16 13:28:13 +02:00
Scott McMurray
99fd9cb697 Remove the loop in Align::from_bytes
Perf is almost certainly irrelevant, but might as well simplify it, since `trailing_zeros` does exactly what's needed.
2023-04-16 04:01:34 -07:00
fee1-dead
7fb14ae84d
Rollup merge of #110396 - Nilstrieb:speedy-bootstrap, r=jyn514
Use lint via `lint_defs` instead of `lints`

This gets rid of a blocking dependency edge from `rustc_lint->rustc_analysis->rustc_hir_typeck->rustc_interface`

![image](https://user-images.githubusercontent.com/48135649/232291152-fc61e6c5-9b1e-4db1-8101-dfaa3b7d30c6.png)
2023-04-16 18:55:39 +08:00
fee1-dead
eba419195c
Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, r=compiler-errors
Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.

These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial.

This commit inlines and removes those trivial methods.

r? `@compiler-errors`
2023-04-16 18:55:38 +08:00
fee1-dead
a5136f14ae
Rollup merge of #109665 - fee1-dead-contrib:rm-remap-queries, r=oli-obk
Remove `remap_env_constness` in queries

This removes some of the complexities with const traits. #88119 used to be caused by this but was fixed by `param_env = param_env.without_const()`.
2023-04-16 18:55:38 +08:00
Matthias Krüger
6ef8648a48 more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_default, option_map_or_none} 2023-04-16 12:45:51 +02:00
Matthias Krüger
bcc15bba95 use matches! macro in more places 2023-04-16 12:08:30 +02:00
Nilstrieb
2109fe4e4e Move some utils out of rustc_const_eval
This allows us to get rid of the `rustc_const_eval->rustc_borrowck`
dependency edge which was delaying the compilation of borrowck.

The added utils in `rustc_middle` are small and should not affect
compile times there.
2023-04-16 12:05:54 +02:00
Camille GILLOT
8889c6fa0e Account for variance in outlives obligations. 2023-04-16 10:01:15 +00:00
Nilstrieb
ee8f92ba0a Use lints via lint_defs instead of lints
This gets rid of a blocking dependency edge from
`rustc_lint->rustc_analysis->rustc_hir_typeck->rustc_interface`
2023-04-16 11:48:01 +02:00
Scott McMurray
c98895d9f2 Various minor Idx-related tweaks
Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.
2023-04-16 02:42:50 -07:00
Deadbeef
147e850691 revive raw pointer comp error 2023-04-16 09:25:48 +00:00
Deadbeef
ede7bc032a make rustc compilable 2023-04-16 07:25:13 +00:00
Deadbeef
dda89945b7 Allow all associated functions and add test 2023-04-16 06:31:08 +00:00
fee1-dead
312cad1f74
Rollup merge of #110387 - nnethercote:rm-use-rustc_hir-as-ast, r=fee1-dead
Don't `use rustc_hir as ast`(!)

It makes for confusing code.

This was introduced in a large commit in #67886 that rearranged a lot of `use` statements. I suspect it was an accident.
2023-04-16 14:24:33 +08:00
fee1-dead
ff39942d33
Rollup merge of #110376 - aDotInTheVoid:doc-comment, r=jyn514
Convert comment to doc comment on `Interner::get`.
2023-04-16 14:24:32 +08:00
Nicholas Nethercote
1ffa331c72 Don't use rustc_hir as ast(!)
It makes for confusing code.

This was introduced in a large commit in #67886 that rearranged a lot of
`use` statements. I suspect it was an accident.
2023-04-16 15:03:17 +10:00
Nicholas Nethercote
d2b5a64579 Simplify CloneLiftImpls and TrivialTypeTraversalImpls.
They both allow for a lifetime other than `'tcx`, but this isn't needed.
2023-04-16 14:19:50 +10:00
John Kåre Alsaker
efe7cf468f Remove WorkerLocal from AttrIdGenerator 2023-04-16 05:50:58 +02:00
John Kåre Alsaker
64474a40b0 Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structures 2023-04-16 05:50:57 +02:00
Nicholas Nethercote
32f6e7a38e Remove EnumTypeTraversalImpl.
I suspect this macro was around before `TypeFoldable`/`TypeVisitable`
were derivable. But now it's only used for two types, `Result` and
`Option`. Removing the macro and implementing the traits for those types
by hand makes the code much simpler.
2023-04-16 13:49:12 +10:00
bors
2a71115261 Auto merge of #105888 - skyzh:skyzh/suggest-lifetime-closure, r=compiler-errors
suggest lifetime for closure parameter type when mismatch

This is a draft PR, will add test cases later and be ready for review.

This PR fixes https://github.com/rust-lang/rust/issues/105675 by adding a diagnostics suggestion. Also a partial fix to https://github.com/rust-lang/rust/issues/105528.

The following code will have a compile error now:

```
fn const_if_unit(input: bool) -> impl for<'a> FnOnce(&'a ()) -> usize {
    let x = |_| 1;
    x
}
```

Before this PR:

```
error[E0308]: mismatched types
 --> src/lib.rs:3:5
  |
3 |     x
  |     ^ one type is more general than the other
  |
  = note: expected trait `for<'a> FnOnce<(&'a (),)>`
             found trait `FnOnce<(&(),)>`
note: this closure does not fulfill the lifetime requirements
 --> src/lib.rs:2:13
  |
2 |     let x = |_| 1;
  |             ^^^

error: implementation of `FnOnce` is not general enough
 --> src/lib.rs:3:5
  |
3 |     x
  |     ^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 ()) -> usize` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rust-test` due to 2 previous errors
```

After this PR:

```
error[E0308]: mismatched types
 --> src/lib.rs:3:5
  |
3 |     x
  |     ^ one type is more general than the other
  |
  = note: expected trait `for<'a> FnOnce<(&'a (),)>`
             found trait `FnOnce<(&(),)>`
note: this closure does not fulfill the lifetime requirements
 --> src/lib.rs:2:13
  |
2 |     let x = |_| 1;
  |             ^^^
help: consider changing the type of the closure parameters
  |
2 |     let x = |_: &_| 1;
  |             ~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> src/lib.rs:3:5
  |
3 |     x
  |     ^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 ()) -> usize` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rust-test` due to 2 previous errors
```

After applying the suggestion, it compiles. The suggestion might not always be correct as the generation procedure of that suggestion is quite simple...
2023-04-16 03:06:46 +00:00
Nicholas Nethercote
4460a1dc28 Remove TypeSuper{Foldable,Visitable} impls for Region.
These traits exist so that folders/visitors can recurse into types of
interest: binders, types, regions, predicates, and consts. But `Region`
is non-recursive and cannot contain other types of interest, so its
methods in these traits are trivial.

This commit inlines and removes those trivial methods.
2023-04-16 09:11:43 +10:00
Yuki Okushi
a8983749bd
Rollup merge of #110366 - matthiaskrgr:compl_123, r=Nilstrieb
fix some clippy::complexity

r? `@Nilstrieb`
2023-04-16 06:55:24 +09:00
Yuki Okushi
99e59dbef3
Rollup merge of #110364 - matthiaskrgr:anti_clone, r=Nilstrieb
remove redundant clones
2023-04-16 06:55:23 +09:00
Yuki Okushi
52d23c9253
Rollup merge of #110272 - Ezrashaw:fix-unconned-lt-in-implbounds, r=aliemjay
fix: skip implied bounds if unconstrained lifetime exists

Fixes #110161

r? ````@aliemjay````
2023-04-16 06:55:21 +09:00
Alona Enraght-Moony
266ec68d3d Convert comment to doc comment on Interner::get. 2023-04-15 21:50:57 +00:00
Matthias Krüger
bcd79c222a fix clippy::{clone_on_copy, useless_conversion} 2023-04-15 19:02:26 +02:00
Matthias Krüger
d666f6bf22 fix clippy::{filter_map_identiy, map_identity, manual_flatten} 2023-04-15 18:56:25 +02:00
Matthias Krüger
1077d574cf remove redundant clones 2023-04-15 18:04:51 +02:00
Ali MJ Al-Nasrawy
4c80f58d41
Update compiler/rustc_trait_selection/src/traits/outlives_bounds.rs 2023-04-15 15:41:42 +03:00
bors
ce1073ba9d Auto merge of #110323 - lcnr:dropck-uwu, r=compiler-errors
explicit `adt_dtorck_constraint` for `ManuallyDrop`

the only reason we didn't add outlives requirements when dropping `ManuallyDrop` was a fast-path in `trivial_dropck_outlives`. Explicitly acknowledge that fast-path in `adt_dtorck_constraint`
2023-04-15 10:21:55 +00:00
Camille GILLOT
9ec086709e Remove outdated comment. 2023-04-15 07:46:46 +00:00
Camille GILLOT
22bf5fd848 Remove useless methods in visit. 2023-04-15 07:46:46 +00:00
Camille GILLOT
8a515aab76 Only enable ConstProp at mir-opt-level >= 2. 2023-04-15 07:46:46 +00:00
bors
158c309513 Auto merge of #110197 - cjgillot:codegen-discr, r=pnkfelix
Do not attempt to commute comparison and cast to codegen discriminants

The general algorithm to compute a discriminant is:
```
relative_tag = tag - niche_start
is_niche = relative_tag <= (ule) relative_max
discr = if is_niche {
    cast(relative_tag) + niche_variants.start()
} else {
    untagged_variant
}
```

We have an optimization branch which attempts to merge the addition and the subtraction by commuting them with the cast. We currently get this optimization wrong.

This PR takes the easiest and safest way: remove the optimization, and let LLVM handle it. (Perf may not agree with that course of action 😅)

There may be a less invasive solution, but I don't have the necessary knowledge of LLVM semantics to find it. Cranelift has the same optimization, which should be handled similarly.
cc `@nikic` and `@bjorn3` if you have a better solution.

Fixes https://github.com/rust-lang/rust/issues/110128
2023-04-14 21:54:56 +00:00
Matthias Krüger
7bfccb3d7f
Rollup merge of #108687 - compiler-errors:reformulate-point_at_expr_source_of_inferred_type, r=oli-obk
Reformulate `point_at_expr_source_of_inferred_type` to be more accurate

Be more accurate when deducing where along the several usages of a binding it is constrained to be some type that is incompatible with an expectation.

This also renames the method to `note_source_of_type_mismatch_constraint` because I prefer that name, though I guess I can revert that. (Also drive-by rename `note_result_coercion` -> `suggest_coercing_result_via_try_operator`, because it's suggesting, not noting!)

This PR is (probably?) best reviewed per commit, but it does regress a bit only to fix it later on, so it could also be reviewed as a whole if that makes the final results more clear.

r? `@estebank`
2023-04-14 21:11:10 +02:00
Camille GILLOT
df9342aa6f Remove from cranelift too. 2023-04-14 16:26:11 +00:00
Camille GILLOT
194497a1a1 Remove attempt to optimize codegen for discriminants. 2023-04-14 16:26:11 +00:00
Alex Chi
90dc6fe71d fix import Applicability
Signed-off-by: Alex Chi <iskyzh@gmail.com>
2023-04-14 11:42:37 -04:00
Alex Chi
173b8567ee use param instead of ty
Signed-off-by: Alex Chi <iskyzh@gmail.com>
2023-04-14 11:39:35 -04:00
Alex Chi
54c11a688f better suggestion based on hir
Signed-off-by: Alex Chi <iskyzh@gmail.com>
2023-04-14 11:39:35 -04:00
Alex Chi
6e17349b12 suggest lifetime for closure parameter type when mismatch 2023-04-14 11:39:35 -04:00
Yuki Okushi
425913367b
Rollup merge of #110315 - oli-obk:mor_smir, r=WaffleLapkin
Add a stable MIR way to get the main function

This is useful for analysis tools that only analyze the code paths that a specific program actually goes through. Or for code generators built on top of stable MIR.
2023-04-14 23:00:36 +09:00
lcnr
64fbdc3779 explicit adt_dtorck_constraint for ManuallyDrop 2023-04-14 15:44:05 +02:00
Maybe Waffle
5571dd061d fix broken intradoclinks 2023-04-14 13:04:58 +00:00
Maybe Waffle
014c6f208e Use ptr::Alignment for extra coolness points 2023-04-14 12:31:49 +00:00
ozkanonur
2e98368c2f make sysroot finding compatible with multiarch systems
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-14 15:03:49 +03:00
Maybe Waffle
36f5918bf1 Test CopyTaggedPtr's HashStable impl 2023-04-14 11:59:53 +00:00
Maybe Waffle
251f662e4d Share Tag2 impl between CopyTaggedPtr and TaggedPtr tests 2023-04-14 11:24:22 +00:00
Maybe Waffle
8d49e948a8 Doc fixes from review 2023-04-14 11:24:22 +00:00
Ezra Shaw
b506d966a3
implement review suggestions 2023-04-14 20:18:28 +12:00
Oli Scherer
e404e77c0b Add a stable MIR way to get the main function 2023-04-14 07:28:56 +00:00
Deadbeef
b59ec166ad allow repr(align = x) on inherent methods 2023-04-14 06:39:48 +00:00
Matthias Krüger
610bc68675
Rollup merge of #110299 - kylematsuda:earlybinder-impl-subject, r=compiler-errors
Switch to `EarlyBinder` for `impl_subject` query

Part of the work to finish https://github.com/rust-lang/rust/issues/105779.

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`.

r? ```@lcnr```
2023-04-14 07:58:42 +02:00
Matthias Krüger
f3c6955249
Rollup merge of #110276 - nnethercote:rm-BrAnon-Span, r=jackh726
Remove all but one of the spans in `BoundRegionKind::BrAnon`

There are only three places where `BoundRegionKind::BrAnon` uses `Some(span)` instead of `None`. Two of them are easy to remove, which this PR does.

r? ```@jackh726```
2023-04-14 07:58:41 +02:00
Matthias Krüger
69d7172b8e
Rollup merge of #110207 - compiler-errors:new-solver-unpin, r=lcnr
Assemble `Unpin` candidates specially for generators in new solver

Fixes compiler-errors/next-solver-hir-issues#16

r? ``@lcnr``
2023-04-14 07:58:40 +02:00
Matthias Krüger
44db7c3b5a
Rollup merge of #110180 - lcnr:canonicalize, r=compiler-errors
don't uniquify regions when canonicalizing

uniquifying causes a bunch of issues, most notably it causes `AliasEq(<?x as Trait<'a>>::Assoc, <?x as Trait<'a>>::Assoc)` to result in ambiguity because both `normalizes-to` paths result in ambiguity and substs equate should trivially succeed but doesn't because we uniquified `'a` to two different regions.

I originally added uniquification to make it easier to deal with requirement 6 from the dev-guide: https://rustc-dev-guide.rust-lang.org/solve/trait-solving.html#requirements

> ### 6. Trait solving must be (free) lifetime agnostic
>
> Trait solving during codegen should have the same result as during typeck. As we erase
> all free regions during codegen we must not rely on them during typeck. A noteworthy example
> is special behavior for `'static`.

cc https://github.com/rust-lang/rustc-dev-guide/pull/1671

Relying on regions being identical may cause ICE during MIR typeck, but even without this PR we can end up relying on that as type inference vars can resolve to types which contain an identical region. Let's land this and deal with any ICE that crop up as we go. Will look at this issue again before stabilization.

r? ```@compiler-errors```
2023-04-14 07:58:40 +02:00
Matthias Krüger
c6223e198d
Rollup merge of #109800 - bryangarza:safe-transmute-improved-errors, r=compiler-errors
Improve safe transmute error reporting

This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason.

Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-14 07:58:39 +02:00
Michael Goulet
319c790600 Move auto trait built-in candidate disqualification to a separate method 2023-04-14 03:14:02 +00:00
Michael Goulet
b335c2d49f Assemble Unpin candidates specially for generators in new solver 2023-04-14 03:13:56 +00:00
Nicholas Nethercote
f07c335e90 Remove another use of BrAnon(Some(_)). 2023-04-14 11:28:16 +10:00
Nicholas Nethercote
7dbd2e2370 Remove one use of BrAnon(Some(_)). 2023-04-14 11:28:10 +10:00
bors
7a78c4ffd5 Auto merge of #110160 - petrochenkov:notagain2, r=cjgillot
resolve: Pre-compute non-reexport module children

Instead of repeating the same logic by walking HIR during metadata encoding.

The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises.

`module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-14 01:14:36 +00:00
Kyle Matsuda
8d5ee1a072 make impl_subject more readable 2023-04-13 16:43:34 -06:00
Bryan Garza
36febe1f4d Improve safe transmute error reporting
This patch updates the error reporting when Safe Transmute is not
possible between 2 types by including the reason.

Also, fix some small bugs that occur when computing the `Answer` for
transmutability.
2023-04-13 21:57:08 +00:00
Kyle Matsuda
e2f5a5a71f make tcx.impl_subject return EarlyBinder, remove bound_impl_subject, rename usages of bound_impl_subject to impl_subject 2023-04-13 15:56:00 -06:00
Kyle Matsuda
dcc51f1ef5 change usage of bound_impl_subject to impl_subject 2023-04-13 15:55:54 -06:00
Matthias Krüger
46c6301672
Rollup merge of #110291 - WaffleLapkin:copy_location_detail, r=oli-obk
Implement `Copy` for `LocationDetail`

micro-nano-little-change
2023-04-13 21:58:39 +02:00
Matthias Krüger
c140e25ec8
Rollup merge of #110283 - saethlin:check-panics-before-alignment, r=bjorn3
Only emit alignment checks if we have a panic_impl

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

r? `@bjorn3` because you commented that this situation could impact you as well
2023-04-13 21:58:39 +02:00
Matthias Krüger
759d4e8651
Rollup merge of #110277 - Ezrashaw:combine-assoc-fns-dlint, r=lcnr
dead-code-lint: de-dup multiple unused assoc functions

Fixes #109600

Prior art: #97853
2023-04-13 21:58:38 +02:00
Matthias Krüger
e85ecbbcdc
Rollup merge of #110233 - nbdd0121:intrinsic, r=tmiasko
Make rust-intrinsic ABI unwindable

Fix #104451, fix https://github.com/rust-lang/miri/issues/2839

r? `@RalfJung`
2023-04-13 21:58:37 +02:00
Matthias Krüger
232eb698ed
Rollup merge of #110193 - compiler-errors:body-owner-issue, r=WaffleLapkin
Check for body owner fallibly in error reporting

Sometimes the "body id" we use for an obligation cause is not actually a body owner, like when we're doing WF checking on items.

Fixes #110157
2023-04-13 21:58:36 +02:00
Maybe Waffle
09a8791d42 Implement Copy for LocationDetail 2023-04-13 18:04:30 +00:00
Maybe Waffle
c155d5149f Implement Send/Sync for CopyTaggedPtr 2023-04-13 16:51:04 +00:00
Lukas Markeffsky
0d0949d87f emit unused_parens for break if it is not immediately followed by a block 2023-04-13 18:09:47 +02:00
Lukas Markeffsky
8df1f41b9c fix false positives for unused_parens around unary and binary operations 2023-04-13 18:08:52 +02:00
Ben Kimock
4061eb5897 Only emit alignment checks if we have a panic_impl 2023-04-13 10:58:00 -04:00
bors
e14b81f10d Auto merge of #109989 - ids1024:m68k-asm, r=Amanieu
Add inline assembly support for m68k

I believe this should be correct, to the extent I understand the logic around inline assembly. M68k is fairly straightforward here, other than having separate address registers.
2023-04-13 11:41:57 +00:00
Ezra Shaw
39e23ef532
impl reviewer feedback
- remove unused (pun intentional) `continue`
- improve wording with assoc items in general
2023-04-13 23:39:14 +12:00
Ezra Shaw
c41dcac8e8
dead-code-lint: de-dup multiple unused assoc fns 2023-04-13 22:42:47 +12:00
Mara Bos
a77d39b5e2 Enable flatten-format-args by default. 2023-04-13 12:15:36 +02:00
Matthias Krüger
6f1500aec2
Rollup merge of #110220 - lcnr:regionzz, r=compiler-errors
cleanup our region error API

- require `TypeErrCtxt` to always result in an error, closing #108810
- move `resolve_regions_and_report_errors` to the `ObligationCtxt`
- call `process_registered_region_obligations` in `resolve_regions`
- move `resolve_regions` into the `outlives` submodule
- add `#[must_use]` to functions returning lists of errors

r? types
2023-04-13 11:21:05 +02:00
Matthias Krüger
35c4ea59a5
Rollup merge of #110218 - nnethercote:rm-ToRegionVid, r=compiler-errors
Remove `ToRegionVid`

r? ```@compiler-errors```
2023-04-13 11:21:01 +02:00
Matthias Krüger
958413cc08
Rollup merge of #110195 - compiler-errors:issue-110052, r=aliemjay
Erase lifetimes above `ty::INNERMOST` when probing ambiguous types

Turns out that `TyCtxt::replace_escaping_bound_vars_uncached` only erases bound vars exactly at `ty::INNERMOST`, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those.

Fixes #110052
2023-04-13 11:21:00 +02:00
Matthias Krüger
6161fb8c65
Rollup merge of #110072 - joshtriplett:stabilize-is-terminal, r=Mark-Simulacrum
Stabilize IsTerminal

FCP completed in https://github.com/rust-lang/rust/issues/98070 .

closes: https://github.com/rust-lang/rust/issues/98070
2023-04-13 11:21:00 +02:00
Ezra Shaw
03cf0e949f
refactor: emit "unused assoc fn" in lexical order
with repect to other dead code lints
2023-04-13 20:53:32 +12:00
Ezra Shaw
ecf2a9b75e
fix: skip implied bounds if unconstrained lifetime exists 2023-04-13 20:29:41 +12:00
Scott McMurray
1bcb0ec28c assume value ranges in transmute
Fixes #109958
2023-04-13 00:12:39 -07:00
bors
d37e2f74af Auto merge of #109786 - estebank:tweak-add-line-sugg, r=compiler-errors
Tweak output for 'add line' suggestion

Closes #108174
2023-04-13 07:02:53 +00:00
Nicholas Nethercote
c18773a286 Make mk_bound_region closure more generic.
This is necessary for the subsequent commits.
2023-04-13 14:47:14 +10:00
Nicholas Nethercote
722e07854a Remove useless match. 2023-04-13 14:47:14 +10:00
Nicholas Nethercote
72605cd267 Remove some unused type folders.
I'm surprised the compiler doesn't warn about these. It appears having
an `impl` on a struct is enough to avoid a warning about it never being
constructed.
2023-04-13 12:20:44 +10:00
Nicholas Nethercote
bbc400993e Remove ToRegionVid.
It is only implemented for `Region`, where it is equivalent to the
inherent `as_var` method.
2023-04-13 12:20:41 +10:00
Nicholas Nethercote
411422f2b9 Remove impl ToRegionVid for RegionVid.
It's weird and unnecessary.
2023-04-13 12:10:16 +10:00
Nicholas Nethercote
c802694bda Make Region::as_var infallible.
It's what all the call sites require.
2023-04-13 12:10:16 +10:00
bors
d8fc819247 Auto merge of #109466 - davidlattimore:inline-arg-via-var-debug-info, r=wesleywiser
Preserve argument indexes when inlining MIR

We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining.

We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.

Fixes #83217

I considered using `Option<NonZeroU16>` instead of `Option<u16>` to store the index. I didn't because `TypeFoldable` isn't implemented for `NonZeroU16` and because it looks like due to padding, it currently wouldn't make any difference. But I indexed from 1 anyway because (a) it'll make it easier if later it becomes worthwhile to use a `NonZeroU16` and because the arguments were previously indexed from 1, so it made for a smaller change.

This is my first PR on rust-lang/rust, so apologies if I've gotten anything not quite right.
2023-04-13 01:51:27 +00:00
AndyJado
bdf0e74777 migrate ftl msg accroding to #103042 2023-04-13 09:43:46 +08:00
AndyJado
d0468a2283 rm var_span_label to var_subdiag & eager subdiag 2023-04-13 09:43:46 +08:00
Ian Douglas Scott
2ac8dee44f Add inline assembly support for m68k 2023-04-12 17:58:15 -07:00
Michael Goulet
5cc4757421 More accurate argument blames, add some comments 2023-04-12 23:20:12 +00:00
Michael Goulet
5a71029dd3 Properly note source of arg mismatch 2023-04-12 23:20:12 +00:00
Michael Goulet
29aee6a125 Restore suggestion based off of backwards inference from bad usage to method call 2023-04-12 23:20:11 +00:00
Michael Goulet
e72c45ad98 Point at which arg causes a binding to be constrained 2023-04-12 23:20:11 +00:00
Michael Goulet
42c4373ad1 Make note_source_of_type_mismatch_constraint simpler 2023-04-12 23:05:55 +00:00
Esteban Küber
9fadcc143a Special-case item attributes in the suggestion output 2023-04-12 22:50:10 +00:00
Esteban Küber
5b40aa5eb4 Tweak output for 'add line' suggestion 2023-04-12 22:50:10 +00:00
bors
9693b178fc Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test )
 - #110035 (fix: ensure bad `#[test]` invocs retain correct AST)
 - #110089 (sync::mpsc: synchronize receiver disconnect with initialization)
 - #110103 (Report overflows gracefully with new solver)
 - #110122 (Fix x check --stage 1 when download-ci-llvm=false)
 - #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting)
 - #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals")
 - #110235 (Fix `--extend-css` option)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-12 22:19:29 +00:00
lcnr
c0d3d32922 fix comment 2023-04-12 22:07:07 +02:00
Matthias Krüger
57393be6fb
Rollup merge of #110135 - compiler-errors:revert-108031, r=davidtwco
Revert "Don't recover lifetimes/labels containing emojis as character literals"

Reverts PR #108031 per https://github.com/rust-lang/rust/pull/109754#issuecomment-1490452045

Fixes (doesnt close until beta backported) #109746

This reverts commit e3f9db5fc3.
This reverts commit 98b82aedba.
This reverts commit 380fa26413.
2023-04-12 22:04:35 +02:00
Matthias Krüger
5d6aeb9799
Rollup merge of #110133 - compiler-errors:issue-110131, r=petrochenkov
Do not use ImplDerivedObligationCause for inherent impl method error reporting

We were constructing a `TraitRef` out of impl substs, for an *inherent* impl that has no corresponding trait. Instead of doing that, let's construct a meaningful obligation cause code, and instead adjust the error reporting machinery to handle that correctly.

Fixes #110131
cc #106702, which introduced this regression
2023-04-12 22:04:34 +02:00
Matthias Krüger
92eb36461b
Rollup merge of #110103 - compiler-errors:new-solver-overflows, r=lcnr
Report overflows gracefully with new solver

avoid reporting overflows as ambiguity errors, so that the error message is clearer.

r? ```@lcnr```
2023-04-12 22:04:33 +02:00