Fix Parser::break_up_float's right span

This commit is contained in:
Lieselotte 2024-09-14 12:41:25 +02:00
parent 003da02352
commit 3d20c810b0
No known key found for this signature in database
GPG Key ID: 68A9A951C7E1F283
3 changed files with 25 additions and 25 deletions

View File

@ -1098,7 +1098,7 @@ enum FloatComponent {
let dot_span = span let dot_span = span
.with_lo(span.lo + ident1_len) .with_lo(span.lo + ident1_len)
.with_hi(span.lo + ident1_len + BytePos(1)); .with_hi(span.lo + ident1_len + BytePos(1));
let ident2_span = self.token.span.with_lo(span.lo + ident1_len + BytePos(1)); let ident2_span = span.with_lo(span.lo + ident1_len + BytePos(1));
(ident1_span, dot_span, ident2_span) (ident1_span, dot_span, ident2_span)
} else { } else {
(span, span, span) (span, span, span)

View File

@ -28,6 +28,7 @@ fn main() {
fn nested() { fn nested() {
offset_of!(((u8, u16), (u32, u16, u8)), 0.2); //~ ERROR no field `2` offset_of!(((u8, u16), (u32, u16, u8)), 0.2); //~ ERROR no field `2`
offset_of!(((u8, u16), (u32, u16, u8)), 0.1e2); //~ ERROR no field `1e2`
offset_of!(((u8, u16), (u32, u16, u8)), 1.2); offset_of!(((u8, u16), (u32, u16, u8)), 1.2);
offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); //~ ERROR no field `0` offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); //~ ERROR no field `0`

View File

@ -29,43 +29,43 @@ LL | { builtin # offset_of((u8, u8), 1 .) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:46:45 --> $DIR/offset-of-tuple.rs:47:45
| |
LL | { builtin # offset_of(ComplexTup, 0.0.1.) }; LL | { builtin # offset_of(ComplexTup, 0.0.1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:47:46 --> $DIR/offset-of-tuple.rs:48:46
| |
LL | { builtin # offset_of(ComplexTup, 0 .0.1.) }; LL | { builtin # offset_of(ComplexTup, 0 .0.1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:48:47 --> $DIR/offset-of-tuple.rs:49:47
| |
LL | { builtin # offset_of(ComplexTup, 0 . 0.1.) }; LL | { builtin # offset_of(ComplexTup, 0 . 0.1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:49:46 --> $DIR/offset-of-tuple.rs:50:46
| |
LL | { builtin # offset_of(ComplexTup, 0. 0.1.) }; LL | { builtin # offset_of(ComplexTup, 0. 0.1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:50:46 --> $DIR/offset-of-tuple.rs:51:46
| |
LL | { builtin # offset_of(ComplexTup, 0.0 .1.) }; LL | { builtin # offset_of(ComplexTup, 0.0 .1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:51:47 --> $DIR/offset-of-tuple.rs:52:47
| |
LL | { builtin # offset_of(ComplexTup, 0.0 . 1.) }; LL | { builtin # offset_of(ComplexTup, 0.0 . 1.) };
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:52:46 --> $DIR/offset-of-tuple.rs:53:46
| |
LL | { builtin # offset_of(ComplexTup, 0.0. 1.) }; LL | { builtin # offset_of(ComplexTup, 0.0. 1.) };
| ^ | ^
@ -104,43 +104,43 @@ LL | offset_of!((u8, u8), 1 .);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:35:34 --> $DIR/offset-of-tuple.rs:36:34
| |
LL | offset_of!(ComplexTup, 0.0.1.); LL | offset_of!(ComplexTup, 0.0.1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:36:35 --> $DIR/offset-of-tuple.rs:37:35
| |
LL | offset_of!(ComplexTup, 0 .0.1.); LL | offset_of!(ComplexTup, 0 .0.1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:37:36 --> $DIR/offset-of-tuple.rs:38:36
| |
LL | offset_of!(ComplexTup, 0 . 0.1.); LL | offset_of!(ComplexTup, 0 . 0.1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:38:35 --> $DIR/offset-of-tuple.rs:39:35
| |
LL | offset_of!(ComplexTup, 0. 0.1.); LL | offset_of!(ComplexTup, 0. 0.1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:39:35 --> $DIR/offset-of-tuple.rs:40:35
| |
LL | offset_of!(ComplexTup, 0.0 .1.); LL | offset_of!(ComplexTup, 0.0 .1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:40:36 --> $DIR/offset-of-tuple.rs:41:36
| |
LL | offset_of!(ComplexTup, 0.0 . 1.); LL | offset_of!(ComplexTup, 0.0 . 1.);
| ^ | ^
error: unexpected token: `)` error: unexpected token: `)`
--> $DIR/offset-of-tuple.rs:41:35 --> $DIR/offset-of-tuple.rs:42:35
| |
LL | offset_of!(ComplexTup, 0.0. 1.); LL | offset_of!(ComplexTup, 0.0. 1.);
| ^ | ^
@ -196,22 +196,21 @@ LL | builtin # offset_of((u8, u8), 1_u8);
error[E0609]: no field `2` on type `(u8, u16)` error[E0609]: no field `2` on type `(u8, u16)`
--> $DIR/offset-of-tuple.rs:30:47 --> $DIR/offset-of-tuple.rs:30:47
| |
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2); LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
| _____------------------------------------------^- | ^
| | |
| | in this macro invocation error[E0609]: no field `1e2` on type `(u8, u16)`
LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2); --> $DIR/offset-of-tuple.rs:31:47
LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
... |
| |
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.1e2);
| ^^^
error[E0609]: no field `0` on type `u8` error[E0609]: no field `0` on type `u8`
--> $DIR/offset-of-tuple.rs:32:49 --> $DIR/offset-of-tuple.rs:33:49
| |
LL | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); LL | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
| ^ | ^
error: aborting due to 33 previous errors error: aborting due to 34 previous errors
For more information about this error, try `rustc --explain E0609`. For more information about this error, try `rustc --explain E0609`.