about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-08-07 14:35:11 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-08-07 14:35:11 +0200
commitf6af4efec579edc8d10f8c2ba5d3c43331130b39 (patch)
tree45b07c47717ae0dd4f5ec33455169ad50797c76f /src
parent55f46419afd2e49acfc6be176ad4aeadaa5686d7 (diff)
downloadrust-f6af4efec579edc8d10f8c2ba5d3c43331130b39.tar.gz
rust-f6af4efec579edc8d10f8c2ba5d3c43331130b39.zip
Use start_point instead of next_point to point to elided lifetime ampersand.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/lifetimes/fullwidth-ampersand.rs7
-rw-r--r--src/test/ui/lifetimes/fullwidth-ampersand.stderr26
2 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/lifetimes/fullwidth-ampersand.rs b/src/test/ui/lifetimes/fullwidth-ampersand.rs
new file mode 100644
index 00000000000..7d8948bd844
--- /dev/null
+++ b/src/test/ui/lifetimes/fullwidth-ampersand.rs
@@ -0,0 +1,7 @@
+// Verify that we do not ICE when the user uses a multubyte ampersand.
+
+fn f(_: &&()) -> &() { todo!() }
+//~^ ERROR unknown start of token: \u{ff06}
+//~| ERROR missing lifetime specifier [E0106]
+
+fn main() {}
diff --git a/src/test/ui/lifetimes/fullwidth-ampersand.stderr b/src/test/ui/lifetimes/fullwidth-ampersand.stderr
new file mode 100644
index 00000000000..4645254f4b7
--- /dev/null
+++ b/src/test/ui/lifetimes/fullwidth-ampersand.stderr
@@ -0,0 +1,26 @@
+error: unknown start of token: \u{ff06}
+  --> $DIR/fullwidth-ampersand.rs:3:10
+   |
+LL | fn f(_: &&()) -> &() { todo!() }
+   |          ^^
+   |
+help: Unicode character '&' (Fullwidth Ampersand) looks like '&' (Ampersand), but it is not
+   |
+LL | fn f(_: &&()) -> &() { todo!() }
+   |          ~
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/fullwidth-ampersand.rs:3:18
+   |
+LL | fn f(_: &&()) -> &() { todo!() }
+   |         -----     ^ expected named lifetime parameter
+   |
+   = help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 2 lifetimes it is borrowed from
+help: consider introducing a named lifetime parameter
+   |
+LL | fn f<'a>(_: &'a &'a ()) -> &'a () { todo!() }
+   |     ++++     ++   ++         ++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0106`.