mirror of
https://github.com/rust-lang/rust
synced 2024-10-06 08:40:35 +00:00
Auto merge of #123592 - matthiaskrgr:rollup-3k1pq8s, r=matthiaskrgr
Rollup of 2 pull requests Successful merges: - #123584 (Emit an error when `rustc_doc_primitive` has an unknown value) - #123589 (sys_common::thread_local_key: make a note that this is not used on Windows) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
e78913baef
|
@ -1,4 +1,4 @@
|
||||||
//! OS-based thread local storage
|
//! OS-based thread local storage for non-Windows systems
|
||||||
//!
|
//!
|
||||||
//! This module provides an implementation of OS-based thread local storage,
|
//! This module provides an implementation of OS-based thread local storage,
|
||||||
//! using the native OS-provided facilities (think `TlsAlloc` or
|
//! using the native OS-provided facilities (think `TlsAlloc` or
|
||||||
|
@ -11,6 +11,9 @@
|
||||||
//! the OS-TLS key. The other is a type which does implement `Drop` and hence
|
//! the OS-TLS key. The other is a type which does implement `Drop` and hence
|
||||||
//! has a safe interface.
|
//! has a safe interface.
|
||||||
//!
|
//!
|
||||||
|
//! Windows doesn't use this module at all; `sys::pal::windows::thread_local_key`
|
||||||
|
//! gets imported in its stead.
|
||||||
|
//!
|
||||||
//! # Usage
|
//! # Usage
|
||||||
//!
|
//!
|
||||||
//! This module should likely not be used directly unless other primitives are
|
//! This module should likely not be used directly unless other primitives are
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
use rustc_hir_analysis::check::intrinsic::intrinsic_operation_unsafety;
|
use rustc_hir_analysis::check::intrinsic::intrinsic_operation_unsafety;
|
||||||
use rustc_index::IndexVec;
|
use rustc_index::IndexVec;
|
||||||
use rustc_metadata::rendered_const;
|
use rustc_metadata::rendered_const;
|
||||||
|
use rustc_middle::span_bug;
|
||||||
use rustc_middle::ty::fast_reject::SimplifiedType;
|
use rustc_middle::ty::fast_reject::SimplifiedType;
|
||||||
use rustc_middle::ty::{self, TyCtxt, Visibility};
|
use rustc_middle::ty::{self, TyCtxt, Visibility};
|
||||||
use rustc_resolve::rustdoc::{
|
use rustc_resolve::rustdoc::{
|
||||||
|
@ -266,8 +267,15 @@ pub(crate) fn primitives(&self, tcx: TyCtxt<'_>) -> ThinVec<(DefId, PrimitiveTyp
|
||||||
let as_primitive = |res: Res<!>| {
|
let as_primitive = |res: Res<!>| {
|
||||||
let Res::Def(DefKind::Mod, def_id) = res else { return None };
|
let Res::Def(DefKind::Mod, def_id) = res else { return None };
|
||||||
tcx.get_attrs(def_id, sym::rustc_doc_primitive).find_map(|attr| {
|
tcx.get_attrs(def_id, sym::rustc_doc_primitive).find_map(|attr| {
|
||||||
// FIXME: should warn on unknown primitives?
|
let attr_value = attr.value_str().expect("syntax should already be validated");
|
||||||
Some((def_id, PrimitiveType::from_symbol(attr.value_str()?)?))
|
let Some(prim) = PrimitiveType::from_symbol(attr_value) else {
|
||||||
|
span_bug!(
|
||||||
|
attr.span,
|
||||||
|
"primitive `{attr_value}` is not a member of `PrimitiveType`"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Some((def_id, prim))
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue