Skip to content

Commit 2d0c0e7

Browse files
committedJan 10, 2025·
fix rustc_const_stable_indirect message
1 parent f9de1b6 commit 2d0c0e7

File tree

256 files changed

+18
-349348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+18
-349348
lines changed
 

‎compiler/rustc_middle/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ middle_const_not_used_in_type_alias =
5252
5353
middle_const_unstable_in_const_stable_exposed =
5454
const function that might be (indirectly) exposed to stable cannot use `#[feature({$gate})]`
55-
.is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
55+
.is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
5656
.unstable_sugg = if the {$is_function_call2 ->
5757
[true] caller
5858
*[false] function

‎compiler/rustc_middle/src/middle/stability.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl<'tcx> TyCtxt<'tcx> {
613613
) {
614614
// This should work pretty much exactly like the function stability logic in
615615
// `compiler/rustc_const_eval/src/check_consts/check.rs`.
616-
// FIXME: Find some way to not duplicate that logic.
616+
// FIXME(const_trait_impl): Find some way to not duplicate that logic.
617617
let Some(ConstStability {
618618
level: attr::StabilityLevel::Unstable { implied_by: implied_feature, .. },
619619
feature,
@@ -623,14 +623,11 @@ impl<'tcx> TyCtxt<'tcx> {
623623
return;
624624
};
625625

626-
let unstable_feature_allowed = span.allows_unstable(feature)
627-
|| implied_feature.is_some_and(|f| span.allows_unstable(f));
628-
629626
let feature_enabled = trait_def_id.is_local()
630627
|| self.features().enabled(feature)
631628
|| implied_feature.is_some_and(|f| self.features().enabled(f));
632629

633-
if !unstable_feature_allowed && !feature_enabled {
630+
if !feature_enabled {
634631
let mut diag = self.dcx().create_err(crate::error::UnstableConstTrait {
635632
span,
636633
def_path: self.def_path_str(trait_def_id),

0 commit comments

Comments
 (0)