[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-09 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

--- Comment #8 from Iain Sandoe  ---
(In reply to Andrew Pinski from comment #5)
> (In reply to Pierre-Emmanuel Patry from comment #2)


> While you are at it, it would be useful to add a link to the rust langauge
> specification (like there is for almost all other languages [I see
> objective-C is not listed]) to https://gcc.gnu.org/readings.html .

This is getting a bit off-topic for the current PR - but, for the record, I am
not aware of any formal spec for Objective-C/C++ - the API is described in
Apple's developer documentation and compliance is assessed (at least by me) in
terms of "do we implement the things that we claim, in the same way as the
system compiler"?

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-09 Thread dkm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

--- Comment #7 from Marc Poulhiès  ---
There's no language spec yet, it's WIP:
https://github.com/rust-lang/rust/issues/113527

Currently, the reference is rustc and the goal is to match its current
behavior.

I think the frontend is not listed because it's currently not
enabled/working-enough.

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

--- Comment #6 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #5)
> While you are at it, it would be useful to add a link to the rust langauge
> specification (like there is for almost all other languages [I see
> objective-C is not listed]) to https://gcc.gnu.org/readings.html .

Also it would be useful to update https://gcc.gnu.org/frontends.html too.

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

--- Comment #5 from Andrew Pinski  ---
(In reply to Pierre-Emmanuel Patry from comment #2)
> I can see the problem with the message, but I don't think we can remove the
> behavior as we have to match rustc's behavior. The compiler has to ICE when
> meeting this identifier. I suggest changing the message to rustc's one "It
> looks like you're trying to break rust; would you like some ICE?" and
> removing the "gcc" identifier check.

Really this sounds like a bad idea to copy 100% of what rustc does. Instead we
should follow the rust language specification (hopefully that actually exists).

While you are at it, it would be useful to add a link to the rust langauge
specification (like there is for almost all other languages [I see objective-C
is not listed]) to https://gcc.gnu.org/readings.html .

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-08 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

Iain Sandoe  changed:

   What|Removed |Added

 CC||iains at gcc dot gnu.org

--- Comment #4 from Iain Sandoe  ---
since humour does not always translate - even between en_GB and en_US in some
cases...

I wonder if the better solution in the case of something that is clearly
intended to be humour (which is subjective as per the comments here) is to
leave the text in the original language (perhaps with surrounding quotation
marks correct for the target language).

That way if the (end user) reading the diagnostic can understand the original
language the joke should stand.  It seems a bit unreasonable to expect
translators to find an equivalent joke in the target language (transliteration
is not likely to work in most cases).

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

--- Comment #3 from Richard Biener  ---
is that part of the language standard?  I don't think we have to copy rustc
easter eggs - in fact I'd report this as a bug to them.

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-08 Thread pierre-emmanuel.patry at embecosm dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

Pierre-Emmanuel Patry  changed:

   What|Removed |Added

 CC||pierre-emmanuel.patry@embec
   ||osm.com

--- Comment #2 from Pierre-Emmanuel Patry  ---
I can see the problem with the message, but I don't think we can remove the
behavior as we have to match rustc's behavior. The compiler has to ICE when
meeting this identifier. I suggest changing the message to rustc's one "It
looks like you're trying to break rust; would you like some ICE?" and removing
the "gcc" identifier check.

[Bug rust/114629] rust-ast-resolve-expr contains bloated code for funny_error

2024-04-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114629

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-04-07
 Status|UNCONFIRMED |NEW
   Keywords||diagnostic

--- Comment #1 from Andrew Pinski  ---
Confirmed.

  else if (funny_error)
{
  /* This was a "break rust" or "break gcc", and the identifier failed to
 resolve.  Emit a funny ICE.  We set the finalizer to our custom one,
 and use the lower-level emit_diagnostic () instead of the more common
 internal_error_no_backtrace () in order to pass our locus.  */
  diagnostic_finalizer (global_dc) = funny_ice_finalizer;
  emit_diagnostic (DK_ICE_NOBT, expr.get_locus (), -1,
   "are you trying to break %s? how dare you?",
   expr.as_string ().c_str ());

This is not even that funny.
I suggest to remove the idea of funny_error really.
  if (ident == "rust" || ident == "gcc")
funny_error = true;

...