Skip to content

Conversation

Shourya742
Copy link
Contributor

closes: #19357

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2025
@Shourya742
Copy link
Contributor Author

@Veykril, with our current test fixture infrastructure, we can't write tests for non-crate files. The test expects the error: "missing default crate root, specify a main.rs or lib.rs."

If I want to test something like this, it won't work:

    check_highlighting(
        r#"
//- /foo.rs
fn main() {
    let x = &raw mut 5;
}
"#,
        expect_file!["./test_data/highlight_issue_19357.html"],
        false,
    );

Should we make changes in the same PR to support this test?

@Veykril
Copy link
Member

Veykril commented Mar 21, 2025

@Veykril, with our current test fixture infrastructure, we can't write tests for non-crate files. The test expects the error: "missing default crate root, specify a main.rs or lib.rs."

If I want to test something like this, it won't work:

    check_highlighting(
        r#"
//- /foo.rs
fn main() {
    let x = &raw mut 5;
}
"#,
        expect_file!["./test_data/highlight_issue_19357.html"],
        false,
    );

Should we make changes in the same PR to support this test?

I think

check_highlighting(
    r#"
//- /foo.rs
fn main() {
    let x = &raw mut 5;
}
//- /main.rs
"#,

might work?

@Shourya742 Shourya742 force-pushed the 2025-03-20-fix-syntax-highlighting branch from cefbe6b to cfac2c3 Compare March 21, 2025 15:27
@Shourya742
Copy link
Contributor Author

@Veykril, with our current test fixture infrastructure, we can't write tests for non-crate files. The test expects the error: "missing default crate root, specify a main.rs or lib.rs."
If I want to test something like this, it won't work:

    check_highlighting(
        r#"
//- /foo.rs
fn main() {
    let x = &raw mut 5;
}
"#,
        expect_file!["./test_data/highlight_issue_19357.html"],
        false,
    );

Should we make changes in the same PR to support this test?

I think

check_highlighting(
    r#"
//- /foo.rs
fn main() {
    let x = &raw mut 5;
}
//- /main.rs
"#,

might work?

works thanks...

@Shourya742 Shourya742 requested a review from Veykril March 21, 2025 15:29
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril added this pull request to the merge queue Mar 23, 2025
Merged via the queue into rust-lang:master with commit 37acea8 Mar 23, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

&raw const/&raw mut is not syntax-highlighted in all files
3 participants