Commit Graph

19037 Commits

Author SHA1 Message Date
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
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
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
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
Dylan DPC
fcbe990093
Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebank
Unhide unknown spans

r? ```@estebank```
2022-11-12 12:02:51 +05:30
Dylan DPC
4b0b89827d
Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obk
Add the `#[derive_const]` attribute

Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to.

r? `````@oli-obk`````
2022-11-12 12:02:50 +05:30
bors
825f8edc2f Auto merge of #103530 - cjgillot:hir-lifetimes-direct, r=estebank
Resolve lifetimes independently for each item-like.

Now that the heavy-lifting is done on the AST and during lowering, we do not need to perform HIR lifetime resolution on a full item at once.  Instead, we can treat each item-like independently, and look at `generics_of` the parent exceptionally for associated items.
2022-11-12 05:22:17 +00:00
bors
42325c525b Auto merge of #104293 - Manishearth:rollup-xj92d0k, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #95292 (Allow specialized const trait impls.)
 - #100386 (Make `Sized` coinductive, again)
 - #102215 (Implement the `+whole-archive` modifier for `wasm-ld`)
 - #103468 (Fix unused lint and parser caring about spaces to won't produce invalid code)
 - #103531 (Suggest calling the instance method of the same name when method not found)
 - #103960 (piece of diagnostic migrate)
 - #104051 (update Miri)
 - #104129 (rustdoc: use javascript to layout notable traits popups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-11 20:11:07 +00:00
Camille GILLOT
ba46b68373 Skip stable hashing without incremental. 2022-11-11 20:03:33 +00:00
bors
7d85104b96 Auto merge of #104289 - Dylan-DPC:rollup-v7wei2t, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #100633 (Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`)
 - #103445 (`#[test]`: Point at return type if `Termination` bound is unsatisfied)
 - #103924 (Fix broken link in description of error code E0706)
 - #104146 (Retry binding TCP Socket in remote-test-server)
 - #104169 (Migrate `:target` rules to use CSS variables)
 - #104202 (Fix ICE #103748)
 - #104216 (Don't ICE on operator trait methods with generic methods)
 - #104217 (Display help message when fluent arg was referenced incorrectly)
 - #104245 (Reduce default configuration's dependency upon static libstdcpp library (#103606))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-11 17:29:10 +00:00
Michael Goulet
93921dd16d Don't ICE with inline const errors during MIR build 2022-11-11 17:21:58 +00:00
Manish Goregaokar
a13809ae51
Rollup merge of #103960 - AndyJado:var_path_only_diag, r=davidtwco
piece of diagnostic migrate

r? `@davidtwco`
2022-11-11 12:12:30 -05:00
Manish Goregaokar
f00897e2f4
Rollup merge of #103531 - chenyukang:yukang/fix-103474, r=estebank
Suggest calling the instance method of the same name when method not found

Fixes #103474
2022-11-11 12:12:30 -05:00
Manish Goregaokar
fd5ff82f28
Rollup merge of #103468 - chenyukang:yukang/fix-103435-extra-parentheses, r=estebank
Fix unused lint and parser caring about spaces to won't produce invalid code

Fixes #103435
2022-11-11 12:12:29 -05:00
Manish Goregaokar
9553fea23a
Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=estebank
Implement the `+whole-archive` modifier for `wasm-ld`

This implements the `Linker::{link_whole_staticlib,link_whole_rlib}` methods for the `WasmLd` linker used on wasm targets. Previously these methods were noops since I think historically `wasm-ld` did not have support for `--whole-archive` but nowadays it does, so the flags are passed through.
2022-11-11 12:12:29 -05:00
Manish Goregaokar
76ce198128
Rollup merge of #100386 - compiler-errors:sized-coinductive-redux, r=lcnr
Make `Sized` coinductive, again

A revival of #83647

---

What exactly makes co-induction sound? Better question: are there any unsoundness risks from this? `Sized` can't be implemented by custom `impl` blocks, nor can it be conditionally implemented based on anything other than child fields being `Sized`, right?

