diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-08-11 09:32:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-08-14 14:14:26 -0700 |
| commit | 604af3f6c0be6ea428a55cfcb303fa1cd1c7958d (patch) | |
| tree | 5d4c22c593c4701b829fdaad19e55ff803c84de7 /src/librustdoc | |
| parent | a8c8e3f80fd0355b2bb91337c6ad0bb0a38d5485 (diff) | |
| download | rust-604af3f6c0be6ea428a55cfcb303fa1cd1c7958d.tar.gz rust-604af3f6c0be6ea428a55cfcb303fa1cd1c7958d.zip | |
librustc: Implement simple `where` clauses.
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change]
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 24 | ||||
| -rw-r--r-- | src/librustdoc/doctree.rs | 18 | ||||
| -rw-r--r-- | src/librustdoc/visit_ast.rs | 18 |
3 files changed, 30 insertions, 30 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c5d3c73c9bc..68e1529fb17 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -363,7 +363,7 @@ impl Clean<Item> for doctree::Module { // determine if we should display the inner contents or // the outer `mod` item for the source code. - let where = { + let whence = { let ctxt = super::ctxtkey.get().unwrap(); let cm = ctxt.sess().codemap(); let outer = cm.lookup_char_pos(self.where_outer.lo); @@ -380,7 +380,7 @@ impl Clean<Item> for doctree::Module { Item { name: Some(name), attrs: self.attrs.clean(), - source: where.clean(), + source: whence.clean(), visibility: self.vis.clean(), stability: self.stab.clean(), def_id: ast_util::local_def(self.id), @@ -781,7 +781,7 @@ impl Clean<Item> for doctree::Function { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), visibility: self.vis.clean(), stability: self.stab.clean(), def_id: ast_util::local_def(self.id), @@ -917,7 +917,7 @@ impl Clean<Item> for doctree::Trait { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -1397,7 +1397,7 @@ impl Clean<Item> for doctree::Struct { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -1443,7 +1443,7 @@ impl Clean<Item> for doctree::Enum { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -1466,7 +1466,7 @@ impl Clean<Item> for doctree::Variant { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), visibility: self.vis.clean(), stability: self.stab.clean(), def_id: ast_util::local_def(self.id), @@ -1652,7 +1652,7 @@ impl Clean<Item> for doctree::Typedef { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id.clone()), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -1702,7 +1702,7 @@ impl Clean<Item> for doctree::Static { Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -1748,7 +1748,7 @@ impl Clean<Item> for doctree::Impl { Item { name: None, attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), def_id: ast_util::local_def(self.id), visibility: self.vis.clean(), stability: self.stab.clean(), @@ -2115,12 +2115,12 @@ impl Clean<Item> for doctree::Macro { Item { name: Some(format!("{}!", self.name.clean())), attrs: self.attrs.clean(), - source: self.where.clean(), + source: self.whence.clean(), visibility: ast::Public.clean(), stability: self.stab.clean(), def_id: ast_util::local_def(self.id), inner: MacroItem(Macro { - source: self.where.to_src(), + source: self.whence.to_src(), }), } } diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index a5ead46384a..da45321e7fd 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -93,7 +93,7 @@ pub struct Struct { pub generics: ast::Generics, pub attrs: Vec<ast::Attribute>, pub fields: Vec<ast::StructField>, - pub where: Span, + pub whence: Span, } pub struct Enum { @@ -103,7 +103,7 @@ pub struct Enum { pub generics: ast::Generics, pub attrs: Vec<ast::Attribute>, pub id: NodeId, - pub where: Span, + pub whence: Span, pub name: Ident, } @@ -114,7 +114,7 @@ pub struct Variant { pub id: ast::NodeId, pub vis: ast::Visibility, pub stab: Option<attr::Stability>, - pub where: Span, + pub whence: Span, } pub struct Function { @@ -125,7 +125,7 @@ pub struct Function { pub vis: ast::Visibility, pub stab: Option<attr::Stability>, pub fn_style: ast::FnStyle, - pub where: Span, + pub whence: Span, pub generics: ast::Generics, } @@ -135,7 +135,7 @@ pub struct Typedef { pub name: Ident, pub id: ast::NodeId, pub attrs: Vec<ast::Attribute>, - pub where: Span, + pub whence: Span, pub vis: ast::Visibility, pub stab: Option<attr::Stability>, } @@ -149,7 +149,7 @@ pub struct Static { pub vis: ast::Visibility, pub stab: Option<attr::Stability>, pub id: ast::NodeId, - pub where: Span, + pub whence: Span, } pub struct Trait { @@ -159,7 +159,7 @@ pub struct Trait { pub parents: Vec<ast::TraitRef>, pub attrs: Vec<ast::Attribute>, pub id: ast::NodeId, - pub where: Span, + pub whence: Span, pub vis: ast::Visibility, pub stab: Option<attr::Stability>, } @@ -170,7 +170,7 @@ pub struct Impl { pub for_: ast::P<ast::Ty>, pub items: Vec<ast::ImplItem>, pub attrs: Vec<ast::Attribute>, - pub where: Span, + pub whence: Span, pub vis: ast::Visibility, pub stab: Option<attr::Stability>, pub id: ast::NodeId, @@ -180,7 +180,7 @@ pub struct Macro { pub name: Ident, pub id: ast::NodeId, pub attrs: Vec<ast::Attribute>, - pub where: Span, + pub whence: Span, pub stab: Option<attr::Stability>, } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index f7ccad79fda..b67b3c394d6 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -91,7 +91,7 @@ impl<'a> RustdocVisitor<'a> { attrs: item.attrs.iter().map(|x| *x).collect(), generics: generics.clone(), fields: sd.fields.iter().map(|x| (*x).clone()).collect(), - where: item.span + whence: item.span } } @@ -107,7 +107,7 @@ impl<'a> RustdocVisitor<'a> { stab: self.stability(x.node.id), id: x.node.id, kind: x.node.kind.clone(), - where: x.span, + whence: x.span, }); } Enum { @@ -118,7 +118,7 @@ impl<'a> RustdocVisitor<'a> { generics: params.clone(), attrs: it.attrs.iter().map(|x| *x).collect(), id: it.id, - where: it.span, + whence: it.span, } } @@ -133,7 +133,7 @@ impl<'a> RustdocVisitor<'a> { attrs: item.attrs.iter().map(|x| *x).collect(), decl: fd.clone(), name: item.ident, - where: item.span, + whence: item.span, generics: gen.clone(), fn_style: *fn_style, } @@ -297,7 +297,7 @@ impl<'a> RustdocVisitor<'a> { name: item.ident, id: item.id, attrs: item.attrs.iter().map(|x| *x).collect(), - where: item.span, + whence: item.span, vis: item.vis, stab: self.stability(item.id), }; @@ -311,7 +311,7 @@ impl<'a> RustdocVisitor<'a> { id: item.id, name: item.ident, attrs: item.attrs.iter().map(|x| *x).collect(), - where: item.span, + whence: item.span, vis: item.vis, stab: self.stability(item.id), }; @@ -325,7 +325,7 @@ impl<'a> RustdocVisitor<'a> { parents: tr.iter().map(|x| (*x).clone()).collect(), id: item.id, attrs: item.attrs.iter().map(|x| *x).collect(), - where: item.span, + whence: item.span, vis: item.vis, stab: self.stability(item.id), }; @@ -339,7 +339,7 @@ impl<'a> RustdocVisitor<'a> { items: items.iter().map(|x| *x).collect(), attrs: item.attrs.iter().map(|x| *x).collect(), id: item.id, - where: item.span, + whence: item.span, vis: item.vis, stab: self.stability(item.id), }; @@ -360,7 +360,7 @@ impl<'a> RustdocVisitor<'a> { id: item.id, attrs: item.attrs.iter().map(|x| *x).collect(), name: item.ident, - where: item.span, + whence: item.span, stab: self.stability(item.id), } } |
