Commit graph

7390 commits

Author SHA1 Message Date
Michael Goulet 5f3357c3c6 Resolve const lifetimes to static in trait too 2024-06-14 11:05:35 -04:00
Michael Goulet 805397c16f Add more tests 2024-06-14 11:05:35 -04:00
Michael Goulet 4f97ab54c4 Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope 2024-06-14 11:05:35 -04:00
bors f9515fdd5a Auto merge of #126473 - matthiaskrgr:rollup-8w2xm09, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123769 (Improve escaping of byte, byte str, and c str proc-macro literals)
 - #126054 (`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration)
 - #126135 (add HermitOS support for vectored read/write operations)
 - #126266 (Unify guarantees about the default allocator)
 - #126285 (`UniqueRc`: support allocators and `T: ?Sized`.)
 - #126399 (extend the check for LLVM build)
 - #126426 (const validation: fix ICE on dangling ZST reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 11:29:58 +00:00
Matthias Krüger aebd794d15
Rollup merge of #126426 - RalfJung:dangling-zst-ice, r=oli-obk
const validation: fix ICE on dangling ZST reference

Fixes https://github.com/rust-lang/rust/issues/126393
I'm not super happy with this fix but I can't think of a better one.

r? `@oli-obk`
2024-06-14 12:23:38 +02:00
Matthias Krüger bfe032334f
Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, r=fee1-dead
`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration

Fixes #113073

This PR suggests  `impl<T: Bound> Trait<T> for Foo` when finding `impl Trait<T: Bound> for Foo`. Tangentially, it also improves a handful of other error messages.

It accomplishes this in two steps:
1. Check if constrained arguments and parameter names appear in the same order and delay emitting "incorrect number of generic arguments" error because it can be confusing for the programmer to see `0 generic arguments provided` when there are `n` constrained generic arguments.

2. Inside `E0229`, suggest declaring the type parameter right after the `impl` keyword by finding the relevant impl block's span for type parameter declaration. This also handles lifetime declarations correctly.

Also, the multi part suggestion doesn't use the fluent error mechanism because translating all the errors to fluent style feels outside the scope of this PR. I will handle it in a separate PR if this gets approved.
2024-06-14 12:23:36 +02:00
Matthias Krüger 20ca54b6a6
Rollup merge of #123769 - dtolnay:literal, r=fee1-dead
Improve escaping of byte, byte str, and c str proc-macro literals

This PR changes the behavior of `proc_macro::Literal::byte_character` (https://github.com/rust-lang/rust/issues/115268), `byte_string`, and `c_string` (https://github.com/rust-lang/rust/issues/119750) to improve their choice of escape sequences. 3 categories of changes are made:

1. Never use `\x00`. Always prefer `\0`, which is supported in all the same places.

2. Never escape `\'` inside double quotes and `\"` inside single quotes.

3. Never use `\x` for valid UTF-8 in literals that permit `\u`.

The second commit adds tests covering these cases, asserting the **old** behavior.

The third commit implements the behavior change and simultaneously updates the tests to assert the **new** behavior.
2024-06-14 12:23:35 +02:00
bors 63491e1012 Auto merge of #126463 - matthiaskrgr:rollup-lnkfibf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #124884 (place explicit lifetime bound after generic param)
 - #126343 (Remove some msys2 utils)
 - #126351 (std::unix::fs::link using direct linkat call for Solaris.)
 - #126368 (Remove some unnecessary crate dependencies.)
 - #126386 (Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 09:19:38 +00:00
Matthias Krüger edd4c97b81
Rollup merge of #126386 - GuillaumeGomez:migrate-run-make-allow-non-lint-warnings-cmdline, r=jieyouxu
Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-06-14 08:35:50 +02:00
Matthias Krüger 74e82328ce
Rollup merge of #124884 - bvanjoi:fix-124785, r=estebank
place explicit lifetime bound after generic param

Fixes #124785

An easy fix.
2024-06-14 08:35:48 +02:00
Matthias Krüger 2b3fb62b93
Rollup merge of #126320 - oli-obk:pat_ice, r=lcnr
Avoid ICES after reporting errors on erroneous patterns

fixes #109812
fixes #125914
fixes #124004
2024-06-14 08:35:48 +02:00
Matthias Krüger 0468462538
Rollup merge of #123962 - oli-obk:define_opaque_types5, r=lcnr
change method resolution to constrain hidden types instead of rejecting method candidates

Some of these are in probes and may affect inference. This is therefore a breaking change.

This allows new code to compile on stable:

```rust
trait Trait {}

impl Trait for u32 {}

struct Bar<T>(T);

impl Bar<u32> {
    fn foo(self) {}
}

fn foo(x: bool) -> Bar<impl Sized> {
    if x {
        let x = foo(false);
        x.foo();
        //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so
    }
    todo!()
}
```

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

