Skip to content
Myr

Merge pull request #3085 from dtolnay/syn3

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Update to syn 3

authored by David Tolnay · committed by GitHub · parents cfe6692, 6dec3b7 · Browse files · 5 files+16 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+16 added−10 removed

  • other:+16 added−10 removed

5 files+16 added−10 removed

modified:.github/workflows/ci.yml+1 added-1 removed
modified:serde_derive/src/internals/attr.rs+1 added-1 removed
1783 unmodified lines
1784 }1785 syn::Type::Macro(ty) => {1786 collect_lifetimes_from_tokens(ty.mac.tokens.clone(), out);1787 }1788 syn::Type::BareFn(_)1788 syn::Type::FnPtr(_)1789 | syn::Type::Never(_)1790 | syn::Type::TraitObject(_)1791 | syn::Type::ImplTrait(_)1792 | syn::Type::Infer(_)
26 unmodified lines
modified:serde_derive/src/internals/receiver.rs+2 added-2 removed
109 unmodified lines
110 Type::Array(ty) => {111 self.visit_type_mut(&mut ty.elem);112 self.visit_expr_mut(&mut ty.len);113 }114 Type::BareFn(ty) => {114 Type::FnPtr(ty) => {115 for arg in &mut ty.inputs {116 self.visit_type_mut(&mut arg.ty);117 }118 self.visit_return_type_mut(&mut ty.output);
70 unmodified lines
189 }190 }191 PathArguments::Parenthesized(arguments) => {192 for argument in &mut arguments.inputs {193 self.visit_type_mut(argument);193 self.visit_type_mut(&mut argument.ty);194 }195 self.visit_return_type_mut(&mut arguments.output);196 }197 }
96 unmodified lines
modified:serde_derive/src/bound.rs+11 added-5 removed
13 unmodified lines
14 .params15 .iter()16 .map(|param| match param {17 syn::GenericParam::Type(param) => syn::GenericParam::Type(syn::TypeParam {18 eq_token: None,18 default: None,19 ..param.clone()20 }),21 _ => param.clone(),
129 unmodified lines
151 fn visit_type(&mut self, ty: &'ast syn::Type) {152 match ty {153 #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]154 syn::Type::Array(ty) => self.visit_type(&ty.elem),156 syn::Type::BareFn(ty) => {155 syn::Type::FnPtr(ty) => {156 for arg in &ty.inputs {157 self.visit_type(&arg.ty);158 }159 self.visit_return_type(&ty.output);
54 unmodified lines
214 }215 }216 syn::PathArguments::Parenthesized(arguments) => {217 for argument in &arguments.inputs {219 self.visit_type(argument);218 self.visit_type(&argument.ty);219 }220 self.visit_return_type(&arguments.output);221 }222 }
62 unmodified lines
285 bounded_ty: syn::TypePath,286 bound: &syn::Path,287 ) -> syn::WherePredicate {288 syn::WherePredicate::Type(syn::PredicateType {289 attrs: Vec::new(),290 lifetimes: None,291 // the type parameter that is being bounded e.g. T292 bounded_ty: syn::Type::Path(bounded_ty),293 colon_token: <Token![:]>::default(),
1 unmodified line
295 bounds: {296 let mut punct = Punctuated::new();297 punct.push(syn::TypeParamBound::Trait(syn::TraitBound {298 paren_token: None,299 modifier: syn::TraitBoundModifier::None,299 lifetimes: None,300 modifiers: syn::TraitBoundModifiers::default(),301 maybe: None,302 path: bound.clone(),303 }));304 punct305 },
7 unmodified lines
313 if !relevant_type_params.contains(id) {314 continue;315 }316 let bounded_ty = syn::TypePath {317 attrs: Vec::new(),318 qself: None,319 path: id.clone().into(),320 };321 dst_predicates.push(make_where_bounded_type(bounded_ty, bound));
13 unmodified lines
335 generics336 .make_where_clause()337 .predicates338 .push(syn::WherePredicate::Type(syn::PredicateType {339 attrs: Vec::new(),340 lifetimes: None,341 // the type that is being bounded e.g. MyStruct<'a, T>342 bounded_ty: type_of_item(cont),343 colon_token: <Token![:]>::default(),344 // the bound e.g. Default345 bounds: vec![syn::TypeParamBound::Trait(syn::TraitBound {346 paren_token: None,344 modifier: syn::TraitBoundModifier::None,347 lifetimes: None,348 modifiers: syn::TraitBoundModifiers::default(),349 maybe: None,350 path: bound.clone(),351 })]352 .into_iter()353 .collect(),
35 unmodified lines
389}390391fn type_of_item(cont: &Container) -> syn::Type {392 syn::Type::Path(syn::TypePath {393 attrs: Vec::new(),394 qself: None,395 path: syn::Path {396 leading_colon: None,397 segments: vec![syn::PathSegment {
8 unmodified lines
406 .iter()407 .map(|param| match param {408 syn::GenericParam::Type(param) => {409 syn::GenericArgument::Type(syn::Type::Path(syn::TypePath {410 attrs: Vec::new(),411 qself: None,412 path: param.ident.clone().into(),413 }))414 }
17 unmodified lines
modified:Cargo.toml+1 added-1 removed