-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement unstable trait impl #140399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement unstable trait impl #140399
Conversation
d01f12a
to
9e139e1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
486d3d3
to
02f780f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
567ec89
to
80fd239
Compare
☔ The latest upstream changes (presumably #142299) made this pull request unmergeable. Please resolve the merge conflicts. |
850e3e1
to
27d9e21
Compare
fd34b00
to
a90c483
Compare
☔ The latest upstream changes (presumably #143091) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add PR description providing an outline of the approach
apart from that, a few minor nits, after this r=me :3
Thank you for working on this ❤️
// enabled that we do not. | ||
// | ||
// Note: we don't consider a feature to be enabled | ||
// if we are in std/core even if there is a corresponding `feature` attribute on the crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future work: we likely want an #[rustc_allow_internal_unstable(foo)]
attribute which only adds UnstableFeature
clauses to the param_env, but not predicates_of
.
tests/ui/unstable-feature_bound/unstable-feature-cross-crate-multiple-symbol.rs
Outdated
Show resolved
Hide resolved
tests/ui/unstable-feature_bound/unstable-feature-cross-crate-require-bound.rs
Show resolved
Hide resolved
tests/ui/unstable-feature_bound/auxiliary/unstable_impl_codegen_aux2.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: lcnr <rust@lcnr.de>
compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: lcnr <rust@lcnr.de>
|
||
let mut err = self.dcx().struct_span_err( | ||
span, | ||
format!("unstable feature `{sym}` is used without being enabled."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try to mirror the existing errors for unstable library features if staged_api
is not enabled
error[E0658]: use of unstable library feature `slice_partition_dedup`
--> src/main.rs:3:7
|
3 | x.partition_dedup();
| ^^^^^^^^^^^^^^^
|
= note: see issue #54279 <https://github.com/rust-lang/rust/issues/54279> for more information
= help: add `#![feature(slice_partition_dedup)]` to the crate attributes to enable
= note: this compiler was built on 2025-07-02; consider upgrading it if it is out of date
not sure whehter you could even reuse the reporting machinery we already use for methods etc
@@ -0,0 +1,12 @@ | |||
//@ aux-build:unstable_feature.rs | |||
extern crate unstable_feature; | |||
use unstable_feature::{Foo, Bar, Moo}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use unstable_feature::{Foo, Bar, Moo}; | |
use unstable_feature::{Bar, Moo}; |
//@ check-pass | ||
#![feature(feat_bar, feat_moo)] | ||
extern crate unstable_feature; | ||
use unstable_feature::{Foo, Bar}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use unstable_feature::{Foo, Bar}; | |
use unstable_feature::Bar; |
tests/ui/unstable-feature_bound/unstable_impl_coherence_inherence.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few more nits
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
Co-authored-by: lcnr <rust@lcnr.de>
This PR allows marking impls of stable trait with stable type as unstable.
The design and mentoring are done by @BoxyUwU