Stream: rustdoc

Topic: intra-doc `pointer` primitive


view this post on Zulip Noah Lev (Jan 10 2021 at 23:53):

A couple weeks ago @Joshua Nelson added intra-doc link targets (not sure what to call them :upside_down:) for "non-path primitives" like slice and pointer. The pointer primitive has the intra-doc aliases *const, *mut, and * (though it might be removed: #80892) as well. However, the pointer primitive feels like a bit of a footgun because things like pointer::is_null actually resolve to <*const T>::is_null. What should we do about it?

view this post on Zulip Noah Lev (Jan 10 2021 at 23:54):

(We have a bit of time to figure this out because it hasn't hit beta yet btw.)

view this post on Zulip Joshua Nelson (Jan 11 2021 at 00:24):

However, the pointer primitive feels like a bit of a footgun because things like pointer::is_null actually resolve to <*const T>::is_null.

err, well, they happen to resolve that way for implementation reasons, but they could just as easily have been *mut

view this post on Zulip Joshua Nelson (Jan 11 2021 at 00:24):

I think the practical thing to do is slap this behind a feature gate and make it a problem for later

view this post on Zulip Noah Lev (Jan 11 2021 at 00:55):

Joshua Nelson said:

However, the pointer primitive feels like a bit of a footgun because things like pointer::is_null actually resolve to <*const T>::is_null.

err, well, they happen to resolve that way for implementation reasons, but they could just as easily have been *mut

Yeah, that's my point: there's no canonical item to link to when you see pointer::is_null.

view this post on Zulip Noah Lev (Jan 11 2021 at 00:55):

Joshua Nelson said:

I think the practical thing to do is slap this behind a feature gate and make it a problem for later

Should I open an issue? Also, can you/do you want to do it?

view this post on Zulip Joshua Nelson (Jan 11 2021 at 01:35):

I can do it. Feel free to open an issue (I plan to have this done tonight, but in case not it should definitely be done before https://github.com/rust-lang/rust/pull/80181 hits beta).

view this post on Zulip Noah Lev (Jan 11 2021 at 02:03):

Issue: #80896


Last updated: Oct 11 2021 at 22:34 UTC