summary refs log tree commit diff stats
path: root/compiler/lambdalifting.nim
diff options
context:
space:
mode:
authorMiran <narimiran@users.noreply.github.com>2018-10-17 00:18:51 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-10-17 00:18:51 +0200
commite8cf289beeb54b8e6d3d1e42c7571d037109caf0 (patch)
treeddf98b3627c5abbcd0c13a539c1ec6841ec95aef /compiler/lambdalifting.nim
parentafc453beff83813d7d4b37501e4602d5dadf4683 (diff)
downloadNim-e8cf289beeb54b8e6d3d1e42c7571d037109caf0.tar.gz
improve error message, closes #2361 (#9387)
* improve error message

* use single % operation
Diffstat (limited to 'compiler/lambdalifting.nim')
-rw-r--r--compiler/lambdalifting.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index d8c0461ce..79b44319f 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -277,8 +277,9 @@ proc freshVarForClosureIter*(g: ModuleGraph; s, owner: PSym): PNode =
 proc markAsClosure(g: ModuleGraph; owner: PSym; n: PNode) =
   let s = n.sym
   if illegalCapture(s):
-    localError(g.config, n.info, "illegal capture '$1' of type <$2> which is declared here: $3" %
-      [s.name.s, typeToString(s.typ), g.config$s.info])
+    localError(g.config, n.info,
+      ("'$1' is of type <$2> which cannot be captured as it would violate memory" &
+       " safety, declared here: $3") % [s.name.s, typeToString(s.typ), g.config$s.info])
   elif owner.typ.callConv notin {ccClosure, ccDefault}:
     localError(g.config, n.info, "illegal capture '$1' because '$2' has the calling convention: <$3>" %
       [s.name.s, owner.name.s, CallingConvToStr[owner.typ.callConv]])