Skip to content

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Mar 30, 2020

Successful merges:

Failed merges:

r? @ghost

rcoh and others added 13 commits March 27, 2020 22:02
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
…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.
…rochenkov

Improve error messages for raw strings (rust-lang#60762)

This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)

Fixes rust-lang#60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes rust-lang#70549

r? @petrochenkov
…henkov

remove obsolete comment

Made obsolete by b5e35b1
@Centril
Copy link
Contributor Author

Centril commented Mar 30, 2020

@bors r+ p=4 rollup=never

@bors
Copy link
Collaborator

bors commented Mar 30, 2020

📌 Commit 13f6f8a has been approved by Centril

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 30, 2020
@Centril Centril added rollup A PR which is a rollup and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 30, 2020
@bors
Copy link
Collaborator

bors commented Mar 30, 2020

⌛ Testing commit 13f6f8a with merge 4f6467955250980d60e69792a8b62b55823d613a...

@bors
Copy link
Collaborator

bors commented Mar 30, 2020

💔 Test failed - checks-azure

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2020
@Centril Centril deleted the rollup-jefxmhm branch March 31, 2020 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants