compiler/rustc_error_codes/src/error_codes/E0412.md MARKDOWN 65 lines View on github.com → Search inside
1#### Note: this error code is no longer emitted by the compiler.23Erroneous code examples:45```compile_fail,E04256impl Something {} // error: type name `Something` is not in scope78// or:910trait Foo {11    fn bar(N); // error: type name `N` is not in scope12}1314// or:1516fn foo(x: T) {} // type name `T` is not in scope17```1819To fix this error, please verify you didn't misspell the type name, you did20declare it or imported it into the scope. Examples:2122```23struct Something;2425impl Something {} // ok!2627// or:2829trait Foo {30    type N;3132    fn bar(_: Self::N); // ok!33}3435// or:3637fn foo<T>(x: T) {} // ok!38```3940Another case that causes this error is when a type is imported into a parent41module. To fix this, you can follow the suggestion and use File directly or42`use super::File;` which will import the types from the parent namespace. An43example that causes this error is below:4445```compile_fail,E042546use std::fs::File;4748mod foo {49    fn some_function(f: File) {}50}51```5253```54use std::fs::File;5556mod foo {57    // either58    use super::File;59    // or60    // use std::fs::File;61    fn foo(f: File) {}62}63# fn main() {} // don't insert it for us; that'll break imports64```

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.