mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-27 16:06:03 +00:00
librustdoc has been updated
Fixes run build error Fix test failure Fix tests' errors
This commit is contained in:
parent
9e20035e33
commit
a2e01c62d5
@ -410,12 +410,12 @@ pub enum Attribute {
|
|||||||
impl Clean<Attribute> for ast::MetaItem {
|
impl Clean<Attribute> for ast::MetaItem {
|
||||||
fn clean(&self, cx: &DocContext) -> Attribute {
|
fn clean(&self, cx: &DocContext) -> Attribute {
|
||||||
match self.node {
|
match self.node {
|
||||||
ast::MetaWord(ref s) => Word(s.get().to_string()),
|
ast::MetaWord(ref s) => Word(s.to_string()),
|
||||||
ast::MetaList(ref s, ref l) => {
|
ast::MetaList(ref s, ref l) => {
|
||||||
List(s.get().to_string(), l.clean(cx))
|
List(s.to_string(), l.clean(cx))
|
||||||
}
|
}
|
||||||
ast::MetaNameValue(ref s, ref v) => {
|
ast::MetaNameValue(ref s, ref v) => {
|
||||||
NameValue(s.get().to_string(), lit_to_string(v))
|
NameValue(s.to_string(), lit_to_string(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -700,19 +700,19 @@ impl Lifetime {
|
|||||||
|
|
||||||
impl Clean<Lifetime> for ast::Lifetime {
|
impl Clean<Lifetime> for ast::Lifetime {
|
||||||
fn clean(&self, _: &DocContext) -> Lifetime {
|
fn clean(&self, _: &DocContext) -> Lifetime {
|
||||||
Lifetime(token::get_name(self.name).get().to_string())
|
Lifetime(token::get_name(self.name).to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Lifetime> for ast::LifetimeDef {
|
impl Clean<Lifetime> for ast::LifetimeDef {
|
||||||
fn clean(&self, _: &DocContext) -> Lifetime {
|
fn clean(&self, _: &DocContext) -> Lifetime {
|
||||||
Lifetime(token::get_name(self.lifetime.name).get().to_string())
|
Lifetime(token::get_name(self.lifetime.name).to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Lifetime> for ty::RegionParameterDef {
|
impl Clean<Lifetime> for ty::RegionParameterDef {
|
||||||
fn clean(&self, _: &DocContext) -> Lifetime {
|
fn clean(&self, _: &DocContext) -> Lifetime {
|
||||||
Lifetime(token::get_name(self.name).get().to_string())
|
Lifetime(token::get_name(self.name).to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ impl Clean<Option<Lifetime>> for ty::Region {
|
|||||||
match *self {
|
match *self {
|
||||||
ty::ReStatic => Some(Lifetime::statik()),
|
ty::ReStatic => Some(Lifetime::statik()),
|
||||||
ty::ReLateBound(_, ty::BrNamed(_, name)) =>
|
ty::ReLateBound(_, ty::BrNamed(_, name)) =>
|
||||||
Some(Lifetime(token::get_name(name).get().to_string())),
|
Some(Lifetime(token::get_name(name).to_string())),
|
||||||
ty::ReEarlyBound(_, _, _, name) => Some(Lifetime(name.clean(cx))),
|
ty::ReEarlyBound(_, _, _, name) => Some(Lifetime(name.clean(cx))),
|
||||||
|
|
||||||
ty::ReLateBound(..) |
|
ty::ReLateBound(..) |
|
||||||
@ -1953,20 +1953,20 @@ fn path_to_string(p: &ast::Path) -> String {
|
|||||||
} else {
|
} else {
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
s.push_str(i.get());
|
s.push_str(&i);
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<String> for ast::Ident {
|
impl Clean<String> for ast::Ident {
|
||||||
fn clean(&self, _: &DocContext) -> String {
|
fn clean(&self, _: &DocContext) -> String {
|
||||||
token::get_ident(*self).get().to_string()
|
token::get_ident(*self).to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<String> for ast::Name {
|
impl Clean<String> for ast::Name {
|
||||||
fn clean(&self, _: &DocContext) -> String {
|
fn clean(&self, _: &DocContext) -> String {
|
||||||
token::get_name(*self).get().to_string()
|
token::get_name(*self).to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2158,7 +2158,7 @@ impl Clean<Vec<Item>> for doctree::Import {
|
|||||||
// forcefully don't inline if this is not public or if the
|
// forcefully don't inline if this is not public or if the
|
||||||
// #[doc(no_inline)] attribute is present.
|
// #[doc(no_inline)] attribute is present.
|
||||||
let denied = self.vis != ast::Public || self.attrs.iter().any(|a| {
|
let denied = self.vis != ast::Public || self.attrs.iter().any(|a| {
|
||||||
a.name().get() == "doc" && match a.meta_item_list() {
|
&a.name()[] == "doc" && match a.meta_item_list() {
|
||||||
Some(l) => attr::contains_name(l, "no_inline"),
|
Some(l) => attr::contains_name(l, "no_inline"),
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
@ -2311,7 +2311,7 @@ impl ToSource for syntax::codemap::Span {
|
|||||||
|
|
||||||
fn lit_to_string(lit: &ast::Lit) -> String {
|
fn lit_to_string(lit: &ast::Lit) -> String {
|
||||||
match lit.node {
|
match lit.node {
|
||||||
ast::LitStr(ref st, _) => st.get().to_string(),
|
ast::LitStr(ref st, _) => st.to_string(),
|
||||||
ast::LitBinary(ref data) => format!("{:?}", data),
|
ast::LitBinary(ref data) => format!("{:?}", data),
|
||||||
ast::LitByte(b) => {
|
ast::LitByte(b) => {
|
||||||
let mut res = String::from_str("b'");
|
let mut res = String::from_str("b'");
|
||||||
@ -2323,8 +2323,8 @@ fn lit_to_string(lit: &ast::Lit) -> String {
|
|||||||
},
|
},
|
||||||
ast::LitChar(c) => format!("'{}'", c),
|
ast::LitChar(c) => format!("'{}'", c),
|
||||||
ast::LitInt(i, _t) => i.to_string(),
|
ast::LitInt(i, _t) => i.to_string(),
|
||||||
ast::LitFloat(ref f, _t) => f.get().to_string(),
|
ast::LitFloat(ref f, _t) => f.to_string(),
|
||||||
ast::LitFloatUnsuffixed(ref f) => f.get().to_string(),
|
ast::LitFloatUnsuffixed(ref f) => f.to_string(),
|
||||||
ast::LitBool(b) => b.to_string(),
|
ast::LitBool(b) => b.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2336,7 +2336,7 @@ fn name_from_pat(p: &ast::Pat) -> String {
|
|||||||
match p.node {
|
match p.node {
|
||||||
PatWild(PatWildSingle) => "_".to_string(),
|
PatWild(PatWildSingle) => "_".to_string(),
|
||||||
PatWild(PatWildMulti) => "..".to_string(),
|
PatWild(PatWildMulti) => "..".to_string(),
|
||||||
PatIdent(_, ref p, _) => token::get_ident(p.node).get().to_string(),
|
PatIdent(_, ref p, _) => token::get_ident(p.node).to_string(),
|
||||||
PatEnum(ref p, _) => path_to_string(p),
|
PatEnum(ref p, _) => path_to_string(p),
|
||||||
PatStruct(ref name, ref fields, etc) => {
|
PatStruct(ref name, ref fields, etc) => {
|
||||||
format!("{} {{ {}{} }}", path_to_string(name),
|
format!("{} {{ {}{} }}", path_to_string(name),
|
||||||
@ -2486,11 +2486,11 @@ impl Clean<Stability> for attr::Stability {
|
|||||||
fn clean(&self, _: &DocContext) -> Stability {
|
fn clean(&self, _: &DocContext) -> Stability {
|
||||||
Stability {
|
Stability {
|
||||||
level: self.level,
|
level: self.level,
|
||||||
feature: self.feature.get().to_string(),
|
feature: self.feature.to_string(),
|
||||||
since: self.since.as_ref().map_or("".to_string(),
|
since: self.since.as_ref().map_or("".to_string(),
|
||||||
|interned| interned.get().to_string()),
|
|interned| interned.to_string()),
|
||||||
reason: self.reason.as_ref().map_or("".to_string(),
|
reason: self.reason.as_ref().map_or("".to_string(),
|
||||||
|interned| interned.get().to_string()),
|
|interned| interned.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
|
|||||||
|
|
||||||
// keywords are also included in the identifier set
|
// keywords are also included in the identifier set
|
||||||
token::Ident(ident, _is_mod_sep) => {
|
token::Ident(ident, _is_mod_sep) => {
|
||||||
match token::get_ident(ident).get() {
|
match &token::get_ident(ident)[] {
|
||||||
"ref" | "mut" => "kw-2",
|
"ref" | "mut" => "kw-2",
|
||||||
|
|
||||||
"self" => "self",
|
"self" => "self",
|
||||||
|
@ -237,7 +237,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
ast::ItemExternCrate(ref p) => {
|
ast::ItemExternCrate(ref p) => {
|
||||||
let path = match *p {
|
let path = match *p {
|
||||||
None => None,
|
None => None,
|
||||||
Some((ref x, _)) => Some(x.get().to_string()),
|
Some((ref x, _)) => Some(x.to_string()),
|
||||||
};
|
};
|
||||||
om.extern_crates.push(ExternCrate {
|
om.extern_crates.push(ExternCrate {
|
||||||
name: name,
|
name: name,
|
||||||
@ -253,7 +253,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
let please_inline = item.attrs.iter().any(|item| {
|
let please_inline = item.attrs.iter().any(|item| {
|
||||||
match item.meta_item_list() {
|
match item.meta_item_list() {
|
||||||
Some(list) => {
|
Some(list) => {
|
||||||
list.iter().any(|i| i.name().get() == "inline")
|
list.iter().any(|i| &i.name()[] == "inline")
|
||||||
}
|
}
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
|
@ -1862,7 +1862,7 @@ mod test {
|
|||||||
.collect();
|
.collect();
|
||||||
println!("varref #{}: {:?}, resolves to {}",idx, varref_idents, varref_name);
|
println!("varref #{}: {:?}, resolves to {}",idx, varref_idents, varref_name);
|
||||||
let string = token::get_ident(final_varref_ident);
|
let string = token::get_ident(final_varref_ident);
|
||||||
println!("varref's first segment's string: \"{}\"", string.get());
|
println!("varref's first segment's string: \"{}\"", &string[]);
|
||||||
println!("binding #{}: {}, resolves to {}",
|
println!("binding #{}: {}, resolves to {}",
|
||||||
binding_idx, bindings[binding_idx], binding_name);
|
binding_idx, bindings[binding_idx], binding_name);
|
||||||
mtwt::with_sctable(|x| mtwt::display_sctable(x));
|
mtwt::with_sctable(|x| mtwt::display_sctable(x));
|
||||||
@ -1915,7 +1915,7 @@ foo_module!();
|
|||||||
let cxbinds: Vec<&ast::Ident> =
|
let cxbinds: Vec<&ast::Ident> =
|
||||||
bindings.iter().filter(|b| {
|
bindings.iter().filter(|b| {
|
||||||
let ident = token::get_ident(**b);
|
let ident = token::get_ident(**b);
|
||||||
let string = ident.get();
|
let string = &ident[];
|
||||||
"xx" == string
|
"xx" == string
|
||||||
}).collect();
|
}).collect();
|
||||||
let cxbinds: &[&ast::Ident] = &cxbinds[];
|
let cxbinds: &[&ast::Ident] = &cxbinds[];
|
||||||
@ -1929,7 +1929,7 @@ foo_module!();
|
|||||||
// the xx binding should bind all of the xx varrefs:
|
// the xx binding should bind all of the xx varrefs:
|
||||||
for (idx,v) in varrefs.iter().filter(|p| {
|
for (idx,v) in varrefs.iter().filter(|p| {
|
||||||
p.segments.len() == 1
|
p.segments.len() == 1
|
||||||
&& "xx" == token::get_ident(p.segments[0].identifier).get()
|
&& "xx" == &token::get_ident(p.segments[0].identifier)[]
|
||||||
}).enumerate() {
|
}).enumerate() {
|
||||||
if mtwt::resolve(v.segments[0].identifier) != resolved_binding {
|
if mtwt::resolve(v.segments[0].identifier) != resolved_binding {
|
||||||
println!("uh oh, xx binding didn't match xx varref:");
|
println!("uh oh, xx binding didn't match xx varref:");
|
||||||
|
@ -1201,19 +1201,19 @@ mod test {
|
|||||||
let source = "/// doc comment\r\nfn foo() {}".to_string();
|
let source = "/// doc comment\r\nfn foo() {}".to_string();
|
||||||
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
|
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
|
||||||
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
|
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
|
||||||
assert_eq!(doc.get(), "/// doc comment");
|
assert_eq!(&doc[], "/// doc comment");
|
||||||
|
|
||||||
let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string();
|
let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string();
|
||||||
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
|
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
|
||||||
let docs = item.attrs.iter().filter(|a| a.name().get() == "doc")
|
let docs = item.attrs.iter().filter(|a| &a.name()[] == "doc")
|
||||||
.map(|a| a.value_str().unwrap().get().to_string()).collect::<Vec<_>>();
|
.map(|a| a.value_str().unwrap().to_string()).collect::<Vec<_>>();
|
||||||
let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()];
|
let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()];
|
||||||
assert_eq!(&docs[], b);
|
assert_eq!(&docs[], b);
|
||||||
|
|
||||||
let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string();
|
let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string();
|
||||||
let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap();
|
let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap();
|
||||||
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
|
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
|
||||||
assert_eq!(doc.get(), "/** doc comment\n * with CRLF */");
|
assert_eq!(&doc[], "/** doc comment\n * with CRLF */");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -37,9 +37,9 @@ impl LintPass for Pass {
|
|||||||
|
|
||||||
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
|
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
|
||||||
let name = token::get_ident(it.ident);
|
let name = token::get_ident(it.ident);
|
||||||
if name.get() == "lintme" {
|
if &name[] == "lintme" {
|
||||||
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
|
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
|
||||||
} else if name.get() == "pleaselintme" {
|
} else if &name[] == "pleaselintme" {
|
||||||
cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'");
|
cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ impl LintPass for Pass {
|
|||||||
|
|
||||||
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
|
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
|
||||||
let name = token::get_ident(it.ident);
|
let name = token::get_ident(it.ident);
|
||||||
if name.get() == "lintme" {
|
if &name[] == "lintme" {
|
||||||
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
|
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// no-prefer-dynamic
|
||||||
|
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
Loading…
Reference in New Issue
Block a user