Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use typeck_results.node_type to resolve the type in suspicious trait object lint #349

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

thomcc
Copy link
Contributor

@thomcc thomcc commented Jul 6, 2023

Thanks to @compiler-errors for helping me out here, this is much cleaner too.

Fixes #348 (we still may want to turn lints entirely off when compiling dependencies, but fixing it for real is better, and trying to parse a bunch of things out of the rustc args felt hairy without a bit more testing).

@thomcc
Copy link
Contributor Author

thomcc commented Jul 6, 2023

Note that without the change, the example I added would hit a similar ICE to the rand one. I can't add a dep on rand to the compiletests, and I don't think the plrust test suite supports deps in trusted mode, so this is probably the best option.

@eeeebbbbrrrr
Copy link
Contributor

eeeebbbbrrrr commented Jul 6, 2023

I don't think the plrust test suite supports deps in trusted mode

It does. The test suite actually sets up an allow-list so it can test that. Would be no problem to add rand to it and use rand in a unit test.

see

plrust/plrust/src/tests.rs

Lines 1401 to 1411 in 07bec8d

let mut allowed_deps = std::fs::File::create(&file_path).unwrap();
allowed_deps
.write_all(
r#"
owo-colors = "=3.5.0"
tokio = { version = "=1.19.2", features = ["rt", "net"]}
plutonium = "*"
"#
.as_bytes(),
)
.unwrap();

@thomcc
Copy link
Contributor Author

thomcc commented Jul 6, 2023

It does. The test suite actually sets up an allow-list so it can test that. Would be no problem to add rand to it and use rand in a unit test.

Ah, I confused the sandbox feature (no network) with trusted. (I thought somehow it had been renamed and I hadn't noticed).

I've added the test.

Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thanks for the unit test!

@thomcc thomcc merged commit 46705ba into main Jul 6, 2023
@thomcc thomcc deleted the thomcc/no-associated-ice branch July 6, 2023 18:06
thomcc added a commit that referenced this pull request Jul 6, 2023
@thomcc thomcc restored the thomcc/no-associated-ice branch July 6, 2023 20:08
thomcc added a commit that referenced this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plrustc panics during compilation when using the rand crate
2 participants