Skip to content

Commit a2e01c6

Browse files
librustdoc has been updated
Fixes run build error Fix test failure Fix tests' errors
1 parent 9e20035 commit a2e01c6

File tree

8 files changed

+33
-31
lines changed

8 files changed

+33
-31
lines changed

src/librustdoc/clean/mod.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,12 @@ pub enum Attribute {
410410
impl Clean<Attribute> for ast::MetaItem {
411411
fn clean(&self, cx: &DocContext) -> Attribute {
412412
match self.node {
413-
ast::MetaWord(ref s) => Word(s.get().to_string()),
413+
ast::MetaWord(ref s) => Word(s.to_string()),
414414
ast::MetaList(ref s, ref l) => {
415-
List(s.get().to_string(), l.clean(cx))
415+
List(s.to_string(), l.clean(cx))
416416
}
417417
ast::MetaNameValue(ref s, ref v) => {
418-
NameValue(s.get().to_string(), lit_to_string(v))
418+
NameValue(s.to_string(), lit_to_string(v))
419419
}
420420
}
421421
}
@@ -700,19 +700,19 @@ impl Lifetime {
700700

701701
impl Clean<Lifetime> for ast::Lifetime {
702702
fn clean(&self, _: &DocContext) -> Lifetime {
703-
Lifetime(token::get_name(self.name).get().to_string())
703+
Lifetime(token::get_name(self.name).to_string())
704704
}
705705
}
706706

707707
impl Clean<Lifetime> for ast::LifetimeDef {
708708
fn clean(&self, _: &DocContext) -> Lifetime {
709-
Lifetime(token::get_name(self.lifetime.name).get().to_string())
709+
Lifetime(token::get_name(self.lifetime.name).to_string())
710710
}
711711
}
712712

713713
impl Clean<Lifetime> for ty::RegionParameterDef {
714714
fn clean(&self, _: &DocContext) -> Lifetime {
715-
Lifetime(token::get_name(self.name).get().to_string())
715+
Lifetime(token::get_name(self.name).to_string())
716716
}
717717
}
718718

@@ -721,7 +721,7 @@ impl Clean<Option<Lifetime>> for ty::Region {
721721
match *self {
722722
ty::ReStatic => Some(Lifetime::statik()),
723723
ty::ReLateBound(_, ty::BrNamed(_, name)) =>
724-
Some(Lifetime(token::get_name(name).get().to_string())),
724+
Some(Lifetime(token::get_name(name).to_string())),
725725
ty::ReEarlyBound(_, _, _, name) => Some(Lifetime(name.clean(cx))),
726726

727727
ty::ReLateBound(..) |
@@ -1953,20 +1953,20 @@ fn path_to_string(p: &ast::Path) -> String {
19531953
} else {
19541954
first = false;
19551955
}
1956-
s.push_str(i.get());
1956+
s.push_str(&i);
19571957
}
19581958
s
19591959
}
19601960

19611961
impl Clean<String> for ast::Ident {
19621962
fn clean(&self, _: &DocContext) -> String {
1963-
token::get_ident(*self).get().to_string()
1963+
token::get_ident(*self).to_string()
19641964
}
19651965
}
19661966

19671967
impl Clean<String> for ast::Name {
19681968
fn clean(&self, _: &DocContext) -> String {
1969-
token::get_name(*self).get().to_string()
1969+
token::get_name(*self).to_string()
19701970
}
19711971
}
19721972

@@ -2158,7 +2158,7 @@ impl Clean<Vec<Item>> for doctree::Import {
21582158
// forcefully don't inline if this is not public or if the
21592159
// #[doc(no_inline)] attribute is present.
21602160
let denied = self.vis != ast::Public || self.attrs.iter().any(|a| {
2161-
a.name().get() == "doc" && match a.meta_item_list() {
2161+
&a.name()[] == "doc" && match a.meta_item_list() {
21622162
Some(l) => attr::contains_name(l, "no_inline"),
21632163
None => false,
21642164
}
@@ -2311,7 +2311,7 @@ impl ToSource for syntax::codemap::Span {
23112311

23122312
fn lit_to_string(lit: &ast::Lit) -> String {
23132313
match lit.node {
2314-
ast::LitStr(ref st, _) => st.get().to_string(),
2314+
ast::LitStr(ref st, _) => st.to_string(),
23152315
ast::LitBinary(ref data) => format!("{:?}", data),
23162316
ast::LitByte(b) => {
23172317
let mut res = String::from_str("b'");
@@ -2323,8 +2323,8 @@ fn lit_to_string(lit: &ast::Lit) -> String {
23232323
},
23242324
ast::LitChar(c) => format!("'{}'", c),
23252325
ast::LitInt(i, _t) => i.to_string(),
2326-
ast::LitFloat(ref f, _t) => f.get().to_string(),
2327-
ast::LitFloatUnsuffixed(ref f) => f.get().to_string(),
2326+
ast::LitFloat(ref f, _t) => f.to_string(),
2327+
ast::LitFloatUnsuffixed(ref f) => f.to_string(),
23282328
ast::LitBool(b) => b.to_string(),
23292329
}
23302330
}
@@ -2336,7 +2336,7 @@ fn name_from_pat(p: &ast::Pat) -> String {
23362336
match p.node {
23372337
PatWild(PatWildSingle) => "_".to_string(),
23382338
PatWild(PatWildMulti) => "..".to_string(),
2339-
PatIdent(_, ref p, _) => token::get_ident(p.node).get().to_string(),
2339+
PatIdent(_, ref p, _) => token::get_ident(p.node).to_string(),
23402340
PatEnum(ref p, _) => path_to_string(p),
23412341
PatStruct(ref name, ref fields, etc) => {
23422342
format!("{} {{ {}{} }}", path_to_string(name),
@@ -2486,11 +2486,11 @@ impl Clean<Stability> for attr::Stability {
24862486
fn clean(&self, _: &DocContext) -> Stability {
24872487
Stability {
24882488
level: self.level,
2489-
feature: self.feature.get().to_string(),
2489+
feature: self.feature.to_string(),
24902490
since: self.since.as_ref().map_or("".to_string(),
2491-
|interned| interned.get().to_string()),
2491+
|interned| interned.to_string()),
24922492
reason: self.reason.as_ref().map_or("".to_string(),
2493-
|interned| interned.get().to_string()),
2493+
|interned| interned.to_string()),
24942494
}
24952495
}
24962496
}

src/librustdoc/html/highlight.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
142142

143143
// keywords are also included in the identifier set
144144
token::Ident(ident, _is_mod_sep) => {
145-
match token::get_ident(ident).get() {
145+
match &token::get_ident(ident)[] {
146146
"ref" | "mut" => "kw-2",
147147

148148
"self" => "self",

src/librustdoc/visit_ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
237237
ast::ItemExternCrate(ref p) => {
238238
let path = match *p {
239239
None => None,
240-
Some((ref x, _)) => Some(x.get().to_string()),
240+
Some((ref x, _)) => Some(x.to_string()),
241241
};
242242
om.extern_crates.push(ExternCrate {
243243
name: name,
@@ -253,7 +253,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
253253
let please_inline = item.attrs.iter().any(|item| {
254254
match item.meta_item_list() {
255255
Some(list) => {
256-
list.iter().any(|i| i.name().get() == "inline")
256+
list.iter().any(|i| &i.name()[] == "inline")
257257
}
258258
None => false,
259259
}

src/libsyntax/ext/expand.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ mod test {
18621862
.collect();
18631863
println!("varref #{}: {:?}, resolves to {}",idx, varref_idents, varref_name);
18641864
let string = token::get_ident(final_varref_ident);
1865-
println!("varref's first segment's string: \"{}\"", string.get());
1865+
println!("varref's first segment's string: \"{}\"", &string[]);
18661866
println!("binding #{}: {}, resolves to {}",
18671867
binding_idx, bindings[binding_idx], binding_name);
18681868
mtwt::with_sctable(|x| mtwt::display_sctable(x));
@@ -1915,7 +1915,7 @@ foo_module!();
19151915
let cxbinds: Vec<&ast::Ident> =
19161916
bindings.iter().filter(|b| {
19171917
let ident = token::get_ident(**b);
1918-
let string = ident.get();
1918+
let string = &ident[];
19191919
"xx" == string
19201920
}).collect();
19211921
let cxbinds: &[&ast::Ident] = &cxbinds[];
@@ -1929,7 +1929,7 @@ foo_module!();
19291929
// the xx binding should bind all of the xx varrefs:
19301930
for (idx,v) in varrefs.iter().filter(|p| {
19311931
p.segments.len() == 1
1932-
&& "xx" == token::get_ident(p.segments[0].identifier).get()
1932+
&& "xx" == &token::get_ident(p.segments[0].identifier)[]
19331933
}).enumerate() {
19341934
if mtwt::resolve(v.segments[0].identifier) != resolved_binding {
19351935
println!("uh oh, xx binding didn't match xx varref:");

src/libsyntax/parse/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1201,19 +1201,19 @@ mod test {
12011201
let source = "/// doc comment\r\nfn foo() {}".to_string();
12021202
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
12031203
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
1204-
assert_eq!(doc.get(), "/// doc comment");
1204+
assert_eq!(&doc[], "/// doc comment");
12051205

12061206
let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string();
12071207
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
1208-
let docs = item.attrs.iter().filter(|a| a.name().get() == "doc")
1209-
.map(|a| a.value_str().unwrap().get().to_string()).collect::<Vec<_>>();
1208+
let docs = item.attrs.iter().filter(|a| &a.name()[] == "doc")
1209+
.map(|a| a.value_str().unwrap().to_string()).collect::<Vec<_>>();
12101210
let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()];
12111211
assert_eq!(&docs[], b);
12121212

12131213
let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string();
12141214
let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap();
12151215
let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();
1216-
assert_eq!(doc.get(), "/** doc comment\n * with CRLF */");
1216+
assert_eq!(&doc[], "/** doc comment\n * with CRLF */");
12171217
}
12181218

12191219
#[test]

src/test/auxiliary/lint_group_plugin_test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ impl LintPass for Pass {
3737

3838
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
3939
let name = token::get_ident(it.ident);
40-
if name.get() == "lintme" {
40+
if &name[] == "lintme" {
4141
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
42-
} else if name.get() == "pleaselintme" {
42+
} else if &name[] == "pleaselintme" {
4343
cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'");
4444
}
4545
}

src/test/auxiliary/lint_plugin_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl LintPass for Pass {
3535

3636
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
3737
let name = token::get_ident(it.ident);
38-
if name.get() == "lintme" {
38+
if &name[] == "lintme" {
3939
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
4040
}
4141
}

src/test/run-pass/issue-15149.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// no-prefer-dynamic
2+
13
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

0 commit comments

Comments
 (0)