diff options
| author | Ralf Jung <post@ralfj.de> | 2018-02-18 19:40:35 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-02-27 13:16:30 +0100 |
| commit | 86821f7fb6afbbfebd2d7b0a681d14c4cf6a578e (patch) | |
| tree | 3e83776e9eb72d7f23e33d54da7d0db91a89235f /src/libsyntax/ast.rs | |
| parent | d1ed6cce6ca875b3902f34c9979cf75afa403fed (diff) | |
| download | rust-86821f7fb6afbbfebd2d7b0a681d14c4cf6a578e.tar.gz rust-86821f7fb6afbbfebd2d7b0a681d14c4cf6a578e.zip | |
add lint to detect ignored generic bounds; this subsumes the previous 'generic bounds in type aliases are ignored' warning
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 6609b77b132..245025d3e4f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -294,6 +294,15 @@ pub enum TyParamBound { RegionTyParamBound(Lifetime) } +impl TyParamBound { + pub fn span(&self) -> Span { + match self { + &TraitTyParamBound(ref t, ..) => t.span, + &RegionTyParamBound(ref l) => l.span, + } + } +} + /// A modifier on a bound, currently this is only used for `?Sized`, where the /// modifier is `Maybe`. Negative bounds should also be handled here. #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] @@ -404,6 +413,16 @@ pub enum WherePredicate { EqPredicate(WhereEqPredicate), } +impl WherePredicate { + pub fn span(&self) -> Span { + match self { + &WherePredicate::BoundPredicate(ref p) => p.span, + &WherePredicate::RegionPredicate(ref p) => p.span, + &WherePredicate::EqPredicate(ref p) => p.span, + } + } +} + /// A type bound. /// /// E.g. `for<'c> Foo: Send+Clone+'c` |
