mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Rollup merge of #46856 - estebank:missing-in-impl-def-span, r=arielb1
Point at def span in "missing in impl" error
This commit is contained in:
commit
94b864ccd0
@ -1274,6 +1274,8 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
impl_id: DefId,
|
||||
impl_trait_ref: ty::TraitRef<'tcx>,
|
||||
impl_item_refs: &[hir::ImplItemRef]) {
|
||||
let impl_span = tcx.sess.codemap().def_span(impl_span);
|
||||
|
||||
// If the trait reference itself is erroneous (so the compilation is going
|
||||
// to fail), skip checking the items here -- the `impl_item` table in `tcx`
|
||||
// isn't populated for such impls.
|
||||
|
@ -27,7 +27,7 @@ error[E0046]: not all trait items implemented, missing: `fmt`
|
||||
--> $DIR/trait_type.rs:31:1
|
||||
|
|
||||
31 | impl std::fmt::Display for MyType4 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
|
||||
|
|
||||
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
|
||||
|
||||
|
@ -3,9 +3,8 @@ error[E0601]: main function not found
|
||||
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
|
||||
--> $DIR/m2.rs:19:1
|
||||
|
|
||||
19 | / impl m1::X for X { //~ ERROR not all trait items implemented
|
||||
20 | | }
|
||||
| |_^ missing `CONSTANT`, `Type`, `method` in implementation
|
||||
19 | impl m1::X for X { //~ ERROR not all trait items implemented
|
||||
| ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation
|
||||
|
|
||||
= note: `CONSTANT` from trait: `const CONSTANT: u32;`
|
||||
= note: `Type` from trait: `type Type;`
|
||||
|
@ -5,7 +5,7 @@ error[E0046]: not all trait items implemented, missing: `foo`
|
||||
| --------- `foo` from trait
|
||||
...
|
||||
17 | impl Foo for Bar {}
|
||||
| ^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
|
||||
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -16,16 +16,11 @@ error[E0323]: item `bar` is an associated const, which doesn't match its trait `
|
||||
error[E0046]: not all trait items implemented, missing: `bar`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:21:1
|
||||
|
|
||||
15 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
15 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
...
|
||||
21 | / impl Foo for FooConstForMethod {
|
||||
22 | | //~^ ERROR E0046
|
||||
23 | | const bar: u64 = 1;
|
||||
24 | | //~^ ERROR E0323
|
||||
25 | | const MY_CONST: u32 = 1;
|
||||
26 | | }
|
||||
| |_^ missing `bar` in implementation
|
||||
21 | impl Foo for FooConstForMethod {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation
|
||||
|
||||
error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:33:5
|
||||
@ -39,16 +34,11 @@ error[E0324]: item `MY_CONST` is an associated method, which doesn't match its t
|
||||
error[E0046]: not all trait items implemented, missing: `MY_CONST`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:30:1
|
||||
|
|
||||
16 | const MY_CONST: u32;
|
||||
| -------------------- `MY_CONST` from trait
|
||||
16 | const MY_CONST: u32;
|
||||
| -------------------- `MY_CONST` from trait
|
||||
...
|
||||
30 | / impl Foo for FooMethodForConst {
|
||||
31 | | //~^ ERROR E0046
|
||||
32 | | fn bar(&self) {}
|
||||
33 | | fn MY_CONST() {}
|
||||
34 | | //~^ ERROR E0324
|
||||
35 | | }
|
||||
| |_^ missing `MY_CONST` in implementation
|
||||
30 | impl Foo for FooMethodForConst {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MY_CONST` in implementation
|
||||
|
||||
error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:41:5
|
||||
@ -62,24 +52,17 @@ error[E0325]: item `bar` is an associated type, which doesn't match its trait `F
|
||||
error[E0046]: not all trait items implemented, missing: `bar`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:39:1
|
||||
|
|
||||
15 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
15 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
...
|
||||
39 | / impl Foo for FooTypeForMethod {
|
||||
40 | | //~^ ERROR E0046
|
||||
41 | | type bar = u64;
|
||||
42 | | //~^ ERROR E0325
|
||||
43 | | //~| ERROR E0437
|
||||
44 | | const MY_CONST: u32 = 1;
|
||||
45 | | }
|
||||
| |_^ missing `bar` in implementation
|
||||
39 | impl Foo for FooTypeForMethod {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `fmt`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:47:1
|
||||
|
|
||||
47 | / impl Debug for FooTypeForMethod {
|
||||
48 | | }
|
||||
| |_^ missing `fmt` in implementation
|
||||
47 | impl Debug for FooTypeForMethod {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
|
||||
|
|
||||
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
|
||||
|
||||
|
@ -1,14 +1,8 @@
|
||||
error[E0046]: not all trait items implemented, missing: `Item`
|
||||
--> $DIR/issue-23729.rs:20:9
|
||||
|
|
||||
20 | / impl Iterator for Recurrence {
|
||||
21 | | //~^ ERROR E0046
|
||||
22 | | #[inline]
|
||||
23 | | fn next(&mut self) -> Option<u64> {
|
||||
... |
|
||||
34 | | }
|
||||
35 | | }
|
||||
| |_________^ missing `Item` in implementation
|
||||
20 | impl Iterator for Recurrence {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation
|
||||
|
|
||||
= note: `Item` from trait: `type Item;`
|
||||
|
||||
|
@ -1,13 +1,8 @@
|
||||
error[E0046]: not all trait items implemented, missing: `Output`
|
||||
--> $DIR/issue-23827.rs:36:1
|
||||
|
|
||||
36 | / impl<C: Component> FnOnce<(C,)> for Prototype {
|
||||
37 | | //~^ ERROR E0046
|
||||
38 | | extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype {
|
||||
39 | | Fn::call(&self, (comp,))
|
||||
40 | | }
|
||||
41 | | }
|
||||
| |_^ missing `Output` in implementation
|
||||
36 | impl<C: Component> FnOnce<(C,)> for Prototype {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation
|
||||
|
|
||||
= note: `Output` from trait: `type Output;`
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
error[E0046]: not all trait items implemented, missing: `Target`
|
||||
--> $DIR/issue-24356.rs:30:9
|
||||
|
|
||||
30 | / impl Deref for Thing {
|
||||
31 | | //~^ ERROR E0046
|
||||
32 | | fn deref(&self) -> i8 { self.0 }
|
||||
33 | | }
|
||||
| |_________^ missing `Target` in implementation
|
||||
30 | impl Deref for Thing {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation
|
||||
|
|
||||
= note: `Target` from trait: `type Target;`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user