Skip to content

libstd/rustdoc: Document potential panics in RefCell where .borrow() is used implicitly in impls #47400

Closed
@Centril

Description

@Centril

There are a bunch of implicit uses of .borrow(), which may panic if the RefCell is already mutably borrowed, inside impls of RefCell:

The potential panics should be noted with a header:

    /// # Panics
    ///
    /// Panics if the value is currently mutably borrowed. For a non-panicking variant, use
    /// [`try_borrow`](#method.try_borrow).

I'll file the PR fixing this if we agree that this is a problem in need of fixing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions