mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 02:23:20 +00:00
fix documenting private items of standard library
This commit is contained in:
parent
fdf6cc34b2
commit
f4ff423d67
@ -318,7 +318,10 @@ impl<BorrowType: marker::BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type>
|
||||
pub fn ascend(
|
||||
self,
|
||||
) -> Result<Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::Edge>, Self> {
|
||||
let _ = BorrowType::TRAVERSAL_PERMIT;
|
||||
const {
|
||||
assert!(BorrowType::TRAVERSAL_PERMIT);
|
||||
}
|
||||
|
||||
// We need to use raw pointers to nodes because, if BorrowType is marker::ValMut,
|
||||
// there might be outstanding mutable references to values that we must not invalidate.
|
||||
let leaf_ptr: *const _ = Self::as_leaf_ptr(&self);
|
||||
@ -1003,7 +1006,10 @@ impl<BorrowType: marker::BorrowType, K, V>
|
||||
/// `edge.descend().ascend().unwrap()` and `node.ascend().unwrap().descend()` should
|
||||
/// both, upon success, do nothing.
|
||||
pub fn descend(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
|
||||
let _ = BorrowType::TRAVERSAL_PERMIT;
|
||||
const {
|
||||
assert!(BorrowType::TRAVERSAL_PERMIT);
|
||||
}
|
||||
|
||||
// We need to use raw pointers to nodes because, if BorrowType is
|
||||
// marker::ValMut, there might be outstanding mutable references to
|
||||
// values that we must not invalidate. There's no worry accessing the
|
||||
@ -1666,17 +1672,17 @@ pub mod marker {
|
||||
pub struct ValMut<'a>(PhantomData<&'a mut ()>);
|
||||
|
||||
pub trait BorrowType {
|
||||
// If node references of this borrow type allow traversing to other
|
||||
// nodes in the tree, this constant can be evaluated. Thus reading it
|
||||
// serves as a compile-time assertion.
|
||||
const TRAVERSAL_PERMIT: () = ();
|
||||
/// If node references of this borrow type allow traversing to other
|
||||
/// nodes in the tree, this constant is set to `true`. It can be used
|
||||
/// for a compile-time assertion.
|
||||
const TRAVERSAL_PERMIT: bool = true;
|
||||
}
|
||||
impl BorrowType for Owned {
|
||||
// Reject evaluation, because traversal isn't needed. Instead traversal
|
||||
// happens using the result of `borrow_mut`.
|
||||
// By disabling traversal, and only creating new references to roots,
|
||||
// we know that every reference of the `Owned` type is to a root node.
|
||||
const TRAVERSAL_PERMIT: () = panic!();
|
||||
/// Reject traversal, because it isn't needed. Instead traversal
|
||||
/// happens using the result of `borrow_mut`.
|
||||
/// By disabling traversal, and only creating new references to roots,
|
||||
/// we know that every reference of the `Owned` type is to a root node.
|
||||
const TRAVERSAL_PERMIT: bool = false;
|
||||
}
|
||||
impl BorrowType for Dying {}
|
||||
impl<'a> BorrowType for Immut<'a> {}
|
||||
|
@ -123,6 +123,7 @@
|
||||
#![feature(fmt_internals)]
|
||||
#![feature(fn_traits)]
|
||||
#![feature(hasher_prefixfree_extras)]
|
||||
#![feature(inline_const)]
|
||||
#![feature(inplace_iteration)]
|
||||
#![feature(iter_advance_by)]
|
||||
#![feature(iter_next_chunk)]
|
||||
|
Loading…
Reference in New Issue
Block a user