Skip to content

Commit c65bffa

Browse files
author
p00512853
committed
fixes in rust 1.73
1 parent cd75e4a commit c65bffa

File tree

11 files changed

+72
-72
lines changed

11 files changed

+72
-72
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ Cargo.lock
3535

3636
# Graphiz
3737
*.dot
38+
/.idea

Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ keywords = ["uml", "graph", "dot", "generator", "modeling-language"]
1414
categories = ["visualization"]
1515
edition = "2018"
1616

17-
[badges]
18-
travis-ci = { repository = "adjivas/ml", branch = "master" }
19-
appveyor = { repository = "adjivas/ml", branch = "master", service = "github" }
17+
2018

2119
[[example]]
2220
name = "ml"
@@ -50,7 +48,8 @@ urlencoding = "2.1.0"
5048
# rustc_errors = {package = "rustc-ap-rustc_errors", version = "727.0.0"}
5149
# rustc_span = {package ="rustc-ap-rustc_span", version = "727.0.0"}
5250
# rustc_serialize = {package = "rustc-ap-rustc_serialize", version = "727.0.0"}
53-
51+
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
52+
#thin-vec = "0.2.12"
5453
[dependencies.itertools]
5554
version = "0.5"
5655

rust-toolchain

-3
This file was deleted.

src/core/item/state/abstraction/enumerate.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::fmt;
22
use std::rc::Rc;
3+
use thin_vec::ThinVec;
34

45
use rustc_ast::ast;
56
use rustc_ast_pretty::pprust::ty_to_string;
@@ -19,8 +20,8 @@ pub struct Enum<'a> {
1920
/// Visibility
2021
pub vis: &'a ast::VisibilityKind,
2122
pub name: symbol::Symbol,
22-
pub params: Vec<symbol::Symbol>,
23-
pub variants: Vec<(symbol::Symbol, Vec<String>)>,
23+
pub params: ThinVec<symbol::Symbol>,
24+
pub variants: ThinVec<(symbol::Symbol, Vec<String>)>,
2425
}
2526

2627
impl<'a> PartialEq for Enum<'a> {
@@ -31,9 +32,6 @@ impl<'a> PartialEq for Enum<'a> {
3132

3233
let bvis = match (a.vis, b.vis) {
3334
(Public, Public) => true,
34-
(Crate(_), Crate(_)) => true,
35-
(Restricted { .. }, Restricted { .. }) => true,
36-
(Inherited, Inherited) => true,
3735
_ => false,
3836
};
3937

@@ -52,8 +50,8 @@ impl<'a>
5250
From<(
5351
(
5452
&'a ast::Item,
55-
&'a Vec<ast::GenericParam>,
56-
&'a Vec<ast::Variant>,
53+
&'a ThinVec<ast::GenericParam>,
54+
&'a ThinVec<ast::Variant>,
5755
),
5856
Rc<ModulePath>,
5957
)> for Enum<'a>
@@ -62,8 +60,8 @@ impl<'a>
6260
((item, params, variants), path): (
6361
(
6462
&'a ast::Item,
65-
&'a Vec<ast::GenericParam>,
66-
&'a Vec<ast::Variant>,
63+
&'a ThinVec<ast::GenericParam>,
64+
&'a ThinVec<ast::Variant>,
6765
),
6866
Rc<ModulePath>,
6967
),
@@ -82,7 +80,7 @@ impl<'a>
8280
..
8381
}| name,
8482
)
85-
.collect::<Vec<symbol::Symbol>>(),
83+
.collect::<ThinVec<symbol::Symbol>>(),
8684
variants: variants
8785
.iter()
8886
.map(
@@ -116,7 +114,7 @@ impl<'a>
116114
}
117115
},
118116
)
119-
.collect::<Vec<(symbol::Symbol, Vec<String>)>>(),
117+
.collect::<ThinVec<(symbol::Symbol, Vec<String>)>>(),
120118
}
121119
}
122120
}

src/core/item/state/abstraction/extend.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::fmt;
22
use std::ops::Deref;
33
use std::rc::Rc;
4+
use thin_vec::ThinVec;
45

