Skip to content

ICE in get_locus, at rust/ast/rust-expr.h:303 with botched feature gate #4301

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
#![feature(unused_variables, server = b"\0")]

original:

#![forbid(unstable_features)]
#![feature(unused_variables, server = b"\0")] //~ ERROR unstable feature

fn main() { }

Version information:

f942905

Possibly related line of code:

// There are two Locations in MetaItemPathExpr (path and expr),
// we have no idea use which of them, just simply return UNKNOWN_LOCATION
// now.
// Maybe we will figure out when we really need the location in the future.
location_t get_locus () const override
{
rust_unreachable ();
return UNKNOWN_LOCATION;
}
void accept_vis (ASTVisitor &vis) override;
bool check_cfg_predicate (const Session &session) const override;

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

/tmp/icemaker_global_tempdir.TpCXxwJbOGok/rustc_testrunner_tmpdir_reporting.y2x4zrYuNwMc/mvce.rs:1:12: error: unknown feature ‘unused_variables’ [E0635]
    1 | #![feature(unused_variables, server = b"\0")]
      |            ^~~~~~~~~~~~~~~~
crab1: internal compiler error: in get_locus, at rust/ast/rust-expr.h:303
0x309a879 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xc38387 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1805
0x90bb44 Rust::AST::MetaItemPathExpr::get_locus() const
	../../gcc/rust/ast/rust-expr.h:303
0x11ef69d Rust::FeatureGate::visit(Rust::AST::Crate&)
	../../gcc/rust/checks/errors/feature/rust-feature-gate.cc:69
0xeae3a1 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:640
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions