fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
7 stars 0 forks source link

Putting `@deprecated` on the program entry `main` crashes the compiler #145

Closed fmease closed 2 years ago

fmease commented 2 years ago

Reproducer:

@deprecated
main: Type = Type

ICE:

internal compiler error: assertion failed: span != default()
 note: at ‘compiler/span/source_map.rs:90:9’
 note: in thread ‘main’
 note: the compiler unexpectedly panicked. this is a bug. we would appreciate a bug report
 note: lushui 0.1.0 (32d6176 2022-06-27)
 help: rerun with the environment variable ‘LUSHUI_BACKTRACE=1’ to display a backtrace

This is because Component::look_up_program_entry passes the spanless identifier main to Resolver::resolve_identifier.

Possible solutions:

fmease commented 2 years ago

rustc doesn't emit a warning for a #[deprecated] main. So let's don't either.

fmease commented 2 years ago

Add a field to the PathResolutionContext (and maybe add a builder for the latter).