Failed to lookup type reference for associated type in where-clause bound

Open
#4,708 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
compilers

Research direction

Start by compiling the provided no_core reproducer and compare it with the Godbolt example. Trace the compiler's type-reference lookup for T::AssocType in the where-clause bound. Done means the reproducer compiles successfully without the “Failed to lookup type reference” error.

Written by the indexing model from the issue text.

Description

Summary

Failed to lookup type reference for associated type in where-clause bound

Reproducer

I tried this code:

#![feature(no_core, lang_items)]
#![no_core]

#[lang = "sized"]
pub trait Sized {}

pub trait Trait {
    type AssocType;
}

pub trait Trait2 {}

pub struct TraitWrapper<T> {
    inner: T,
}

impl<T: Trait> TraitWrapper<T>
where
    T::AssocType: Trait2,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}
Does the code make use of any (1.49) nightly feature ?
  • Nightly
Godbolt link

https://godbolt.org/z/dEcr35Khh

Actual behavior
crab1: error: Failed to lookup type reference for node: T::AssocType
Expected behavior
Compiler returned: 0
GCC Version

master

Dominant language
C++
Stars
3k
Forks
238
Avg merge
4d 8h
Merged PRs (30d)
31

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rust-GCC/gccrs

All issues in Rust-GCC/gccrs

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.