Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#69458 - Luro02:master, r=GuillaumeGomez,oll…
…ie27 improve folder name for persistent doc tests This partially fixes rust-lang#69411 by using the entire path as folder name, but I do not know how to deal with the proc-macro problem, where a doc test is forwarded to multiple generated functions, which have the same line for the doc test (origin). For example ```rust #[derive(ShortHand)] pub struct ExtXMedia { /// The [`MediaType`] associated with this tag. /// /// # Example /// -> /// ``` <- this line is given to `run_test` /// # use hls_m3u8::tags::ExtXMedia; /// use hls_m3u8::types::MediaType; /// /// let mut media = ExtXMedia::new(MediaType::Audio, "ag1", "english audio channel"); /// /// media.set_media_type(MediaType::Video); /// /// assert_eq!(media.media_type(), MediaType::Video); /// ``` /// /// # Note /// /// This attribute is required. #[shorthand(enable(copy))] media_type: MediaType, // the rest of the fields are omitted } ``` and my proc macro generates ```rust #[allow(dead_code)] impl ExtXMedia { /// The [`MediaType`] associated with this tag. /// /// # Example /// /// ``` /// # use hls_m3u8::tags::ExtXMedia; /// use hls_m3u8::types::MediaType; /// /// let mut media = ExtXMedia::new(MediaType::Audio, "ag1", "english audio channel"); /// /// media.set_media_type(MediaType::Video); /// /// assert_eq!(media.media_type(), MediaType::Video); /// ``` /// /// # Note /// /// This attribute is required. #[inline(always)] #[must_use] pub fn media_type(&self) -> MediaType { struct _AssertCopy where MediaType: ::std::marker::Copy; self.media_type } /// The [`MediaType`] associated with this tag. /// /// # Example /// /// ``` /// # use hls_m3u8::tags::ExtXMedia; /// use hls_m3u8::types::MediaType; /// /// let mut media = ExtXMedia::new(MediaType::Audio, "ag1", "english audio channel"); /// /// media.set_media_type(MediaType::Video); /// /// assert_eq!(media.media_type(), MediaType::Video); /// ``` /// /// # Note /// /// This attribute is required. #[inline(always)] pub fn set_media_type<VALUE: ::std::convert::Into<MediaType>>( &mut self, value: VALUE, ) -> &mut Self { self.media_type = value.into(); self } } ``` rustdoc then executes both tests with the same line (the line from the example above the field -> 2 different tests have the same name). We need a way to differentiate between the two tests generated by the proc-macro, so that they do not cause threading issues.
- Loading branch information