Do not error during method probe on Sized predicates for types that aren't the method receiver#99146
Merged
bors merged 2 commits intorust-lang:masterfrom Jul 12, 2022
Merged
Conversation
Contributor
|
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
compiler-errors
commented
Jul 11, 2022
| @@ -0,0 +1,39 @@ | |||
| error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time | |||
Contributor
Author
There was a problem hiding this comment.
This error is actually more verbose than what it used to (erroneously) say before, but it's more consistent with an error you'd get if you, for example, passed any other DST as a generic arg. It also makes the second error, the mismatched types ("" against dyn ToString) not be suppressed any longer, which IMO is better.
Contributor
|
@bors r+ |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 11, 2022
Do not error during method probe on `Sized` predicates for types that aren't the method receiver Fixes rust-lang#61525 This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below: ``` error: the `query` method cannot be invoked on a trait object --> src/lib.rs:14:11 | 14 | 1.query::<dyn ToString>("") | ^^^^^ | = note: another candidate was found in the following trait, perhaps add a `use` for it: `use crate::Example;` ``` Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 11, 2022
Do not error during method probe on `Sized` predicates for types that aren't the method receiver Fixes rust-lang#61525 This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below: ``` error: the `query` method cannot be invoked on a trait object --> src/lib.rs:14:11 | 14 | 1.query::<dyn ToString>("") | ^^^^^ | = note: another candidate was found in the following trait, perhaps add a `use` for it: `use crate::Example;` ``` Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 12, 2022
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`) - rust-lang#99055 (Fix rustdoc help options) - rust-lang#99075 (Fix duplicated type annotation suggestion) - rust-lang#99124 (Fix sized check ICE in asm check) - rust-lang#99142 (fix(doctest): treat fatal parse errors as incomplete attributes) - rust-lang#99145 (Don't rerun the build script for the compiler each time on non-windows platforms) - rust-lang#99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver) - rust-lang#99161 (compiletest: trim edition before passing as flag) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
estebank
reviewed
Jul 18, 2022
| let all_substs = self.instantiate_method_substs(&pick, segment, rcvr_substs); | ||
|
|
||
| debug!("all_substs={:?}", all_substs); | ||
| debug!("rcvr_substs={rcvr_substs:?}, all_substs={all_substs:?}"); |
Contributor
There was a problem hiding this comment.
Isn't this the same as
debug!(?rcvr_substs, ?all_substs);
?
Contributor
Author
There was a problem hiding this comment.
yeah, you're right. not super familiar with the tracing macros, sorry😅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #61525
This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the
Sizedpredicate in the end. It just means that we don't emit an erroneous message as below:Also fixes erroneously suggesting the same trait over again, as seen in the
issue-35976.rsUI test.