Skip to content

Commit 2398581

Browse files
committed
Auto merge of rust-lang#76934 - camelid:rustdoc-allow-generic-params, r=jyn514
Allow generic parameters in intra-doc links Fixes rust-lang#62834. --- The contents of the generics will be mostly ignored (except for warning if fully-qualified syntax is used, which is currently unsupported in intra-doc links - see issue rust-lang#74563). * Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>` * Allow links like `Vec::<T>::new()` * Warn on * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`) * Missing type to apply generics to (`<T>` or `<Box<T>>`) * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`) * Invalid path separator (`Vec:<T>:new`) * Too many angle brackets (`Vec<<T>>`) * Empty angle brackets (`Vec<>`) Note that this implementation *does* allow some constructs that aren't valid in the actual Rust syntax, for example `Box::<T>new()`. That may not be supported in rustdoc in the future; it is an implementation detail.
2 parents 9da49de + e7417f9 commit 2398581

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/option.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@
141141
//! ```
142142
//!
143143
//! [`Box<T>`]: ../../std/boxed/struct.Box.html
144+
//! [`Box<U>`]: ../../std/boxed/struct.Box.html
145+
//! [`num::NonZero*`]: crate::num
146+
//! [`ptr::NonNull<U>`]: crate::ptr::NonNull
144147
145148
#![stable(feature = "rust1", since = "1.0.0")]
146149

0 commit comments

Comments
 (0)