commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
ffdf4be7ebb8262e3122e4006102a15e103c794a | Jelte Fennema | 2017-01-29T14:11:11 | Docs: Add code to generate #derive(Not) docs | diff --git a/tests/not.rs b/tests/not.rs
new file mode 100644
index 0000000..7e3ad8d
--- /dev/null
+++ b/tests/not.rs
@@ -0,0 +1,28 @@
+#![allow(dead_code)]
+#[macro_use]
+extern crate derive_more;
+
+#[derive(Not)]
+struct MyInts(i32, i32);
+
+#[derive(Not)]
+struct Point2D {
+ x: i32,
+ y: i32,
+}
+
+#[derive(N... | 1 | 28 | 0 |
9c05768444c1dee79b0f1eca94c649bbfa591e66 | Jelte Fennema | 2017-01-29T13:46:40 | Tests: Add code to generate Add docs | diff --git a/tests/add.rs b/tests/add.rs
new file mode 100644
index 0000000..f9ec5a7
--- /dev/null
+++ b/tests/add.rs
@@ -0,0 +1,23 @@
+#![allow(dead_code)]
+#[macro_use]
+extern crate derive_more;
+
+#[derive(Add)]
+struct MyInts(i32, i32);
+
+#[derive(Add)]
+struct Point2D {
+ x: i32,
+ y: i32,
+}
+
+#[derive(A... | 1 | 23 | 0 |
0ee8826652a33f3524bc25b626cf9dbaa7fc1547 | Jelte Fennema | 2017-01-28T19:58:25 | Docs: Switch order of Mul and AddAssign in docs | diff --git a/src/lib.rs b/src/lib.rs
index 8121d73..70b9f5e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,9 +38,9 @@
//! 1. `From`, only contains the [`From`].
//! 2. `Not`-like, contains [`Not`] and [`Neg`].
//! 3. `Add`-like, contains [`Add`], [`Sub`], [`BitAnd`], [`BitOr`] and [`BitXor`].
-//! 4. `Mul`-like, co... | 1 | 4 | 4 |
fdd3afbe85a4cce5a1397112293468432d3d513e | Jelte Fennema | 2017-01-28T19:57:06 | Docs: Add example to docs | diff --git a/src/lib.rs b/src/lib.rs
index 8e0af58..8121d73 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,6 +9,25 @@
//! This library tries to remove these annoyances and the corresponding boilerplate code.
//! It does this by allowing you to derive lots of commonly used traits for both structs and enums.
//!
+//! ... | 1 | 19 | 0 |
fd8b63de53c615adf71981b768adf079c56a7353 | Jelte Fennema | 2017-01-28T19:45:28 | Docs: Add file were doc examples are generated from | diff --git a/tests/from.rs b/tests/from.rs
new file mode 100644
index 0000000..0504577
--- /dev/null
+++ b/tests/from.rs
@@ -0,0 +1,30 @@
+#![allow(dead_code)]
+#[macro_use]
+extern crate derive_more;
+
+#[derive(From)]
+struct MyInt(i32);
+
+#[derive(From)]
+struct MyInts(i32, i32);
+
+#[derive(From)]
+struct Point1D ... | 1 | 30 | 0 |
7a6a7bb062e016fad42711483c0b27633dc14cd3 | Jelte Fennema | 2017-01-28T19:29:01 | Run rustfmt | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index eabf1c4..7593534 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -1,4 +1,4 @@
-use quote::{Tokens};
+use quote::Tokens;
use syn::{Body, Ident, VariantData, MacroInput};
use add_like::{tuple_exprs, struct_exprs};
@@ -11,14 +11,10 ... | 8 | 101 | 93 |
1a228ed39b85ff76271108270dbc6029884ab86a | Jelte Fennema | 2017-01-28T19:22:00 | From: Use original as name for argument | diff --git a/src/from.rs b/src/from.rs
index 9327117..135247f 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -35,8 +35,8 @@ pub fn expand(input: &MacroInput, _: &str) -> Tokens {
fn newtype_from(input_type: &Ident, original_type: &Ty) -> Tokens {
quote!{
impl ::std::convert::From<#original_type> for #inpu... | 1 | 10 | 10 |
fe1d599cf372dfba02a54f8e4e00f75240b629a9 | Jelte Fennema | 2017-01-28T18:04:05 | Docs: Add some introductory docs to the crate root | diff --git a/src/lib.rs b/src/lib.rs
index 48d2298..681baf5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,83 @@
+//! # derive_more
+//! Rust has lots of builtin traits that are implemented for its basic types, such as [`Add`], [`Not`]
+//! or [`From`].
+//! However, when wrapping these types inside your own stru... | 1 | 81 | 0 |
9a8fdc56f17f8730e816fc725a01579899eb49d0 | Jelte Fennema | 2017-01-28T12:39:59 | From: Add support for all sized regular structs | diff --git a/src/from.rs b/src/from.rs
index 19f2570..9327117 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -22,7 +22,7 @@ pub fn expand(input: &MacroInput, _: &str) -> Tokens {
newtype_struct_from(input_type, &fields[0])
}
else {
- panic!("Only tuple structs an... | 2 | 16 | 1 |
9d7c40cd52f2d73c15f2780927d4f8cc9984c409 | Jelte Fennema | 2017-01-28T12:10:43 | Cleanup: Remove all clone() calls from code | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index ab2eaf8..eabf1c4 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -7,7 +7,7 @@ pub fn expand(input: &MacroInput, trait_name: &str) -> Tokens {
let method_name = trait_name.to_string();
let method_name = method_name.trim_righ... | 5 | 25 | 24 |
7f82da1321c27122e99c332eaf5c9fd0f4a5f423 | Jelte Fennema | 2017-01-28T11:05:28 | From: Add From for structs with a single field | diff --git a/src/from.rs b/src/from.rs
index db2ff09..f42bda6 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -11,12 +11,20 @@ pub fn expand(input: &MacroInput, _: &str) -> Tokens {
match input.body {
Body::Struct(VariantData::Tuple(ref fields)) => {
if fields.len() == 1 {
- newt... | 2 | 28 | 2 |
9dbd8d8e7c06594942181e634a1562cb008aa729 | Jelte Fennema | 2017-01-24T22:57:26 | From: Add support for all sized tuple structs | diff --git a/src/add_like.rs b/src/add_like.rs
index 2cb3bd3..071827c 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,6 +1,7 @@
use quote::{Tokens, ToTokens};
use syn::{Body, Field, Ident, Variant, VariantData, MacroInput};
use std::iter;
+use utils::numbered_vars;
pub fn expand(input: &MacroInput, trait... | 5 | 43 | 16 |
3556b049da18ce70649f01159b8105c4212d0685 | Jelte Fennema | 2017-01-24T20:36:17 | From: Rename structs to fields to match rest of lib | diff --git a/src/from.rs b/src/from.rs
index 46bc597..636acdf 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -8,9 +8,9 @@ use syn::{Body, Ident, Variant, VariantData, MacroInput, Ty};
pub fn expand(input: &MacroInput, _: &str) -> Tokens {
let name = input.ident.clone();
match input.body {
- Body::Struc... | 1 | 3 | 3 |
28e2ee264e88187529da3570c5d2c49c66d13641 | Jelte Fennema | 2017-01-24T20:09:40 | Fix warning | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index 19ddb46..ab2eaf8 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -1,5 +1,5 @@
use quote::{Tokens};
-use syn::{Body, Ident, Variant, VariantData, MacroInput};
+use syn::{Body, Ident, VariantData, MacroInput};
use add_like::{tuple_ex... | 1 | 1 | 1 |
67cee6a6f1dbad0c9def9ede962555c5e7bd8c3b | Jelte Fennema | 2017-01-24T20:05:39 | AddAssign: These traits now work for all structs | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index 282a19f..19ddb46 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -1,23 +1,21 @@
use quote::{Tokens};
use syn::{Body, Ident, Variant, VariantData, MacroInput};
-use add_like::{tuple_content, struct_content};
+use add_like::{tuple_ex... | 3 | 40 | 19 |
cfa29ff99d871206e1eb1fe8f143611e66793cc2 | Jelte Fennema | 2017-01-12T23:35:54 | Initial code for add_assign_like | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
new file mode 100644
index 0000000..282a19f
--- /dev/null
+++ b/src/add_assign_like.rs
@@ -0,0 +1,34 @@
+use quote::{Tokens};
+use syn::{Body, Ident, Variant, VariantData, MacroInput};
+use add_like::{tuple_content, struct_content};
+
+pub fn expand(input: &M... | 3 | 47 | 3 |
e44d0acc919d93c404453e7eb506beefec02184e | Jelte Fennema | 2017-01-12T22:04:55 | Fix unused code warnings | diff --git a/tests/lib.rs b/tests/lib.rs
index 2dccae6..bbb75ca 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -30,8 +30,8 @@ struct NestedInt(MyInt);
#[derive(Add, Sub)]
enum SimpleMyIntEnum{
Int(i32),
- UnsignedOne(u32),
- UnsignedTwo(u32),
+ _UnsignedOne(u32),
+ _UnsignedTwo(u32),
}
#[derive(Eq... | 1 | 8 | 8 |
3394fbc875dd44738fc1f0f781d4d909dd8760a1 | Jelte Fennema | 2017-01-11T22:25:56 | Neg: Add neg support | diff --git a/src/lib.rs b/src/lib.rs
index 93c6395..ef3893d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,6 +8,7 @@ use proc_macro::TokenStream;
mod from;
mod add_like;
mod mul_like;
+mod not_like;
macro_rules! create_derive(
($mod_:ident, $trait_:ident, $fn_name: ident) => {
@@ -31,3 +32,5 @@ create_derive... | 3 | 155 | 2 |
794c8f40727b408cd196b09284de5cce9ff5d06c | Jelte Fennema | 2017-01-10T23:09:34 | Bump version to 0.4.0 | diff --git a/Cargo.toml b/Cargo.toml
index 5f535c5..08de8f9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.3.0"
+version = "0.4.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT" | 1 | 1 | 1 |
94487cd9d41ecd9da42ea67b1e57d1894ffeac29 | Jelte Fennema | 2017-01-10T23:15:04 | Macros 1.1: clean up code leftovers | diff --git a/src/add_like.rs b/src/add_like.rs
index 104eb0d..3a9b69d 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,5 +1,5 @@
use quote::{Tokens, ToTokens};
-use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
+use syn::{Body, Field, Ident, Variant, VariantData, MacroInput};
use std::iter;... | 5 | 3 | 173 |
8107aebd435e1eb0daa7abf9dc50dc209a0792bb | Jelte Fennema | 2017-01-10T23:04:16 | Macros 1.1: Add mul_like support for regular structs | diff --git a/src/lib.rs b/src/lib.rs
index 88a45fa..1393bc0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -40,6 +40,10 @@ create_derive!(add_like, BitAnd, bit_and_derive);
create_derive!(add_like, BitOr, bit_or_derive);
create_derive!(add_like, BitXor, bit_xor_derive);
create_derive!(mul_like, Mul, mul_derive);
+creat... | 3 | 27 | 22 |
245a61130cd5bd5c25d1e986ab2d8fb9796762b1 | Jelte Fennema | 2017-01-10T22:29:55 | Macros 1.1: Add mul_like support tuple structs | diff --git a/src/lib.rs b/src/lib.rs
index b9500ae..88a45fa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,6 +39,7 @@ create_derive!(add_like, Sub, sub_derive);
create_derive!(add_like, BitAnd, bit_and_derive);
create_derive!(add_like, BitOr, bit_or_derive);
create_derive!(add_like, BitXor, bit_xor_derive);
+create... | 3 | 33 | 15 |
769e094b26cb6ea4d045452f4df2f965abc925db | Jelte Fennema | 2017-01-09T00:31:35 | Macros 1.1: Start with mul_like | diff --git a/src/add_like.rs b/src/add_like.rs
index a3077c9..104eb0d 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -26,7 +26,7 @@ pub fn expand(input: &MacroInput, trait_name: &str) -> Tokens {
};
quote!(
- impl std::ops::#trait_ident for #input_type {
+ impl ::std::ops::#trait_ident ... | 2 | 39 | 2 |
647aec259157fce15d30b37a985567b40fea5f54 | Jelte Fennema | 2017-01-09T00:03:05 | Macros 1.1: Make macro creating macro more generic | diff --git a/src/from.rs b/src/from.rs
index 4344711..bc3dfb6 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -5,7 +5,7 @@ use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
/// Provides the hook to expand `#[derive(From)]` into an implementation of `From`
-pub fn expand(input: &MacroInput) -> Toke... | 2 | 10 | 16 |
896038cdf874a9a7c9de4159dc3059ea680a0e41 | Jelte Fennema | 2017-01-08T23:35:44 | Macros 1.1: Remove legacy add_like the new one is fully functional | diff --git a/src/add_like_old.rs b/src/add_like_old.rs
deleted file mode 100644
index 948f932..0000000
--- a/src/add_like_old.rs
+++ /dev/null
@@ -1,160 +0,0 @@
-use syntax::ast::*;
-use syntax::codemap::{Span, Spanned};
-use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
-use syntax::e... | 1 | 0 | 160 |
c1cffc3551eee39bc7f68458efa45937478b8926 | Jelte Fennema | 2017-01-08T23:33:11 | Macros 1.1: Add a macro to generate the add_like macros | diff --git a/src/add_like.rs b/src/add_like.rs
index 102cdac..a3077c9 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -2,8 +2,7 @@ use quote::{Tokens, ToTokens};
use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
use std::iter;
-pub fn expand(input: &MacroInput) -> Tokens {
- let trait_na... | 3 | 25 | 15 |
b11aa814b6b320502591dc54398749ca5f7a9def | Jelte Fennema | 2017-01-08T22:56:20 | Macros 1.1: Get add_like working for all Struct enum type | diff --git a/src/add_like.rs b/src/add_like.rs
index b79a0f3..102cdac 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -66,6 +66,7 @@ fn struct_content(input_type: &Ident, fields: &Vec<Field>, method_ident: &Ident)
fn enum_content(input_type: &Ident, variants: &Vec<Variant>, method_ident: &Ident) -> Tokens {
... | 2 | 40 | 19 |
ab7a3cf56b6ff8f3148967a05b3c6b3c580d445f | Jelte Fennema | 2017-01-08T22:19:39 | Macros 1.1: Add add_like error for Unit enum | diff --git a/src/add_like.rs b/src/add_like.rs
index 95bcc32..b79a0f3 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -68,22 +68,26 @@ fn enum_content(input_type: &Ident, variants: &Vec<Variant>, method_ident: &Iden
let mut matches = vec![];
for variant in variants {
+ let subtype = &variant.id... | 2 | 10 | 6 |
90a1a14bd0a6785b490e657f9925351b08f94048 | Jelte Fennema | 2017-01-08T22:13:37 | Macros 1.1: Add add_like support for tuple struct enums | diff --git a/src/add_like.rs b/src/add_like.rs
index 9105c71..95bcc32 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,5 +1,6 @@
-use quote::Tokens;
+use quote::{Tokens, ToTokens};
use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
+use std::iter;
pub fn expand(input: &MacroInput) -> Token... | 2 | 50 | 8 |
0606b216aab6888bbc700f3769c04515cb9fcf4d | Jelte Fennema | 2017-01-08T16:53:26 | Macros 1.1: Enable enum From test | diff --git a/tests/lib.rs b/tests/lib.rs
index 17c9c81..e7a4eba 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -46,7 +46,7 @@ enum SimpleMyIntEnum{
// SomeUnit,
// }
//
-// #[derive(Eq, PartialEq, Debug)]
+#[derive(Eq, PartialEq, Debug)]
#[derive(From)]
// #[derive(Add)]
enum MyIntEnum{
@@ -74,7 +74,7 @@ fn... | 1 | 2 | 2 |
27024230f58384cc85de41dc1604cbfcfc15cfb3 | Jelte Fennema | 2017-01-08T16:51:10 | Macros 1.1: Add some comment for clarity | diff --git a/src/add_like.rs b/src/add_like.rs
index 41150d0..9105c71 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -34,6 +34,7 @@ fn tuple_content(input_type: &Ident, fields: &Vec<Field>, method_ident: &Ident)
for i in 0..fields.len() {
let i = Ident::from(i.to_string());
+ // generates ... | 1 | 2 | 0 |
549d45d5d7e3ab0786969efbc0c5bdc920c764dc | Jelte Fennema | 2017-01-08T16:44:30 | Macros 1.1: Get struct add_like working (only for Add for now) | diff --git a/src/add_like.rs b/src/add_like.rs
index f8da0ce..41150d0 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -3,6 +3,7 @@ use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
pub fn expand(input: &MacroInput) -> Tokens {
let trait_name = "Add";
+ let trait_ident = Ident::from(t... | 2 | 34 | 18 |
34be3e34ef0abfb7858054a1d2735cf806bd3f2a | Jelte Fennema | 2017-01-08T10:57:53 | Macros 1.1: Continue with add_like even more | diff --git a/src/add_like.rs b/src/add_like.rs
index 96d3249..f8da0ce 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -4,25 +4,39 @@ use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
pub fn expand(input: &MacroInput) -> Tokens {
let trait_name = "Add";
let method_name = trait_name.to... | 2 | 24 | 10 |
3a7a8331663e1a3b005e9fd06a1fe990a8bbcae9 | Jelte Fennema | 2017-01-08T10:05:45 | Macros 1.1: Continue with add_like | diff --git a/src/add_like.rs b/src/add_like.rs
index e783a59..96d3249 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -5,22 +5,22 @@ pub fn expand(input: &MacroInput) -> Tokens {
let trait_name = "Add";
let method_name = trait_name.to_lowercase();
let method_ident = Ident::from(method_name);
- l... | 1 | 7 | 7 |
c8d685661e09ac7256eee12cca8867d0d178bd58 | Jelte Fennema | 2017-01-07T22:43:16 | Macros 1.1: Start with add_like | diff --git a/src/add_like.rs b/src/add_like.rs
index cada651..e783a59 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,3 +1,28 @@
use quote::Tokens;
use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
+pub fn expand(input: &MacroInput) -> Tokens {
+ let trait_name = "Add";
+ let metho... | 2 | 32 | 0 |
fd2c24eb852561c507b6a967b7dc5cf5d2766513 | Jelte Fennema | 2017-01-07T21:58:50 | Macros 1.1: Remove old code from new add an mul files | diff --git a/src/add_like.rs b/src/add_like.rs
index 948f932..cada651 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,160 +1,3 @@
-use syntax::ast::*;
-use syntax::codemap::{Span, Spanned};
-use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
-use syntax::ext::quote::rt::ExtPars... | 2 | 4 | 292 |
b59c084dca76fa241558b58ff164f305c083d8c3 | Jelte Fennema | 2017-01-07T21:57:12 | Macros 1.1: Copy legacy add and mul files | diff --git a/src/add_like_old.rs b/src/add_like_old.rs
new file mode 100644
index 0000000..948f932
--- /dev/null
+++ b/src/add_like_old.rs
@@ -0,0 +1,160 @@
+use syntax::ast::*;
+use syntax::codemap::{Span, Spanned};
+use syntax::ext::base::{Annotatable, ExtCtxt};
+use syntax::ext::build::AstBuilder;
+use syntax::ext::... | 2 | 294 | 0 |
8f5edc8d32466c0bcbefc2307a70d33413e6ee9e | Jelte Fennema | 2017-01-07T21:56:11 | Macros 1.1: Remove legacy From | diff --git a/src/from.rs b/src/from.rs
index b818e6e..4344711 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -1,97 +1,77 @@
use std::collections::HashMap;
-use syntax::ast::*;
-use syntax::codemap::Span;
-use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
-use syntax::ptr::P;
-use syn... | 3 | 40 | 139 |
cfa48cc7e4d0292ed6ac8953c05a01d6d541e401 | Jelte Fennema | 2017-01-07T21:52:46 | Macros 1.1: From enum now fully works | diff --git a/Cargo.toml b/Cargo.toml
index c1a305f..5f535c5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,4 +12,4 @@ proc-macro = true
[dependencies]
quote = "0.3"
-syn = "0.10.5"
+syn = "0.10.6"
diff --git a/src/from_new.rs b/src/from_new.rs
index b7c0301..4344711 100644
--- a/src/from_new.rs
+++ b/src/from_new.... | 3 | 33 | 31 |
73203ec008386e5f405c30faa7e66dad01ef1d67 | Jelte Fennema | 2017-01-07T19:40:05 | Macros 1.1: Initial changes for enum_from | diff --git a/src/from_new.rs b/src/from_new.rs
index 2c3bb0c..b7c0301 100644
--- a/src/from_new.rs
+++ b/src/from_new.rs
@@ -2,19 +2,24 @@ use std::collections::HashMap;
use quote::Tokens;
use syn::{Body, Field, Ident, Variant, VariantData, MacroInput, Ty};
+use syntax::print::pprust::ty_to_string;
/// Provide... | 2 | 56 | 7 |
c3a271623dfda84a2b74f28814124517f524012b | Jelte Fennema | 2017-01-07T19:23:27 | Macros 1.1: Add better errors | diff --git a/src/from_new.rs b/src/from_new.rs
index 60b0ae7..2c3bb0c 100644
--- a/src/from_new.rs
+++ b/src/from_new.rs
@@ -12,10 +12,10 @@ pub fn expand(input: &MacroInput) -> Tokens {
newtype_from(input.ident.clone(), structs[0].ty.clone())
}
else {
- unreach... | 1 | 2 | 2 |
5a803439122095ad686086801588f9c303b4a839 | Jelte Fennema | 2017-01-07T19:10:33 | Macros 1.1: Support newtype struct From | diff --git a/src/from_new.rs b/src/from_new.rs
index a6c1974..60b0ae7 100644
--- a/src/from_new.rs
+++ b/src/from_new.rs
@@ -1,27 +1,31 @@
use std::collections::HashMap;
-use syntax::ast::*;
-use syntax::codemap::Span;
-use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
-use syntax::... | 2 | 19 | 14 |
b2979a909fd0b7d866fb72a9707dd17f8aee4f3a | Jelte Fennema | 2017-01-05T22:30:14 | Initial changes for macros 1.1 | diff --git a/Cargo.toml b/Cargo.toml
index 45d6bb9..c1a305f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,8 @@ repository = "https://github.com/JelteF/derive_more"
[lib]
name = "derive_more"
-plugin = true
+proc-macro = true
[dependencies]
+quote = "0.3"
+syn = "0.10.5"
diff --git a/src/from.rs b/src/from.... | 5 | 140 | 101 |
b2c9ec3a985a65014bf10ea2f7155257dff4f796 | Jelte Fennema | 2017-01-05T20:06:18 | Fix final errors | diff --git a/src/from.rs b/src/from.rs
index c87925c..d082596 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -17,7 +17,7 @@ pub fn expand(cx: &mut ExtCtxt, span: Span, _: &MetaItem,
match x.node {
ItemKind::Struct(VariantData::Tuple(ref structs, _), _) => {
if structs.l... | 2 | 4 | 4 |
da76003a298d27e0c0a0bcfefab02c71500ee5e5 | Jelte Fennema | 2017-01-05T20:05:12 | Change pat_enum to new pat_tuple_struct | diff --git a/src/add_like.rs b/src/add_like.rs
index ceeb5a2..948f932 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -106,8 +106,8 @@ fn enum_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, enum_def: &EnumDef
exprs.push(cx.parse_expr(format!("__l_{}.{}(__r_{})", i, method_name, i)));
... | 1 | 2 | 2 |
34dd6591835b4ad4165c6e4618523868a8b0979a | Jelte Fennema | 2017-01-05T19:45:38 | Fix errors pertaining to NamedField being removed | diff --git a/src/add_like.rs b/src/add_like.rs
index 9a67524..ceeb5a2 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -72,11 +72,9 @@ fn struct_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields: &Vec<Str
let mut filled_fields = vec![];
for field in fields {
- let (field_id, field_nam... | 2 | 6 | 8 |
aea17abeb103e23c785840a01bbf030572942f95 | Jelte Fennema | 2017-01-05T19:14:39 | Fix build issues in lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index 203468f..471b3ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,14 +2,13 @@
#[macro_use]
extern crate rustc;
-extern crate rustc_front;
extern crate rustc_plugin;
#[macro_use]
extern crate syntax;
extern crate syntax_ext;
use rustc_plugin::Registry;
-use syntax::par... | 1 | 4 | 5 |
858e0b06ad6a69b10196a637863c406b9fc7d286 | Jelte Fennema | 2016-04-29T09:39:46 | Bump version to 0.3.0 | diff --git a/Cargo.toml b/Cargo.toml
index 5b1e84e..45d6bb9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.2.0"
+version = "0.3.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT" | 1 | 1 | 1 |
fdf811046f8792a56aab07b4cae6da614db27a72 | Jelte Fennema | 2016-04-29T07:36:20 | Add support for shift right and left operations | diff --git a/src/lib.rs b/src/lib.rs
index ce06b88..203468f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,7 +17,7 @@ mod add_like;
mod mul_like;
const ADDLIKE_OPS: &'static [&'static str] = &["Add", "Sub", "BitAnd", "BitOr", "BitXor"];
-const MULLIKE_OPS: &'static [&'static str] = &["Mul", "Div", "Rem"];
+const M... | 2 | 2 | 2 |
b47c00552493ce2b3fdb029221693bcb12a792fe | Jelte Fennema | 2016-04-29T07:33:31 | Remove unused code | diff --git a/src/add_like.rs b/src/add_like.rs
index 8464459..9a67524 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,11 +1,9 @@
use syntax::ast::*;
-use syntax_ext::deriving::generic::ty;
use syntax::codemap::{Span, Spanned};
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::ext::build::AstBuilde... | 4 | 3 | 16 |
2ad6e1f98bd8b5485f50b4267d390739a9d2e5e0 | Jelte Fennema | 2016-04-29T07:28:57 | Add old tests again | diff --git a/tests/lib.rs b/tests/lib.rs
index 055a591..326dd71 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -4,16 +4,90 @@
extern crate syntax;
use syntax::codemap;
+#[derive(From)]
+#[derive(Eq, PartialEq, Debug)]
+#[derive(Add)]
+struct MyInt(i32);
+
+#[derive(Add)]
+#[derive(Eq, PartialEq, Debug)]
+struct My... | 1 | 78 | 4 |
8dd26e9a0bbaf7d44fba66f8054929996889d7a7 | Jelte Fennema | 2016-04-11T23:46:37 | Get mul working for structs | diff --git a/src/mul_like.rs b/src/mul_like.rs
index 95b2c6b..90439f9 100644
--- a/src/mul_like.rs
+++ b/src/mul_like.rs
@@ -22,9 +22,9 @@ pub fn expand(cx: &mut ExtCtxt, span: Span, item: &Annotatable, push: &mut FnMut
Some((x.ident, cx.ty_ident(span, x.ident), tuple_content(cx, span, x, fields, m... | 2 | 26 | 4 |
4af0f2b6083facc426b406e5931369e60e534749 | Jelte Fennema | 2016-04-11T23:33:05 | Remove non working mul_like file and fix mul_like for tuples | diff --git a/src/lib.rs b/src/lib.rs
index c1e7949..bf27b83 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,8 +14,7 @@ use syntax::ext::base::MultiDecorator;
mod from;
mod add_like;
-mod mul_like_traitdef;
-mod mul_like_quote;
+mod mul_like;
const ADDLIKE_OPS: &'static [&'static str] = &["Add", "Sub", "BitAnd", ... | 4 | 26 | 146 |
da59ed475f6d5f0932a502360d9592f864d7b191 | Jelte Fennema | 2016-04-11T22:45:12 | Finally get new mul to work | diff --git a/src/lib.rs b/src/lib.rs
index 245eed0..c1e7949 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,8 +31,8 @@ pub fn plugin_registrar(reg: &mut Registry) {
}
for op in MULLIKE_OPS {
let expand = move |cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Annotatable, push: &mut FnMut(Annota... | 2 | 19 | 59 |
9358cda0eccbc8c4e5ba9c662714b7333896fcf6 | Jelte Fennema | 2016-04-11T18:05:15 | Make two non working implementations for mul like derives | diff --git a/src/lib.rs b/src/lib.rs
index ce06b88..245eed0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,7 +14,8 @@ use syntax::ext::base::MultiDecorator;
mod from;
mod add_like;
-mod mul_like;
+mod mul_like_traitdef;
+mod mul_like_quote;
const ADDLIKE_OPS: &'static [&'static str] = &["Add", "Sub", "BitAnd", ... | 5 | 287 | 143 |
97665cf8a2c4f44ea896b36dedb8341ecd54b3a7 | Jelte Fennema | 2016-04-05T11:45:08 | Move different derive types to their own sub modules | diff --git a/src/add_like.rs b/src/add_like.rs
new file mode 100644
index 0000000..8464459
--- /dev/null
+++ b/src/add_like.rs
@@ -0,0 +1,164 @@
+use syntax::ast::*;
+use syntax_ext::deriving::generic::ty;
+use syntax::codemap::{Span, Spanned};
+use syntax::ext::base::{Annotatable, ExtCtxt};
+use syntax::ext::build::As... | 4 | 345 | 317 |
990091e76ffff8219b40942fc0fb06da2d6b06df | Jelte Fennema | 2016-04-05T10:10:34 | Try creating a better mul | diff --git a/src/lib.rs b/src/lib.rs
index 7a28cd2..2ecec8c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,14 +12,21 @@ use rustc_plugin::Registry;
use syntax::parse::token::intern;
use syntax::ext::base::MultiDecorator;
-const INFIX_OPS: &'static [&'static str] = &["Add", "Sub", "Mul", "Div", "Rem", "BitAnd", "Bi... | 2 | 145 | 71 |
92e9bf4a4e0a867e0afdb10837e94c61189e5108 | Jelte Fennema | 2016-04-02T22:35:02 | Bump version to 0.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index eaa9cd4..5b1e84e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.1.0"
+version = "0.2.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT" | 1 | 1 | 1 |
b11cf3b9d9f0ada61209a008e9d4568f3dd7c455 | Jelte Fennema | 2016-04-02T22:01:24 | Add special error for Unit types | diff --git a/src/lib.rs b/src/lib.rs
index aac73c0..7a28cd2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -254,7 +254,9 @@ fn enum_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, enum_def:
let new_tuple = cx.expr_struct(span, type_path.clone(), filled_fields);
matches.push... | 2 | 9 | 5 |
8191ac7f305d48942735531d88cce313819ba827 | Jelte Fennema | 2016-04-02T21:50:43 | Normal structs in enums can now be added as well | diff --git a/src/lib.rs b/src/lib.rs
index d0e7726..aac73c0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -29,7 +29,7 @@ pub fn plugin_registrar(reg: &mut Registry) {
use std::collections::HashMap;
use syntax::ast::*;
-use syntax::codemap::Span;
+use syntax::codemap::{Span, Spanned};
use syntax::ext::base::{Annotata... | 2 | 46 | 8 |
7b9535555ccdd72ba1bce2df57bfd38b122a452a | Jelte Fennema | 2016-04-02T19:10:28 | Tuple enum options can be added now | diff --git a/src/lib.rs b/src/lib.rs
index 263d6d5..d0e7726 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -205,14 +205,37 @@ fn struct_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields:
fn enum_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields: &EnumDef, method_name: String) -> P<... | 2 | 34 | 3 |
02a94d4ff1ced2ff90407a0252ccc7947f4272d5 | Jelte Fennema | 2016-04-02T13:50:39 | Make subtraction actually work for enums | diff --git a/src/lib.rs b/src/lib.rs
index 29184da..263d6d5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -205,10 +205,12 @@ fn struct_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields:
fn enum_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields: &EnumDef, method_name: String) -> P<... | 2 | 5 | 2 |
5467c659b1715360d0ef94bd09ff20445a88e3a0 | Jelte Fennema | 2016-03-31T16:07:59 | Change method call to quote macro | diff --git a/src/lib.rs b/src/lib.rs
index 716cdff..29184da 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -212,5 +212,5 @@ fn enum_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields: &
}
matches.push(quote_arm!(cx, _ => Err("Trying to add mismatched enum types"), ));
- cx.expr_match(span... | 1 | 1 | 1 |
50e78a22ce02a8e1573516a4cdb17e954d5c56ed | Jelte Fennema | 2016-03-31T16:03:05 | Basic enum support | diff --git a/src/lib.rs b/src/lib.rs
index b05ea68..716cdff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -203,5 +203,14 @@ fn struct_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields:
}
fn enum_infix_op_content(cx: &mut ExtCtxt, span: Span, item: &P<Item>, fields: &EnumDef, method_name: String) -... | 2 | 19 | 1 |
cc92a1f7d46f9f8d19de6ab50380261f3fcd14ca | Jelte Fennema | 2016-03-31T08:03:21 | Initial code to do arithmetic on enums | diff --git a/src/lib.rs b/src/lib.rs
index e1d023e..b05ea68 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -132,18 +132,25 @@ fn expand_derive_infix_op(cx: &mut ExtCtxt, span: Span, item: &Annotatable,
Annotatable::Item(ref x) => {
match x.node {
ItemKind::Struct(VariantData::Tuple(r... | 2 | 19 | 7 |
6811a2182872a7b50661bee61d850564868703ac | Jelte Fennema | 2016-03-28T22:35:21 | Add derive for all infix operations except shifting ones | diff --git a/src/lib.rs b/src/lib.rs
index 6669f95..e1d023e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,14 +12,20 @@ use rustc_plugin::Registry;
use syntax::parse::token::intern;
use syntax::ext::base::MultiDecorator;
+const INFIX_OPS: &'static [&'static str] = &["Add", "Sub", "Mul", "Div", "Rem", "BitAnd", "Bi... | 2 | 9 | 16 |
b248a7ea4b62803ccf44bfc64d63392801871418 | Jelte Fennema | 2016-03-28T21:50:32 | Add derive(Sub) support | diff --git a/src/lib.rs b/src/lib.rs
index e2e36af..6669f95 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,6 +17,7 @@ use syntax::ext::base::MultiDecorator;
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_From"), MultiDecorator(box expand_derive_from));
reg.registe... | 2 | 16 | 4 |
526e57ac358a27f85bd3671a4cee9f10d2258e13 | Jelte Fennema | 2016-03-28T13:00:06 | Generalize Add functions for any infix ops | diff --git a/src/lib.rs b/src/lib.rs
index e8e1a6d..e2e36af 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -117,16 +117,23 @@ fn enum_from(cx: &mut ExtCtxt, enum_ident: Ident, definition: &EnumDef,
fn expand_derive_add(cx: &mut ExtCtxt, span: Span, _: &MetaItem,
item: &Annotatable, push: &mut FnMu... | 1 | 17 | 11 |
eba0172a97fbd09f427a0d9e8977971898984741 | Jelte Fennema | 2016-03-27T23:22:25 | Derive(Add) implemented for non tuple structs | diff --git a/src/lib.rs b/src/lib.rs
index 8a74cf3..e8e1a6d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -122,9 +122,12 @@ fn expand_derive_add(cx: &mut ExtCtxt, span: Span, _: &MetaItem,
let result = match *item {
Annotatable::Item(ref x) => {
match x.node {
- ItemKind::Struct(... | 2 | 35 | 5 |
ef58b8dd49bef2ace495c5286d11a771b6ee78c7 | Jelte Fennema | 2016-03-27T22:35:44 | Fix add for general tuple structs | diff --git a/src/lib.rs b/src/lib.rs
index 8b907fa..8a74cf3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,7 @@ use syntax::ast::*;
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::ext::build::AstBuilder;
+use syntax::ext::quote::rt::ExtParseUtils;
use syntax::ptr::P;
us... | 2 | 11 | 7 |
00958433db831ed74e2d18237e92cdeb3fe39db8 | Jelte Fennema | 2016-03-24T22:11:16 | Start implementing arbitrary tuple struct add | diff --git a/src/lib.rs b/src/lib.rs
index 55812c7..8b907fa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -122,12 +122,7 @@ fn expand_derive_add(cx: &mut ExtCtxt, span: Span, _: &MetaItem,
Annotatable::Item(ref x) => {
match x.node {
ItemKind::Struct(VariantData::Tuple(ref structs, ... | 2 | 12 | 13 |
17a7b89e93f05363d8c4af33e75df020c4858916 | Jelte Fennema | 2016-03-24T21:38:54 | Get derive(Add) working for newtypes | diff --git a/src/lib.rs b/src/lib.rs
index 7d01425..55812c7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,11 +16,12 @@ use syntax::ext::base::MultiDecorator;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_From"), MultiDecorator(box expand_derive_f... | 2 | 52 | 1 |
a0e4dc272a7edc93f93b9ac7f0652cc0906b87ef | Jelte Fennema | 2016-03-24T20:32:09 | Bump version to 0.1.0 | diff --git a/Cargo.toml b/Cargo.toml
index 7a6cea0..9596e07 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_from"
-version = "0.0.1"
+version = "0.1.0"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
[lib] | 1 | 1 | 1 |
77d8a83b3325283017a2219a5337bcca9ddcace6 | Jelte Fennema | 2016-03-24T20:31:45 | Remove some unnecessary included features | diff --git a/src/lib.rs b/src/lib.rs
index 8cb89da..7d01425 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-#![feature(plugin_registrar, box_syntax, rustc_private, custom_derive, quote, plugin, custom_attribute)]
+#![feature(plugin_registrar, box_syntax, rustc_private, custom_derive, quote)]
#[macro_use]
... | 1 | 1 | 1 |
d9b6a395683e0503809d8eff38461f5513b3b7ac | Jelte Fennema | 2016-03-24T20:27:40 | Add support for enums | diff --git a/src/lib.rs b/src/lib.rs
index 9295758..8cb89da 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,11 +18,14 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_From"), MultiDecorator(box expand_derive_from));
}
-use syntax::ast::{Ident, Ty, VariantData, ItemKi... | 2 | 65 | 8 |
d615294a88086a0ee1564c1e5ed660b40d6bdf38 | Jelte Fennema | 2016-03-24T19:16:23 | Split main function into two parts | diff --git a/src/lib.rs b/src/lib.rs
index 3d32b0b..9295758 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,40 +18,42 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_From"), MultiDecorator(box expand_derive_from));
}
-use syntax::ast::{VariantData, ItemKind, MetaIte... | 1 | 15 | 13 |
1eec18105d9f935b02090ae73e3cdec2799fcd7b | Jelte Fennema | 2016-03-24T18:30:32 | Use quote_item! macro to reduce code size a lot | diff --git a/src/lib.rs b/src/lib.rs
index e0d0a14..3d32b0b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,28 +18,22 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("derive_From"), MultiDecorator(box expand_derive_from));
}
-use syntax::ast::{Item, VariantData, ItemKind, E... | 2 | 26 | 85 |
ee6ce3c801b3a90ba1dff0a5835684c13545cf05 | Jelte Fennema | 2016-03-24T17:46:49 | First iteration of derive(From), currently only for newtypes | diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..7a6cea0
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "derive_from"
+version = "0.0.1"
+authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
+
+[lib]
+name = "derive_from"
+plugin = true
+
+[dependencies]
diff --git a/src/lib.r... | 3 | 167 | 0 |
0b404336abbacc5d34df70af981ff5a338206bfe | Kreijstal | 2026-02-25T21:27:00 | add cygwin (#197) | diff --git a/build/common.rs b/build/common.rs
index 06c12cb..91696e3 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -331,6 +331,9 @@ pub fn search_libclang_directories(filenames: &[String], variable: &str) -> Vec<
.filter(|d| d.1 || !msvc)
.map(|d| d.0)
.collect()
+ } e... | 2 | 6 | 0 |
fc898226e282cb2b5ffad7533d9e3fc91e67e5b4 | Christopher Degawa | 2026-02-25T20:23:46 | Add rewriter API (#191)
Signed-off-by: Christopher Degawa <ccom@randomderp.com> | diff --git a/src/lib.rs b/src/lib.rs
index 6c6b876..9955856 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1536,6 +1536,8 @@ opaque!(CXRemapping);
#[cfg(feature = "clang_5_0")]
opaque!(CXTargetInfo);
opaque!(CXTranslationUnit);
+#[cfg(feature = "clang_12_0")]
+opaque!(CXRewriter);
// Transparent ___________________... | 1 | 23 | 0 |
4985661aabb2f693713762d1e9ec91f3d4a6f0e5 | Jean-Pierre De Jesus DIAZ | 2026-02-25T20:19:34 | Search in LIBRARY_PATH too (#186)
In addition to LD_LIBRARY_PATH. We might want to only search in one of these
in the future (depending on feature flags). | diff --git a/build/common.rs b/build/common.rs
index f04ad40..06c12cb 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -309,6 +309,14 @@ pub fn search_libclang_directories(filenames: &[String], variable: &str) -> Vec<
}
}
+ // Search the directories in the `LIBRARY_PATH` environment variable,
+ ... | 1 | 8 | 0 |
06fe5792ced22d0e76374ac0039a0f7f1707c848 | Michael Leandersson | 2026-02-25T19:37:19 | Fix directories windows path (#185)
Co-authored-by: Michael Leandersson <michael.leandersson@smarteye.se> | diff --git a/build/common.rs b/build/common.rs
index 6653478..f04ad40 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -190,7 +190,7 @@ const DIRECTORIES_WINDOWS: &[(&str, bool)] = &[
("C:\\LLVM\\lib", true),
// LLVM + Clang can be installed as a component of Visual Studio.
// https://github.com/Kyl... | 1 | 1 | 1 |
7b591157fa6bedb0943f9a508cc0d17a14f7e459 | Alexander van Saase | 2026-02-25T14:05:27 | Directly include file from build directory instead of copying in build script (#200) | diff --git a/build.rs b/build.rs
index e96a43e..2dc77af 100644
--- a/build.rs
+++ b/build.rs
@@ -28,37 +28,13 @@ pub mod dynamic;
#[path = "build/static.rs"]
pub mod r#static;
-/// Copies a file.
-#[cfg(feature = "runtime")]
-fn copy(source: &str, destination: &Path) {
- use std::fs::File;
- use std::io::{Rea... | 2 | 4 | 28 |
2cb708ca844e746cd0ee52f72977bbee4842fe55 | Harold Sun | 2024-09-23T01:45:19 | fix: get LLVM static libraries | diff --git a/build/static.rs b/build/static.rs
index 6bc2bea..e835178 100644
--- a/build/static.rs
+++ b/build/static.rs
@@ -41,7 +41,7 @@ fn get_library_name(path: &Path) -> Option<String> {
/// Gets the LLVM static libraries required to link to `libclang`.
fn get_llvm_libraries() -> Vec<String> {
- common::run... | 1 | 1 | 1 |
341ce9de0d3e110a66186704f0da4a797f8cff22 | Andrew Liu | 2024-05-26T04:33:56 | Return unescaped paths when searching for library files | diff --git a/build/common.rs b/build/common.rs
index 6a1f7b7..a32e8b6 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -237,7 +237,7 @@ fn search_directory(directory: &Path, filenames: &[String]) -> Vec<(PathBuf, Str
return None;
}
- Some((directory.to_owned(), filename.i... | 1 | 1 | 1 |
f76ca0660206f2d4a25ec063fb49e77920b68f4a | Kyle Mayes | 2024-01-03T10:59:34 | Fix bindgen deprecation notice | diff --git a/bindgen-test/build.rs b/bindgen-test/build.rs
index 9cff7ac..fe2114a 100644
--- a/bindgen-test/build.rs
+++ b/bindgen-test/build.rs
@@ -8,7 +8,7 @@ fn main() {
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
bindgen::Builder::default()
.header("wrapper.h")
- .parse_callback... | 1 | 1 | 1 |
fb980cd8eba94388b442fdb5568967ccc0ad5a14 | Kyle Mayes | 2024-01-03T10:34:50 | Fix build script and tests to work with 1.60.0 | diff --git a/Cargo.toml b/Cargo.toml
index 2e0e0be..5af722a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -56,7 +56,8 @@ glob = "0.3"
[dev-dependencies]
glob = "0.3"
-tempfile = "3"
+lazy_static = "1"
+tempfile = ">=3.0.0, <3.7.0"
[package.metadata.docs.rs]
diff --git a/build/common.rs b/build/common.rs
index d8... | 2 | 7 | 4 |
34ba8f7dd8fee4bb3272dab8b72b88742cbe2773 | Kyle Mayes | 2024-01-03T10:29:31 | Remove unneeded extern crate statements | diff --git a/build.rs b/build.rs
index 6b15126..e96a43e 100644
--- a/build.rs
+++ b/build.rs
@@ -15,8 +15,6 @@
#![allow(unused_attributes)]
-extern crate glob;
-
use std::path::Path;
#[macro_use]
diff --git a/build/common.rs b/build/common.rs
index 114607a..d8cb7d5 100644
--- a/build/common.rs
+++ b/build/comm... | 6 | 0 | 17 |
ccf2e8c8f9a845d2836d4ce54f5c2cef90c2e764 | Kyle Mayes | 2024-01-03T10:28:40 | Fix clippy warnings | diff --git a/build/common.rs b/build/common.rs
index 3005a8a..114607a 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -24,7 +24,7 @@ fn add_command_error(name: &str, path: &str, arguments: &[&str], message: String
COMMAND_ERRORS.with(|e| {
e.borrow_mut()
.entry(name.into())
- ... | 1 | 2 | 2 |
ba6c84b40772214b11aaf17ec2b144712b3eade4 | Kyle Mayes | 2024-01-03T10:26:02 | Avoid the use of serial_test due to high MSRV
Some of the transitive dependencies introduced by serial_test would
require bumping the MSRV past 1.60.0 (the current MSRV of bindgen
which is the primary user of this crate). | diff --git a/Cargo.toml b/Cargo.toml
index bceb9d2..2e0e0be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -56,7 +56,6 @@ glob = "0.3"
[dev-dependencies]
glob = "0.3"
-serial_test = "1"
tempfile = "3"
[package.metadata.docs.rs]
diff --git a/tests/build.rs b/tests/build.rs
index 669c561..eda28dd 100644
--- a/tests/... | 2 | 16 | 15 |
425e5cf4b07bccc666127f865cea8cb74606dfc6 | Kyle Mayes | 2024-01-03T10:10:05 | Use 2021 edition | diff --git a/Cargo.toml b/Cargo.toml
index c70b380..bceb9d2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,7 @@
[package]
+edition = "2021"
+
name = "clang-sys"
authors = ["Kyle Mayes <kyle@mayeses.com>"] | 1 | 2 | 0 |
47a8f4d833d4df5d721c6554840aa0fc4f38eac1 | ptrstr | 2023-12-13T15:01:58 | Fix CXUnaryOperatorKind | diff --git a/src/lib.rs b/src/lib.rs
index a72d9a6..31e2e96 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1159,20 +1159,21 @@ cenum! {
/// Only available on `libclang` 17.0 and later.
#[cfg(feature = "clang_17_0")]
enum CXUnaryOperatorKind {
- const CXUnaryOperator_PostInc = 0,
- const CXUna... | 1 | 15 | 14 |
aa9bfe4dcd543a0c6a857a9d75962f399fbf92e2 | ptrstr | 2023-12-13T01:27:42 | Fix CXIndexOptions values.Fix alignment on Windows | diff --git a/src/lib.rs b/src/lib.rs
index ec457bd..a72d9a6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1288,16 +1288,27 @@ cenum! {
}
}
-cenum! {
- #[repr(c_ushort)]
- /// Only available on `libclang` 17.0 and later.
- #[cfg(feature = "clang_17_0")]
- enum CXIndexOptions_Flags {
- const CXI... | 1 | 21 | 10 |
2d2ac3160e0de28c4675eacddf2e987785550bed | ptrstr | 2023-12-12T03:16:58 | Add repr attribute handler for cenum. Fix types for CXIndexOptions | diff --git a/src/lib.rs b/src/lib.rs
index 97c54c6..ec457bd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -48,6 +48,20 @@ pub type CXInclusionVisitor = extern "C" fn(CXFile, *mut CXSourceLocation, c_uin
/// Defines a C enum as a series of constants.
macro_rules! cenum {
+ (#[repr($ty:ty)] $(#[$meta:meta])* enum $n... | 2 | 27 | 17 |
e9466593c204b42db3a7df6ea3f2150355494ede | ptrstr | 2023-12-11T21:48:01 | Add bindings for Clang 17 | diff --git a/Cargo.toml b/Cargo.toml
index 3c6d3d6..a2b7bf7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -36,6 +36,7 @@ clang_13_0 = ["clang_12_0"]
clang_14_0 = ["clang_13_0"]
clang_15_0 = ["clang_14_0"]
clang_16_0 = ["clang_15_0"]
+clang_17_0 = ["clang_16_0"]
runtime = ["libloading"]
static = []
@@ -58,4 +59,4 @... | 3 | 129 | 4 |
2172423be7d0cc86d80f58aaf46f0cde84969d52 | Alexis (Poliorcetics) Bourget | 2023-07-25T13:00:47 | deps: update to libloading 0.8 | diff --git a/Cargo.toml b/Cargo.toml
index 3c6d3d6..a00a214 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,7 +44,7 @@ static = []
glob = "0.3"
libc = { version = "0.2.39", default-features = false }
-libloading = { version = "0.7", optional = true }
+libloading = { version = "0.8", optional = true }
[build-depe... | 1 | 1 | 1 |
72e76bc389f037c3f3068d1f50434a883f009c17 | Kyle Mayes | 2023-03-29T23:49:15 | Fix clippy warnings | diff --git a/build/common.rs b/build/common.rs
index e13e883..3005a8a 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -336,7 +336,7 @@ pub fn search_libclang_directories(filenames: &[String], variable: &str) -> Vec<
.map(|d| d.strip_prefix('/').or_else(|| d.strip_prefix("C:\\")).unwrap_or(d))
... | 2 | 4 | 4 |
0b56a3ad69abff20dd2bf0ed1a036d1b4d65fedb | Kyle Mayes | 2023-03-29T23:46:57 | Improve error message for unloaded function | diff --git a/src/link.rs b/src/link.rs
index 66c76ab..07c4be3 100644
--- a/src/link.rs
+++ b/src/link.rs
@@ -40,6 +40,7 @@ macro_rules! link {
)+
) => (
use std::cell::{RefCell};
+ use std::fmt;
use std::sync::{Arc};
use std::path::{Path, PathBuf};
@@ -58,6 +59,31 @@ ma... | 1 | 54 | 7 |
05c981283207ae2918cd94cb866e5f352166827b | Alexander Kjäll | 2023-03-01T16:04:25 | replace tempdir with tempfile, since tempdir is deprecated | diff --git a/Cargo.toml b/Cargo.toml
index 7497f3b..55d26f5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,7 +54,7 @@ glob = "0.3"
glob = "0.3"
serial_test = "1"
-tempdir = "0.3"
+tempfile = "3"
[package.metadata.docs.rs]
diff --git a/tests/build.rs b/tests/build.rs
index 70a3bc0..669c561 100644
--- a/tests/b... | 2 | 4 | 4 |
6dcaeb172ad79a3ffc58df858fa7e7861b6b8a30 | Hiroaki Yutani | 2023-02-18T13:07:06 | Restore clang_CXXMethod_isVirtual() | diff --git a/src/lib.rs b/src/lib.rs
index 1fb9944..edaf2d3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1770,6 +1770,7 @@ link! {
pub fn clang_CXXMethod_isMoveAssignmentOperator(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isPureVirtual(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isStatic... | 1 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.