rust/tests
bors 014bd8290f Auto merge of #140399 - tiif:unstable_impl, r=lcnr,BoxyUwU
Implement unstable trait impl

This PR allows marking impls of stable trait with stable type as unstable.

## Approach

In std/core, an impl can be marked as unstable by annotating it with ``#[unstable_feature_bound(feat_name)]``. This will add a ``ClauseKind::Unstable_Feature(feat_name)`` to the list of predicates in ``predicates_of`` .

When an unstable impl's function is called, we will first iterate through all the goals in ``param_env`` to check if there is any ``ClauseKind::UnstableFeature(feat_name)`` in ``param_env``.

The existence of ``ClauseKind::Unstable_Feature(feat_name)`` in ``param_env`` means an``#[unstable_feature_bound(feat_name)]`` is present at the call site of the function, so we allow the check to succeed in this case.

If ``ClauseKind::UnstableFeature(feat_name)`` does not exist in ``param_env``, we will still allow the check to succeed for either of the cases below:
1. The feature is enabled through ``#[feature(feat_name)]`` outside of std / core.
2. We are in codegen because we may be monomorphizing a body from an upstream crate which had an unstable feature enabled that the downstream crate do not.

For the rest of the case, it will fail with ambiguity.

## Limitation

In this PR, we do not support:
1. using items that need ``#[unstable_feature_bound]`` within stable APIs
2. annotate main function with ``#[unstable_feature_bound]``
3. annotate ``#[unstable_feature_bound]`` on items other than free function and impl

## Acknowledgement
The design and mentoring are done by `@BoxyUwU`
2025-07-17 01:57:55 +00:00
..
assembly emit .att_syntax when global/naked asm use that option 2025-07-09 01:09:55 +02:00
auxiliary make cfg_select a builtin macro 2025-07-13 14:34:40 +02:00
codegen Rollup merge of #143718 - scottmcm:ub-transmute-is-ub, r=WaffleLapkin 2025-07-11 07:35:22 +02:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage Remove let_chains feature 2025-06-30 07:49:20 -05:00
coverage-run-rustdoc
crashes Remove support for dyn* 2025-07-01 19:00:21 +00:00
debuginfo tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Update SUMMARY.md 2025-07-14 12:01:41 +03:00
pretty Rewrite empty attribute lint 2025-07-06 09:51:35 +02:00
run-make Rollup merge of #143837 - jieyouxu:symbol-apis, r=ChrisDenton 2025-07-15 12:52:39 +02:00
rustdoc Add regression test for #143107 2025-07-10 11:41:50 +02:00
rustdoc-gui Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
rustdoc-js Migrate some tests away from concat-idents 2025-06-24 10:54:54 +00:00
rustdoc-js-std add doc(alias("AsciiChar")) to core::ascii::Char 2025-06-20 11:11:51 -05:00
rustdoc-json rustdoc-json: Structured attributes 2025-07-15 16:52:41 +00:00
rustdoc-ui refactor: Make -Ztrack-diagnostics emit like a note 2025-07-03 07:19:25 -06:00
ui Auto merge of #140399 - tiif:unstable_impl, r=lcnr,BoxyUwU 2025-07-17 01:57:55 +00:00
ui-fulldeps rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
COMPILER_TESTS.md