Use full expr span for return suggestion on type error/ambiguity#127129
Use full expr span for return suggestion on type error/ambiguity#127129bors merged 1 commit intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
7ac8186 to
d5bddee
Compare
jieyouxu
left a comment
There was a problem hiding this comment.
The span changes LGTM, the UI test I believe has incorrect "follow-up error annotation" syntax (pre-existing, which may have led you astray).
There was a problem hiding this comment.
Problem: I think this needs to be
| //| HELP you might have meant to return this value | |
| //~| HELP you might have meant to return this value |
to quality as a "follow-up error annotation" in the UI test mode (and suite). Hm. Actually, is the HELP error annotation just wrong in that entire file? I dug through compiletest a little and
rust/src/tools/compiletest/src/errors.rs
Lines 125 to 131 in 716752e
to the best of my knowledge //| is not a supported form of test annotation lol. Apparently there's a few other tests that also does the //| but AFAICT compiletest only uses the //~| form (cargo or r-a might be different here).
There was a problem hiding this comment.
Yeah that was my typo from copypasting from the file without thinking rather than just writing my own UI test -- //| is definitely not valid and I should have seen that lmao
|
@rustbot author |
d5bddee to
583b5fc
Compare
|
Made the test file less dumb @rustbot ready |
jieyouxu
left a comment
There was a problem hiding this comment.
Looks good! r=me after CI is green.
|
@bors r=jieyouxu rollup |
…jieyouxu Use full expr span for return suggestion on type error/ambiguity We sometimes use parts of an expression rather than the whole thing for an obligation span. For example, a method obligation will just point to the path segment corresponding to the `method` in `rcvr.method(args)`. So let's not use that assuming it'll point to the *whole* expression span, which we can access from the expr hir id we store in `ObligationCauseCode::WhereClauseInExpr`. Fixes rust-lang#127109
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#126753 (Add nightly style guide section for `precise_capturing` `use<>` syntax) - rust-lang#126880 (Migrate `volatile-intrinsics`, `weird-output-filenames`, `wasm-override-linker`, `wasm-exceptions-nostd` to `rmake`) - rust-lang#126941 (Migrate `run-make/llvm-ident` to `rmake.rs`) - rust-lang#127128 (Stabilize `duration_abs_diff`) - rust-lang#127129 (Use full expr span for return suggestion on type error/ambiguity) - rust-lang#127188 ( improve the way bootstrap handles rustlib components) - rust-lang#127201 (Improve run-make-support API) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#126732 (Stabilize `PanicInfo::message()` and `PanicMessage`) - rust-lang#126753 (Add nightly style guide section for `precise_capturing` `use<>` syntax) - rust-lang#126832 (linker: Refactor interface for passing arguments to linker) - rust-lang#126880 (Migrate `volatile-intrinsics`, `weird-output-filenames`, `wasm-override-linker`, `wasm-exceptions-nostd` to `rmake`) - rust-lang#127128 (Stabilize `duration_abs_diff`) - rust-lang#127129 (Use full expr span for return suggestion on type error/ambiguity) - rust-lang#127188 ( improve the way bootstrap handles rustlib components) - rust-lang#127201 (Improve run-make-support API) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127129 - compiler-errors:full-expr-span, r=jieyouxu Use full expr span for return suggestion on type error/ambiguity We sometimes use parts of an expression rather than the whole thing for an obligation span. For example, a method obligation will just point to the path segment corresponding to the `method` in `rcvr.method(args)`. So let's not use that assuming it'll point to the *whole* expression span, which we can access from the expr hir id we store in `ObligationCauseCode::WhereClauseInExpr`. Fixes rust-lang#127109
We sometimes use parts of an expression rather than the whole thing for an obligation span. For example, a method obligation will just point to the path segment corresponding to the
methodinrcvr.method(args).So let's not use that assuming it'll point to the whole expression span, which we can access from the expr hir id we store in
ObligationCauseCode::WhereClauseInExpr.Fixes #127109