When there is a compiler error, the errors differ in that the clippy-driver uses the fully qualified module path to refer to trait, struct, function, etc. definitions, and rustc does not.
This becomes a problem when writing trybuild compiler tests against macros, in which case the tests only pass if the output is exactly the same. It would be expected that these tests should be able to be run through clippy-driver and rustc and yield the same results.
When it is run via rustc, this is the error output:
error[E0277]: the trait bound `MyStruct: MyTrait` is not satisfied
--> src/main.rs:8:19
|
8 | my_mod::my_fn(my_mod::MyStruct);
| ------------- ^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `MyStruct`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> src/main.rs:2:5
|
2 | pub trait MyTrait {}
| ^^^^^^^^^^^^^^^^^
note: required by a bound in `my_fn`
--> src/main.rs:4:21
|
4 | pub fn my_fn<T: MyTrait>(_t: T) {}
| ^^^^^^^ required by this bound in `my_fn`
When the clippy tool runs it (via clippy-driver) this is the error output:
error[E0277]: the trait bound `my_mod::MyStruct: my_mod::MyTrait` is not satisfied
--> src/main.rs:8:19
|
8 | my_mod::my_fn(my_mod::MyStruct);
| ------------- ^^^^^^^^^^^^^^^^ the trait `my_mod::MyTrait` is not implemented for `my_mod::MyStruct`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> src/main.rs:2:5
|
2 | pub trait MyTrait {}
| ^^^^^^^^^^^^^^^^^
note: required by a bound in `my_mod::my_fn`
--> src/main.rs:4:21
|
4 | pub fn my_fn<T: MyTrait>(_t: T) {}
| ^^^^^^^ required by this bound in `my_fn`
Description
When there is a compiler error, the errors differ in that the
clippy-driver
uses the fully qualified module path to refer to trait, struct, function, etc. definitions, andrustc
does not.This becomes a problem when writing
trybuild
compiler tests against macros, in which case the tests only pass if the output is exactly the same. It would be expected that these tests should be able to be run throughclippy-driver
andrustc
and yield the same results.I created a simple example in Rust playground that fails to compile.
When it is run via
rustc
, this is the error output:When the
clippy
tool runs it (viaclippy-driver
) this is the error output:Version
Additional Labels
No response