Avoid a bunch of booleans in favor of Result<(), ErrorGuaranteed> as that more robustly proves that an error has been emitted#126317
Conversation
…s that more robustly proves that an error has been emitted
hm, if so then |
| if segment.ident.name == kw::Empty { | ||
| span_bug!(rcvr.span, "empty method name") | ||
| } else { | ||
| match self.report_method_error(expr.hir_id, rcvr_t, error, expected, false) { |
There was a problem hiding this comment.
please make report_method_error return an ErrorGuaranteed. there's no reason to return Result<Diag, ErrorGuaranteed> when the only two callsites just call diag.emit().
| }; | ||
| if has_error { | ||
| if let Err(guar) = has_error { | ||
| let err_inputs = self.err_args(args_no_rcvr.len()); |
There was a problem hiding this comment.
make err_args take the ErrorGuaranteed
| expected: Expectation<'tcx>, | ||
| trait_missing_method: bool, | ||
| ) -> Option<Diag<'_>> { | ||
| ) -> Result<Diag<'_>, ErrorGuaranteed> { |
There was a problem hiding this comment.
| ) -> Result<Diag<'_>, ErrorGuaranteed> { | |
| ) -> ErrorGuaranteed { |
| // We could pass the file for long types into these two, but it isn't strictly necessary | ||
| // given how targeted they are. | ||
| if self.suggest_wrapping_range_with_parens( | ||
| self.suggest_wrapping_range_with_parens( |
There was a problem hiding this comment.
These probably shouldn't be named suggest_*, since they're emitting their own error. Could you think of a better name for this?
compiler-errors
left a comment
There was a problem hiding this comment.
r=me when ci is green
|
@bors r=compiler-errors |
…mpiler-errors Rollup of 8 pull requests Successful merges: - rust-lang#125869 (Add `target_env = "p1"` to the `wasm32-wasip1` target) - rust-lang#126019 (Add TODO comment to unsafe env modification) - rust-lang#126036 (Migrate `run-make/short-ice` to `rmake`) - rust-lang#126276 (Detect pub structs never constructed even though they impl pub trait with assoc constants) - rust-lang#126282 (Ensure self-contained linker is only enabled on dev/nightly ) - rust-lang#126317 (Avoid a bunch of booleans in favor of Result<(), ErrorGuaranteed> as that more robustly proves that an error has been emitted) - rust-lang#126324 (Adjust LoongArch64 data layouts for LLVM update) - rust-lang#126340 (Fix outdated predacates_of.rs comments) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126317 - oli-obk:recursive_rpit4, r=compiler-errors Avoid a bunch of booleans in favor of Result<(), ErrorGuaranteed> as that more robustly proves that an error has been emitted pulled out of rust-lang#126316 This PR cannot have any effect on compilation. All it does is shift a `Ty::new_misc_error` to a `span_delayed_bug` and preserve the `ErrorGuaranteed` in all other cases
|
|
||
| let lines = match cfg.lines { | ||
| Ok(v) => &v == "1", | ||
| Err(_) => false, |
There was a problem hiding this comment.
I think a surprising side-effect of this change was to turn off the lines by default?
Even when they are turned on, they look very different... much harder than before to just "move up" and find earlier things on the same level of nesting, since the line is now just a snake that moves left and right with the indentation, it no longer properly shows what nesting level we are getting back to.
There was a problem hiding this comment.
lines were already turned off in an earlier PR by someone else because they broke code folding which allowed you to fold entire sub-spans. After I switched tracing-tree to use the snaky line, you get both the lines (which I find useful) and the code folding, so I made it opt-in. Locally I was replacing | manually with spaces in the last year just to get code folding in IDEs.
There was a problem hiding this comment.
When you hover over the line numbers in vscode, folding thingies like for directories show up. These are indentation based I think, but in code they may be squirly bracket based
|
Ah I see. I often go through these logs in a terminal and I find the new format a lot harder to read there than the old one.
|
pulled out of #126316
This PR cannot have any effect on compilation.
All it does is shift a
Ty::new_misc_errorto aspan_delayed_bugand preserve theErrorGuaranteedin all other cases