about summary refs log tree commit diff
path: root/src/libsyntax/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-29 12:53:47 -0600
committerGitHub <noreply@github.com>2016-11-29 12:53:47 -0600
commitb30022a1d32ebbd41f6623ab6fe7c62d489548e1 (patch)
tree54ac5c080e4c0da11b23c9599387b0178bc8ff57 /src/libsyntax/lib.rs
parentf50dbd580f3d5d88a300da540db3c85164bfd0de (diff)
parentb7982bbbe0a002272b86ed2f7f7902b2c3471087 (diff)
downloadrust-b30022a1d32ebbd41f6623ab6fe7c62d489548e1.tar.gz
rust-b30022a1d32ebbd41f6623ab6fe7c62d489548e1.zip
Auto merge of #37369 - estebank:multiline-span, r=nikomatsakis
Show multiline spans in full if short enough

When dealing with multiline spans that span few lines, show the complete span instead of restricting to the first character of the first line.

For example, instead of:

```
% ./rustc file2.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> file2.rs:13:9
   |
13 |    foo(1 + bar(x,
   |        ^ trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

show

```
% ./rustc file2.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> file2.rs:13:9
   |
13 |      foo(1 + bar(x,
   |  ________^ starting here...
14 | |            y),
   | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

The [proposal in internals](https://internals.rust-lang.org/t/proposal-for-multiline-span-comments/4242/6) outlines the reasoning behind this.
Diffstat (limited to 'src/libsyntax/lib.rs')
-rw-r--r--src/libsyntax/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 5a1b0d4005e..7a9347ded12 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -145,4 +145,7 @@ pub mod ext {
     }
 }
 
+#[cfg(test)]
+mod test_snippet;
+
 // __build_diagnostic_array! { libsyntax, DIAGNOSTICS }