Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE in retrieving ambiguous associated type - E0223 #3082

Open
MahadMuhammad opened this issue Jul 13, 2024 · 0 comments · May be fixed by #3176
Open

ICE in retrieving ambiguous associated type - E0223 #3082

MahadMuhammad opened this issue Jul 13, 2024 · 0 comments · May be fixed by #3176
Assignees
Labels

Comments

@MahadMuhammad
Copy link
Contributor

ICE in retrieving ambiguous associated type - E0223


Code

#![allow(unused)]
fn main() {
trait Hello {
    type Who;

    fn hello() -> <i32>::You; // error[E0223]: ambiguous associated type
}
}

Meta

  • What version of Rust GCC were you using, git sha d674058
  • gccrs (Compiler-Explorer-Build-gcc-d67405831843e84a419be52743fe8bf43dc9d9ae-binutils-2.42) 14.0.1 20240309 (experimental)

Error output

  • Internal Compiler Error.

Backtrace

  
➜  gccrs-build gcc/crab1 /home/mhd/Desktop/gccrs/gcc/testsuite/rust/external/t.rs                  
crab1: internal compiler error: in get_as_type_path, at rust/ast/rust-path.h:1220
0x13992ce Rust::AST::QualifiedPathType::get_as_type_path()
        ../../gccrs/gcc/rust/ast/rust-path.h:1220
0x157cac2 Rust::HIR::ASTLowerQualifiedPathInType::visit(Rust::AST::QualifiedPathInType&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-type.cc:148
0x13803dd Rust::AST::QualifiedPathInType::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-path.cc:356
0x157c9d2 Rust::HIR::ASTLowerQualifiedPathInType::translate(Rust::AST::QualifiedPathInType&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-type.cc:131
0x157d5e0 Rust::HIR::ASTLoweringType::visit(Rust::AST::QualifiedPathInType&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-type.cc:287
0x13803dd Rust::AST::QualifiedPathInType::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-path.cc:356
0x157c3c2 Rust::HIR::ASTLoweringType::translate(Rust::AST::Type&, bool)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-type.cc:185
0x157331e Rust::HIR::ASTLowerTraitItem::visit(Rust::AST::Function&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-implitem.cc:243
0x12a59f0 Rust::AST::Function::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-ast.cc:4727
0x1573182 Rust::HIR::ASTLowerTraitItem::translate(Rust::AST::AssociatedItem&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-implitem.cc:212
0x156b43f Rust::HIR::ASTLoweringItem::visit(Rust::AST::Trait&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-item.cc:593
0x12a5d10 Rust::AST::Trait::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-ast.cc:4811
0x1567b62 Rust::HIR::ASTLoweringItem::translate(Rust::AST::Item&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-item.cc:38
0x1581780 Rust::HIR::ASTLoweringStmt::visit(Rust::AST::Trait&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-stmt.cc:145
0x12a5d10 Rust::AST::Trait::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-ast.cc:4811
0x1581106 Rust::HIR::ASTLoweringStmt::translate(Rust::AST::Stmt*, bool*)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-stmt.cc:32
0x1557207 Rust::HIR::ASTLoweringBlock::visit(Rust::AST::BlockExpr&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower.cc:116
0x12a53c0 Rust::AST::BlockExpr::accept_vis(Rust::AST::ASTVisitor&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/ast/rust-ast.cc:4529
0x155935f Rust::HIR::ASTLoweringBlock::translate(Rust::AST::BlockExpr&, bool*)
        ../../gccrs/gcc/rust/hir/rust-ast-lower-block.h:37
0x156a4c4 Rust::HIR::ASTLoweringItem::visit(Rust::AST::Function&)
        /home/mhd/Desktop/gccrs-build/gcc/../../gccrs/gcc/rust/hir/rust-ast-lower-item.cc:443
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.

@philberty philberty self-assigned this Sep 20, 2024
philberty added a commit that referenced this issue Sep 20, 2024
Qualified path expressions usually are <X as Y>::... but the as is optional
this adds the extra checking in hir lowering to not hit that nullptr.

Fixes #3082

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit): check for valid as segment

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude:
	* rust/compile/issue-3082.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty added a commit that referenced this issue Sep 20, 2024
Qualified path expressions usually are <X as Y>::... but the as is optional
this adds the extra checking in hir lowering to not hit that nullptr.

Fixes #3082

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit):
	check for valid as segment

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: nr2 cant handle this
	* rust/compile/issue-3082.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty added a commit that referenced this issue Sep 20, 2024
Qualified path expressions usually are <X as Y>::... but the as is optional
this adds the extra checking in hir lowering to not hit that nullptr.

Fixes #3082

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit):
	check for valid as segment

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: nr2 cant handle this
	* rust/compile/issue-3082.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants