Rollup merge of #152206 - tshepang:misc, r=davidtwco

misc doc improvements

These are things I collected as I was looking at code and docs
This commit is contained in:
Stuart Cook 2026-02-17 13:02:23 +11:00 committed by GitHub
commit 910d4f4c09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 52 additions and 29 deletions

View file

@ -1,7 +1,7 @@
The requested ABI is unsupported by the current target. The requested ABI is unsupported by the current target.
The rust compiler maintains for each target a list of unsupported ABIs on The Rust compiler maintains a list of unsupported ABIs for each target.
that target. If an ABI is present in such a list this usually means that the If an ABI is present in such a list, this usually means that the
target / ABI combination is currently unsupported by llvm. target / ABI combination is currently unsupported by llvm.
If necessary, you can circumvent this check using custom target specifications. If necessary, you can circumvent this check using custom target specifications.

View file

@ -86,8 +86,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
if let Some(f) = REMOVED_LANG_FEATURES.iter().find(|f| name == f.feature.name) { if let Some(f) = REMOVED_LANG_FEATURES.iter().find(|f| name == f.feature.name) {
let pull_note = if let Some(pull) = f.pull { let pull_note = if let Some(pull) = f.pull {
format!( format!(
"; see <https://github.com/rust-lang/rust/pull/{}> for more information", "; see <https://github.com/rust-lang/rust/pull/{pull}> for more information",
pull
) )
} else { } else {
"".to_owned() "".to_owned()
@ -123,7 +122,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
// If the enabled feature is unstable, record it. // If the enabled feature is unstable, record it.
if UNSTABLE_LANG_FEATURES.iter().find(|f| name == f.name).is_some() { if UNSTABLE_LANG_FEATURES.iter().find(|f| name == f.name).is_some() {
// When the ICE comes a standard library crate, there's a chance that the person // When the ICE comes from a standard library crate, there's a chance that the person
// hitting the ICE may be using -Zbuild-std or similar with an untested target. // hitting the ICE may be using -Zbuild-std or similar with an untested target.
// The bug is probably in the standard library and not the compiler in that case, // The bug is probably in the standard library and not the compiler in that case,
// but that doesn't really matter - we want a bug report. // but that doesn't really matter - we want a bug report.

View file

@ -64,8 +64,6 @@ pub struct EnabledLibFeature {
} }
impl Features { impl Features {
/// `since` should be set for stable features that are nevertheless enabled with a `#[feature]`
/// attribute, indicating since when they are stable.
pub fn set_enabled_lang_feature(&mut self, lang_feat: EnabledLangFeature) { pub fn set_enabled_lang_feature(&mut self, lang_feat: EnabledLangFeature) {
self.enabled_lang_features.push(lang_feat); self.enabled_lang_features.push(lang_feat);
self.enabled_features.insert(lang_feat.gate_name); self.enabled_features.insert(lang_feat.gate_name);
@ -781,8 +779,9 @@ impl Features {
} }
} }
/// Some features are not allowed to be used together at the same time, if /// Some features are not allowed to be used together at the same time.
/// the two are present, produce an error. ///
/// If the two are present, produce an error.
pub const INCOMPATIBLE_FEATURES: &[(Symbol, Symbol)] = &[ pub const INCOMPATIBLE_FEATURES: &[(Symbol, Symbol)] = &[
// Experimental match ergonomics rulesets are incompatible with each other, to simplify the // Experimental match ergonomics rulesets are incompatible with each other, to simplify the
// boolean logic required to tell which typing rules to use. // boolean logic required to tell which typing rules to use.

View file

@ -3659,10 +3659,10 @@ declare_lint! {
/// `stdcall`, `fastcall`, and `cdecl` calling conventions (or their unwind /// `stdcall`, `fastcall`, and `cdecl` calling conventions (or their unwind
/// variants) on targets that cannot meaningfully be supported for the requested target. /// variants) on targets that cannot meaningfully be supported for the requested target.
/// ///
/// For example `stdcall` does not make much sense for a x86_64 or, more apparently, powerpc /// For example, `stdcall` does not make much sense for a x86_64 or, more apparently, powerpc
/// code, because this calling convention was never specified for those targets. /// code, because this calling convention was never specified for those targets.
/// ///
/// Historically MSVC toolchains have fallen back to the regular C calling convention for /// Historically, MSVC toolchains have fallen back to the regular C calling convention for
/// targets other than x86, but Rust doesn't really see a similar need to introduce a similar /// targets other than x86, but Rust doesn't really see a similar need to introduce a similar
/// hack across many more targets. /// hack across many more targets.
/// ///
@ -3689,7 +3689,7 @@ declare_lint! {
/// ///
/// ### Explanation /// ### Explanation
/// ///
/// On most of the targets the behaviour of `stdcall` and similar calling conventions is not /// On most of the targets, the behaviour of `stdcall` and similar calling conventions is not
/// defined at all, but was previously accepted due to a bug in the implementation of the /// defined at all, but was previously accepted due to a bug in the implementation of the
/// compiler. /// compiler.
pub UNSUPPORTED_CALLING_CONVENTIONS, pub UNSUPPORTED_CALLING_CONVENTIONS,

View file

@ -42,7 +42,9 @@ where
} }
} }
/// A complete reference to a trait. These take numerous guises in syntax, /// A complete reference to a trait.
///
/// These take numerous guises in syntax,
/// but perhaps the most recognizable form is in a where-clause: /// but perhaps the most recognizable form is in a where-clause:
/// ```ignore (illustrative) /// ```ignore (illustrative)
/// T: Foo<U> /// T: Foo<U>
@ -241,7 +243,9 @@ impl ImplPolarity {
} }
} }
/// Polarity for a trait predicate. May either be negative or positive. /// Polarity for a trait predicate.
///
/// May either be negative or positive.
/// Distinguished from [`ImplPolarity`] since we never compute goals with /// Distinguished from [`ImplPolarity`] since we never compute goals with
/// "reservation" level. /// "reservation" level.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
@ -327,6 +331,7 @@ impl<I: Interner> ty::Binder<I, ExistentialPredicate<I>> {
} }
/// An existential reference to a trait, where `Self` is erased. /// An existential reference to a trait, where `Self` is erased.
///
/// For example, the trait object `Trait<'a, 'b, X, Y>` is: /// For example, the trait object `Trait<'a, 'b, X, Y>` is:
/// ```ignore (illustrative) /// ```ignore (illustrative)
/// exists T. T: Trait<'a, 'b, X, Y> /// exists T. T: Trait<'a, 'b, X, Y>
@ -442,6 +447,7 @@ impl<I: Interner> ExistentialProjection<I> {
} }
/// Extracts the underlying existential trait reference from this projection. /// Extracts the underlying existential trait reference from this projection.
///
/// For example, if this is a projection of `exists T. <T as Iterator>::Item == X`, /// For example, if this is a projection of `exists T. <T as Iterator>::Item == X`,
/// then this function would return an `exists T. T: Iterator` existential trait /// then this function would return an `exists T. T: Iterator` existential trait
/// reference. /// reference.
@ -493,14 +499,17 @@ impl<I: Interner> ty::Binder<I, ExistentialProjection<I>> {
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))]
pub enum AliasTermKind { pub enum AliasTermKind {
/// A projection `<Type as Trait>::AssocType`. /// A projection `<Type as Trait>::AssocType`.
///
/// Can get normalized away if monomorphic enough. /// Can get normalized away if monomorphic enough.
ProjectionTy, ProjectionTy,
/// An associated type in an inherent `impl` /// An associated type in an inherent `impl`
InherentTy, InherentTy,
/// An opaque type (usually from `impl Trait` in type aliases or function return types) /// An opaque type (usually from `impl Trait` in type aliases or function return types)
///
/// Can only be normalized away in PostAnalysis mode or its defining scope. /// Can only be normalized away in PostAnalysis mode or its defining scope.
OpaqueTy, OpaqueTy,
/// A free type alias that actually checks its trait bounds. /// A free type alias that actually checks its trait bounds.
///
/// Currently only used if the type alias references opaque types. /// Currently only used if the type alias references opaque types.
/// Can always be normalized away. /// Can always be normalized away.
FreeTy, FreeTy,

View file

@ -29,14 +29,17 @@ mod closure;
)] )]
pub enum AliasTyKind { pub enum AliasTyKind {
/// A projection `<Type as Trait>::AssocType`. /// A projection `<Type as Trait>::AssocType`.
///
/// Can get normalized away if monomorphic enough. /// Can get normalized away if monomorphic enough.
Projection, Projection,
/// An associated type in an inherent `impl` /// An associated type in an inherent `impl`
Inherent, Inherent,
/// An opaque type (usually from `impl Trait` in type aliases or function return types) /// An opaque type (usually from `impl Trait` in type aliases or function return types)
///
/// Can only be normalized away in PostAnalysis mode or its defining scope. /// Can only be normalized away in PostAnalysis mode or its defining scope.
Opaque, Opaque,
/// A type alias that actually checks its trait bounds. /// A type alias that actually checks its trait bounds.
///
/// Currently only used if the type alias references opaque types. /// Currently only used if the type alias references opaque types.
/// Can always be normalized away. /// Can always be normalized away.
Free, Free,
@ -99,7 +102,9 @@ pub enum TyKind<I: Interner> {
/// An array with the given length. Written as `[T; N]`. /// An array with the given length. Written as `[T; N]`.
Array(I::Ty, I::Const), Array(I::Ty, I::Const),
/// A pattern newtype. Takes any type and restricts its valid values to its pattern. /// A pattern newtype.
///
/// Takes any type and restricts its valid values to its pattern.
/// This will also change the layout to take advantage of this restriction. /// This will also change the layout to take advantage of this restriction.
/// Only `Copy` and `Clone` will automatically get implemented for pattern types. /// Only `Copy` and `Clone` will automatically get implemented for pattern types.
/// Auto-traits treat this as if it were an aggregate with a single nested type. /// Auto-traits treat this as if it were an aggregate with a single nested type.
@ -116,8 +121,9 @@ pub enum TyKind<I: Interner> {
/// `&'a mut T` or `&'a T`. /// `&'a mut T` or `&'a T`.
Ref(I::Region, I::Ty, Mutability), Ref(I::Region, I::Ty, Mutability),
/// The anonymous type of a function declaration/definition. Each /// The anonymous type of a function declaration/definition.
/// function has a unique type. ///
/// Each function has a unique type.
/// ///
/// For the function `fn foo() -> i32 { 3 }` this type would be /// For the function `fn foo() -> i32 { 3 }` this type would be
/// shown to the user as `fn() -> i32 {foo}`. /// shown to the user as `fn() -> i32 {foo}`.
@ -129,7 +135,9 @@ pub enum TyKind<I: Interner> {
/// ``` /// ```
FnDef(I::FunctionId, I::GenericArgs), FnDef(I::FunctionId, I::GenericArgs),
/// A pointer to a function. Written as `fn() -> i32`. /// A pointer to a function.
///
/// Written as `fn() -> i32`.
/// ///
/// Note that both functions and closures start out as either /// Note that both functions and closures start out as either
/// [FnDef] or [Closure] which can be then be coerced to this variant. /// [FnDef] or [Closure] which can be then be coerced to this variant.
@ -179,6 +187,7 @@ pub enum TyKind<I: Interner> {
Coroutine(I::CoroutineId, I::GenericArgs), Coroutine(I::CoroutineId, I::GenericArgs),
/// A type representing the types stored inside a coroutine. /// A type representing the types stored inside a coroutine.
///
/// This should only appear as part of the `CoroutineArgs`. /// This should only appear as part of the `CoroutineArgs`.
/// ///
/// Unlike upvars, the witness can reference lifetimes from /// Unlike upvars, the witness can reference lifetimes from
@ -210,6 +219,7 @@ pub enum TyKind<I: Interner> {
Tuple(I::Tys), Tuple(I::Tys),
/// A projection, opaque type, free type alias, or inherent associated type. /// A projection, opaque type, free type alias, or inherent associated type.
///
/// All of these types are represented as pairs of def-id and args, and can /// All of these types are represented as pairs of def-id and args, and can
/// be normalized, so they are grouped conceptually. /// be normalized, so they are grouped conceptually.
Alias(AliasTyKind, AliasTy<I>), Alias(AliasTyKind, AliasTy<I>),
@ -253,8 +263,9 @@ pub enum TyKind<I: Interner> {
/// inside of the type. /// inside of the type.
Infer(InferTy), Infer(InferTy),
/// A placeholder for a type which could not be computed; this is /// A placeholder for a type which could not be computed.
/// propagated to avoid useless error messages. ///
/// This is propagated to avoid useless error messages.
Error(I::ErrorGuaranteed), Error(I::ErrorGuaranteed),
} }
@ -282,7 +293,9 @@ impl<I: Interner> TyKind<I> {
} }
/// Returns `true` when the outermost type cannot be further normalized, /// Returns `true` when the outermost type cannot be further normalized,
/// resolved, or instantiated. This includes all primitive types, but also /// resolved, or instantiated.
///
/// This includes all primitive types, but also
/// things like ADTs and trait objects, since even if their arguments or /// things like ADTs and trait objects, since even if their arguments or
/// nested types may be further simplified, the outermost [`ty::TyKind`] or /// nested types may be further simplified, the outermost [`ty::TyKind`] or
/// type constructor remains the same. /// type constructor remains the same.
@ -481,6 +494,7 @@ impl<I: Interner> AliasTy<I> {
} }
/// Extracts the underlying trait reference and own args from this projection. /// Extracts the underlying trait reference and own args from this projection.
///
/// For example, if this is a projection of `<T as StreamingIterator>::Item<'a>`, /// For example, if this is a projection of `<T as StreamingIterator>::Item<'a>`,
/// then this function would return a `T: StreamingIterator` trait reference and /// then this function would return a `T: StreamingIterator` trait reference and
/// `['a]` as the own args. /// `['a]` as the own args.
@ -490,6 +504,7 @@ impl<I: Interner> AliasTy<I> {
} }
/// Extracts the underlying trait reference from this projection. /// Extracts the underlying trait reference from this projection.
///
/// For example, if this is a projection of `<T as Iterator>::Item`, /// For example, if this is a projection of `<T as Iterator>::Item`,
/// then this function would return a `T: Iterator` trait reference. /// then this function would return a `T: Iterator` trait reference.
/// ///
@ -593,8 +608,9 @@ pub enum InferTy {
FloatVar(FloatVid), FloatVar(FloatVid),
/// A [`FreshTy`][Self::FreshTy] is one that is generated as a replacement /// A [`FreshTy`][Self::FreshTy] is one that is generated as a replacement
/// for an unbound type variable. This is convenient for caching etc. See /// for an unbound type variable.
/// `TypeFreshener` for more details. ///
/// This is convenient for caching etc. See `TypeFreshener` for more details.
/// ///
/// Compare with [`TyVar`][Self::TyVar]. /// Compare with [`TyVar`][Self::TyVar].
FreshTy(u32), FreshTy(u32),

View file

@ -25,7 +25,7 @@ labels_blocking_approval = [
"S-waiting-on-t-rustdoc-frontend", "S-waiting-on-t-rustdoc-frontend",
"S-waiting-on-t-clippy", "S-waiting-on-t-clippy",
# PR manually set to blocked # PR manually set to blocked
"S-blocked" "S-blocked",
] ]
# If CI runs quicker than this duration, consider it to be a failure # If CI runs quicker than this duration, consider it to be a failure
@ -41,7 +41,7 @@ approved = [
"-S-waiting-on-author", "-S-waiting-on-author",
"-S-waiting-on-crater", "-S-waiting-on-crater",
"-S-waiting-on-review", "-S-waiting-on-review",
"-S-waiting-on-team" "-S-waiting-on-team",
] ]
unapproved = [ unapproved = [
"+S-waiting-on-author", "+S-waiting-on-author",
@ -49,16 +49,16 @@ unapproved = [
"-S-waiting-on-bors", "-S-waiting-on-bors",
"-S-waiting-on-crater", "-S-waiting-on-crater",
"-S-waiting-on-review", "-S-waiting-on-review",
"-S-waiting-on-team" "-S-waiting-on-team",
] ]
try_failed = [ try_failed = [
"+S-waiting-on-author", "+S-waiting-on-author",
"-S-waiting-on-review", "-S-waiting-on-review",
"-S-waiting-on-crater" "-S-waiting-on-crater",
] ]
auto_build_succeeded = [ auto_build_succeeded = [
"+merged-by-bors", "+merged-by-bors",
"-S-waiting-on-bors" "-S-waiting-on-bors",
] ]
auto_build_failed = [ auto_build_failed = [
"+S-waiting-on-review", "+S-waiting-on-review",
@ -66,5 +66,5 @@ auto_build_failed = [
"-S-waiting-on-bors", "-S-waiting-on-bors",
"-S-waiting-on-author", "-S-waiting-on-author",
"-S-waiting-on-crater", "-S-waiting-on-crater",
"-S-waiting-on-team" "-S-waiting-on-team",
] ]