r? `@nikomatsakis` for whenever he gets back from vacation
2022-11-11 12:12:28 -05:00
Manish Goregaokar
cd30ccf974
Rollup merge of #95292 - BGR360:const-trait-specialize, r=lcnr
Allow specialized const trait impls.

Fixes #95186.
Fixes #95187.

I've done my best to create a comprehensive test suite for the interaction between `min_specialization` and `const_trait_impls`. I wouldn't be surprised if there are interesting cases I haven't tested, please let me know.
2022-11-11 12:12:27 -05:00
clubby789
b2da155a9a Introduce ExprKind::IncludedBytes 2022-11-11 16:31:32 +00:00
Dylan DPC
6026785b7a
Rollup merge of #104217 - Nilstrieb:funny-dollar-syntax, r=TaKO8Ki
Display help message when fluent arg was referenced incorrectly

The fluent argument syntax is a little special and easy to get wrong, so we emit a small help message when someone gets it wrong.

Example:
```
parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}`
```
panics with
```
thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter`
help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead
attr: `None`
args: `FluentArgs([("delimiter", String("}"))])`
errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21
```

fixes #103539
2022-11-11 20:51:41 +05:30
Dylan DPC
e83b4765c3
Rollup merge of #104216 - Nilstrieb:dont-ice-invalid-operator-traits, r=estebank
Don't ICE on operator trait methods with generic methods

Emit a fatal error instead.
fixes #104213
2022-11-11 20:51:41 +05:30
Dylan DPC
f3931c8be5
Rollup merge of #104202 - camsteffen:103748, r=estebank
Fix ICE #103748

Fixes #103748
2022-11-11 20:51:40 +05:30
Dylan DPC
6e819af3a7
Rollup merge of #103924 - PeteDevoy:patch-1, r=estebank
Fix broken link in description of error code E0706

Corresponding subsection in async book is `07.05` not `07.06`.

The information on the linked page is the same so it may be reasonable to remove the whole sentence.
2022-11-11 20:51:39 +05:30
Dylan DPC
bc9567fbf6
Rollup merge of #103445 - fmease:fix-50291, r=estebank
`#[test]`: Point at return type if `Termination` bound is unsatisfied

Together with #103142 (already merged) this fully fixes #50291.

I don't consider my current solution of changing a few spans “here and there” very clean since the
failed obligation is a `FunctionArgumentObligation` and we point at a type instead of a function argument.

If you agree with me on this point, I can offer to keep the spans of the existing nodes and instead inject
`let _: AssertRetTyIsTermination<$ret_ty>;` (type to be defined in `libtest`) similar to `AssertParamIsEq` etc.
used by some built-in derive-macros.

I haven't tried that approach yet though and cannot promise that it would actually work out or
be “cleaner” for that matter.

````@rustbot```` label A-libtest A-diagnostics
r? ````@estebank````
2022-11-11 20:51:38 +05:30
Dylan DPC
978e7abece
Rollup merge of #100633 - estebank:must_use_async_fn_return, r=tmandry
Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`

No longer lint against `#[must_use] async fn foo()`.

When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.

Fix #78149.
2022-11-11 20:51:38 +05:30
Oli Scherer
df2adc4760 Print all labels, even if they have no span. Fall back to main item's span. 2022-11-11 14:45:28 +00:00
Oli Scherer
21ce58732b Don't add message that will never be shown to users
It will still be used in json, as seen by the ui test changes
2022-11-11 14:45:28 +00:00
Oli Scherer
014f7f4092 Remove some redundant arguments 2022-11-11 14:17:27 +00:00
bors
742d3f02c2 Auto merge of #102872 - mikebenfield:better-get-discr, r=nagisa
rustc_codegen_ssa: Better code generation for niche discriminants.

In some cases we can avoid arithmetic before checking whether a niche is a tag.

Also rename some identifiers around niches.

