| author | bors <bors@rust-lang.org> 2026-02-23 02:39:01 UTC |
| committer | bors <bors@rust-lang.org> 2026-02-23 02:39:01 UTC |
| log | d3e8bd94cc042c65e30a6c60146a8a00531d1292 |
| tree | 4ab77e891f59003c330107a5c81f93c24a3b0709 |
| parent | c78a29473a68f07012904af11c92ecffa68fcc75 |
| parent | 8c96521c992d7567d689823edc1c88cf9607429f |
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#152229 (Remove deterministic picking from query cycle handling)
- rust-lang/rust#152970 (extend unpin noalias tests to cover mutable references)
- rust-lang/rust#149783 (stabilize `cfg_select!`)
- rust-lang/rust#151744 (fix refining_impl_trait suggestion with return_type_notation)
- rust-lang/rust#152366 (Add try_shrink_to and try_shrink_to_fit to Vec)
- rust-lang/rust#152640 (Add direct link to rustc-dev-guide in README)
- rust-lang/rust#152963 (Revert "Stabilize `str_as_str`")
- rust-lang/rust#152984 (Remove redundant call to `check_codegen_attributes_extra` in Inliner)
- rust-lang/rust#152987 (Use `HashStable` derive in more places)64 files changed, 329 insertions(+), 286 deletions(-)
Cargo.lock-1| ... | ... | @@ -4492,7 +4492,6 @@ dependencies = [ |
| 4492 | 4492 | "rustc_abi", |
| 4493 | 4493 | "rustc_data_structures", |
| 4494 | 4494 | "rustc_errors", |
| 4495 | "rustc_hashes", | |
| 4496 | 4495 | "rustc_hir", |
| 4497 | 4496 | "rustc_index", |
| 4498 | 4497 | "rustc_macros", |
README.md+2| ... | ... | @@ -52,6 +52,8 @@ See https://www.rust-lang.org/community for a list of chat platforms and forums. |
| 52 | 52 | |
| 53 | 53 | See [CONTRIBUTING.md](CONTRIBUTING.md). |
| 54 | 54 | |
| 55 | For a detailed explanation of the compiler's architecture and how to begin contributing, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/). | |
| 56 | ||
| 55 | 57 | ## License |
| 56 | 58 | |
| 57 | 59 | Rust is primarily distributed under the terms of both the MIT license and the |
compiler/rustc_attr_parsing/src/attributes/cfg_select.rs+8-14| ... | ... | @@ -128,20 +128,14 @@ pub fn parse_cfg_select( |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | if let Some(features) = features | |
| 132 | && features.enabled(sym::cfg_select) | |
| 133 | { | |
| 134 | let it = branches | |
| 135 | .reachable | |
| 136 | .iter() | |
| 137 | .map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone())) | |
| 138 | .chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t))) | |
| 139 | .chain( | |
| 140 | branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)), | |
| 141 | ); | |
| 142 | ||
| 143 | lint_unreachable(p, it, lint_node_id); | |
| 144 | } | |
| 131 | let it = branches | |
| 132 | .reachable | |
| 133 | .iter() | |
| 134 | .map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone())) | |
| 135 | .chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t))) | |
| 136 | .chain(branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry))); | |
| 137 | ||
| 138 | lint_unreachable(p, it, lint_node_id); | |
| 145 | 139 | |
| 146 | 140 | Ok(branches) |
| 147 | 141 | } |
compiler/rustc_codegen_cranelift/patches/0027-sysroot_tests-128bit-atomic-operations.patch+1-1| ... | ... | @@ -17,8 +17,8 @@ index 1e336bf..35e6f54 100644 |
| 17 | 17 | @@ -2,4 +2,3 @@ |
| 18 | 18 | // tidy-alphabetical-start |
| 19 | 19 | -#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] |
| 20 | #![cfg_attr(test, feature(cfg_select))] | |
| 21 | 20 | #![feature(array_ptr_get)] |
| 21 | #![feature(array_try_from_fn)] | |
| 22 | 22 | diff --git a/coretests/tests/atomic.rs b/coretests/tests/atomic.rs |
| 23 | 23 | index b735957..ea728b6 100644 |
| 24 | 24 | --- a/coretests/tests/atomic.rs |
compiler/rustc_data_structures/src/lib.rs+4-1| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #![allow(rustc::default_hash_types)] |
| 12 | 12 | #![allow(rustc::potential_query_instability)] |
| 13 | 13 | #![cfg_attr(bootstrap, feature(assert_matches))] |
| 14 | #![cfg_attr(bootstrap, feature(cfg_select))] | |
| 14 | 15 | #![cfg_attr(bootstrap, feature(cold_path))] |
| 15 | 16 | #![cfg_attr(test, feature(test))] |
| 16 | 17 | #![deny(unsafe_op_in_unsafe_fn)] |
| ... | ... | @@ -18,7 +19,6 @@ |
| 18 | 19 | #![feature(ascii_char)] |
| 19 | 20 | #![feature(ascii_char_variants)] |
| 20 | 21 | #![feature(auto_traits)] |
| 21 | #![feature(cfg_select)] | |
| 22 | 22 | #![feature(const_default)] |
| 23 | 23 | #![feature(const_trait_impl)] |
| 24 | 24 | #![feature(dropck_eyepatch)] |
| ... | ... | @@ -47,6 +47,9 @@ use std::fmt; |
| 47 | 47 | #[cfg(not(bootstrap))] |
| 48 | 48 | pub use std::{assert_matches, debug_assert_matches}; |
| 49 | 49 | |
| 50 | // This allows derive macros to reference this crate | |
| 51 | extern crate self as rustc_data_structures; | |
| 52 | ||
| 50 | 53 | pub use atomic_ref::AtomicRef; |
| 51 | 54 | pub use ena::{snapshot_vec, undo_log, unify}; |
| 52 | 55 | // Re-export `hashbrown::hash_table`, because it's part of our API |
compiler/rustc_data_structures/src/sorted_map/index_map.rs+4-19| ... | ... | @@ -3,8 +3,7 @@ |
| 3 | 3 | use std::hash::{Hash, Hasher}; |
| 4 | 4 | |
| 5 | 5 | use rustc_index::{Idx, IndexVec}; |
| 6 | ||
| 7 | use crate::stable_hasher::{HashStable, StableHasher}; | |
| 6 | use rustc_macros::HashStable_NoContext; | |
| 8 | 7 | |
| 9 | 8 | /// An indexed multi-map that preserves insertion order while permitting both *O*(log *n*) lookup of |
| 10 | 9 | /// an item by key and *O*(1) lookup by index. |
| ... | ... | @@ -24,11 +23,13 @@ use crate::stable_hasher::{HashStable, StableHasher}; |
| 24 | 23 | /// in-place. |
| 25 | 24 | /// |
| 26 | 25 | /// [`SortedMap`]: super::SortedMap |
| 27 | #[derive(Clone, Debug)] | |
| 26 | #[derive(Clone, Debug, HashStable_NoContext)] | |
| 28 | 27 | pub struct SortedIndexMultiMap<I: Idx, K, V> { |
| 29 | 28 | /// The elements of the map in insertion order. |
| 30 | 29 | items: IndexVec<I, (K, V)>, |
| 31 | 30 | |
| 31 | // We can ignore this field because it is not observable from the outside. | |
| 32 | #[stable_hasher(ignore)] | |
| 32 | 33 | /// Indices of the items in the set, sorted by the item's key. |
| 33 | 34 | idx_sorted_by_item_key: Vec<I>, |
| 34 | 35 | } |
| ... | ... | @@ -126,22 +127,6 @@ where |
| 126 | 127 | } |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | impl<I: Idx, K, V, C> HashStable<C> for SortedIndexMultiMap<I, K, V> | |
| 130 | where | |
| 131 | K: HashStable<C>, | |
| 132 | V: HashStable<C>, | |
| 133 | { | |
| 134 | fn hash_stable(&self, ctx: &mut C, hasher: &mut StableHasher) { | |
| 135 | let SortedIndexMultiMap { | |
| 136 | items, | |
| 137 | // We can ignore this field because it is not observable from the outside. | |
| 138 | idx_sorted_by_item_key: _, | |
| 139 | } = self; | |
| 140 | ||
| 141 | items.hash_stable(ctx, hasher) | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | 130 | impl<I: Idx, K: Ord, V> FromIterator<(K, V)> for SortedIndexMultiMap<I, K, V> { |
| 146 | 131 | fn from_iter<J>(iter: J) -> Self |
| 147 | 132 | where |
compiler/rustc_data_structures/src/svh.rs+12-11| ... | ... | @@ -7,12 +7,21 @@ |
| 7 | 7 | |
| 8 | 8 | use std::fmt; |
| 9 | 9 | |
| 10 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext}; | |
| 10 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 11 | 11 | |
| 12 | 12 | use crate::fingerprint::Fingerprint; |
| 13 | use crate::stable_hasher; | |
| 14 | 13 | |
| 15 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable_NoContext, Decodable_NoContext, Hash)] | |
| 14 | #[derive( | |
| 15 | Copy, | |
| 16 | Clone, | |
| 17 | PartialEq, | |
| 18 | Eq, | |
| 19 | Debug, | |
| 20 | Encodable_NoContext, | |
| 21 | Decodable_NoContext, | |
| 22 | Hash, | |
| 23 | HashStable_NoContext | |
| 24 | )] | |
| 16 | 25 | pub struct Svh { |
| 17 | 26 | hash: Fingerprint, |
| 18 | 27 | } |
| ... | ... | @@ -39,11 +48,3 @@ impl fmt::Display for Svh { |
| 39 | 48 | f.pad(&self.to_hex()) |
| 40 | 49 | } |
| 41 | 50 | } |
| 42 | ||
| 43 | impl<T> stable_hasher::HashStable<T> for Svh { | |
| 44 | #[inline] | |
| 45 | fn hash_stable(&self, ctx: &mut T, hasher: &mut stable_hasher::StableHasher) { | |
| 46 | let Svh { hash } = *self; | |
| 47 | hash.hash_stable(ctx, hasher); | |
| 48 | } | |
| 49 | } |
compiler/rustc_feature/src/accepted.rs+2| ... | ... | @@ -102,6 +102,8 @@ declare_features! ( |
| 102 | 102 | (accepted, cfg_doctest, "1.40.0", Some(62210)), |
| 103 | 103 | /// Enables `#[cfg(panic = "...")]` config key. |
| 104 | 104 | (accepted, cfg_panic, "1.60.0", Some(77443)), |
| 105 | /// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times. | |
| 106 | (accepted, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)), | |
| 105 | 107 | /// Allows `cfg(target_abi = "...")`. |
| 106 | 108 | (accepted, cfg_target_abi, "1.78.0", Some(80970)), |
| 107 | 109 | /// Allows `cfg(target_feature = "...")`. |
compiler/rustc_feature/src/unstable.rs-2| ... | ... | @@ -388,8 +388,6 @@ declare_features! ( |
| 388 | 388 | (unstable, cfg_sanitize, "1.41.0", Some(39699)), |
| 389 | 389 | /// Allows `cfg(sanitizer_cfi_generalize_pointers)` and `cfg(sanitizer_cfi_normalize_integers)`. |
| 390 | 390 | (unstable, cfg_sanitizer_cfi, "1.77.0", Some(89653)), |
| 391 | /// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times. | |
| 392 | (unstable, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)), | |
| 393 | 391 | /// Allows `cfg(target(abi = "..."))`. |
| 394 | 392 | (unstable, cfg_target_compact, "1.63.0", Some(96901)), |
| 395 | 393 | /// Allows `cfg(target_has_atomic_load_store = "...")`. |
compiler/rustc_hir/src/diagnostic_items.rs+3-9| ... | ... | @@ -1,19 +1,13 @@ |
| 1 | 1 | use rustc_data_structures::fx::FxIndexMap; |
| 2 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 2 | use rustc_macros::HashStable_Generic; | |
| 3 | 3 | use rustc_span::Symbol; |
| 4 | 4 | use rustc_span::def_id::DefIdMap; |
| 5 | 5 | |
| 6 | 6 | use crate::def_id::DefId; |
| 7 | 7 | |
| 8 | #[derive(Debug, Default)] | |
| 8 | #[derive(Debug, Default, HashStable_Generic)] | |
| 9 | 9 | pub struct DiagnosticItems { |
| 10 | #[stable_hasher(ignore)] | |
| 10 | 11 | pub id_to_name: DefIdMap<Symbol>, |
| 11 | 12 | pub name_to_id: FxIndexMap<Symbol, DefId>, |
| 12 | 13 | } |
| 13 | ||
| 14 | impl<CTX: crate::HashStableContext> HashStable<CTX> for DiagnosticItems { | |
| 15 | #[inline] | |
| 16 | fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { | |
| 17 | self.name_to_id.hash_stable(ctx, hasher); | |
| 18 | } | |
| 19 | } |
compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs+13-1| ... | ... | @@ -6,6 +6,7 @@ use rustc_infer::infer::TyCtxtInferExt; |
| 6 | 6 | use rustc_lint_defs::builtin::{REFINING_IMPL_TRAIT_INTERNAL, REFINING_IMPL_TRAIT_REACHABLE}; |
| 7 | 7 | use rustc_middle::span_bug; |
| 8 | 8 | use rustc_middle::traits::ObligationCause; |
| 9 | use rustc_middle::ty::print::{with_no_trimmed_paths, with_types_for_signature}; | |
| 9 | 10 | use rustc_middle::ty::{ |
| 10 | 11 | self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperVisitable, TypeVisitable, |
| 11 | 12 | TypeVisitableExt, TypeVisitor, TypingMode, |
| ... | ... | @@ -332,6 +333,17 @@ fn report_mismatched_rpitit_signature<'tcx>( |
| 332 | 333 | hir::FnRetTy::Return(ty) => ty.span, |
| 333 | 334 | }); |
| 334 | 335 | |
| 336 | // Use ForSignature mode to ensure RPITITs are printed as `impl Trait` rather than | |
| 337 | // `impl Trait { T::method(..) }` when RTN is enabled. | |
| 338 | // | |
| 339 | // We use `with_no_trimmed_paths!` to avoid triggering the `trimmed_def_paths` query, | |
| 340 | // which requires diagnostic context (via `must_produce_diag`). Since we're formatting | |
| 341 | // the type before creating the diagnostic, we need to avoid this query. This is the | |
| 342 | // standard approach used elsewhere in the compiler for formatting types in suggestions | |
| 343 | // (e.g., see `rustc_hir_typeck/src/demand.rs`). | |
| 344 | let return_ty_suggestion = | |
| 345 | with_no_trimmed_paths!(with_types_for_signature!(format!("{return_ty}"))); | |
| 346 | ||
| 335 | 347 | let span = unmatched_bound.unwrap_or(span); |
| 336 | 348 | tcx.emit_node_span_lint( |
| 337 | 349 | if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE }, |
| ... | ... | @@ -342,7 +354,7 @@ fn report_mismatched_rpitit_signature<'tcx>( |
| 342 | 354 | trait_return_span, |
| 343 | 355 | pre, |
| 344 | 356 | post, |
| 345 | return_ty, | |
| 357 | return_ty: return_ty_suggestion, | |
| 346 | 358 | unmatched_bound, |
| 347 | 359 | }, |
| 348 | 360 | ); |
compiler/rustc_hir_analysis/src/errors.rs+2-2| ... | ... | @@ -1132,7 +1132,7 @@ pub(crate) struct UnusedAssociatedTypeBounds { |
| 1132 | 1132 | #[note( |
| 1133 | 1133 | "we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information" |
| 1134 | 1134 | )] |
| 1135 | pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> { | |
| 1135 | pub(crate) struct ReturnPositionImplTraitInTraitRefined { | |
| 1136 | 1136 | #[suggestion( |
| 1137 | 1137 | "replace the return type so that it matches the trait", |
| 1138 | 1138 | applicability = "maybe-incorrect", |
| ... | ... | @@ -1146,7 +1146,7 @@ pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> { |
| 1146 | 1146 | |
| 1147 | 1147 | pub pre: &'static str, |
| 1148 | 1148 | pub post: &'static str, |
| 1149 | pub return_ty: Ty<'tcx>, | |
| 1149 | pub return_ty: String, | |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | #[derive(LintDiagnostic)] |
compiler/rustc_lint_defs/src/builtin.rs+1-2| ... | ... | @@ -864,7 +864,7 @@ declare_lint! { |
| 864 | 864 | /// ### Example |
| 865 | 865 | /// |
| 866 | 866 | /// ```rust |
| 867 | /// #![feature(cfg_select)] | |
| 867 | /// # #![cfg_attr(bootstrap, feature(cfg_select))] | |
| 868 | 868 | /// cfg_select! { |
| 869 | 869 | /// _ => (), |
| 870 | 870 | /// windows => (), |
| ... | ... | @@ -882,7 +882,6 @@ declare_lint! { |
| 882 | 882 | pub UNREACHABLE_CFG_SELECT_PREDICATES, |
| 883 | 883 | Warn, |
| 884 | 884 | "detects unreachable configuration predicates in the cfg_select macro", |
| 885 | @feature_gate = cfg_select; | |
| 886 | 885 | } |
| 887 | 886 | |
| 888 | 887 | declare_lint! { |
compiler/rustc_macros/src/lib.rs+1-1| ... | ... | @@ -64,7 +64,7 @@ decl_derive!( |
| 64 | 64 | hash_stable::hash_stable_generic_derive |
| 65 | 65 | ); |
| 66 | 66 | decl_derive!( |
| 67 | [HashStable_NoContext] => | |
| 67 | [HashStable_NoContext, attributes(stable_hasher)] => | |
| 68 | 68 | /// `HashStable` implementation that has no `HashStableContext` bound and |
| 69 | 69 | /// which adds `where` bounds for `HashStable` based off of fields and not |
| 70 | 70 | /// generics. This is suitable for use in crates like `rustc_type_ir`. |
compiler/rustc_middle/src/dep_graph/dep_node.rs+4-9| ... | ... | @@ -54,7 +54,7 @@ use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint}; |
| 54 | 54 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey}; |
| 55 | 55 | use rustc_hir::def_id::DefId; |
| 56 | 56 | use rustc_hir::definitions::DefPathHash; |
| 57 | use rustc_macros::{Decodable, Encodable}; | |
| 57 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 58 | 58 | use rustc_span::Symbol; |
| 59 | 59 | |
| 60 | 60 | use super::{KeyFingerprintStyle, SerializedDepNodeIndex}; |
| ... | ... | @@ -290,7 +290,9 @@ pub struct DepKindVTable<'tcx> { |
| 290 | 290 | /// some independent path or string that persists between runs without |
| 291 | 291 | /// the need to be mapped or unmapped. (This ensures we can serialize |
| 292 | 292 | /// them even in the absence of a tcx.) |
| 293 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)] | |
| 293 | #[derive( | |
| 294 | Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable, HashStable | |
| 295 | )] | |
| 294 | 296 | pub struct WorkProductId { |
| 295 | 297 | hash: Fingerprint, |
| 296 | 298 | } |
| ... | ... | @@ -302,13 +304,6 @@ impl WorkProductId { |
| 302 | 304 | WorkProductId { hash: hasher.finish() } |
| 303 | 305 | } |
| 304 | 306 | } |
| 305 | ||
| 306 | impl<HCX> HashStable<HCX> for WorkProductId { | |
| 307 | #[inline] | |
| 308 | fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) { | |
| 309 | self.hash.hash_stable(hcx, hasher) | |
| 310 | } | |
| 311 | } | |
| 312 | 307 | impl<HCX> ToStableHashKey<HCX> for WorkProductId { |
| 313 | 308 | type KeyType = Fingerprint; |
| 314 | 309 | #[inline] |
compiler/rustc_middle/src/mir/mod.rs+1-20| ... | ... | @@ -891,7 +891,7 @@ pub struct VarBindingForm<'tcx> { |
| 891 | 891 | pub introductions: Vec<VarBindingIntroduction>, |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | #[derive(Clone, Debug, TyEncodable, TyDecodable)] | |
| 894 | #[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)] | |
| 895 | 895 | pub enum BindingForm<'tcx> { |
| 896 | 896 | /// This is a binding for a non-`self` binding, or a `self` that has an explicit type. |
| 897 | 897 | Var(VarBindingForm<'tcx>), |
| ... | ... | @@ -909,25 +909,6 @@ pub struct VarBindingIntroduction { |
| 909 | 909 | pub is_shorthand: bool, |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | mod binding_form_impl { | |
| 913 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 914 | ||
| 915 | use crate::ich::StableHashingContext; | |
| 916 | ||
| 917 | impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for super::BindingForm<'tcx> { | |
| 918 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 919 | use super::BindingForm::*; | |
| 920 | std::mem::discriminant(self).hash_stable(hcx, hasher); | |
| 921 | ||
| 922 | match self { | |
| 923 | Var(binding) => binding.hash_stable(hcx, hasher), | |
| 924 | ImplicitSelf(kind) => kind.hash_stable(hcx, hasher), | |
| 925 | RefForGuard(local) => local.hash_stable(hcx, hasher), | |
| 926 | } | |
| 927 | } | |
| 928 | } | |
| 929 | } | |
| 930 | ||
| 931 | 912 | /// `BlockTailInfo` is attached to the `LocalDecl` for temporaries |
| 932 | 913 | /// created during evaluation of expressions in a block tail |
| 933 | 914 | /// expression; that is, a block like `{ STMT_1; STMT_2; EXPR }`. |
compiler/rustc_middle/src/query/stack.rs+1-7| ... | ... | @@ -4,7 +4,6 @@ use std::mem::transmute; |
| 4 | 4 | use std::sync::Arc; |
| 5 | 5 | |
| 6 | 6 | use rustc_data_structures::sync::{DynSend, DynSync}; |
| 7 | use rustc_hashes::Hash64; | |
| 8 | 7 | use rustc_hir::def::DefKind; |
| 9 | 8 | use rustc_span::Span; |
| 10 | 9 | use rustc_span::def_id::DefId; |
| ... | ... | @@ -23,9 +22,6 @@ pub struct QueryStackFrame<I> { |
| 23 | 22 | pub info: I, |
| 24 | 23 | |
| 25 | 24 | pub dep_kind: DepKind, |
| 26 | /// This hash is used to deterministically pick | |
| 27 | /// a query to remove cycles in the parallel compiler. | |
| 28 | pub hash: Hash64, | |
| 29 | 25 | pub def_id: Option<DefId>, |
| 30 | 26 | /// A def-id that is extracted from a `Ty` in a query key |
| 31 | 27 | pub def_id_for_ty_in_cycle: Option<DefId>, |
| ... | ... | @@ -36,18 +32,16 @@ impl<'tcx> QueryStackFrame<QueryStackDeferred<'tcx>> { |
| 36 | 32 | pub fn new( |
| 37 | 33 | info: QueryStackDeferred<'tcx>, |
| 38 | 34 | dep_kind: DepKind, |
| 39 | hash: Hash64, | |
| 40 | 35 | def_id: Option<DefId>, |
| 41 | 36 | def_id_for_ty_in_cycle: Option<DefId>, |
| 42 | 37 | ) -> Self { |
| 43 | Self { info, def_id, dep_kind, hash, def_id_for_ty_in_cycle } | |
| 38 | Self { info, def_id, dep_kind, def_id_for_ty_in_cycle } | |
| 44 | 39 | } |
| 45 | 40 | |
| 46 | 41 | pub fn lift(&self) -> QueryStackFrame<QueryStackFrameExtra> { |
| 47 | 42 | QueryStackFrame { |
| 48 | 43 | info: self.info.extract(), |
| 49 | 44 | dep_kind: self.dep_kind, |
| 50 | hash: self.hash, | |
| 51 | 45 | def_id: self.def_id, |
| 52 | 46 | def_id_for_ty_in_cycle: self.def_id_for_ty_in_cycle, |
| 53 | 47 | } |
compiler/rustc_mir_transform/src/inline.rs-1| ... | ... | @@ -607,7 +607,6 @@ fn try_inlining<'tcx, I: Inliner<'tcx>>( |
| 607 | 607 | let callee_attrs = callee_attrs.as_ref(); |
| 608 | 608 | check_inline::is_inline_valid_on_fn(tcx, callsite.callee.def_id())?; |
| 609 | 609 | check_codegen_attributes(inliner, callsite, callee_attrs)?; |
| 610 | inliner.check_codegen_attributes_extra(callee_attrs)?; | |
| 611 | 610 | |
| 612 | 611 | let terminator = caller_body[callsite.block].terminator.as_ref().unwrap(); |
| 613 | 612 | let TerminatorKind::Call { args, destination, .. } = &terminator.kind else { bug!() }; |
compiler/rustc_query_impl/Cargo.toml-1| ... | ... | @@ -9,7 +9,6 @@ measureme = "12.0.1" |
| 9 | 9 | rustc_abi = { path = "../rustc_abi" } |
| 10 | 10 | rustc_data_structures = { path = "../rustc_data_structures" } |
| 11 | 11 | rustc_errors = { path = "../rustc_errors" } |
| 12 | rustc_hashes = { path = "../rustc_hashes" } | |
| 13 | 12 | rustc_hir = { path = "../rustc_hir" } |
| 14 | 13 | rustc_index = { path = "../rustc_index" } |
| 15 | 14 | rustc_macros = { path = "../rustc_macros" } |
compiler/rustc_query_impl/src/job.rs+29-42| ... | ... | @@ -209,27 +209,6 @@ fn connected_to_root<'tcx>( |
| 209 | 209 | visit_waiters(job_map, query, |_, successor| connected_to_root(job_map, successor, visited)) |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | // Deterministically pick an query from a list | |
| 213 | fn pick_query<'a, 'tcx, T, F>(job_map: &QueryJobMap<'tcx>, queries: &'a [T], f: F) -> &'a T | |
| 214 | where | |
| 215 | F: Fn(&T) -> (Span, QueryJobId), | |
| 216 | { | |
| 217 | // Deterministically pick an entry point | |
| 218 | // FIXME: Sort this instead | |
| 219 | queries | |
| 220 | .iter() | |
| 221 | .min_by_key(|v| { | |
| 222 | let (span, query) = f(v); | |
| 223 | let hash = job_map.frame_of(query).hash; | |
| 224 | // Prefer entry points which have valid spans for nicer error messages | |
| 225 | // We add an integer to the tuple ensuring that entry points | |
| 226 | // with valid spans are picked first | |
| 227 | let span_cmp = if span == DUMMY_SP { 1 } else { 0 }; | |
| 228 | (span_cmp, hash) | |
| 229 | }) | |
| 230 | .unwrap() | |
| 231 | } | |
| 232 | ||
| 233 | 212 | /// Looks for query cycles starting from the last query in `jobs`. |
| 234 | 213 | /// If a cycle is found, all queries in the cycle is removed from `jobs` and |
| 235 | 214 | /// the function return true. |
| ... | ... | @@ -263,48 +242,56 @@ fn remove_cycle<'tcx>( |
| 263 | 242 | } |
| 264 | 243 | } |
| 265 | 244 | |
| 245 | struct EntryPoint { | |
| 246 | query_in_cycle: QueryJobId, | |
| 247 | waiter: Option<(Span, QueryJobId)>, | |
| 248 | } | |
| 249 | ||
| 266 | 250 | // Find the queries in the cycle which are |
| 267 | 251 | // connected to queries outside the cycle |
| 268 | 252 | let entry_points = stack |
| 269 | 253 | .iter() |
| 270 | .filter_map(|&(span, query)| { | |
| 271 | if job_map.parent_of(query).is_none() { | |
| 254 | .filter_map(|&(_, query_in_cycle)| { | |
| 255 | if job_map.parent_of(query_in_cycle).is_none() { | |
| 272 | 256 | // This query is connected to the root (it has no query parent) |
| 273 | Some((span, query, None)) | |
| 257 | Some(EntryPoint { query_in_cycle, waiter: None }) | |
| 274 | 258 | } else { |
| 275 | let mut waiters = Vec::new(); | |
| 276 | // Find all the direct waiters who lead to the root | |
| 277 | let _ = visit_waiters(job_map, query, |span, waiter| { | |
| 259 | let mut waiter_on_cycle = None; | |
| 260 | // Find a direct waiter who leads to the root | |
| 261 | let _ = visit_waiters(job_map, query_in_cycle, |span, waiter| { | |
| 278 | 262 | // Mark all the other queries in the cycle as already visited |
| 279 | 263 | let mut visited = FxHashSet::from_iter(stack.iter().map(|q| q.1)); |
| 280 | 264 | |
| 281 | 265 | if connected_to_root(job_map, waiter, &mut visited).is_break() { |
| 282 | waiters.push((span, waiter)); | |
| 266 | waiter_on_cycle = Some((span, waiter)); | |
| 267 | ControlFlow::Break(None) | |
| 268 | } else { | |
| 269 | ControlFlow::Continue(()) | |
| 283 | 270 | } |
| 284 | ||
| 285 | ControlFlow::Continue(()) | |
| 286 | 271 | }); |
| 287 | if waiters.is_empty() { | |
| 288 | None | |
| 289 | } else { | |
| 290 | // Deterministically pick one of the waiters to show to the user | |
| 291 | let waiter = *pick_query(job_map, &waiters, |s| *s); | |
| 292 | Some((span, query, Some(waiter))) | |
| 293 | } | |
| 272 | ||
| 273 | waiter_on_cycle.map(|waiter_on_cycle| EntryPoint { | |
| 274 | query_in_cycle, | |
| 275 | waiter: Some(waiter_on_cycle), | |
| 276 | }) | |
| 294 | 277 | } |
| 295 | 278 | }) |
| 296 | .collect::<Vec<(Span, QueryJobId, Option<(Span, QueryJobId)>)>>(); | |
| 279 | .collect::<Vec<EntryPoint>>(); | |
| 297 | 280 | |
| 298 | // Deterministically pick an entry point | |
| 299 | let (_, entry_point, usage) = pick_query(job_map, &entry_points, |e| (e.0, e.1)); | |
| 281 | // Pick an entry point, preferring ones with waiters | |
| 282 | let entry_point = entry_points | |
| 283 | .iter() | |
| 284 | .find(|entry_point| entry_point.waiter.is_some()) | |
| 285 | .unwrap_or(&entry_points[0]); | |
| 300 | 286 | |
| 301 | 287 | // Shift the stack so that our entry point is first |
| 302 | let entry_point_pos = stack.iter().position(|(_, query)| query == entry_point); | |
| 288 | let entry_point_pos = | |
| 289 | stack.iter().position(|(_, query)| *query == entry_point.query_in_cycle); | |
| 303 | 290 | if let Some(pos) = entry_point_pos { |
| 304 | 291 | stack.rotate_left(pos); |
| 305 | 292 | } |
| 306 | 293 | |
| 307 | let usage = usage.map(|(span, job)| (span, job_map.frame_of(job).clone())); | |
| 294 | let usage = entry_point.waiter.map(|(span, job)| (span, job_map.frame_of(job).clone())); | |
| 308 | 295 | |
| 309 | 296 | // Create the cycle error |
| 310 | 297 | let error = CycleError { |
compiler/rustc_query_impl/src/plumbing.rs+1-10| ... | ... | @@ -4,10 +4,8 @@ |
| 4 | 4 | |
| 5 | 5 | use std::num::NonZero; |
| 6 | 6 | |
| 7 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 8 | 7 | use rustc_data_structures::sync::{DynSend, DynSync}; |
| 9 | 8 | use rustc_data_structures::unord::UnordMap; |
| 10 | use rustc_hashes::Hash64; | |
| 11 | 9 | use rustc_hir::def_id::DefId; |
| 12 | 10 | use rustc_hir::limit::Limit; |
| 13 | 11 | use rustc_index::Idx; |
| ... | ... | @@ -319,18 +317,11 @@ where |
| 319 | 317 | { |
| 320 | 318 | let kind = vtable.dep_kind; |
| 321 | 319 | |
| 322 | let hash = tcx.with_stable_hashing_context(|mut hcx| { | |
| 323 | let mut hasher = StableHasher::new(); | |
| 324 | kind.as_usize().hash_stable(&mut hcx, &mut hasher); | |
| 325 | key.hash_stable(&mut hcx, &mut hasher); | |
| 326 | hasher.finish::<Hash64>() | |
| 327 | }); | |
| 328 | ||
| 329 | 320 | let def_id: Option<DefId> = key.key_as_def_id(); |
| 330 | 321 | let def_id_for_ty_in_cycle: Option<DefId> = key.def_id_for_ty_in_cycle(); |
| 331 | 322 | |
| 332 | 323 | let info = QueryStackDeferred::new((tcx, vtable, key), mk_query_stack_frame_extra); |
| 333 | QueryStackFrame::new(info, kind, hash, def_id, def_id_for_ty_in_cycle) | |
| 324 | QueryStackFrame::new(info, kind, def_id, def_id_for_ty_in_cycle) | |
| 334 | 325 | } |
| 335 | 326 | |
| 336 | 327 | pub(crate) fn encode_query_results<'a, 'tcx, Q, C: QueryCache, const FLAGS: QueryFlags>( |
compiler/rustc_span/src/lib.rs+2-8| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | |
| 18 | 18 | // tidy-alphabetical-start |
| 19 | 19 | #![allow(internal_features)] |
| 20 | #![cfg_attr(bootstrap, feature(cfg_select))] | |
| 20 | 21 | #![cfg_attr(bootstrap, feature(if_let_guard))] |
| 21 | 22 | #![cfg_attr(target_arch = "loongarch64", feature(stdarch_loongarch))] |
| 22 | #![feature(cfg_select)] | |
| 23 | 23 | #![feature(core_io_borrowed_buf)] |
| 24 | 24 | #![feature(map_try_insert)] |
| 25 | 25 | #![feature(negative_impls)] |
| ... | ... | @@ -2653,7 +2653,7 @@ impl_pos! { |
| 2653 | 2653 | pub struct BytePos(pub u32); |
| 2654 | 2654 | |
| 2655 | 2655 | /// A byte offset relative to file beginning. |
| 2656 | #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] | |
| 2656 | #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, HashStable_Generic)] | |
| 2657 | 2657 | pub struct RelativeBytePos(pub u32); |
| 2658 | 2658 | |
| 2659 | 2659 | /// A character offset. |
| ... | ... | @@ -2677,12 +2677,6 @@ impl<D: Decoder> Decodable<D> for BytePos { |
| 2677 | 2677 | } |
| 2678 | 2678 | } |
| 2679 | 2679 | |
| 2680 | impl<H: HashStableContext> HashStable<H> for RelativeBytePos { | |
| 2681 | fn hash_stable(&self, hcx: &mut H, hasher: &mut StableHasher) { | |
| 2682 | self.0.hash_stable(hcx, hasher); | |
| 2683 | } | |
| 2684 | } | |
| 2685 | ||
| 2686 | 2680 | impl<S: Encoder> Encodable<S> for RelativeBytePos { |
| 2687 | 2681 | fn encode(&self, s: &mut S) { |
| 2688 | 2682 | s.emit_u32(self.0); |
compiler/rustc_target/src/target_features.rs+2-18| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //! Note that these are similar to but not always identical to LLVM's feature names, |
| 3 | 3 | //! and Rust adds some features that do not correspond to LLVM features at all. |
| 4 | 4 | use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 5 | use rustc_macros::HashStable_Generic; | |
| 6 | 6 | use rustc_span::{Symbol, sym}; |
| 7 | 7 | |
| 8 | 8 | use crate::spec::{Abi, Arch, FloatAbi, RustcAbi, Target}; |
| ... | ... | @@ -12,7 +12,7 @@ use crate::spec::{Abi, Arch, FloatAbi, RustcAbi, Target}; |
| 12 | 12 | pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"]; |
| 13 | 13 | |
| 14 | 14 | /// Stability information for target features. |
| 15 | #[derive(Debug, Copy, Clone)] | |
| 15 | #[derive(Debug, Copy, Clone, HashStable_Generic)] | |
| 16 | 16 | pub enum Stability { |
| 17 | 17 | /// This target feature is stable, it can be used in `#[target_feature]` and |
| 18 | 18 | /// `#[cfg(target_feature)]`. |
| ... | ... | @@ -32,22 +32,6 @@ pub enum Stability { |
| 32 | 32 | } |
| 33 | 33 | use Stability::*; |
| 34 | 34 | |
| 35 | impl<CTX> HashStable<CTX> for Stability { | |
| 36 | #[inline] | |
| 37 | fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { | |
| 38 | std::mem::discriminant(self).hash_stable(hcx, hasher); | |
| 39 | match self { | |
| 40 | Stability::Stable => {} | |
| 41 | Stability::Unstable(nightly_feature) => { | |
| 42 | nightly_feature.hash_stable(hcx, hasher); | |
| 43 | } | |
| 44 | Stability::Forbidden { reason } => { | |
| 45 | reason.hash_stable(hcx, hasher); | |
| 46 | } | |
| 47 | } | |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | 35 | impl Stability { |
| 52 | 36 | /// Returns whether the feature can be used in `cfg(target_feature)` ever. |
| 53 | 37 | /// (It might still be nightly-only even if this returns `true`, so make sure to also check |
library/alloc/src/raw_vec/mod.rs+29-2| ... | ... | @@ -399,6 +399,21 @@ impl<T, A: Allocator> RawVec<T, A> { |
| 399 | 399 | // SAFETY: All calls on self.inner pass T::LAYOUT as the elem_layout |
| 400 | 400 | unsafe { self.inner.shrink_to_fit(cap, T::LAYOUT) } |
| 401 | 401 | } |
| 402 | ||
| 403 | /// Shrinks the buffer down to the specified capacity. If the given amount | |
| 404 | /// is 0, actually completely deallocates. | |
| 405 | /// | |
| 406 | /// # Errors | |
| 407 | /// | |
| 408 | /// This function returns an error if the allocator cannot shrink the allocation. | |
| 409 | /// | |
| 410 | /// # Panics | |
| 411 | /// | |
| 412 | /// Panics if the given amount is *larger* than the current capacity. | |
| 413 | #[inline] | |
| 414 | pub(crate) fn try_shrink_to_fit(&mut self, cap: usize) -> Result<(), TryReserveError> { | |
| 415 | unsafe { self.inner.try_shrink_to_fit(cap, T::LAYOUT) } | |
| 416 | } | |
| 402 | 417 | } |
| 403 | 418 | |
| 404 | 419 | unsafe impl<#[may_dangle] T, A: Allocator> Drop for RawVec<T, A> { |
| ... | ... | @@ -731,6 +746,20 @@ impl<A: Allocator> RawVecInner<A> { |
| 731 | 746 | } |
| 732 | 747 | } |
| 733 | 748 | |
| 749 | /// # Safety | |
| 750 | /// | |
| 751 | /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to | |
| 752 | /// initially construct `self` | |
| 753 | /// - `elem_layout`'s size must be a multiple of its alignment | |
| 754 | /// - `cap` must be less than or equal to `self.capacity(elem_layout.size())` | |
| 755 | unsafe fn try_shrink_to_fit( | |
| 756 | &mut self, | |
| 757 | cap: usize, | |
| 758 | elem_layout: Layout, | |
| 759 | ) -> Result<(), TryReserveError> { | |
| 760 | unsafe { self.shrink(cap, elem_layout) } | |
| 761 | } | |
| 762 | ||
| 734 | 763 | #[inline] |
| 735 | 764 | const fn needs_to_grow(&self, len: usize, additional: usize, elem_layout: Layout) -> bool { |
| 736 | 765 | additional > self.capacity(elem_layout.size()).wrapping_sub(len) |
| ... | ... | @@ -778,7 +807,6 @@ impl<A: Allocator> RawVecInner<A> { |
| 778 | 807 | /// initially construct `self` |
| 779 | 808 | /// - `elem_layout`'s size must be a multiple of its alignment |
| 780 | 809 | /// - `cap` must be less than or equal to `self.capacity(elem_layout.size())` |
| 781 | #[cfg(not(no_global_oom_handling))] | |
| 782 | 810 | #[inline] |
| 783 | 811 | unsafe fn shrink(&mut self, cap: usize, elem_layout: Layout) -> Result<(), TryReserveError> { |
| 784 | 812 | assert!(cap <= self.capacity(elem_layout.size()), "Tried to shrink to a larger capacity"); |
| ... | ... | @@ -796,7 +824,6 @@ impl<A: Allocator> RawVecInner<A> { |
| 796 | 824 | /// |
| 797 | 825 | /// # Safety |
| 798 | 826 | /// `cap <= self.capacity()` |
| 799 | #[cfg(not(no_global_oom_handling))] | |
| 800 | 827 | unsafe fn shrink_unchecked( |
| 801 | 828 | &mut self, |
| 802 | 829 | cap: usize, |
library/alloc/src/vec/mod.rs+68-3| ... | ... | @@ -75,8 +75,6 @@ |
| 75 | 75 | |
| 76 | 76 | #[cfg(not(no_global_oom_handling))] |
| 77 | 77 | use core::clone::TrivialClone; |
| 78 | #[cfg(not(no_global_oom_handling))] | |
| 79 | use core::cmp; | |
| 80 | 78 | use core::cmp::Ordering; |
| 81 | 79 | use core::hash::{Hash, Hasher}; |
| 82 | 80 | #[cfg(not(no_global_oom_handling))] |
| ... | ... | @@ -88,7 +86,7 @@ use core::mem::{self, Assume, ManuallyDrop, MaybeUninit, SizedTypeProperties, Tr |
| 88 | 86 | use core::ops::{self, Index, IndexMut, Range, RangeBounds}; |
| 89 | 87 | use core::ptr::{self, NonNull}; |
| 90 | 88 | use core::slice::{self, SliceIndex}; |
| 91 | use core::{fmt, hint, intrinsics, ub_checks}; | |
| 89 | use core::{cmp, fmt, hint, intrinsics, ub_checks}; | |
| 92 | 90 | |
| 93 | 91 | #[stable(feature = "extract_if", since = "1.87.0")] |
| 94 | 92 | pub use self::extract_if::ExtractIf; |
| ... | ... | @@ -1613,6 +1611,73 @@ impl<T, A: Allocator> Vec<T, A> { |
| 1613 | 1611 | } |
| 1614 | 1612 | } |
| 1615 | 1613 | |
| 1614 | /// Tries to shrink the capacity of the vector as much as possible | |
| 1615 | /// | |
| 1616 | /// The behavior of this method depends on the allocator, which may either shrink the vector | |
| 1617 | /// in-place or reallocate. The resulting vector might still have some excess capacity, just as | |
| 1618 | /// is the case for [`with_capacity`]. See [`Allocator::shrink`] for more details. | |
| 1619 | /// | |
| 1620 | /// [`with_capacity`]: Vec::with_capacity | |
| 1621 | /// | |
| 1622 | /// # Errors | |
| 1623 | /// | |
| 1624 | /// This function returns an error if the allocator fails to shrink the allocation, | |
| 1625 | /// the vector thereafter is still safe to use, the capacity remains unchanged | |
| 1626 | /// however. See [`Allocator::shrink`]. | |
| 1627 | /// | |
| 1628 | /// # Examples | |
| 1629 | /// | |
| 1630 | /// ``` | |
| 1631 | /// #![feature(vec_fallible_shrink)] | |
| 1632 | /// | |
| 1633 | /// let mut vec = Vec::with_capacity(10); | |
| 1634 | /// vec.extend([1, 2, 3]); | |
| 1635 | /// assert!(vec.capacity() >= 10); | |
| 1636 | /// vec.try_shrink_to_fit().expect("why is the test harness failing to shrink to 12 bytes"); | |
| 1637 | /// assert!(vec.capacity() >= 3); | |
| 1638 | /// ``` | |
| 1639 | #[unstable(feature = "vec_fallible_shrink", issue = "152350")] | |
| 1640 | #[inline] | |
| 1641 | pub fn try_shrink_to_fit(&mut self) -> Result<(), TryReserveError> { | |
| 1642 | if self.capacity() > self.len { self.buf.try_shrink_to_fit(self.len) } else { Ok(()) } | |
| 1643 | } | |
| 1644 | ||
| 1645 | /// Shrinks the capacity of the vector with a lower bound. | |
| 1646 | /// | |
| 1647 | /// The capacity will remain at least as large as both the length | |
| 1648 | /// and the supplied value. | |
| 1649 | /// | |
| 1650 | /// If the current capacity is less than the lower limit, this is a no-op. | |
| 1651 | /// | |
| 1652 | /// # Errors | |
| 1653 | /// | |
| 1654 | /// This function returns an error if the allocator fails to shrink the allocation, | |
| 1655 | /// the vector thereafter is still safe to use, the capacity remains unchanged | |
| 1656 | /// however. See [`Allocator::shrink`]. | |
| 1657 | /// | |
| 1658 | /// # Examples | |
| 1659 | /// | |
| 1660 | /// ``` | |
| 1661 | /// #![feature(vec_fallible_shrink)] | |
| 1662 | /// | |
| 1663 | /// let mut vec = Vec::with_capacity(10); | |
| 1664 | /// vec.extend([1, 2, 3]); | |
| 1665 | /// assert!(vec.capacity() >= 10); | |
| 1666 | /// vec.try_shrink_to(4).expect("why is the test harness failing to shrink to 12 bytes"); | |
| 1667 | /// assert!(vec.capacity() >= 4); | |
| 1668 | /// vec.try_shrink_to(0).expect("this is a no-op and thus the allocator isn't involved."); | |
| 1669 | /// assert!(vec.capacity() >= 3); | |
| 1670 | /// ``` | |
| 1671 | #[unstable(feature = "vec_fallible_shrink", issue = "152350")] | |
| 1672 | #[inline] | |
| 1673 | pub fn try_shrink_to(&mut self, min_capacity: usize) -> Result<(), TryReserveError> { | |
| 1674 | if self.capacity() > min_capacity { | |
| 1675 | self.buf.try_shrink_to_fit(cmp::max(self.len, min_capacity)) | |
| 1676 | } else { | |
| 1677 | Ok(()) | |
| 1678 | } | |
| 1679 | } | |
| 1680 | ||
| 1616 | 1681 | /// Converts the vector into [`Box<[T]>`][owned slice]. |
| 1617 | 1682 | /// |
| 1618 | 1683 | /// Before doing the conversion, this method discards excess capacity like [`shrink_to_fit`]. |
library/alloctests/tests/lib.rs+1| ... | ... | @@ -33,6 +33,7 @@ |
| 33 | 33 | #![feature(thin_box)] |
| 34 | 34 | #![feature(drain_keep_rest)] |
| 35 | 35 | #![feature(local_waker)] |
| 36 | #![feature(str_as_str)] | |
| 36 | 37 | #![feature(strict_provenance_lints)] |
| 37 | 38 | #![feature(string_replace_in_place)] |
| 38 | 39 | #![feature(vec_deque_truncate_front)] |
library/core/src/bstr/mod.rs+2| ... | ... | @@ -74,6 +74,7 @@ impl ByteStr { |
| 74 | 74 | /// it helps dereferencing other "container" types, |
| 75 | 75 | /// for example `Box<ByteStr>` or `Arc<ByteStr>`. |
| 76 | 76 | #[inline] |
| 77 | // #[unstable(feature = "str_as_str", issue = "130366")] | |
| 77 | 78 | #[unstable(feature = "bstr", issue = "134915")] |
| 78 | 79 | pub const fn as_byte_str(&self) -> &ByteStr { |
| 79 | 80 | self |
| ... | ... | @@ -85,6 +86,7 @@ impl ByteStr { |
| 85 | 86 | /// it helps dereferencing other "container" types, |
| 86 | 87 | /// for example `Box<ByteStr>` or `MutexGuard<ByteStr>`. |
| 87 | 88 | #[inline] |
| 89 | // #[unstable(feature = "str_as_str", issue = "130366")] | |
| 88 | 90 | #[unstable(feature = "bstr", issue = "134915")] |
| 89 | 91 | pub const fn as_mut_byte_str(&mut self) -> &mut ByteStr { |
| 90 | 92 | self |
library/core/src/ffi/c_str.rs+1-2| ... | ... | @@ -655,8 +655,7 @@ impl CStr { |
| 655 | 655 | /// it helps dereferencing other string-like types to string slices, |
| 656 | 656 | /// for example references to `Box<CStr>` or `Arc<CStr>`. |
| 657 | 657 | #[inline] |
| 658 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 659 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 658 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 660 | 659 | pub const fn as_c_str(&self) -> &CStr { |
| 661 | 660 | self |
| 662 | 661 | } |
library/core/src/lib.rs+1-2| ... | ... | @@ -98,7 +98,6 @@ |
| 98 | 98 | // tidy-alphabetical-start |
| 99 | 99 | #![feature(asm_experimental_arch)] |
| 100 | 100 | #![feature(bstr_internals)] |
| 101 | #![feature(cfg_select)] | |
| 102 | 101 | #![feature(cfg_target_has_reliable_f16_f128)] |
| 103 | 102 | #![feature(const_carrying_mul_add)] |
| 104 | 103 | #![feature(const_cmp)] |
| ... | ... | @@ -227,7 +226,7 @@ pub mod autodiff { |
| 227 | 226 | #[unstable(feature = "contracts", issue = "128044")] |
| 228 | 227 | pub mod contracts; |
| 229 | 228 | |
| 230 | #[unstable(feature = "cfg_select", issue = "115585")] | |
| 229 | #[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")] | |
| 231 | 230 | pub use crate::macros::cfg_select; |
| 232 | 231 | |
| 233 | 232 | #[macro_use] |
library/core/src/macros/mod.rs+1-5| ... | ... | @@ -206,8 +206,6 @@ pub macro assert_matches { |
| 206 | 206 | /// # Example |
| 207 | 207 | /// |
| 208 | 208 | /// ``` |
| 209 | /// #![feature(cfg_select)] | |
| 210 | /// | |
| 211 | 209 | /// cfg_select! { |
| 212 | 210 | /// unix => { |
| 213 | 211 | /// fn foo() { /* unix specific functionality */ } |
| ... | ... | @@ -225,14 +223,12 @@ pub macro assert_matches { |
| 225 | 223 | /// right-hand side: |
| 226 | 224 | /// |
| 227 | 225 | /// ``` |
| 228 | /// #![feature(cfg_select)] | |
| 229 | /// | |
| 230 | 226 | /// let _some_string = cfg_select! { |
| 231 | 227 | /// unix => "With great power comes great electricity bills", |
| 232 | 228 | /// _ => { "Behind every successful diet is an unwatched pizza" } |
| 233 | 229 | /// }; |
| 234 | 230 | /// ``` |
| 235 | #[unstable(feature = "cfg_select", issue = "115585")] | |
| 231 | #[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")] | |
| 236 | 232 | #[rustc_diagnostic_item = "cfg_select"] |
| 237 | 233 | #[rustc_builtin_macro] |
| 238 | 234 | pub macro cfg_select($($tt:tt)*) { |
library/core/src/prelude/v1.rs+1-1| ... | ... | @@ -80,7 +80,7 @@ mod ambiguous_macros_only { |
| 80 | 80 | #[doc(no_inline)] |
| 81 | 81 | pub use self::ambiguous_macros_only::{env, panic}; |
| 82 | 82 | |
| 83 | #[unstable(feature = "cfg_select", issue = "115585")] | |
| 83 | #[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")] | |
| 84 | 84 | #[doc(no_inline)] |
| 85 | 85 | pub use crate::cfg_select; |
| 86 | 86 |
library/core/src/slice/mod.rs+2-4| ... | ... | @@ -5337,8 +5337,7 @@ impl<T> [T] { |
| 5337 | 5337 | /// it helps dereferencing other "container" types to slices, |
| 5338 | 5338 | /// for example `Box<[T]>` or `Arc<[T]>`. |
| 5339 | 5339 | #[inline] |
| 5340 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 5341 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 5340 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 5342 | 5341 | pub const fn as_slice(&self) -> &[T] { |
| 5343 | 5342 | self |
| 5344 | 5343 | } |
| ... | ... | @@ -5349,8 +5348,7 @@ impl<T> [T] { |
| 5349 | 5348 | /// it helps dereferencing other "container" types to slices, |
| 5350 | 5349 | /// for example `Box<[T]>` or `MutexGuard<[T]>`. |
| 5351 | 5350 | #[inline] |
| 5352 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 5353 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 5351 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 5354 | 5352 | pub const fn as_mut_slice(&mut self) -> &mut [T] { |
| 5355 | 5353 | self |
| 5356 | 5354 | } |
library/core/src/str/mod.rs+1-2| ... | ... | @@ -3137,8 +3137,7 @@ impl str { |
| 3137 | 3137 | /// it helps dereferencing other string-like types to string slices, |
| 3138 | 3138 | /// for example references to `Box<str>` or `Arc<str>`. |
| 3139 | 3139 | #[inline] |
| 3140 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 3141 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 3140 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 3142 | 3141 | pub const fn as_str(&self) -> &str { |
| 3143 | 3142 | self |
| 3144 | 3143 | } |
library/coretests/tests/lib.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | // tidy-alphabetical-start |
| 2 | 2 | #![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] |
| 3 | #![cfg_attr(test, feature(cfg_select))] | |
| 4 | 3 | #![feature(array_ptr_get)] |
| 5 | 4 | #![feature(array_try_from_fn)] |
| 6 | 5 | #![feature(array_try_map)] |
library/panic_unwind/src/lib.rs-1| ... | ... | @@ -15,7 +15,6 @@ |
| 15 | 15 | #![unstable(feature = "panic_unwind", issue = "32837")] |
| 16 | 16 | #![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")] |
| 17 | 17 | #![feature(cfg_emscripten_wasm_eh)] |
| 18 | #![feature(cfg_select)] | |
| 19 | 18 | #![feature(core_intrinsics)] |
| 20 | 19 | #![feature(panic_unwind)] |
| 21 | 20 | #![feature(staged_api)] |
library/std/src/ffi/os_str.rs+1-2| ... | ... | @@ -1285,8 +1285,7 @@ impl OsStr { |
| 1285 | 1285 | /// it helps dereferencing other string-like types to string slices, |
| 1286 | 1286 | /// for example references to `Box<OsStr>` or `Arc<OsStr>`. |
| 1287 | 1287 | #[inline] |
| 1288 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 1289 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 1288 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 1290 | 1289 | pub const fn as_os_str(&self) -> &OsStr { |
| 1291 | 1290 | self |
| 1292 | 1291 | } |
library/std/src/lib.rs+1-2| ... | ... | @@ -322,7 +322,6 @@ |
| 322 | 322 | #![feature(bstr)] |
| 323 | 323 | #![feature(bstr_internals)] |
| 324 | 324 | #![feature(cast_maybe_uninit)] |
| 325 | #![feature(cfg_select)] | |
| 326 | 325 | #![feature(char_internals)] |
| 327 | 326 | #![feature(clone_to_uninit)] |
| 328 | 327 | #![feature(const_convert)] |
| ... | ... | @@ -695,7 +694,7 @@ mod panicking; |
| 695 | 694 | #[allow(dead_code, unused_attributes, fuzzy_provenance_casts, unsafe_op_in_unsafe_fn)] |
| 696 | 695 | mod backtrace_rs; |
| 697 | 696 | |
| 698 | #[unstable(feature = "cfg_select", issue = "115585")] | |
| 697 | #[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")] | |
| 699 | 698 | pub use core::cfg_select; |
| 700 | 699 | #[unstable( |
| 701 | 700 | feature = "concat_bytes", |
library/std/src/path.rs+1-2| ... | ... | @@ -3235,8 +3235,7 @@ impl Path { |
| 3235 | 3235 | /// it helps dereferencing other `PathBuf`-like types to `Path`s, |
| 3236 | 3236 | /// for example references to `Box<Path>` or `Arc<Path>`. |
| 3237 | 3237 | #[inline] |
| 3238 | #[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 3239 | #[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")] | |
| 3238 | #[unstable(feature = "str_as_str", issue = "130366")] | |
| 3240 | 3239 | pub const fn as_path(&self) -> &Path { |
| 3241 | 3240 | self |
| 3242 | 3241 | } |
library/std/src/prelude/v1.rs+1-1| ... | ... | @@ -79,7 +79,7 @@ mod ambiguous_macros_only { |
| 79 | 79 | #[doc(no_inline)] |
| 80 | 80 | pub use self::ambiguous_macros_only::{vec, panic}; |
| 81 | 81 | |
| 82 | #[unstable(feature = "cfg_select", issue = "115585")] | |
| 82 | #[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")] | |
| 83 | 83 | #[doc(no_inline)] |
| 84 | 84 | pub use core::prelude::v1::cfg_select; |
| 85 | 85 |
library/std/tests/env_modify.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | // These tests are in a separate integration test as they modify the environment, |
| 2 | 2 | // and would otherwise cause some other tests to fail. |
| 3 | #![feature(cfg_select)] | |
| 4 | 3 | |
| 5 | 4 | use std::env::*; |
| 6 | 5 | use std::ffi::{OsStr, OsString}; |
library/std_detect/src/lib.rs+1-1| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | //! * `s390x`: [`is_s390x_feature_detected`] |
| 16 | 16 | |
| 17 | 17 | #![unstable(feature = "stdarch_internal", issue = "none")] |
| 18 | #![feature(staged_api, cfg_select, doc_cfg, allow_internal_unstable)] | |
| 18 | #![feature(staged_api, doc_cfg, allow_internal_unstable)] | |
| 19 | 19 | #![deny(rust_2018_idioms)] |
| 20 | 20 | #![allow(clippy::shadow_reuse)] |
| 21 | 21 | #![cfg_attr(test, allow(unused_imports))] |
library/unwind/src/lib.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | #![no_std] |
| 2 | 2 | #![unstable(feature = "panic_unwind", issue = "32837")] |
| 3 | 3 | #![feature(cfg_emscripten_wasm_eh)] |
| 4 | #![feature(cfg_select)] | |
| 5 | 4 | #![feature(link_cfg)] |
| 6 | 5 | #![feature(staged_api)] |
| 7 | 6 | #![cfg_attr( |
src/tools/miri/src/lib.rs+1-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | #![cfg_attr(bootstrap, feature(if_let_guard))] |
| 2 | 2 | #![feature(abort_unwind)] |
| 3 | #![feature(cfg_select)] | |
| 4 | 3 | #![feature(rustc_private)] |
| 5 | 4 | #![feature(float_gamma)] |
| 6 | 5 | #![feature(float_erf)] |
| ... | ... | @@ -17,6 +16,7 @@ |
| 17 | 16 | #![feature(derive_coerce_pointee)] |
| 18 | 17 | #![feature(arbitrary_self_types)] |
| 19 | 18 | #![feature(iter_advance_by)] |
| 19 | #![cfg_attr(bootstrap, feature(cfg_select))] | |
| 20 | 20 | // Configure clippy and other lints |
| 21 | 21 | #![allow( |
| 22 | 22 | clippy::collapsible_else_if, |
src/tools/miri/tests/pass/float_extra_rounding_error.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //@revisions: random max none |
| 3 | 3 | //@[max]compile-flags: -Zmiri-max-extra-rounding-error |
| 4 | 4 | //@[none]compile-flags: -Zmiri-no-extra-rounding-error |
| 5 | #![feature(cfg_select)] | |
| 6 | 5 | |
| 7 | 6 | use std::collections::HashSet; |
| 8 | 7 | use std::hint::black_box; |
tests/codegen-llvm/function-arguments.rs+14-2| ... | ... | @@ -257,11 +257,11 @@ pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) {} |
| 257 | 257 | #[no_mangle] |
| 258 | 258 | pub fn trait_raw(_: *const dyn Drop) {} |
| 259 | 259 | |
| 260 | // Ensure that `Box` gets `noalias` when the right traits are present, but removing *either* `Unpin` | |
| 261 | // or `UnsafeUnpin` is enough to lose the attribute. | |
| 260 | 262 | // CHECK: @trait_box(ptr noalias noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}}) |
| 261 | 263 | #[no_mangle] |
| 262 | 264 | pub fn trait_box(_: Box<dyn Drop + Unpin + UnsafeUnpin>) {} |
| 263 | ||
| 264 | // Ensure that removing *either* `Unpin` or `UnsafeUnpin` is enough to lose the attribute. | |
| 265 | 265 | // CHECK: @trait_box_pin1(ptr noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}}) |
| 266 | 266 | #[no_mangle] |
| 267 | 267 | pub fn trait_box_pin1(_: Box<dyn Drop + Unpin>) {} |
| ... | ... | @@ -269,6 +269,18 @@ pub fn trait_box_pin1(_: Box<dyn Drop + Unpin>) {} |
| 269 | 269 | #[no_mangle] |
| 270 | 270 | pub fn trait_box_pin2(_: Box<dyn Drop + UnsafeUnpin>) {} |
| 271 | 271 | |
| 272 | // Same for mutable references (with a non-zero minimal size so that we also see the | |
| 273 | // `dereferenceable` disappear). | |
| 274 | // CHECK: @trait_mutref(ptr noalias noundef align 4 dereferenceable(4){{( %_1.0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %_1.1)?}}) | |
| 275 | #[no_mangle] | |
| 276 | pub fn trait_mutref(_: &mut (i32, dyn Drop + Unpin + UnsafeUnpin)) {} | |
| 277 | // CHECK: @trait_mutref_pin1(ptr noundef nonnull align 4{{( %_1.0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %_1.1)?}}) | |
| 278 | #[no_mangle] | |
| 279 | pub fn trait_mutref_pin1(_: &mut (i32, dyn Drop + Unpin)) {} | |
| 280 | // CHECK: @trait_mutref_pin2(ptr noundef nonnull align 4{{( %_1.0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %_1.1)?}}) | |
| 281 | #[no_mangle] | |
| 282 | pub fn trait_mutref_pin2(_: &mut (i32, dyn Drop + UnsafeUnpin)) {} | |
| 283 | ||
| 272 | 284 | // CHECK: { ptr, ptr } @trait_option(ptr noalias noundef align 1 %x.0, ptr %x.1) |
| 273 | 285 | #[no_mangle] |
| 274 | 286 | pub fn trait_option( |
tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | #![crate_type = "staticlib"] |
| 2 | 2 | #![feature(c_variadic)] |
| 3 | #![feature(cfg_select)] | |
| 4 | 3 | |
| 5 | 4 | use std::ffi::{CStr, CString, VaList, c_char, c_double, c_int, c_long, c_longlong}; |
| 6 | 5 |
tests/ui/asm/cfg.rs-1| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | //@ revisions: reva revb |
| 4 | 4 | //@ only-x86_64 |
| 5 | 5 | //@ run-pass |
| 6 | #![feature(cfg_select)] | |
| 7 | 6 | |
| 8 | 7 | use std::arch::{asm, naked_asm}; |
| 9 | 8 |
tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr+1-1| ... | ... | @@ -18,7 +18,7 @@ LL | #[warn(refining_impl_trait)] |
| 18 | 18 | help: replace the return type so that it matches the trait |
| 19 | 19 | | |
| 20 | 20 | LL - fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> { |
| 21 | LL + fn foo(&self) -> impl Future<Output = i32> { | |
| 21 | LL + fn foo(&self) -> impl std::future::Future<Output = i32> { | |
| 22 | 22 | | |
| 23 | 23 | |
| 24 | 24 | warning: 1 warning emitted |
tests/ui/async-await/in-trait/async-example-desugared-manual.stderr+1-1| ... | ... | @@ -18,7 +18,7 @@ LL | #[warn(refining_impl_trait)] |
| 18 | 18 | help: replace the return type so that it matches the trait |
| 19 | 19 | | |
| 20 | 20 | LL - fn foo(&self) -> MyFuture { |
| 21 | LL + fn foo(&self) -> impl Future<Output = i32> { | |
| 21 | LL + fn foo(&self) -> impl std::future::Future<Output = i32> { | |
| 22 | 22 | | |
| 23 | 23 | |
| 24 | 24 | warning: 1 warning emitted |
tests/ui/check-cfg/cfg-select.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #![feature(cfg_select)] | |
| 4 | 3 | #![crate_type = "lib"] |
| 5 | 4 | |
| 6 | 5 | cfg_select! { |
tests/ui/check-cfg/cfg-select.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | warning: unexpected `cfg` condition name: `invalid_cfg1` |
| 2 | --> $DIR/cfg-select.rs:8:5 | |
| 2 | --> $DIR/cfg-select.rs:7:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | invalid_cfg1 => {} |
| 5 | 5 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -10,7 +10,7 @@ LL | invalid_cfg1 => {} |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
| 11 | 11 | |
| 12 | 12 | warning: unexpected `cfg` condition name: `invalid_cfg2` |
| 13 | --> $DIR/cfg-select.rs:14:5 | |
| 13 | --> $DIR/cfg-select.rs:13:5 | |
| 14 | 14 | | |
| 15 | 15 | LL | invalid_cfg2 => {} |
| 16 | 16 | | ^^^^^^^^^^^^ |
tests/ui/feature-gates/feature-gate-cfg-select.rs deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | #![warn(unreachable_cfg_select_predicates)] | |
| 2 | //~^ WARN unknown lint: `unreachable_cfg_select_predicates` | |
| 3 | ||
| 4 | cfg_select! { | |
| 5 | //~^ ERROR use of unstable library feature `cfg_select` | |
| 6 | _ => {} | |
| 7 | // With the feature enabled, this branch would trip the unreachable_cfg_select_predicate lint. | |
| 8 | true => {} | |
| 9 | } | |
| 10 | ||
| 11 | fn main() {} |
tests/ui/feature-gates/feature-gate-cfg-select.stderr deleted-25| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | error[E0658]: use of unstable library feature `cfg_select` | |
| 2 | --> $DIR/feature-gate-cfg-select.rs:4:1 | |
| 3 | | | |
| 4 | LL | cfg_select! { | |
| 5 | | ^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: see issue #115585 <https://github.com/rust-lang/rust/issues/115585> for more information | |
| 8 | = help: add `#![feature(cfg_select)]` to the crate attributes to enable | |
| 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 10 | ||
| 11 | warning: unknown lint: `unreachable_cfg_select_predicates` | |
| 12 | --> $DIR/feature-gate-cfg-select.rs:1:9 | |
| 13 | | | |
| 14 | LL | #![warn(unreachable_cfg_select_predicates)] | |
| 15 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 16 | | | |
| 17 | = note: the `unreachable_cfg_select_predicates` lint is unstable | |
| 18 | = note: see issue #115585 <https://github.com/rust-lang/rust/issues/115585> for more information | |
| 19 | = help: add `#![feature(cfg_select)]` to the crate attributes to enable | |
| 20 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 21 | = note: `#[warn(unknown_lints)]` on by default | |
| 22 | ||
| 23 | error: aborting due to 1 previous error; 1 warning emitted | |
| 24 | ||
| 25 | For more information about this error, try `rustc --explain E0658`. |
tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr+1-1| ... | ... | @@ -29,7 +29,7 @@ LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { |
| 29 | 29 | help: replace the return type so that it matches the trait |
| 30 | 30 | | |
| 31 | 31 | LL - fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { |
| 32 | LL + fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { | |
| 32 | LL + fn iter(&self) -> impl std::iter::Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { | |
| 33 | 33 | | |
| 34 | 34 | |
| 35 | 35 | error: aborting due to 1 previous error; 1 warning emitted |
tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr+3-2| ... | ... | @@ -12,8 +12,9 @@ LL | fn bar(&self) -> impl Iterator + '_ { |
| 12 | 12 | = note: `#[warn(refining_impl_trait_internal)]` (part of `#[warn(refining_impl_trait)]`) on by default |
| 13 | 13 | help: replace the return type so that it matches the trait |
| 14 | 14 | | |
| 15 | LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { | |
| 16 | | +++++++++++++++++++ | |
| 15 | LL - fn bar(&self) -> impl Iterator + '_ { | |
| 16 | LL + fn bar(&self) -> impl std::iter::Iterator<Item = impl Sized> + '_ { | |
| 17 | | | |
| 17 | 18 | |
| 18 | 19 | warning: 1 warning emitted |
| 19 | 20 |
tests/ui/impl-trait/in-trait/foreign.stderr+2-2| ... | ... | @@ -15,7 +15,7 @@ LL | #[warn(refining_impl_trait)] |
| 15 | 15 | help: replace the return type so that it matches the trait |
| 16 | 16 | | |
| 17 | 17 | LL - fn bar(self) -> Arc<String> { |
| 18 | LL + fn bar(self) -> impl Deref<Target = impl Sized> { | |
| 18 | LL + fn bar(self) -> impl std::ops::Deref<Target = impl Sized> { | |
| 19 | 19 | | |
| 20 | 20 | |
| 21 | 21 | warning: impl trait in impl method signature does not match trait method signature |
| ... | ... | @@ -34,7 +34,7 @@ LL | #[warn(refining_impl_trait)] |
| 34 | 34 | help: replace the return type so that it matches the trait |
| 35 | 35 | | |
| 36 | 36 | LL - fn bar(self) -> Arc<String> { |
| 37 | LL + fn bar(self) -> impl Deref<Target = impl Sized> { | |
| 37 | LL + fn bar(self) -> impl std::ops::Deref<Target = impl Sized> { | |
| 38 | 38 | | |
| 39 | 39 | |
| 40 | 40 | warning: 2 warnings emitted |
tests/ui/impl-trait/in-trait/refine-return-type-notation.rs created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | #![feature(return_type_notation)] | |
| 2 | #![deny(refining_impl_trait)] | |
| 3 | ||
| 4 | trait Trait { | |
| 5 | fn f() -> impl Sized; | |
| 6 | } | |
| 7 | ||
| 8 | impl Trait for () { | |
| 9 | fn f() {} | |
| 10 | //~^ ERROR impl trait in impl method signature does not match trait method signature | |
| 11 | } | |
| 12 | ||
| 13 | fn main() {} |
tests/ui/impl-trait/in-trait/refine-return-type-notation.stderr created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | error: impl trait in impl method signature does not match trait method signature | |
| 2 | --> $DIR/refine-return-type-notation.rs:9:5 | |
| 3 | | | |
| 4 | LL | fn f() -> impl Sized; | |
| 5 | | ---------- return type from trait method defined here | |
| 6 | ... | |
| 7 | LL | fn f() {} | |
| 8 | | ^^^^^^ | |
| 9 | | | |
| 10 | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate | |
| 11 | = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information | |
| 12 | note: the lint level is defined here | |
| 13 | --> $DIR/refine-return-type-notation.rs:2:9 | |
| 14 | | | |
| 15 | LL | #![deny(refining_impl_trait)] | |
| 16 | | ^^^^^^^^^^^^^^^^^^^ | |
| 17 | = note: `#[deny(refining_impl_trait_internal)]` implied by `#[deny(refining_impl_trait)]` | |
| 18 | help: replace the return type so that it matches the trait | |
| 19 | | | |
| 20 | LL | fn f()-> impl Sized {} | |
| 21 | | +++++++++++++ | |
| 22 | ||
| 23 | error: aborting due to 1 previous error | |
| 24 |
tests/ui/macros/cfg_select.rs-1| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | #![feature(cfg_select)] | |
| 2 | 1 | #![crate_type = "lib"] |
| 3 | 2 | #![warn(unreachable_cfg_select_predicates)] // Unused warnings are disabled by default in UI tests. |
| 4 | 3 |
tests/ui/macros/cfg_select.stderr+17-17| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: none of the predicates in this `cfg_select` evaluated to true |
| 2 | --> $DIR/cfg_select.rs:162:1 | |
| 2 | --> $DIR/cfg_select.rs:161:1 | |
| 3 | 3 | | |
| 4 | 4 | LL | / cfg_select! { |
| 5 | 5 | LL | | |
| ... | ... | @@ -8,55 +8,55 @@ LL | | } |
| 8 | 8 | | |_^ |
| 9 | 9 | |
| 10 | 10 | error: none of the predicates in this `cfg_select` evaluated to true |
| 11 | --> $DIR/cfg_select.rs:167:1 | |
| 11 | --> $DIR/cfg_select.rs:166:1 | |
| 12 | 12 | | |
| 13 | 13 | LL | cfg_select! {} |
| 14 | 14 | | ^^^^^^^^^^^^^^ |
| 15 | 15 | |
| 16 | 16 | error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `=>` |
| 17 | --> $DIR/cfg_select.rs:171:5 | |
| 17 | --> $DIR/cfg_select.rs:170:5 | |
| 18 | 18 | | |
| 19 | 19 | LL | => {} |
| 20 | 20 | | ^^ |
| 21 | 21 | |
| 22 | 22 | error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found expression |
| 23 | --> $DIR/cfg_select.rs:176:5 | |
| 23 | --> $DIR/cfg_select.rs:175:5 | |
| 24 | 24 | | |
| 25 | 25 | LL | () => {} |
| 26 | 26 | | ^^ expressions are not allowed here |
| 27 | 27 | |
| 28 | 28 | error[E0539]: malformed `cfg_select` macro input |
| 29 | --> $DIR/cfg_select.rs:181:5 | |
| 29 | --> $DIR/cfg_select.rs:180:5 | |
| 30 | 30 | | |
| 31 | 31 | LL | "str" => {} |
| 32 | 32 | | ^^^^^ expected a valid identifier here |
| 33 | 33 | |
| 34 | 34 | error[E0539]: malformed `cfg_select` macro input |
| 35 | --> $DIR/cfg_select.rs:186:5 | |
| 35 | --> $DIR/cfg_select.rs:185:5 | |
| 36 | 36 | | |
| 37 | 37 | LL | a::b => {} |
| 38 | 38 | | ^^^^ expected a valid identifier here |
| 39 | 39 | |
| 40 | 40 | error[E0537]: invalid predicate `a` |
| 41 | --> $DIR/cfg_select.rs:191:5 | |
| 41 | --> $DIR/cfg_select.rs:190:5 | |
| 42 | 42 | | |
| 43 | 43 | LL | a() => {} |
| 44 | 44 | | ^^^ |
| 45 | 45 | |
| 46 | 46 | error: expected one of `(`, `::`, `=>`, or `=`, found `+` |
| 47 | --> $DIR/cfg_select.rs:196:7 | |
| 47 | --> $DIR/cfg_select.rs:195:7 | |
| 48 | 48 | | |
| 49 | 49 | LL | a + 1 => {} |
| 50 | 50 | | ^ expected one of `(`, `::`, `=>`, or `=` |
| 51 | 51 | |
| 52 | 52 | error: expected one of `(`, `::`, `=>`, or `=`, found `!` |
| 53 | --> $DIR/cfg_select.rs:202:8 | |
| 53 | --> $DIR/cfg_select.rs:201:8 | |
| 54 | 54 | | |
| 55 | 55 | LL | cfg!() => {} |
| 56 | 56 | | ^ expected one of `(`, `::`, `=>`, or `=` |
| 57 | 57 | |
| 58 | 58 | warning: unreachable configuration predicate |
| 59 | --> $DIR/cfg_select.rs:137:5 | |
| 59 | --> $DIR/cfg_select.rs:136:5 | |
| 60 | 60 | | |
| 61 | 61 | LL | _ => {} |
| 62 | 62 | | - always matches |
| ... | ... | @@ -64,13 +64,13 @@ LL | true => {} |
| 64 | 64 | | ^^^^ this configuration predicate is never reached |
| 65 | 65 | | |
| 66 | 66 | note: the lint level is defined here |
| 67 | --> $DIR/cfg_select.rs:3:9 | |
| 67 | --> $DIR/cfg_select.rs:2:9 | |
| 68 | 68 | | |
| 69 | 69 | LL | #![warn(unreachable_cfg_select_predicates)] // Unused warnings are disabled by default in UI tests. |
| 70 | 70 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 71 | 71 | |
| 72 | 72 | warning: unreachable configuration predicate |
| 73 | --> $DIR/cfg_select.rs:143:5 | |
| 73 | --> $DIR/cfg_select.rs:142:5 | |
| 74 | 74 | | |
| 75 | 75 | LL | true => {} |
| 76 | 76 | | ---- always matches |
| ... | ... | @@ -78,25 +78,25 @@ LL | _ => {} |
| 78 | 78 | | ^ this configuration predicate is never reached |
| 79 | 79 | |
| 80 | 80 | warning: unreachable configuration predicate |
| 81 | --> $DIR/cfg_select.rs:150:5 | |
| 81 | --> $DIR/cfg_select.rs:149:5 | |
| 82 | 82 | | |
| 83 | 83 | LL | _ => {} |
| 84 | 84 | | ^ this configuration predicate is never reached |
| 85 | 85 | |
| 86 | 86 | warning: unreachable configuration predicate |
| 87 | --> $DIR/cfg_select.rs:156:5 | |
| 87 | --> $DIR/cfg_select.rs:155:5 | |
| 88 | 88 | | |
| 89 | 89 | LL | test => {} |
| 90 | 90 | | ^^^^ this configuration predicate is never reached |
| 91 | 91 | |
| 92 | 92 | warning: unreachable configuration predicate |
| 93 | --> $DIR/cfg_select.rs:158:5 | |
| 93 | --> $DIR/cfg_select.rs:157:5 | |
| 94 | 94 | | |
| 95 | 95 | LL | _ => {} |
| 96 | 96 | | ^ this configuration predicate is never reached |
| 97 | 97 | |
| 98 | 98 | warning: unexpected `cfg` condition name: `a` |
| 99 | --> $DIR/cfg_select.rs:196:5 | |
| 99 | --> $DIR/cfg_select.rs:195:5 | |
| 100 | 100 | | |
| 101 | 101 | LL | a + 1 => {} |
| 102 | 102 | | ^ help: found config with similar value: `target_feature = "a"` |
| ... | ... | @@ -107,7 +107,7 @@ LL | a + 1 => {} |
| 107 | 107 | = note: `#[warn(unexpected_cfgs)]` on by default |
| 108 | 108 | |
| 109 | 109 | warning: unexpected `cfg` condition name: `cfg` |
| 110 | --> $DIR/cfg_select.rs:202:5 | |
| 110 | --> $DIR/cfg_select.rs:201:5 | |
| 111 | 111 | | |
| 112 | 112 | LL | cfg!() => {} |
| 113 | 113 | | ^^^ |
tests/ui/macros/cfg_select_parse_error.rs-1| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | #![feature(cfg_select)] | |
| 2 | 1 | #![crate_type = "lib"] |
| 3 | 2 | |
| 4 | 3 | // Check that parse errors in arms that are not selected are still reported. |
tests/ui/macros/cfg_select_parse_error.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: Rust has no postfix increment operator |
| 2 | --> $DIR/cfg_select_parse_error.rs:8:22 | |
| 2 | --> $DIR/cfg_select_parse_error.rs:7:22 | |
| 3 | 3 | | |
| 4 | 4 | LL | false => { 1 ++ 2 } |
| 5 | 5 | | ^^ not a valid postfix operator |
| ... | ... | @@ -11,7 +11,7 @@ LL + false => { { let tmp = 1 ; 1 += 1; tmp } 2 } |
| 11 | 11 | | |
| 12 | 12 | |
| 13 | 13 | error: Rust has no postfix increment operator |
| 14 | --> $DIR/cfg_select_parse_error.rs:15:29 | |
| 14 | --> $DIR/cfg_select_parse_error.rs:14:29 | |
| 15 | 15 | | |
| 16 | 16 | LL | false => { fn foo() { 1 +++ 2 } } |
| 17 | 17 | | ^^ not a valid postfix operator |
tests/ui/resolve/slice-as-slice.rs created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | //@ check-pass | |
| 2 | // This is a regression test for github.com/rust-lang/rust/issues/152961 | |
| 3 | // This broke when a method `as_slice` was added on slices | |
| 4 | // This pattern is used in the `rgb` crate | |
| 5 | ||
| 6 | struct Meow; | |
| 7 | ||
| 8 | trait ComponentSlice<T> { | |
| 9 | fn as_slice(&self) -> &[T]; | |
| 10 | } | |
| 11 | ||
| 12 | impl ComponentSlice<u8> for [Meow] { | |
| 13 | fn as_slice(&self) -> &[u8] { | |
| 14 | todo!() | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | fn a(data: &[Meow]) { | |
| 19 | b(data.as_slice()); | |
| 20 | //~^ WARN a method with this name may be added to the standard library in the future | |
| 21 | //~| WARN once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! | |
| 22 | } | |
| 23 | ||
| 24 | fn b(_b: &[u8]) { } | |
| 25 | ||
| 26 | fn main() {} |
tests/ui/resolve/slice-as-slice.stderr created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | warning: a method with this name may be added to the standard library in the future | |
| 2 | --> $DIR/slice-as-slice.rs:19:12 | |
| 3 | | | |
| 4 | LL | b(data.as_slice()); | |
| 5 | | ^^^^^^^^ | |
| 6 | | | |
| 7 | = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! | |
| 8 | = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> | |
| 9 | = help: call with fully qualified syntax `ComponentSlice::as_slice(...)` to keep using the current method | |
| 10 | = note: `#[warn(unstable_name_collisions)]` (part of `#[warn(future_incompatible)]`) on by default | |
| 11 | help: add `#![feature(str_as_str)]` to the crate attributes to enable `core::slice::<impl [T]>::as_slice` | |
| 12 | | | |
| 13 | LL + #![feature(str_as_str)] | |
| 14 | | | |
| 15 | ||
| 16 | warning: 1 warning emitted | |
| 17 |