Skip to content

Extraneous "parameter never used" error #35075

Closed
@alexcrichton

Description

@alexcrichton

When compiling this code:

struct Foo<T> {      
    inner: Bar<T>,   
}                    

the compiler emits:

error[E0412]: type name `Bar` is undefined or not in scope                                                          
 --> foo.rs:2:12                                                                                                    
  |                                                                                                                 
2 |     inner: Bar<T>,                                                                                              
  |            ^^^^^^ undefined or not in scope                                                                     
  |                                                                                                                 
  = help: no candidates by the name of `Bar` found in your project; maybe you misspelled the name or forgot to import an external crate?                                                                                                

error: main function not found                                                                                      

error[E0392]: parameter `T` is never used                                                                           
 --> foo.rs:1:12                                                                                                    
  |                                                                                                                 
1 | struct Foo<T> {                                                                                                 
  |            ^                                                                                                    
  |                                                                                                                 
  = help: consider removing `T` or using a marker such as `std::marker::PhantomData`                                

error: aborting due to previous error                                                                               

The second error here isn't actually relevant and should be turned off because the first error was emitted.

cc @nrc
cc @jonathandturner

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions