-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pretty HIR for anon consts in diagnostics #123926
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@@ -0,0 +1,9 @@ | |||
error[E0533]: expected value, found struct variant `Struct<0>::Variant` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to print Struct<>::Variant
This comment has been minimized.
This comment has been minimized.
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@@ -24,7 +24,9 @@ LL - let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | |||
LL + let str::as_bytes; | |||
| | |||
|
|||
error[E0533]: expected unit struct, unit variant or constant, found associated function `str<, T>::as_bytes` | |||
error[E0533]: expected unit struct, unit variant or constant, found associated function `str<{ | |||
fn str() { let (/*ERROR*/); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly this seems to be the first time we leak pp
's /*ERROR*/
in error messages.
At least according to rg -F '/*ERROR*/' -g 'tests/**/*.stderr'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For follow-up: Would it make sense to only print function signatures in const
items in types instead of including their body? What is the output with
fn main() {
let str::<{fn str<T>() { let _; }}, T>::as_bytes;
}
Nice of you to make a distinction between our users and fuzzers, I'm not so sure that an edge case will be hit by one and not the other ^_^ @bors r+ |
@bors r- land after other pr |
@bors r=estebank |
Rollup of 7 pull requests Successful merges: - rust-lang#123016 (Remove `TypeVariableOriginKind` and `ConstVariableOriginKind`) - rust-lang#123462 (Cleanup: Rename `ModSep` to `PathSep`) - rust-lang#123603 (Don't even parse an intrinsic unless the feature gate is enabled) - rust-lang#123926 (Fix pretty HIR for anon consts in diagnostics) - rust-lang#123973 (crashes: readme: add reminder to add Fixes #abcde to prs to automatically close issues.) - rust-lang#123984 (sanitizers: Add rustc_sanitizers to triagebot.toml) - rust-lang#123989 (Just use `type_dependent_def_id` to figure out what the method is for an expr) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123926 - compiler-errors:no-ann, r=estebank Fix pretty HIR for anon consts in diagnostics This removes the `NoAnn` printer which skips over nested bodies altogether, which is confusing, and requires users of `{ty|qpath|pat}_to_string` to pass in `&tcx` which now impleemnts `hir_pretty::PpAnn`. There's one case where this "regresses" by actually printing out the body of the anon const -- we could suppress that, but I don't expect people to actually get anon consts like that unless they're fuzzing, tbh. r? estebank
Fix pretty HIR for anon consts in diagnostics This removes the `NoAnn` printer which skips over nested bodies altogether, which is confusing, and requires users of `{ty|qpath|pat}_to_string` to pass in `&tcx` which now impleemnts `hir_pretty::PpAnn`. There's one case where this "regresses" by actually printing out the body of the anon const -- we could suppress that, but I don't expect people to actually get anon consts like that unless they're fuzzing, tbh. r? estebank
This removes the
NoAnn
printer which skips over nested bodies altogether, which is confusing, and requires users of{ty|qpath|pat}_to_string
to pass in&tcx
which now impleemntshir_pretty::PpAnn
.There's one case where this "regresses" by actually printing out the body of the anon const -- we could suppress that, but I don't expect people to actually get anon consts like that unless they're fuzzing, tbh.
r? estebank