This is relevant to #101872
2022-11-11 13:50:32 +00:00
Camille GILLOT
9d86e6abaf Use the interned stable hash as plain hash. 2022-11-11 13:02:37 +00:00
Camille GILLOT
d47424b833 Hash spans when interning. 2022-11-11 13:02:37 +00:00
Camille GILLOT
c42a4245cc Do not rename bound variables when verbose-printing binders. 2022-11-11 13:02:37 +00:00
León Orell Valerian Liehr
c2b906ba9a
Recover from fn ptr tys with generic param list 2022-11-11 13:42:40 +01:00
Camille GILLOT
6c95805a34 Clean-up formatting. 2022-11-11 10:32:49 +00:00
Camille GILLOT
60892e8b1d Visit opaque types during type collection too. 2022-11-11 10:29:27 +00:00
Jannis Christopher Köhl
3c6d1a723d Add test for repr(transparent) with scalar 2022-11-11 11:24:31 +01:00
Camille GILLOT
3075f03513 Resolve lifetimes using the regular logic for RPIT. 2022-11-11 10:12:28 +00:00
Camille GILLOT
44c10e4cb0 Resolve lifetimes independently for each item-like. 2022-11-11 10:11:50 +00:00
Camille GILLOT
0ff1d1e122 Tweak signatures in rustc_middle::hir::map. 2022-11-11 10:10:16 +00:00
Florian Bartels
84e1fbcadf Add no_std AArch64 support for the QNX Neutrino (nto) 7.1 RTOS
This change allows to compile no_std applications for the QNX Neutrino
realtime operating system for ARM 64 bit CPUs.
Tested with QNX Neutrino 7.1.
2022-11-11 10:44:48 +01:00
Michael Benfield
51918dcc51 rustc_codegen_ssa: Better code generation for niche discriminants.
In some cases we can avoid arithmetic before checking whether a niche
represents an untagged variant.

This is relevant to #101872
2022-11-11 05:54:30 +00:00
bors
b7b7f2716e Auto merge of #103898 - Nilstrieb:match-macro, r=nnethercote
Retry failed macro matching for diagnostics

When a declarative macro fails to match, retry the matching to collect diagnostic info instead of collecting it on the fly in the hot path. Split out of #103439.

You made a bunch of changes to declarative macro matching, so
r? `@nnethercote`

This change should produce a few small perf wins: https://github.com/rust-lang/rust/pull/103439#issuecomment-1294249602
2022-11-11 04:54:59 +00:00
bors
5b82ea74b7 Auto merge of #99918 - WaffleLapkin:fnFnfun, r=estebank
Recover wrong-cased keywords that start items

(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)

r? `@estebank`

We've talked a bit about this recovery, but I just wanted to make sure that this is the right approach :)

For now I've only added the case insensitive recovery to `use`s, since most other items like `impl` blocks, modules, functions can start with multiple keywords which complicates the matter.
2022-11-11 02:07:52 +00:00
Esteban Küber
8bd8484972 review comments 2022-11-10 18:06:59 -08:00
Esteban Küber
243496e129 Consider #[must_use] annotation on async fn as also affecting the Future::Output
No longer lint against `#[must_use] async fn foo()`.

When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.

Fix #78149.
2022-11-10 18:01:03 -08:00
Esteban Küber
50bb7a40e1 Tweak span for #[must_use]
Do not point at whole statement, only at the expression (skip pointing at `;`)
2022-11-10 18:01:02 -08:00
Takayuki Maeda
6018f115aa emit errors when using RangeFrom and RangeTo 2022-11-11 10:51:02 +09:00
Takayuki Maeda
004986b79b avoid unnecessary format! 2022-11-11 10:51:02 +09:00
Takayuki Maeda
c467006fd0 suggest removing unnecessary . to use a floating point literal 2022-11-11 10:51:00 +09:00
Michael Goulet
fea8d0eb99 More nits 2022-11-10 21:29:20 +00:00
lcnr
0f2e45b18f make Sized coinductive 2022-11-10 21:18:06 +00:00
Michael Goulet
9c8037c430 Deduce closure signature from TAIT supertraits 2022-11-10 20:24:41 +00:00
Michael Goulet
55f1f993ff More accurately report error when formal and expected signature types differ 2022-11-10 20:21:31 +00:00
Michael Goulet
312d6b8e9a Don't emit coerce suggestions for a type into itself 2022-11-10 20:21:13 +00:00
bors
c1a859b25a Auto merge of #104164 - cjgillot:u64-cache, r=compiler-errors
Use 64 bits for incremental cache in-file positions

