recover primary span label

This commit is contained in:
Esteban Küber 2023-11-09 06:01:10 +00:00
parent 8bd8f3b090
commit 4f7dddd4a1
51 changed files with 131 additions and 107 deletions

View File

@ -2418,9 +2418,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
field_ident: Ident,
base: &'tcx hir::Expr<'tcx>,
ty: Ty<'tcx>,
) {
) -> bool {
let Some(output_ty) = self.get_impl_future_output_ty(ty) else {
return;
return false;
};
let mut add_label = true;
if let ty::Adt(def, _) = output_ty.kind() {
@ -2449,6 +2449,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if add_label {
err.span_label(field_ident.span, format!("field not found in `{ty}`"));
}
true
}
fn ban_nonexisting_field(
@ -2464,20 +2465,27 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
);
let mut err = self.no_such_field_err(ident, base_ty, base.hir_id);
match *base_ty.peel_refs().kind() {
let has_label = match *base_ty.peel_refs().kind() {
ty::Array(_, len) => {
self.maybe_suggest_array_indexing(&mut err, expr, base, ident, len);
false
}
ty::RawPtr(..) => {
self.suggest_first_deref_field(&mut err, expr, base, ident);
false
}
ty::Param(param_ty) => {
self.point_at_param_definition(&mut err, param_ty);
false
}
ty::Alias(ty::Opaque, _) => {
self.suggest_await_on_field_access(&mut err, ident, base, base_ty.peel_refs());
self.suggest_await_on_field_access(&mut err, ident, base, base_ty.peel_refs())
}
_ => {}
_ => false,
};
if !has_label {
err.span_label(ident.span, "unknown field");
}
self.suggest_fn_call(&mut err, base, base_ty, |output_ty| {

View File

@ -10,6 +10,7 @@ fn await_on_struct_missing() {
let x = S;
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
@ -22,6 +23,7 @@ fn await_on_struct_similar() {
let x = S { awai: 42 };
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| HELP a field with a similar name exists
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2021"` in `Cargo.toml`
@ -31,6 +33,7 @@ fn await_on_struct_similar() {
fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
@ -39,6 +42,7 @@ fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
fn await_on_apit(x: impl Future<Output = ()>) {
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide

View File

@ -2,17 +2,17 @@ error[E0609]: no field `await` on type `await_on_struct_missing::S`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0609]: no field `await` on type `await_on_struct_similar::S`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:23:7
--> $DIR/suggest-switching-edition-on-await-cargo.rs:24:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2021"` in `Cargo.toml`
@ -23,20 +23,20 @@ LL | x.awai;
| ~~~~
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:32:7
--> $DIR/suggest-switching-edition-on-await-cargo.rs:34:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0609]: no field `await` on type `impl Future<Output = ()>`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:40:7
--> $DIR/suggest-switching-edition-on-await-cargo.rs:43:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2021"` in `Cargo.toml`

View File

@ -8,6 +8,7 @@ fn await_on_struct_missing() {
let x = S;
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP pass `--edition 2021` to `rustc`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
@ -20,6 +21,7 @@ fn await_on_struct_similar() {
let x = S { awai: 42 };
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| HELP a field with a similar name exists
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP pass `--edition 2021` to `rustc`
@ -29,6 +31,7 @@ fn await_on_struct_similar() {
fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP pass `--edition 2021` to `rustc`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
@ -37,6 +40,7 @@ fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
fn await_on_apit(x: impl Future<Output = ()>) {
x.await;
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP pass `--edition 2021` to `rustc`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide

View File

@ -2,17 +2,17 @@ error[E0609]: no field `await` on type `await_on_struct_missing::S`
--> $DIR/suggest-switching-edition-on-await.rs:9:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0609]: no field `await` on type `await_on_struct_similar::S`
--> $DIR/suggest-switching-edition-on-await.rs:21:7
--> $DIR/suggest-switching-edition-on-await.rs:22:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: pass `--edition 2021` to `rustc`
@ -23,20 +23,20 @@ LL | x.awai;
| ~~~~
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
--> $DIR/suggest-switching-edition-on-await.rs:30:7
--> $DIR/suggest-switching-edition-on-await.rs:32:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0609]: no field `await` on type `impl Future<Output = ()>`
--> $DIR/suggest-switching-edition-on-await.rs:38:7
--> $DIR/suggest-switching-edition-on-await.rs:41:7
|
LL | x.await;
| ^^^^^
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: pass `--edition 2021` to `rustc`

View File

@ -2,7 +2,7 @@ error[E0609]: no field `c` on type `&Foo`
--> $DIR/issue-30580.rs:12:11
|
LL | b.c;
| ^
| ^ unknown field
|
help: a field with a similar name exists
|

View File

@ -21,15 +21,18 @@ fn main() {
// `doc(hidden)` because it's defined in this crate.
A::default().hey;
//~^ ERROR no field `hey` on type `A`
//~| NOTE unknown field
//~| NOTE available fields are: `hello`, `bye`
// Here we want to hide the field `hello` since it's marked
// `doc(hidden)` and comes from an external crate.
doc_hidden_fields::B::default().hey;
//~^ ERROR no field `hey` on type `B`
//~| NOTE unknown field
//~| NOTE available field is: `bye`
C::default().hey;
//~^ ERROR no field `hey` on type `C`
//~| NOTE unknown field
//~| NOTE available fields are: `hello`, `bye`
}

View File

@ -2,23 +2,23 @@ error[E0609]: no field `hey` on type `A`
--> $DIR/dont-suggest-doc-hidden-fields.rs:22:18
|
LL | A::default().hey;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `hello`, `bye`
error[E0609]: no field `hey` on type `B`
--> $DIR/dont-suggest-doc-hidden-fields.rs:28:37
--> $DIR/dont-suggest-doc-hidden-fields.rs:29:37
|
LL | doc_hidden_fields::B::default().hey;
| ^^^
| ^^^ unknown field
|
= note: available field is: `bye`
error[E0609]: no field `hey` on type `C`
--> $DIR/dont-suggest-doc-hidden-fields.rs:32:18
--> $DIR/dont-suggest-doc-hidden-fields.rs:34:18
|
LL | C::default().hey;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `hello`, `bye`

View File

@ -13,13 +13,13 @@ error[E0609]: no field `field` on type `Compound`
--> $DIR/dont-suggest-hygienic-fields.rs:24:16
|
LL | let _ = ty.field;
| ^^^^^
| ^^^^^ unknown field
error[E0609]: no field `fieeld` on type `Compound`
--> $DIR/dont-suggest-hygienic-fields.rs:25:16
|
LL | let _ = ty.fieeld;
| ^^^^^^
| ^^^^^^ unknown field
error[E0026]: struct `Compound` does not have a field named `field`
--> $DIR/dont-suggest-hygienic-fields.rs:27:20
@ -42,7 +42,7 @@ error[E0609]: no field `0` on type `Component`
--> $DIR/dont-suggest-hygienic-fields.rs:34:16
|
LL | let _ = ty.0;
| ^
| ^ unknown field
error: aborting due to 6 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `baz` on type `Foo`
--> $DIR/issue-36798.rs:7:7
|
LL | f.baz;
| ^^^
| ^^^ unknown field
|
help: a field with a similar name exists
|

View File

@ -2,7 +2,7 @@ error[E0609]: no field `zz` on type `Foo`
--> $DIR/issue-36798_unknown_field.rs:7:7
|
LL | f.zz;
| ^^
| ^^ unknown field
|
= note: available field is: `bar`

View File

@ -16,7 +16,7 @@ error[E0609]: no field `inocently_mispellable` on type `Demo`
--> $DIR/issue-42599_available_fields_note.rs:32:41
|
LL | let innocent_field_misaccess = demo.inocently_mispellable;
| ^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^ unknown field
|
help: a field with a similar name exists
|
@ -27,7 +27,7 @@ error[E0609]: no field `egregiously_nonexistent_field` on type `Demo`
--> $DIR/issue-42599_available_fields_note.rs:35:42
|
LL | let egregious_field_misaccess = demo.egregiously_nonexistent_field;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `favorite_integer`, `innocently_misspellable`

View File

@ -2,7 +2,7 @@ error[E0609]: no field `method` on type `Foo`
--> $DIR/E0609-private-method.rs:15:7
|
LL | f.method;
| ^^^^^^
| ^^^^^^ unknown field
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0609]: no field `foo` on type `Foo`
--> $DIR/E0609.rs:8:15
|
LL | let _ = x.foo;
| ^^^
| ^^^ unknown field
|
= note: available field is: `x`
@ -10,7 +10,7 @@ error[E0609]: no field `1` on type `Bar`
--> $DIR/E0609.rs:11:7
|
LL | y.1;
| ^
| ^ unknown field
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `1` on type `Foo`
--> $DIR/ex-E0612.rs:5:6
|
LL | y.1;
| ^
| ^ unknown field
|
help: a field with a similar name exists
|

View File

@ -29,7 +29,7 @@ error[E0609]: no field `foo` on type `Foo`
--> $DIR/infinite-autoderef.rs:24:9
|
LL | Foo.foo;
| ^^^
| ^^^ unknown field
error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
--> $DIR/infinite-autoderef.rs:25:9

View File

@ -3,7 +3,8 @@ error[E0609]: no field `x` on type `*mut A`
|
LL | let x : i32 = n.x;
| --^
| |
| | |
| | unknown field
| help: `n` is a raw pointer; try dereferencing it: `(*n).x`
error[E0609]: no field `y` on type `*mut A`
@ -11,7 +12,8 @@ error[E0609]: no field `y` on type `*mut A`
|
LL | let y : f64 = n.y;
| --^
| |
| | |
| | unknown field
| help: `n` is a raw pointer; try dereferencing it: `(*n).y`
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `is_failure` on type `!`
--> $DIR/issue-13847.rs:2:12
|
LL | return.is_failure
| ^^^^^^^^^^
| ^^^^^^^^^^ unknown field
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0609]: no field `desc` on type `&str`
--> $DIR/issue-14721.rs:3:24
|
LL | println!("{}", foo.desc);
| ^^^^
| ^^^^ unknown field
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0609]: no field `1` on type `(usize,)`
--> $DIR/issue-19244-1.rs:4:24
|
LL | let a: [isize; TUP.1];
| ^
| ^ unknown field
error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0609]: no field `nonexistent_field` on type `MyStruct`
--> $DIR/issue-19244-2.rs:5:27
|
LL | let a: [isize; STRUCT.nonexistent_field];
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ unknown field
|
= note: available field is: `field`

View File

@ -2,7 +2,7 @@ error[E0609]: no field `a` on type `Foo`
--> $DIR/issue-23253.rs:4:14
|
LL | Foo::Bar.a;
| ^
| ^ unknown field
error: aborting due to previous error

View File

@ -2,19 +2,19 @@ error[E0609]: no field `b` on type `Foo`
--> $DIR/issue-24365.rs:10:22
|
LL | println!("{}", a.b);
| ^
| ^ unknown field
error[E0609]: no field `attr_name_idx` on type `&Attribute`
--> $DIR/issue-24365.rs:17:18
|
LL | let z = (&x).attr_name_idx;
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ unknown field
error[E0609]: no field `attr_name_idx` on type `Attribute`
--> $DIR/issue-24365.rs:18:15
|
LL | let y = x.attr_name_idx;
| ^^^^^^^^^^^^^
| ^^^^^^^^^^^^^ unknown field
error: aborting due to 3 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `trace` on type `&T`
--> $DIR/issue-31011.rs:3:17
|
LL | if $ctx.trace {
| ^^^^^
| ^^^^^ unknown field
...
LL | fn wrap<T>(context: &T) -> ()
| - type parameter 'T' declared here

View File

@ -8,13 +8,13 @@ error[E0609]: no field `lorem` on type `&'static str`
--> $DIR/issue-33525.rs:3:8
|
LL | "".lorem;
| ^^^^^
| ^^^^^ unknown field
error[E0609]: no field `ipsum` on type `&'static str`
--> $DIR/issue-33525.rs:4:8
|
LL | "".ipsum;
| ^^^^^
| ^^^^^ unknown field
error: aborting due to 3 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `00` on type `Verdict`
--> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:8:30
|
LL | let _condemned = justice.00;
| ^^
| ^^ unknown field
|
help: a field with a similar name exists
|
@ -13,7 +13,7 @@ error[E0609]: no field `001` on type `Verdict`
--> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31
|
LL | let _punishment = justice.001;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `0`, `1`

View File

@ -18,7 +18,7 @@ error[E0609]: no field `f` on type `fn() {main}`
--> $DIR/cast-rfc0401.rs:65:18
|
LL | let _ = main.f as *const u32;
| ^
| ^ unknown field
error[E0605]: non-primitive cast: `*const u8` as `&u8`
--> $DIR/cast-rfc0401.rs:29:13

View File

@ -266,7 +266,7 @@ error[E0609]: no field `1e1` on type `S`
--> $DIR/float-field.rs:6:7
|
LL | s.1e1;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -274,13 +274,13 @@ error[E0609]: no field `1e1` on type `(u8, u8)`
--> $DIR/float-field.rs:9:9
|
LL | s.1.1e1;
| ^^^
| ^^^ unknown field
error[E0609]: no field `0x1e1` on type `S`
--> $DIR/float-field.rs:24:7
|
LL | s.0x1e1;
| ^^^^^
| ^^^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -288,7 +288,7 @@ error[E0609]: no field `0x1` on type `S`
--> $DIR/float-field.rs:25:7
|
LL | s.0x1.;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -296,7 +296,7 @@ error[E0609]: no field `0x1` on type `S`
--> $DIR/float-field.rs:28:7
|
LL | s.0x1.1;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -304,7 +304,7 @@ error[E0609]: no field `0x1` on type `S`
--> $DIR/float-field.rs:30:7
|
LL | s.0x1.1e1;
| ^^^
| ^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -312,7 +312,7 @@ error[E0609]: no field `0x1e` on type `S`
--> $DIR/float-field.rs:34:7
|
LL | s.0x1e+1;
| ^^^^
| ^^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -320,7 +320,7 @@ error[E0609]: no field `0x1e` on type `S`
--> $DIR/float-field.rs:35:7
|
LL | s.0x1e-1;
| ^^^^
| ^^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -328,7 +328,7 @@ error[E0609]: no field `1e1` on type `S`
--> $DIR/float-field.rs:42:7
|
LL | s.1e1f32;
| ^^^^^^
| ^^^^^^ unknown field
|
= note: available fields are: `0`, `1`
@ -336,13 +336,13 @@ error[E0609]: no field `f32` on type `(u8, u8)`
--> $DIR/float-field.rs:44:9
|
LL | s.1.f32;
| ^^^
| ^^^ unknown field
error[E0609]: no field `1e1` on type `(u8, u8)`
--> $DIR/float-field.rs:46:7
|
LL | s.1.1e1f32;
| ^^^^^^^^
| ^^^^^^^^ unknown field
error: aborting due to 55 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `baa` on type `BuildData`
--> $DIR/struct-fields-typo.rs:11:17
|
LL | let x = foo.baa;
| ^^^
| ^^^ unknown field
|
help: a field with a similar name exists
|

View File

@ -2,7 +2,7 @@ error[E0609]: no field `d` on type `&A`
--> $DIR/struct-pat-derived-error.rs:8:31
|
LL | let A { x, y } = self.d;
| ^
| ^ unknown field
|
help: a field with a similar name exists
|

View File

@ -13,7 +13,7 @@ error[E0609]: no field `i` on type `fn() -> Foo {foo}`
--> $DIR/call-on-missing.rs:16:9
|
LL | foo.i;
| ^
| ^ unknown field
|
help: use parentheses to call this function
|
@ -35,7 +35,7 @@ error[E0609]: no field `i` on type `Box<dyn Fn() -> Foo>`
--> $DIR/call-on-missing.rs:26:14
|
LL | callable.i;
| ^
| ^ unknown field
|
help: use parentheses to call this trait object
|
@ -62,7 +62,7 @@ LL | fn type_param<T: Fn() -> Foo>(t: T) {
| - type parameter 'T' declared here
...
LL | t.i;
| ^
| ^ unknown field
|
help: use parentheses to call this type parameter
|

View File

@ -2,7 +2,7 @@ error[E0609]: no field `opts` on type `TyCtxt<'tcx>`
--> $DIR/field-access-considering-privacy.rs:29:13
|
LL | tcx.opts;
| ^^^^
| ^^^^ unknown field
|
help: one of the expressions' fields has a field of the same name
|

View File

@ -2,7 +2,7 @@ error[E0609]: no field `f` on type `Foo`
--> $DIR/non-existent-field-present-in-subfield-recursion-limit.rs:41:22
|
LL | let test = fooer.f;
| ^
| ^ unknown field
|
= note: available fields are: `first`, `second`, `third`

View File

@ -2,7 +2,7 @@ error[E0609]: no field `c` on type `Foo`
--> $DIR/non-existent-field-present-in-subfield.rs:37:24
|
LL | let _test = &fooer.c;
| ^
| ^ unknown field
|
help: one of the expressions' fields has a field of the same name
|
@ -13,7 +13,7 @@ error[E0609]: no field `test` on type `Foo`
--> $DIR/non-existent-field-present-in-subfield.rs:40:24
|
LL | let _test2 = fooer.test;
| ^^^^
| ^^^^ unknown field
|
help: one of the expressions' fields has a field of the same name
|

View File

@ -2,7 +2,7 @@ error[E0609]: no field `opts` on type `*const Session`
--> $DIR/parenthesized-deref-suggestion.rs:7:30
|
LL | (sess as *const Session).opts;
| ^^^^
| ^^^^ unknown field
|
help: `(sess as *const Session)` is a raw pointer; try dereferencing it
|
@ -14,7 +14,8 @@ error[E0609]: no field `0` on type `[u32; 1]`
|
LL | (x as [u32; 1]).0;
| ----------------^
| |
| | |
| | unknown field
| help: instead of using tuple indexing, use array indexing: `(x as [u32; 1])[0]`
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `cap` on type `S`
--> $DIR/private-field.rs:7:12
|
LL | dbg!(s.cap)
| ^^^
| ^^^ unknown field
|
= note: available field is: `val`

View File

@ -2,7 +2,7 @@ error[E0609]: no field `longname` on type `Arc<S>`
--> $DIR/suggest-field-through-deref.rs:10:15
|
LL | let _ = x.longname;
| ^^^^^^^^
| ^^^^^^^^ unknown field
|
help: a field with a similar name exists
|
@ -13,7 +13,7 @@ error[E0609]: no field `longname` on type `S`
--> $DIR/suggest-field-through-deref.rs:12:15
|
LL | let _ = y.longname;
| ^^^^^^^^
| ^^^^^^^^ unknown field
|
help: a field with a similar name exists
|
@ -24,7 +24,7 @@ error[E0609]: no field `longname` on type `Option<Arc<S>>`
--> $DIR/suggest-field-through-deref.rs:14:15
|
LL | let _ = a.longname;
| ^^^^^^^^
| ^^^^^^^^ unknown field
|
help: a field with a similar name exists
|
@ -35,7 +35,7 @@ error[E0609]: no field `long_name` on type `Option<S>`
--> $DIR/suggest-field-through-deref.rs:16:15
|
LL | let _ = b.long_name;
| ^^^^^^^^^
| ^^^^^^^^^ unknown field
|
help: one of the expressions' fields has a field of the same name
|
@ -46,7 +46,7 @@ error[E0609]: no field `longname` on type `Result<Arc<S>, ()>`
--> $DIR/suggest-field-through-deref.rs:18:15
|
LL | let _ = c.longname;
| ^^^^^^^^
| ^^^^^^^^ unknown field
|
help: a field with a similar name exists
|
@ -57,7 +57,7 @@ error[E0609]: no field `long_name` on type `Result<S, ()>`
--> $DIR/suggest-field-through-deref.rs:20:15
|
LL | let _ = d.long_name;
| ^^^^^^^^^
| ^^^^^^^^^ unknown field
|
help: one of the expressions' fields has a field of the same name
|

View File

@ -23,7 +23,7 @@ error[E0609]: no field `field` on type `Thing`
--> $DIR/too-many-field-suggestions.rs:26:7
|
LL | t.field;
| ^^^^^
| ^^^^^ unknown field
|
help: some of the expressions' fields have a field of the same name
|

View File

@ -2,19 +2,19 @@ error[E0609]: no field `1` on type `(((),),)`
--> $DIR/index-invalid.rs:2:22
|
LL | let _ = (((),),).1.0;
| ^
| ^ unknown field
error[E0609]: no field `1` on type `((),)`
--> $DIR/index-invalid.rs:4:24
|
LL | let _ = (((),),).0.1;
| ^
| ^ unknown field
error[E0609]: no field `000` on type `(((),),)`
--> $DIR/index-invalid.rs:6:22
|
LL | let _ = (((),),).000.000;
| ^^^
| ^^^ unknown field
error: aborting due to 3 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `0` on type `Point`
--> $DIR/tuple-index-not-tuple.rs:6:12
|
LL | origin.0;
| ^
| ^ unknown field
|
help: a field with a similar name exists
|
@ -13,7 +13,7 @@ error[E0609]: no field `0` on type `Empty`
--> $DIR/tuple-index-not-tuple.rs:8:11
|
LL | Empty.0;
| ^
| ^ unknown field
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `2` on type `Point`
--> $DIR/tuple-index-out-of-bounds.rs:7:12
|
LL | origin.2;
| ^
| ^ unknown field
|
help: a field with a similar name exists
|
@ -13,7 +13,7 @@ error[E0609]: no field `2` on type `({integer}, {integer})`
--> $DIR/tuple-index-out-of-bounds.rs:12:11
|
LL | tuple.2;
| ^
| ^ unknown field
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn equals_ref<Point>(a: &Point, b: &Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `x` on type `&Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:31:18
@ -14,7 +14,7 @@ LL | fn equals_ref<Point>(a: &Point, b: &Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `y` on type `&Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:31:25
@ -23,7 +23,7 @@ LL | fn equals_ref<Point>(a: &Point, b: &Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `y` on type `&Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:31:32
@ -32,7 +32,7 @@ LL | fn equals_ref<Point>(a: &Point, b: &Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `x` on type `Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:39:11
@ -41,7 +41,7 @@ LL | fn equals_val<Point>(a: Point, b: Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `x` on type `Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:39:18
@ -50,7 +50,7 @@ LL | fn equals_val<Point>(a: Point, b: Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `y` on type `Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:39:25
@ -59,7 +59,7 @@ LL | fn equals_val<Point>(a: Point, b: Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error[E0609]: no field `y` on type `Point`
--> $DIR/issue-52082-type-param-shadows-existing-type.rs:39:32
@ -68,7 +68,7 @@ LL | fn equals_val<Point>(a: Point, b: Point) -> bool
| ----- type parameter 'Point' declared here
LL | {
LL | a.x == b.x && a.y == b.y
| ^
| ^ unknown field
error: aborting due to 8 previous errors

View File

@ -3,7 +3,8 @@ error[E0609]: no field `0` on type `[{integer}; 5]`
|
LL | arr.0;
| ----^
| |
| | |
| | unknown field
| help: instead of using tuple indexing, use array indexing: `arr[0]`
error: aborting due to previous error

View File

@ -8,7 +8,7 @@ error[E0609]: no field `0` on type `&_`
--> $DIR/issue-65611.rs:59:36
|
LL | let x = buffer.last().unwrap().0.clone();
| ^
| ^ unknown field
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `sleep` on type `&mut S`
--> $DIR/issue-67971.rs:5:9
|
LL | ctx.sleep = 0;
| ^^^^^
| ^^^^^ unknown field
error[E0308]: mismatched types
--> $DIR/issue-67971.rs:3:24

View File

@ -2,7 +2,7 @@ error[E0609]: no field `0` on type `fn(char, u16) -> Foo {Foo}`
--> $DIR/tuple-field.rs:12:15
|
LL | thing.bar.0;
| ^
| ^ unknown field
|
help: use parentheses to construct this tuple struct
|

View File

@ -8,7 +8,7 @@ error[E0609]: no field `nonexistent_field` on type `fn(_) -> Option<_> {Option::
--> $DIR/issue-96738.rs:3:10
|
LL | Some.nonexistent_field;
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ unknown field
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0609]: no field `homura` on type `&'static str`
--> $DIR/no-type-for-node-ice.rs:4:8
|
LL | "".homura[""];
| ^^^^^^
| ^^^^^^ unknown field
error: aborting due to previous error

View File

@ -8,7 +8,7 @@ error[E0609]: no field `principial` on type `U`
--> $DIR/union-suggest-field.rs:17:15
|
LL | let w = u.principial;
| ^^^^^^^^^^
| ^^^^^^^^^^ unknown field
|
help: a field with a similar name exists
|

View File

@ -8,7 +8,7 @@ error[E0609]: no field `principial` on type `U`
--> $DIR/union-suggest-field.rs:17:15
|
LL | let w = u.principial;
| ^^^^^^^^^^
| ^^^^^^^^^^ unknown field
|
help: a field with a similar name exists
|

View File

@ -3,7 +3,8 @@ error[E0609]: no field `f` on type `*const Rec`
|
LL | return p.f;
| --^
| |
| | |
| | unknown field
| help: `p` is a raw pointer; try dereferencing it: `(*p).f`
error: aborting due to previous error