Skip to content

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

Merged
thomcc merged 2 commits into
mainfrom
thomcc/no-associated-ice
Jul 6, 2023
Merged

Use typeck_results.node_type to resolve the type in suspicious trait object lint#349
thomcc merged 2 commits into
mainfrom
thomcc/no-associated-ice

Conversation

@thomcc

@thomcc thomcc commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

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

thomcc commented Jul 6, 2023

Copy link
Copy Markdown
Contributor Author

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.

@thomcc
thomcc requested a review from workingjubilee July 6, 2023 17:05
@eeeebbbbrrrr

eeeebbbbrrrr commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

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 https://github.com/tcdi/plrust/blob/07bec8de9a6c0150eee1950b94301653ea0e9cdc/plrust/src/tests.rs#L1401-L1411

@thomcc

thomcc commented Jul 6, 2023

Copy link
Copy Markdown
Contributor Author

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.

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Copy link
Copy Markdown
Contributor

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
@tcdidev
tcdidev deleted the thomcc/no-associated-ice branch February 27, 2026 17:14
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