Skip to content

Conversation

paldepind
Copy link
Contributor

@paldepind paldepind commented Aug 28, 2025

In Rust a trait method can only be invoked if the trait is visible/in scope.

This means that for a path Type::method we should only consider method methods on traits that are visible. Similarly, for method calls foo.bar(...) we should only consider bar methods on traits that are visible.

This PR is motived by a type explosion in Deno, that is magnified by #20133. Accounting for visible traits in #20133 in the same way as in this PR should also reduce false positives for blanket implementations.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Aug 28, 2025
@paldepind paldepind added the no-change-note-required This PR does not need a change note label Aug 28, 2025
@paldepind paldepind force-pushed the rust/trait-method-scope branch 2 times, most recently from b042f1d to 51d2f9a Compare August 29, 2025 09:28
@paldepind paldepind force-pushed the rust/trait-method-scope branch 3 times, most recently from b1e8f70 to aea83fa Compare August 29, 2025 10:59
@paldepind paldepind force-pushed the rust/trait-method-scope branch from aea83fa to e632865 Compare August 29, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant