Replace Rc with Lrc for shared data

This commit is contained in:
John Kåre Alsaker 2018-02-27 17:11:14 +01:00
parent 878f5b0514
commit b74e97cf42
86 changed files with 435 additions and 413 deletions

View file

@ -13,6 +13,7 @@
#![feature(quote, rustc_private)]
extern crate syntax;
extern crate rustc_data_structures;
use syntax::ext::base::{ExtCtxt, DummyResolver};
use syntax::ext::expand::ExpansionConfig;
@ -23,7 +24,7 @@ use syntax::ast::{Expr, ExprKind, LitKind, StrStyle, RangeLimits};
use syntax::symbol::Symbol;
use syntax::ptr::P;
use std::rc::Rc;
use rustc_data_structures::sync::Lrc;
fn main() {
let parse_sess = ParseSess::new(FilePathMapping::empty());
@ -33,12 +34,12 @@ fn main() {
// check byte string
let byte_string = quote_expr!(&cx, b"one");
let byte_string_lit_kind = LitKind::ByteStr(Rc::new(b"one".to_vec()));
let byte_string_lit_kind = LitKind::ByteStr(Lrc::new(b"one".to_vec()));
assert_eq!(byte_string.node, ExprKind::Lit(P(dummy_spanned(byte_string_lit_kind))));
// check raw byte string
let raw_byte_string = quote_expr!(&cx, br###"#"two"#"###);
let raw_byte_string_lit_kind = LitKind::ByteStr(Rc::new(b"#\"two\"#".to_vec()));
let raw_byte_string_lit_kind = LitKind::ByteStr(Lrc::new(b"#\"two\"#".to_vec()));
assert_eq!(raw_byte_string.node, ExprKind::Lit(P(dummy_spanned(raw_byte_string_lit_kind))));
// check dotdoteq