Skip to content

Commit 93d691c

Browse files
authored
Merge pull request #326 from dtolnay/arc
ToTokens for Arc
2 parents 24d1082 + d27d589 commit 93d691c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/to_tokens.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::TokenStreamExt;
2+
use std::sync::Arc;
23
use alloc::borrow::{Cow, ToOwned};
34
use alloc::boxed::Box;
45
use alloc::ffi::CString;
@@ -104,6 +105,12 @@ impl<T: ?Sized + ToTokens> ToTokens for Rc<T> {
104105
}
105106
}
106107

108+
impl<T: ?Sized + ToTokens> ToTokens for Arc<T> {
109+
fn to_tokens(&self, tokens: &mut TokenStream) {
110+
(**self).to_tokens(tokens);
111+
}
112+
}
113+
107114
impl<T: ToTokens> ToTokens for Option<T> {
108115
fn to_tokens(&self, tokens: &mut TokenStream) {
109116
if let Some(t) = self {

tests/ui/not-quotable.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ error[E0277]: the trait bound `Ipv4Addr: ToTokens` is not satisfied
1010
= help: the following other types implement trait `ToTokens`:
1111
&T
1212
&mut T
13+
Arc<T>
1314
Box<T>
1415
CStr
1516
CString
1617
Cow<'a, T>
1718
Option<T>
18-
Rc<T>
1919
and $N others
2020
= note: this error originates in the macro `quote` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)