chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 23:56:51 +0000 (00:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 23:56:51 +0000 (00:56 +0100)
.gitignore
Makefile
bck-err.txt [new file with mode: 0644]
bck-lifetimes.fig [new file with mode: 0644]
intro.fig
talk.txt

index 45ebfabfbb384fc135e83ee768ea0f0cdd8e656a..3097f76c1d9d3b81247050e802dd1f8401f9a804 100644 (file)
@@ -1,6 +1,8 @@
 intro.ps
 mm0.ps
 mm.ps
+bck-lifetimes.ps
 *.1
+*.txt.eps
 slides.pdf
 slides.ps
index 6622a4dfeca0a6470baabe3ce574ab6af9c2b983..99703831a37c8a50c872371b86e5ec5dae274db1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,8 @@ SLIDES+= intro
 SLIDES+= mm0
 SLIDES+= mm
 
+SLIDES+= bck-lifetimes
+
 SLIDEFILES=$(addsuffix .ps, $(SLIDES))
 
 o= >$@.new && mv -f $@.new $@
@@ -18,6 +20,8 @@ mm0.ps: mm.fig
        iconv <$< >$@.1 -f UTF-8 -t ISO-8859-1
        LC_CTYPE=en_GB fig2dev -L ps -l dummy -z A4 -D-60 <$@.1 $o
 
+bck-lifetimes.ps: bck-err.txt.eps
+
 %.eps:   %.fig
        iconv <$< >$@.1 -f UTF-8 -t ISO-8859-1
        # wtf!
diff --git a/bck-err.txt b/bck-err.txt
new file mode 100644 (file)
index 0000000..46c8670
--- /dev/null
@@ -0,0 +1,5 @@
+1 | fn longest(x: &str, y: &str) -> &str {
+  |                                 ^ expected lifetime parameter
+  |
+  = help: this function's return type contains a borrowed value, but the
+signature does not say whether it is borrowed from `x` or `y`
diff --git a/bck-lifetimes.fig b/bck-lifetimes.fig
new file mode 100644 (file)
index 0000000..f23aabf
--- /dev/null
@@ -0,0 +1,29 @@
+#FIG 3.2  Produced by xfig version 3.2.6a
+Landscape
+Center
+Metric
+A4
+100.00
+Single
+-2
+1200 2
+1 3 0 2 4 7 60 -1 -1 0.000 1 0.0000 2478 3757 611 611 2478 3757 1887 3600
+1 3 0 2 1 7 60 -1 -1 0.000 1 0.0000 4460 3733 385 385 4460 3733 4168 3482
+1 3 0 2 1 7 60 -1 -1 0.000 1 0.0000 7755 3761 385 385 7755 3761 7463 3510
+1 3 0 2 1 7 60 -1 -1 0.000 1 0.0000 6179 4264 385 385 6179 4264 5887 4013
+2 5 0 1 0 -1 60 -1 -1 0.000 0 0 -1 0 0 5
+       0 bck-err.txt.eps
+        -900 -90 11250 -90 11250 1319 -900 1319 -900 -90
+2 1 0 2 0 7 60 -1 -1 0.000 0 0 -1 0 0 2
+        -1080 1620 11430 1620
+4 0 0 60 -1 12 30 0.0000 4 390 11400 -900 -1800 fn longest(x: &str, y: &str) -> &str {\001
+4 0 0 60 -1 12 30 0.0000 4 390 11700 -900 -1245   if x.len() > y.len() { x } else { y }\001
+4 0 0 60 -1 12 30 0.0000 4 360 300 -900 -690 }\001
+4 0 0 60 -1 12 30 0.0000 4 360 300 -900 5490 }\001
+4 0 0 60 -1 12 30 0.0000 4 390 11700 -900 5040   if x.len() > y.len() { x } else { y }\001
+4 0 0 60 -1 12 30 0.0000 4 360 7800 990 4365               -> &'a str {\001
+4 0 1 60 -1 1 30 0.0000 4 450 3990 4590 3150 lifetime annotations\001
+4 0 4 60 -1 1 30 0.0000 4 450 1650 270 2160 function\001
+4 0 4 60 -1 1 30 0.0000 4 420 2910 270 2610 parameterised\001
+4 0 4 60 -1 1 30 0.0000 4 450 2085 270 3060 by lifetime\001
+4 0 0 60 -1 12 30 0.0000 4 390 11400 -900 3915 fn longest<'a>(x: &'a str, y: &'a str)\001
index e8a1343c7cd014e5046014e64dfcf63c55cce804..233b1b28af0a9893fc1cd4797a7737eb32d11d96 100644 (file)
--- a/intro.fig
+++ b/intro.fig
@@ -7,17 +7,18 @@ A4
 Single
 -2
 1200 2
-6 -1350 1125 10800 6300
 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
         -1350 1125 10800 1125
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        -1350 5940 10800 5940
+4 0 0 50 -1 2 36 0.0000 4 420 1200 -1350 -1350 Rust\001
 4 0 0 50 -1 2 30 0.0000 4 375 2565 -900 2025 Ian Jackson\001
 4 0 0 50 -1 2 30 0.0000 4 330 1275 4050 2025 Citrix\001
 4 0 0 50 -1 2 30 0.0000 4 435 2115 5850 2025 May 2019\001
-4 0 0 50 -1 2 30 0.0000 4 330 2505 0 3375 Who am I ?\001
-4 0 0 50 -1 2 30 0.0000 4 435 5655 0 4275 curmudgeon and pessimist\001
-4 0 0 50 -1 2 30 0.0000 4 435 6630 0 5175 Perl, C, Tcl, Python, bash, SQL\001
-4 0 0 50 -1 2 30 0.0000 4 435 10320 0 6075 some C++, Haskell, Ocaml, asm, JS, Lisp, Java...\001
--6
-4 0 0 50 -1 2 30 0.0000 4 435 11925 -1350 -450 The most exciting new programming language for years\001
-4 0 0 50 -1 2 36 0.0000 4 420 1200 -1350 -1350 Rust\001
-4 0 0 50 -1 2 30 0.0000 4 435 3105 900 450 (what, really?)\001
+4 0 0 50 -1 2 30 0.0000 4 435 11925 -1350 -630 The most exciting new programming language for years\001
+4 0 0 50 -1 2 30 0.0000 4 435 3105 900 90 (what, really?)\001
+4 0 0 50 -1 2 30 0.0000 4 435 5655 0 3870 curmudgeon and pessimist\001
+4 0 0 50 -1 2 30 0.0000 4 435 5400 0 4590 Perl, C, Tcl, Python, bash\001
+4 0 0 50 -1 2 30 0.0000 4 330 2505 -450 3240 Who am I ?\001
+4 0 0 50 -1 2 30 0.0000 4 435 10320 0 5310 some C++, Haskell, Ocaml, asm, JS, Lisp, Java...\001
+4 0 0 60 -1 0 20 0.0000 4 300 8715 -990 6570 Some examples taken from the Rust Book etc, Apache 2.0 / MIT\001
index a0970be391da7ed1390940b05268f4f13f39cfbc..5440e07ec982a60b6bc876ad7e43041c89086547 100644 (file)
--- a/talk.txt
+++ b/talk.txt
@@ -205,7 +205,7 @@ E======================================================================E
 Of course nothing is perfect.  I'm very critical by nature, so I often
 find things to gripe about.
 
-[ borrow checker error ]
+[ borrow checker error, lifetime example ]
 
 The most obvious difficulty with Rust, if you read the internet, is
 some's feeling they are constantly fighting the borrow checker.