We currently use a 32-bit integer to encode byte positions into the incremental cache.
This is not enough when the query chache file is >4GB.

As the overflow check was a `debug_assert`, it was removed in released compilers, making compilation succeed silently.
At the next compilation, cache decoding would try to read unrelated data because of garbled file position, triggering an ICE.

Fixes https://github.com/rust-lang/rust/issues/79786
(I'm closing that bug since it the original report and the subsequent questions are probably different instances. A new bug should be opened for new instances of that ICE.)
2022-11-10 20:13:42 +00:00
Michael Goulet
033cf9880d Support DoubleEndedIterator for subst_iter and subst_iter_copied 2022-11-10 19:36:14 +00:00
Ben Reeves
fe53cacff9 Apply PR feedback. 2022-11-10 12:56:33 -06:00
Ben Reeves
c0ae62ee95 Require ~const qualifier on trait bounds in specializing impls if present in base impl. 2022-11-10 12:37:07 -06:00
Ben Reeves
ce03d259da Disallow specializing on const impls with non-const impls. 2022-11-10 12:37:06 -06:00
Ben Reeves
5c25d30f6f Allow specialized const trait impls.
Fixes #95186.
Fixes #95187.
2022-11-10 12:37:06 -06:00
Jannis Christopher Köhl
8ecb276735 Simplify creation of map 2022-11-10 19:12:10 +01:00
Charles Lew
3074678cd1 Mark trait_upcasting feature no longer incomplete. 2022-11-11 00:35:08 +08:00
Manish Goregaokar
ea56e80726
Rollup merge of #104235 - compiler-errors:more-ct-guar, r=oli-obk
Use `const_error_with_guaranteed` more

Better to pass down an ErrorGuaranteed rather than making a new one out of thin air, for some usages. Also for the ones where we *do* need to delay a bug, that delayed bug will have a more descriptive message.
2022-11-10 10:47:42 -05:00
Manish Goregaokar
77fde5d49a
Rollup merge of #104233 - compiler-errors:issue-104209, r=lcnr
Don't ICE when encountering `ConstKind::Error` in `RequiredConstsVisitor`

Fixes #104209
2022-11-10 10:47:41 -05:00
Manish Goregaokar
c6595ea22a
Rollup merge of #104194 - BoxyUwU:early_binder_docs, r=compiler-errors
`EarlyBinder` docs
2022-11-10 10:47:41 -05:00
Manish Goregaokar
819c9315c3
Rollup merge of #104186 - chenyukang:yukang/fix-104086-let-binding-issue, r=oli-obk
Tighten the 'introduce new binding' suggestion

Fixes #104086
2022-11-10 10:47:40 -05:00
Manish Goregaokar
8f2c1f8469
Rollup merge of #104077 - nicholasbishop:bishop-uefi-aapcs, r=nagisa
Use aapcs for efiapi calling convention on arm

On arm, [llvm treats the C calling convention as `aapcs` on soft-float targets and `aapcs-vfp` on hard-float targets](https://github.com/rust-lang/compiler-builtins/issues/116#issuecomment-261057422). UEFI specifies in the arm calling convention that [floating point extensions aren't used](https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention), so always translate `efiapi` to `aapcs` on arm.

https://github.com/rust-lang/rust/issues/65815
2022-11-10 10:47:39 -05:00
Manish Goregaokar
529f7149d2
Rollup merge of #104036 - compiler-errors:option-sugg, r=petrochenkov
Suggest `is_some` when we've found `Option` but expected `bool`

Thanks `@lunasorcery` for the suggestion.
2022-11-10 10:47:38 -05:00
Manish Goregaokar
9c0e783f6d
Rollup merge of #103863 - compiler-errors:fulfillcx-less, r=wesleywiser
Use `TraitEngine` in more places, restrict visibility of `FulfillmentCtxt` constructor

Most places that are constructing a `FulfillmentContext` should be constructing a `TraitEngine` generically, so later on if/when we're transitioning it'll be easier.

Logical extension of #99746
2022-11-10 10:47:37 -05:00
Manish Goregaokar
a7cd4f2edf
Rollup merge of #101939 - zhaixiaojuan:loongarch64-abi, r=oli-obk
Add loongarch64 abi support
2022-11-10 10:47:36 -05:00
Boxy
2566701e33 broken links go brrrrr 2022-11-10 14:57:18 +00:00
bors
01a6f30324 Auto merge of #104236 - compiler-errors:rollup-adjshd6, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #102763 (Some diagnostic-related nits)
 - #103443 (Parser: Recover from using colon as path separator in imports)
 - #103675 (remove redundent "<>" for ty::Slice with reference type)
 - #104046 (bootstrap: add support for running Miri on a file)
 - #104115 (Migrate crate-search element to CSS variables)
 - #104190 (Ignore "Change InferCtxtBuilder from enter to build" in git blame)
 - #104201 (Add check in GUI test for file loading failure)
 - #104211 (⬆️ rust-analyzer)
 - #104231 (Update mailmap)

Failed merges:

 - #104169 (Migrate `:target` rules to use CSS variables)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-10 13:04:51 +00:00
Michael Goulet
f9160224cf
Rollup merge of #103675 - lyming2007:issue-103271-fix, r=fee1-dead
remove redundent "<>" for ty::Slice with reference type

this fix #103271
2022-11-09 21:53:35 -08:00
Michael Goulet
0c4a81c97b
Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, r=compiler-errors
Parser: Recover from using colon as path separator in imports

I don't know if this is the right approach, any feedback is welcome.

r? ```@compiler-errors```

Fixes #103269
2022-11-09 21:53:34 -08:00
Michael Goulet
e5ecf629dd
Rollup merge of #102763 - compiler-errors:nits, r=cjgillot
Some diagnostic-related nits

1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>`
2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller.

idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-09 21:53:34 -08:00
Michael Goulet
f902b495ba Don't print full paths in overlap errors 2022-11-10 05:41:09 +00:00
Michael Goulet
0f89fb1791 Use const_error_with_guaranteed more 2022-11-10 05:39:15 +00:00
bors
11fa0850f0 Auto merge of #103636 - chenyukang:yukang/fix-103587-sugg-if-let, r=jackh276,davidtwco
Recover from common if let syntax mistakes/typos

Fixes #103587
2022-11-10 05:19:10 +00:00
Michael Goulet
31157def1a Don't ICE when encountering ConstKind::Error in RequiredConstsVisitor 2022-11-10 05:14:04 +00:00
Michael Goulet
ed17c6b1c3 Use TraitEngine in more places, make FulfillmentCtxt constructor more private 2022-11-10 04:26:43 +00:00
bors
5eef9b2c50 Auto merge of #101990 - clubby789:dont-machine-apply-placeholder-method, r=compiler-errors
Fix auto-application of associated generic functions with placeholders

Fixes #101920
2022-11-10 02:05:38 +00:00
Yiming Lei
0b6934d6c6 remove redundent "<>" for ty::Slice with reference type
this fix #103271
2022-11-09 17:42:17 -08:00
Bryan Garza
509b9478f5 Refactor nested for-loops into find() calls 2022-11-10 00:13:48 +00:00
Bryan Garza
fa99cb8269 Allow and add track_caller to generators
This patch allows the usage of the `track_caller` annotation on
generators, as well as sets them conditionally if the parent also has
`track_caller` set.

Also add this annotation on the `GenFuture`'s `poll()` function.
2022-11-09 23:27:14 +00:00
Michael Goulet
63217e08cc make dropck_outlives into a proper canonicalized type query 2022-11-09 22:58:39 +00:00
Michael Goulet
ed6a7cc228 Remove save_and_restore_in_snapshot_flag 2022-11-09 22:58:39 +00:00
Nilstrieb
bd3c4fb2f6
Display help message when fluent arg was referenced incorrectly
The fluent argument syntax is a little special and easy to get wrong, so
we emit a small help message when someone gets it wrong.

Example:
```
parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}`
```
panics with
```
thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter`
help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead
attr: `None`
args: `FluentArgs([("delimiter", String("}"))])`
errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21
```
2022-11-09 22:38:10 +01:00
Nilstrieb
cedaaa640e
Don't ICE on operator trait methods with generic methods
Emit a fatal error instead.
2022-11-09 22:01:58 +01:00
Manish Goregaokar
70c04a2fd1
Rollup merge of #104184 - jyn514:rustdoc-version, r=davidtwco
Fix `rustdoc --version` when used with download-rustc

Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.

cc https://github.com/rust-lang/rust/issues/103206#issuecomment-1284123084
2022-11-09 15:39:07 -05:00
Manish Goregaokar
a709cc1f32
Rollup merge of #104156 - oli-obk:autoderef, r=estebank
Cleanups in autoderef impl

Just something I noticed. Turns out the `overloaded_span` is not actually used separately from the main span, so I merged them.
2022-11-09 15:39:06 -05:00
Manish Goregaokar
bfd637a3cf
Rollup merge of #104020 - nicholasbishop:bishop-limit-efiapi, r=nagisa
Limit efiapi calling convention to supported arches

Supported architectures in UEFI are described here:
https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions

https://github.com/rust-lang/rust/issues/65815
2022-11-09 15:39:05 -05:00
Manish Goregaokar
67c0bff934
Rollup merge of #104015 - alex:remove-kernel, r=oli-obk
Remove linuxkernel targets

These are not used by the actual Rust-for-Linux project, so they're mostly just confusing.
2022-11-09 15:39:05 -05:00
Manish Goregaokar
017c9aa4a0
Rollup merge of #103929 - BlackHoleFox:apple-targets-cleanup, r=petrochenkov
Cleanup Apple-related code in rustc_target

While working on https://github.com/rust-lang/rust/pull/103455, the consistency of the `rustc_target` code for Apple's platforms was "kind of bad." There were two "base" files (`apple_base.rs` and `apple_sdk_base.rs`) that the targets each pulled some parts out of, each and all of them were written slightly differently, and sometimes missed comments other implementations had.

So to hopefully make future maintenance, like implementing https://github.com/rust-lang/compiler-team/issues/556, easier, this makes all of them use similar patterns and the same target base logic everywhere instead of picking bits from both. This also has some other smaller upsides like less stringly-typed functions.
2022-11-09 15:39:04 -05:00
Manish Goregaokar
3f11d39eec
Rollup merge of #103464 - JakobDegen:mir-parsing, r=oli-obk
Add support for custom mir

This implements rust-lang/compiler-team#564 . Details about the design, motivation, etc. can be found in there.

r? ```@oli-obk```
2022-11-09 15:39:03 -05:00
Manish Goregaokar
46bc12c95a
Rollup merge of #103307 - b4den:master, r=estebank
Add context to compiler error message

Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-09 15:39:02 -05:00
Manish Goregaokar
2206267c31
Rollup merge of #101005 - SLASHLogin:rustc_codegen_llvm_diagnostics, r=davidtwco
Migrate rustc_codegen_llvm to SessionDiagnostics

WIP: Port current implementation of diagnostics to the new SessionDiagnostics.

Part of #100717

```@rustbot``` label +A-translation
2022-11-09 15:39:02 -05:00
Nilstrieb
07a47e0708
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.
2022-11-09 21:28:07 +01:00
Michael Goulet
38ada60eb6 Suggest is_some or let when encountering Option and bool type mismatch 2022-11-09 20:00:24 +00:00
Michael Goulet
9568138069 rebase conflict 2022-11-09 19:42:23 +00:00