gccrs
gccrs copied to clipboard
Inherit Implementation of type outside current crate - Internal Compile Error
Inherit Implementation of type outside current crate:
I tried this code from E0116
:
#![allow(unused)]
fn main() {
impl Vec<u8> { } // error
}
- Also, this
#![allow(unused)]
fn main() {
type Bytes = Vec<u8>;
impl Bytes { } // error, same as above
}
I Expected to see this happen:
- GIve error like rustc.
- i.e.,
-
error[E0116]: cannot define inherent impl for a type outside of the crate where the type is defined
-
Instead this happened:
- First, it gives
failed to resolve TypePath: x in this scope
- Then, internal compiler error.
➜ gccrs-build gcc/crab1 ../mahad-testsuite/E0116A.rs
../mahad-testsuite/E0116A.rs:3:6: error: failed to resolve TypePath: Vec<Type: u8> in this scope
3 | impl Vec<u8> { } // error
| ^~~
crab1: internal compiler error: in visit, at rust/resolve/rust-ast-resolve-item.cc:574
0x7b8ce4 Rust::Resolver::ResolveItem::visit(Rust::AST::InherentImpl&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:574
0xbb2167 Rust::Resolver::ResolveItem::go(Rust::AST::Item*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:212
0xbc2bf8 Rust::Resolver::ResolveStmt::go(Rust::AST::Stmt*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-stmt.h:43
0xbc2bf8 Rust::Resolver::ResolveStmt::go(Rust::AST::Stmt*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-stmt.h:35
0xbc2bf8 Rust::Resolver::ResolveExpr::visit(Rust::AST::BlockExpr&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-expr.cc:316
0xbc4aaf Rust::Resolver::ResolveExpr::go(Rust::AST::Expr*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, bool)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-expr.cc:36
0xbb64f6 Rust::Resolver::ResolveItem::visit(Rust::AST::Function&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:540
0xbb2167 Rust::Resolver::ResolveItem::go(Rust::AST::Item*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:212
0xba68fa Rust::Resolver::NameResolution::go(Rust::AST::Crate&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve.cc:108
0xa6a839 Rust::Session::compile_crate(char const*)
../../gccrs/gcc/rust/rust-session-manager.cc:595
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.
- For Second Example:
➜ gccrs-build gcc/crab1 ../mahad-testsuite/E0116B.rs
../mahad-testsuite/E0116B.rs:5:6: error: failed to resolve TypePath: Bytes in this scope
5 | impl Bytes { } // error, same as above
| ^~~~~
crab1: internal compiler error: in visit, at rust/resolve/rust-ast-resolve-item.cc:574
0x7b8ce4 Rust::Resolver::ResolveItem::visit(Rust::AST::InherentImpl&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:574
0xbb2167 Rust::Resolver::ResolveItem::go(Rust::AST::Item*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:212
0xbc2bf8 Rust::Resolver::ResolveStmt::go(Rust::AST::Stmt*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-stmt.h:43
0xbc2bf8 Rust::Resolver::ResolveStmt::go(Rust::AST::Stmt*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-stmt.h:35
0xbc2bf8 Rust::Resolver::ResolveExpr::visit(Rust::AST::BlockExpr&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-expr.cc:316
0xbc4aaf Rust::Resolver::ResolveExpr::go(Rust::AST::Expr*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, bool)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-expr.cc:36
0xbb64f6 Rust::Resolver::ResolveItem::visit(Rust::AST::Function&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:540
0xbb2167 Rust::Resolver::ResolveItem::go(Rust::AST::Item*, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve-item.cc:212
0xba68fa Rust::Resolver::NameResolution::go(Rust::AST::Crate&)
../../gccrs/gcc/rust/resolve/rust-ast-resolve.cc:108
0xa6a839 Rust::Session::compile_crate(char const*)
../../gccrs/gcc/rust/rust-session-manager.cc:595
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.
Meta
- What version of Rust GCC were you using, git sha b75357f4a1835dcd288df67402340b4cb6b96c12.
- Godbolt version:
- gccrs (Compiler-Explorer-Build-gcc-a06cec181de6398231e0662c1ed83d905ad6d1d9-binutils-2.40) 13.0.1 20230417 (experimental)