fixes  #121404

cc https://github.com/rust-lang/rust/issues/116652
2024-06-14 08:35:46 +02:00
Ralf Jung a6907100de const validation: fix ICE on dangling ZST reference 2024-06-14 07:52:51 +02:00
Matthias Krüger 422da40294
Rollup merge of #126371 - estebank:suggest-core, r=fmease
Tweak output of import suggestions

When both `std::` and `core::` items are available, only suggest the `std::` ones. We ensure that in `no_std` crates we suggest `core::` items.

Ensure that the list of items suggested to be imported are always in the order of local crate items, `std`/`core` items and finally foreign crate items.

Tweak wording of import suggestion: if there are multiple items but they are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 22:55:46 +02:00
Matthias Krüger 977c5fd419
Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov
Add pub struct with allow(dead_code) into worklist

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Fixes #126289
2024-06-13 22:55:45 +02:00
Esteban Küber 5de8e6edfc Tweak output of import suggestions
When both `std::` and `core::` items are available, only suggest the
`std::` ones. We ensure that in `no_std` crates we suggest `core::`
items.

Ensure that the list of items suggested to be imported are always in the
order of local crate items, `std`/`core` items and finally foreign crate
items.

Tweak wording of import suggestion: if there are multiple items but they
are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 20:22:21 +00:00
David Tolnay 7ddc89e893
Remove superfluous escaping from byte, byte str, and c str literals 2024-06-13 09:49:15 -07:00
David Tolnay 2cc0284905
Add more Literal::to_string tests 2024-06-13 09:39:29 -07:00
David Tolnay 57106e4a46
Rename proc_macro::Literal tests from parse.rs to literal.rs
This module contains tests not just of parse (FromStr) but also
to_string (Display) for literals.
2024-06-13 09:39:27 -07:00
Waffle Lapkin ea98e42bfd rebase blessing 2024-06-13 14:43:16 +02:00
Guillaume Gomez eca8d209d9 Make run-make/allow-non-lint-warnings-cmdline into a ui test 2024-06-13 12:55:55 +02:00
Oli Scherer 9cf60ee9d3 Method resolution constrains hidden types instead of rejecting method candidates 2024-06-13 10:41:53 +00:00
Oli Scherer c75f7283bf Add some tests 2024-06-13 10:41:52 +00:00
Waffle Lapkin 268b556393 Bless a test 2024-06-13 12:24:31 +02:00
Waffle Lapkin 83f8f9f85d Implement lint for obligations broken by never type fallback change 2024-06-13 12:24:31 +02:00
Oli Scherer a6217011f6 Replace some Option<Diag> with Result<(), Diag> 2024-06-13 06:16:12 +00:00
Oli Scherer 2733b8ab8d Avoid follow-up errors on erroneous patterns 2024-06-13 06:14:32 +00:00
Jubilee d33ec8ed8c
Rollup merge of #126358 - jswrenn:fix-125811, r=compiler-errors
safe transmute: support `Single` enums

Previously, the implementation of `Tree::from_enum` incorrectly treated enums with `Variants::Single` and `Variants::Multiple` identically. This is incorrect for `Variants::Single` enums, which delegate their layout to that of a variant with a particular index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted to compute the tag of variants other than the one at `Variants::Single`'s `index`, and fell afoul of a sanity-checking assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`. This assertion is non-load-bearing, and can be removed; the routine its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent: calling `Tree::from_variant` on a variant that does not exist is ill-defined. A sanity check the given variant has `FieldShapes::Arbitrary` fails, and the analysis is (correctly) aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that `Tree::from_variant` is not called on variants that are, as far as layout is concerned, nonexistent. Specifically, the implementation of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the first case, `Tree::uninhabited()` is produced. In the second case, the layout is delegated to `Variants::Single`'s index.

Fixes #125811
2024-06-12 20:03:22 -07:00
Jubilee 100588ff31
Rollup merge of #126337 - oli-obk:nested_gat_opaque, r=lcnr
Add test for walking order dependent opaque type behaviour

r? ```@lcnr```

adding the test for your comment here: https://github.com/rust-lang/rust/pull/122366/files#r1521124754
2024-06-12 20:03:21 -07:00
Jubilee 25c55c51cb
Rollup merge of #126142 - compiler-errors:trait-ref-split, r=jackh726
Harmonize using root or leaf obligation in trait error reporting

When #121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation.

Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation.

This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓

r? ``@estebank``

Fixes #126129
2024-06-12 20:03:19 -07:00
Jack Wrenn fb662f2126 safe transmute: support Variants::Single enums
Previously, the implementation of `Tree::from_enum` incorrectly
treated enums with `Variants::Single` and `Variants::Multiple`
identically. This is incorrect for `Variants::Single` enums,
which delegate their layout to that of a variant with a particular
index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted
to compute the tag of variants other than the one at
`Variants::Single`'s `index`, and fell afoul of a sanity-checking
assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`.
This assertion is non-load-bearing, and can be removed; the routine
its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent:
calling `Tree::from_variant` on a variant that does not exist is
ill-defined. A sanity check the given variant has
`FieldShapes::Arbitrary` fails, and the analysis is (correctly)
aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that
`Tree::from_variant` is not called on variants that are, as far as
layout is concerned, nonexistent. Specifically, the implementation
of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the
first case, `Tree::uninhabited()` is produced. In the second case,
the layout is delegated to `Variants::Single`'s index.

Fixes #125811
2024-06-13 01:38:51 +00:00
Michael Goulet ae24ebe710 Rebase fallout 2024-06-12 21:17:33 -04:00
Michael Goulet 2c0348a0d8 Stop passing traitref/traitpredicate by ref 2024-06-12 20:57:24 -04:00
Michael Goulet 93d83c8f69 Bless and add ICE regression test 2024-06-12 20:57:23 -04:00
Michael Goulet c453c82de4 Harmonize use of leaf and root obligation in trait error reporting 2024-06-12 20:57:23 -04:00
Veera 5da1b4189e E0229: Suggest Moving Type Constraints to Type Parameter Declaration 2024-06-12 19:32:31 -04:00
Michael Goulet 44040a0670 Also passthrough for projection clauses 2024-06-12 19:10:02 -04:00
Michael Goulet b0c1474381 better error message for normalizes-to ambiguities 2024-06-12 19:03:37 -04:00
Michael Goulet 52b2c88bdf Walk into alias-eq nested goals even if normalization fails 2024-06-12 19:03:37 -04:00
Michael Goulet 306501044e
Rollup merge of #126276 - mu001999-contrib:dead/enhance, r=fee1-dead
Detect pub structs never constructed even though they impl pub trait with assoc constants

Extend dead code analysis to impl items of pub assoc constants.

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-12 14:26:26 -04:00
Michael Goulet 88984fe748
Rollup merge of #126019 - tbu-:pr_unsafe_env_fixme, r=fee1-dead
Add TODO comment to unsafe env modification

Addresses https://github.com/rust-lang/rust/pull/124636#issuecomment-2132119534.

I think that the diff display regresses a little, because it's no longer showing the `+` to show where the `unsafe {}` is added. I think it's still fine.

Tracking:
- https://github.com/rust-lang/rust/issues/124866

r? `@RalfJung`
2024-06-12 14:26:24 -04:00
Michael Goulet 7133257d4f
Rollup merge of #125869 - alexcrichton:add-p1-to-wasi-targets, r=wesleywiser
Add `target_env = "p1"` to the `wasm32-wasip1` target

This commit sets the `target_env` key for the
`wasm32-wasi{,p1,p1-threads}` targets to the string `"p1"`. This mirrors how the `wasm32-wasip2` target has `target_env = "p2"`. The intention of this is to more easily detect each target in downstream crates to enable adding custom code per-target.

cc #125803

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-12 14:26:24 -04:00
bors 1d43fbbc73 Auto merge of #126332 - GuillaumeGomez:rollup-bu1q4pz, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #126039 (Promote `arm64ec-pc-windows-msvc` to tier 2)
 - #126075 (Remove `DebugWithInfcx` machinery)
 - #126228 (Provide correct parent for nested anon const)
 - #126232 (interpret: dyn trait metadata check: equate traits in a proper way)
 - #126242 (Simplify provider api to improve llvm ir)
 - #126294 (coverage: Replace the old span refiner with a single function)
 - #126295 (No uninitalized report in a pre-returned match arm)
 - #126312 (Update `rustc-perf` submodule)
 - #126322 (Follow up to splitting core's PanicInfo and std's PanicInfo)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-12 15:58:32 +00:00
Tobias Bucher 4f5fb3126f Add TODO comment to unsafe env modification
Addresses https://github.com/rust-lang/rust/pull/124636#issuecomment-2132119534.

I think that the diff display regresses a little, because it's no longer
showing the `+` to show where the `unsafe {}` is added. I think it's
still fine.
2024-06-12 17:51:18 +02:00
Oli Scherer ffe5439330 Add test for walking order dependent opaque type behaviour 2024-06-12 15:32:25 +00:00
r0cky af106617f1 Detect pub structs never constructed even though they impl pub trait with assoc constants 2024-06-12 23:31:27 +08:00
Guillaume Gomez 876ef7f021
Rollup merge of #126295 - linyihai:uninitalized-in-match-arm, r=pnkfelix
No uninitalized report in a pre-returned match arm

This is a attemp to address https://github.com/rust-lang/rust/issues/126133
2024-06-12 15:45:01 +02:00
Guillaume Gomez c21de3c91e
Rollup merge of #126228 - BoxyUwU:nested_repeat_expr_generics, r=compiler-errors
Provide correct parent for nested anon const

Fixes #126147

99% of this PR is just comments explaining what the issue is.

`tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering.

So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results.

Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now)

r? ````@compiler-errors````
2024-06-12 15:44:58 +02:00
Guillaume Gomez 99d0feedb8
Rollup merge of #126075 - compiler-errors:remove-debugwithinfcx, r=lcnr
Remove `DebugWithInfcx` machinery

This PR removes `DebugWithInfcx` after having a lot of second thoughts about it due to recent type system uplifting work. We could add it back later if we want, but I don't think the amount of boilerplate in the complier and the existence of (kindof) hacks like `NoInfcx` currently justify the existence of `DebugWithInfcx`, especially since it's not even being used anywhere in the compiler currently.

The motivation for `DebugWithInfcx` is that we want to be able to print infcx-aware information, such as universe information[^1] (though if there are other usages that I'm overlooking, please let me know). I think there are probably more tailored solutions that can specifically be employed in places where this infcx-aware printing is necessary. For example, one way of achieving this is by implementing a custom `FmtPrinter` which overloads `ty_infer_name` (perhaps also extending it to have overrideable stubs for printing placeholders too) to print the `?u.i` name for an infer var. This will necessitate uplifting `Print` from `rustc_middle::ty::print`, but this seems a bit more extensible and reusable than `DebugWithInfcx`.

One of the problems w/ `DebugWithInfcx` is its opt-in-ness. Even if a compiler dev adds a new `debug!(ty)` in a context where there is an `infcx` we can access, they have to *opt-in* to using `DebugWithInfcx` with something like `debug!(infcx.with(ty))`. This feels to me like it risks a lot of boilerplate, and very easy to just forget adding it at all, especially in cases like `#[instrument]`.

A second problem is the `NoInfcx` type itself. It's necessary to have this dummy infcx implementation since we often want to print types outside of the scope of a valid `Infcx`. Right now, `NoInfcx` is only *partially* a valid implementation of `InferCtxtLike`, except for the methods that we specifically need for `DebugWithInfcx`. As I work on uplifting the trait solver, I actually want to add a lot more methods to `InferCtxtLike` and having to add `unreachable!("this should never be called")` stubs for uplifted methods like `next_ty_var` is quite annoying.

In reality, I actually only *really* care about the second problem -- we could, perhaps, instead just try to get rid of `NoInfcx` and just just duplicate `Debug` and `DebugWithInfcx` for most types. If we're okay with duplicating all these implementations (though most of them would just be trivial `#[derive(Debug, DebugWithInfcx)]`), I'd be okay with that too 🤔

r? `@BoxyUwU` `@lcnr` would like to know your thoughts -- happy to discuss this further, mainly trying to bring this problem up

[^1]: Which in my experience is only really necessary when we're debugging things like generalizer bugs.
2024-06-12 15:44:58 +02:00
bors 0285dab54f Auto merge of #125141 - SergioGasquez:feat/no_std-xtensa, r=davidtwco
Add no_std Xtensa targets support

Adds no_std Xtensa targets. This enables using Rust on ESP32, ESP32-S2 and ESP32-S3 chips.

Tier 3 policy:

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

`@MabezDev` and I (`@SergioGasquez)` will maintain the targets.

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

The target triple is consistent with other targets.

> 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.
> If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

We follow the same naming convention as other targets.

> 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 does not introduce any legal issues.

> The target must not introduce license incompatibilities.

There are no license incompatibilities

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

Everything added is under that licenses

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

Requirements are not changed for any other target.

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

The linker used by the targets is the GCC linker from the GCC toolchain cross-compiled for Xtensa. GNU GPL.

> "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 such terms exist for this target

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

Understood

> 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 target already implements core.

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

Here is how to build for the target https://docs.esp-rs.org/book/installation/riscv-and-xtensa.html and it also covers how to run binaries on the target.

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

Understood

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

No other targets should be affected

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target.

It can produce assembly, but it requires a custom LLVM with Xtensa support (https://github.com/espressif/llvm-project/). The patches are trying to be upstreamed (https://github.com/espressif/llvm-project/issues/4)
2024-06-12 13:43:31 +00:00