56
use rustc_ast::{ast, ptr};
67
use rustc_ast_pretty::pprust::ty_to_string;
@@ -18,8 +19,8 @@ pub struct Trait<'a> {
1819
/// Visibility
1920
pub vis: &'a ast::VisibilityKind,
2021
pub name: symbol::Symbol,
21-
pub params: Vec<symbol::Symbol>,
22-
pub items: Vec<(symbol::Symbol, Vec<String>, String)>,
22+
pub params: ThinVec<symbol::Symbol>,
23+
pub items: ThinVec<(symbol::Symbol, Vec<String>, String)>,
2324
}
2425

2526
impl<'a> PartialEq for Trait<'a> {
@@ -30,9 +31,6 @@ impl<'a> PartialEq for Trait<'a> {
3031

3132
let bvis = match (a.vis, b.vis) {
3233
(Public, Public) => true,
33-
(Crate(_), Crate(_)) => true,
34-
(Restricted { .. }, Restricted { .. }) => true,
35-
(Inherited, Inherited) => true,
3634
_ => false,
3735
};
3836

@@ -51,8 +49,8 @@ impl<'a>
5149
From<(
5250
(
5351
&'a ast::Item,
54-
&'a Vec<ast::GenericParam>,
55-
&'a Vec<ptr::P<ast::Item<ast::AssocItemKind>>>,
52+
&'a ThinVec<ast::GenericParam>,
53+
&'a ThinVec<ptr::P<ast::Item<ast::AssocItemKind>>>,
5654
),
5755
Rc<ModulePath>,
5856
)> for Trait<'a>
@@ -61,8 +59,8 @@ impl<'a>
6159
((item, params, trait_item), path): (
6260
(
6361
&'a ast::Item,
64-
&'a Vec<ast::GenericParam>,
65-
&'a Vec<ptr::P<ast::Item<ast::AssocItemKind>>>,
62+
&'a ThinVec<ast::GenericParam>,
63+
&'a ThinVec<ptr::P<ast::Item<ast::AssocItemKind>>>,
6664
),
6765
Rc<ModulePath>,
6866
),
@@ -81,7 +79,7 @@ impl<'a>
8179
..
8280
}| name,
8381
)
84-
.collect::<Vec<symbol::Symbol>>(),
82+
.collect::<ThinVec<symbol::Symbol>>(),
8583
items: trait_item
8684
.iter()
8785
.filter_map(|p| {
@@ -113,7 +111,7 @@ impl<'a>
113111
None
114112
}
115113
})
116-
.collect::<Vec<(symbol::Symbol, Vec<String>, String)>>(),
114+
.collect::<ThinVec<(symbol::Symbol, Vec<String>, String)>>(),
117115
}
118116
}
119117
}

src/core/item/state/abstraction/mod.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub mod structure;
55
use std::fmt;
66
use std::rc::Rc;
77
use std::vec;
8+
use thin_vec::ThinVec;
89

910
use rustc_ast::{ast, ptr};
1011
use rustc_span::symbol;
@@ -116,8 +117,8 @@ impl<'a>
116117
From<(
117118
(
118119
&'a ast::Item,
119-
&'a Vec<ast::GenericParam>,
120-
&'a Vec<ptr::P<ast::Item<ast::AssocItemKind>>>,
120+
&'a ThinVec<ast::GenericParam>,
121+
&'a ThinVec<ptr::P<ast::Item<ast::AssocItemKind>>>,
121122
),
122123
Rc<ModulePath>,
123124
)> for Abstract<'a>
@@ -126,8 +127,8 @@ impl<'a>
126127
arguments: (
127128
(
128129
&'a ast::Item,
129-
&'a Vec<ast::GenericParam>,
130-
&'a Vec<ptr::P<ast::Item<ast::AssocItemKind>>>,
130+
&'a ThinVec<ast::GenericParam>,
131+
&'a ThinVec<ptr::P<ast::Item<ast::AssocItemKind>>>,
131132
),
132133
Rc<ModulePath>,
133134
),
@@ -136,8 +137,8 @@ impl<'a>
136137
}
137138
}
138139

139-
impl<'a> From<((&'a ast::Item, &'a Vec<ast::FieldDef>), Rc<ModulePath>)> for Abstract<'a> {
140-
fn from(arguments: ((&'a ast::Item, &'a Vec<ast::FieldDef>), Rc<ModulePath>)) -> Abstract<'a> {
140+
impl<'a> From<((&'a ast::Item, &'a ThinVec<ast::FieldDef>), Rc<ModulePath>)> for Abstract<'a> {
141+
fn from(arguments: ((&'a ast::Item, &'a ThinVec<ast::FieldDef>), Rc<ModulePath>)) -> Abstract<'a> {
141142
Abstract::Struct(Struct::from(arguments))
142143
}
143144
}
@@ -146,8 +147,8 @@ impl<'a>
146147
From<(
147148
(
148149
&'a ast::Item,
149-
&'a Vec<ast::GenericParam>,
150-
&'a Vec<ast::Variant>,
150+
&'a ThinVec<ast::GenericParam>,
151+
&'a ThinVec<ast::Variant>,
151152
),
152153
Rc<ModulePath>,
153154
)> for Abstract<'a>
@@ -156,8 +157,8 @@ impl<'a>
156157
arguments: (
157158
(
158159
&'a ast::Item,
159-
&'a Vec<ast::GenericParam>,
160-
&'a Vec<ast::Variant>,
160+
&'a ThinVec<ast::GenericParam>,
161+
&'a ThinVec<ast::Variant>,
161162
),
162163
Rc<ModulePath>,
163164
),

src/core/item/state/abstraction/structure.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::fmt;
22
use std::rc::Rc;
3+
use thin_vec::ThinVec;
34

45
use rustc_ast::ast;
56
use rustc_ast_pretty::pprust::ty_to_string;
@@ -20,7 +21,7 @@ pub struct Struct<'a> {
2021
/// Visibility
2122
pub vis: &'a ast::VisibilityKind,
2223
pub name: symbol::Symbol,
23-
pub fields: Vec<(&'a ast::VisibilityKind, Option<symbol::Symbol>, String)>,
24+
pub fields: ThinVec<(&'a ast::VisibilityKind, Option<symbol::Symbol>, String)>,
2425
}
2526

2627
impl<'a> PartialEq for Struct<'a> {
@@ -31,8 +32,6 @@ impl<'a> PartialEq for Struct<'a> {
3132

3233
let bvis = match (a.vis, b.vis) {
3334
(Public, Public) => true,
34-
(Crate(_), Crate(_)) => true,
35-
(Restricted { .. }, Restricted { .. }) => true,
3635
(Inherited, Inherited) => true,
3736
_ => false,
3837
};
@@ -45,9 +44,9 @@ impl<'a> PartialEq for Struct<'a> {
4544

4645
impl<'a> Eq for Struct<'a> {}
4746

48-
impl<'a> From<((&'a ast::Item, &'a Vec<ast::FieldDef>), Rc<ModulePath>)> for Struct<'a> {
47+
impl<'a> From<((&'a ast::Item, &'a ThinVec<ast::FieldDef>), Rc<ModulePath>)> for Struct<'a> {
4948
fn from(
50-
((item, struct_field), path): ((&'a ast::Item, &'a Vec<ast::FieldDef>), Rc<ModulePath>),
49+
((item, struct_field), path): ((&'a ast::Item, &'a ThinVec<ast::FieldDef>), Rc<ModulePath>),
5150
) -> Struct<'a> {
5251
Struct {
5352
path: path,
@@ -69,7 +68,7 @@ impl<'a> From<((&'a ast::Item, &'a Vec<ast::FieldDef>), Rc<ModulePath>)> for Str
6968
None => Some((&vis.kind, None, ty_to_string(&ty))),
7069
},
7170
)
72-
.collect::<Vec<(&ast::VisibilityKind, Option<symbol::Symbol>, String)>>(),
71+
.collect::<ThinVec<(&ast::VisibilityKind, Option<symbol::Symbol>, String)>>(),
7372
}
7473
}
7574
}

src/core/item/state/implem.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::DEFAULT_FUNC;
22

33
use std::fmt;
4+
use thin_vec::ThinVec;
45

56
use rustc_ast::ast;
67
use rustc_ast_pretty::pprust::ty_to_string;
@@ -12,9 +13,9 @@ use crate::dot::escape_html;
1213
1314
#[derive(Default, Debug, Clone, Eq, PartialEq)]
1415
pub struct Implem {
15-
ty: Vec<(symbol::Symbol, Vec<String>)>,
16+
ty: ThinVec<(symbol::Symbol, Vec<String>)>,
1617
/// method's name, arguments, result.
17-
method: Vec<(symbol::Symbol, Vec<String>, Option<String>)>,
18+
method: ThinVec<(symbol::Symbol, Vec<String>, Option<String>)>,
1819
}
1920

2021
impl Implem {
@@ -49,14 +50,14 @@ impl Implem {
4950

5051
impl
5152
From<(
52-
Vec<(symbol::Symbol, Vec<String>)>,
53-
Vec<(symbol::Symbol, Vec<String>, Option<String>)>,
53+
ThinVec<(symbol::Symbol, Vec<String>)>,
54+
ThinVec<(symbol::Symbol, Vec<String>, Option<String>)>,
5455
)> for Implem
5556
{
5657
fn from(
5758
(ty, method): (
58-
Vec<(symbol::Symbol, Vec<String>)>,
59-
Vec<(symbol::Symbol, Vec<String>, Option<String>)>,
59+
ThinVec<(symbol::Symbol, Vec<String>)>,
60+
ThinVec<(symbol::Symbol, Vec<String>, Option<String>)>,
6061
),
6162
) -> Implem {
6263
Implem {
@@ -66,8 +67,8 @@ impl
6667
}
6768
}
6869

69-
impl<'a> From<(&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)> for Implem {
70-
fn from((segments, impl_item): (&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)) -> Implem {
70+
impl<'a> From<(&'a ThinVec<ast::PathSegment>, &'a ThinVec<ast::Item>)> for Implem {
71+
fn from((segments, impl_item): (&'a ThinVec<ast::PathSegment>, &'a ThinVec<ast::Item>)) -> Implem {
7172
Implem::from((
7273
segments
7374
.iter()
@@ -91,7 +92,7 @@ impl<'a> From<(&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)> for Implem {
9192
// }
9293
},
9394
)
94-
.collect::<Vec<(symbol::Symbol, Vec<String>)>>(),
95+
.collect::<ThinVec<(symbol::Symbol, Vec<String>)>>(),
9596
impl_item
9697
.iter()
9798
.flat_map(
@@ -137,13 +138,13 @@ impl<'a> From<(&'a Vec<ast::PathSegment>, &'a Vec<ast::Item>)> for Implem {
137138
None
138139
}
139140
})
140-
.collect::<Vec<(symbol::Symbol, Vec<String>, Option<String>)>>()
141+
.collect::<ThinVec<(symbol::Symbol, Vec<String>, Option<String>)>>()
141142
} else {
142-
vec![]
143+
ThinVec::new()
143144
}
144145
},
145146
)
146-
.collect::<Vec<(symbol::Symbol, Vec<String>, Option<String>)>>(),
147+
.collect::<ThinVec<(symbol::Symbol, Vec<String>, Option<String>)>>(),
147148
))
148149
}
149150
}

src/core/item/state/method.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ops::Deref;
55
use std::rc::Rc;
66

77
use rustc_ast::ast;
8-
use rustc_ast_pretty::pprust::{state, state::PrintState, ty_to_string};
8+
use rustc_ast_pretty::pprust::ty_to_string;
99
use rustc_span::symbol;
1010

1111
use crate::module::path::ModulePath;
@@ -153,7 +153,8 @@ impl From<(Vec<ast::Item>, Rc<ModulePath>)> for Method {
153153
inputs
154154
.iter()
155155
.map(|ref arg| {
156-
state::State::new().param_to_string(&arg)
156+
use rustc_ast_pretty::pprust::pat_to_string;
157+
pat_to_string(&arg.pat)
157158
})
158159
.collect::<Vec<String>>(),
159160
Some(ty_to_string(&ty)),
@@ -170,7 +171,8 @@ impl From<(Vec<ast::Item>, Rc<ModulePath>)> for Method {
170171
inputs
171172
.iter()
172173
.map(|ref arg| {
173-
state::State::new().param_to_string(&arg)
174+
use rustc_ast_pretty::pprust::pat_to_string;
175+
pat_to_string(&arg.pat)
174176
})
175177
.collect::<Vec<String>>(),
176178
None,

0 commit comments

Comments
 (0)