about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-06-20 10:49:54 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-06-20 15:46:58 -0700
commitae067477fbc08e5998756d36b6ab0b82173e5c74 (patch)
tree371d0ec94c45be7be04db1ad534df4c4093a8676 /src/libsyntax/parse
parent6750eb5a05042fe3fb84708909074f33ad86d3ec (diff)
downloadrust-ae067477fbc08e5998756d36b6ab0b82173e5c74.tar.gz
rust-ae067477fbc08e5998756d36b6ab0b82173e5c74.zip
libsyntax: Stop parsing `+` with no bounds after it.
This will break code that looks like `Box<Trait+>`. Change that code to
`Box<Trait>` instead.

Closes #14925.

[breaking-change]
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index ae2ec216bee..158a8c5a116 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1646,6 +1646,12 @@ impl<'a> Parser<'a> {
             let bounds = {
                 if self.eat(&token::BINOP(token::PLUS)) {
                     let (_, bounds) = self.parse_ty_param_bounds(false);
+                    if bounds.len() == 0 {
+                        let last_span = self.last_span;
+                        self.span_err(last_span,
+                                      "at least one type parameter bound \
+                                       must be specified after the `+`");
+                    }
                     Some(bounds)
                 } else {
                     None