Skip to content
ZOLO / TE824 Type · error

invalid qualified trait path

Qualified trait paths must be `core::<module>::<Trait>` or `std::<module>::<Trait>`, naming a `pub trait` actually declared there — in a generic bound and in an `impl` header alike.

Why this fires

A qualified trait path doesn't resolve to a real exported trait. The module may come from the project, an installed package, core, or std; its last segment must name a pub trait actually declared there. This applies in a generic bound, an impl header, and let value: impl module::Trait.

fn f<T: core::cmp::Bogus>(a: T) -> T { a }
//      ^^^^^^^^^^^^^^^^^ error[TE824]: invalid qualified trait path `core::cmp::Bogus`

The same check covers the trait position of an impl:

impl core::cmp::Bogus for Money { }
//   ^^^^^^^^^^^^^^^^^ error[TE824]: invalid qualified trait path `core::cmp::Bogus`

impl contracts::PrivateCleanup for Money { }
//   ^^^^^^^^^^^^^^^^^^^^^^^^^ error[TE824]: the trait is not public

Fix it

Use the correct module and trait name and export a user trait when it crosses a module boundary:

fn f<T: core::cmp::Ord>(a: T) -> T { a }   // or simply  <T: Ord>

// contracts.zolo
pub trait Cleanup {
  fn close(self)
}

// main.zolo — no `use contracts::Cleanup` is needed for a qualified path
let file: impl contracts::Cleanup = File.new("report.txt")

Notes

  • A bare unknown trait name (<T: Foo>) is TE822, not TE824.
  • Private traits cannot be named across a module boundary; add pub or keep the reference inside the declaring module.
  • Resolution uses the same sibling/project/package lookup rules as use, so a path is not accepted merely because its final name matches a known trait.

See also

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br