Skip to content

Commit e9d13db

Browse files
committed
Fix Parser::break_up_float fractional part's span
1 parent e8f8b52 commit e9d13db

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

compiler/rustc_parse/src/parser/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ impl<'a> Parser<'a> {
10901090
let dot_span = span
10911091
.with_lo(span.lo + ident1_len)
10921092
.with_hi(span.lo + ident1_len + BytePos(1));
1093-
let ident2_span = self.token.span.with_lo(span.lo + ident1_len + BytePos(1));
1093+
let ident2_span = span.with_lo(span.lo + ident1_len + BytePos(1));
10941094
(ident1_span, dot_span, ident2_span)
10951095
} else {
10961096
(span, span, span)

tests/ui/feature-gates/feature-gate-offset-of-nested.stderr

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,12 @@ LL | offset_of!(Alpha, Two.0);
1111
error[E0658]: only a single ident or integer is stable as the field in offset_of
1212
--> $DIR/feature-gate-offset-of-nested.rs:24:33
1313
|
14-
LL | offset_of!((u32, (S, T)), 1.1);
15-
| _____----------------------------^-
16-
| | |
17-
| | in this macro invocation
18-
LL | | offset_of!(S, b.0);
19-
LL | | offset_of!((S, ()), 0.c);
20-
LL | | offset_of!(S, c.t);
21-
... |
14+
LL | offset_of!((u32, (S, T)), 1.1);
15+
| ^
2216
|
2317
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
2418
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
2519
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
26-
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
2720

2821
error[E0658]: only a single ident or integer is stable as the field in offset_of
2922
--> $DIR/feature-gate-offset-of-nested.rs:25:21

tests/ui/offset-of/offset-of-tuple.stderr

+2-9
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,8 @@ LL | builtin # offset_of((u8, u8), 1_u8);
196196
error[E0609]: no field `2` on type `(u8, u16)`
197197
--> $DIR/offset-of-tuple.rs:31:47
198198
|
199-
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
200-
| _____------------------------------------------^-
201-
| | |
202-
| | in this macro invocation
203-
LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2);
204-
LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
205-
... |
206-
|
207-
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
199+
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
200+
| ^
208201

209202
error[E0609]: no field `0` on type `u8`
210203
--> $DIR/offset-of-tuple.rs:33:49

0 commit comments

Comments
 (0)