public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Merge #1733 Date: Fri, 13 Jan 2023 08:26:01 +0000 (GMT) [thread overview] Message-ID: <20230113082601.1BE10385B515@sourceware.org> (raw) https://gcc.gnu.org/g:2f9f77f9dd6330fe60554400133d7217f78afa43 commit 2f9f77f9dd6330fe60554400133d7217f78afa43 Merge: 0030bead12e 68839a57ea5 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Thu Jan 12 13:54:04 2023 +0000 Merge #1733 1733: diagnostics: Add underline for tokens in diagnostics. r=CohenArthur a=TuringKi Currently, the diagnostics only point to the corresponding token's start position by carets, and lack of underlines for full token. This commit add support for such underlines in diagnostics by encoding range information in location_t. the results like this: ``` ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:5:14: error: invalid cast 'bool' to 'f32' [E0054] 5 | let fone = t as f32; // { dg-error "invalid cast" } | ^ ~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:6:15: error: invalid cast 'bool' to 'f64' [E0054] 6 | let fzero = f as f64; // { dg-error "invalid cast" } | ^ ~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:8:12: error: invalid cast 'u8' to 'bool' [E0054] 8 | let nb = 0u8 as bool; // { dg-error "invalid cast .u8. to .bool. \\\[E0054\\\]" } | ^~~ ~~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:9:12: error: invalid cast 'bool' to 'char' [E0054] 9 | let nc = true as char; // { dg-error "invalid cast" } | ^~~~ ~~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:13:12: error: invalid cast 'char' to 'f32' [E0054] 13 | let fa = a as f32; // { dg-error "invalid cast" } | ^ ~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:14:12: error: invalid cast 'char' to 'bool' [E0054] 14 | let bb = b as bool; // { dg-error "invalid cast .char. to .bool. \\\[E0054\\\]" } | ^ ~~~~ ../gcc/testsuite/rust/compile/bad_as_bool_char.rs:17:12: error: invalid cast 'u32' to 'char' [E0054] 17 | let ab = t32 as char; // { dg-error "invalid cast" } | ^~~ ~~~~ ``` This commit is split from pr #1718. Signed-off-by: Xiao Ma <mxlol233@outlook.com> Co-authored-by: mxlol233 <mxlol233@outlook.com> Diff: gcc/rust/lex/rust-lex.cc | 57 ++++++++++++++++++++++ gcc/testsuite/rust/compile/diagnostic_underline.rs | 15 ++++++ 2 files changed, 72 insertions(+)
reply other threads:[~2023-01-13 8:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230113082601.1BE10385B515@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).