Add run-make-fulldeps test
Implement RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER Also makes minor docs edits.
This commit is contained in:
parent
7d7dfba350
commit
535278aa51
@ -126,14 +126,17 @@ fn borrow(&self) -> &Fingerprint {
|
||||
}
|
||||
}
|
||||
|
||||
/// A [`StableCrateId`] is a 64 bit hash of the crate name combined with all
|
||||
/// `-Cmetadata` arguments. It is to [`CrateNum`] what [`DefPathHash`] is to
|
||||
/// A [`StableCrateId`] is a 64-bit hash of a crate name, together with all
|
||||
/// `-Cmetadata` arguments, and some other data. It is to [`CrateNum`] what [`DefPathHash`] is to
|
||||
/// [`DefId`]. It is stable across compilation sessions.
|
||||
///
|
||||
/// Since the ID is a hash value there is a (very small) chance that two crates
|
||||
/// Since the ID is a hash value, there is a small chance that two crates
|
||||
/// end up with the same [`StableCrateId`]. The compiler will check for such
|
||||
/// collisions when loading crates and abort compilation in order to avoid
|
||||
/// further trouble.
|
||||
///
|
||||
/// See the discussion in [`DefId`] for more information
|
||||
/// on the possibility of hash collisions in rustc,
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||
#[derive(HashStable_Generic, Encodable, Decodable)]
|
||||
pub struct StableCrateId(pub(crate) u64);
|
||||
@ -174,8 +177,14 @@ pub fn new(crate_name: &str, is_exe: bool, mut metadata: Vec<String>) -> StableC
|
||||
// Also incorporate the rustc version. Otherwise, with -Zsymbol-mangling-version=v0
|
||||
// and no -Cmetadata, symbols from the same crate compiled with different versions of
|
||||
// rustc are named the same.
|
||||
let rustc_version = option_env!("CFG_VERSION").unwrap_or("unknown version").as_bytes();
|
||||
hasher.write(rustc_version);
|
||||
//
|
||||
// RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER is used to inject rustc version information
|
||||
// during testing.
|
||||
if let Some(val) = std::env::var_os("RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER") {
|
||||
hasher.write(val.to_string_lossy().into_owned().as_bytes())
|
||||
} else {
|
||||
hasher.write(option_env!("CFG_VERSION").unwrap_or("unknown version").as_bytes());
|
||||
}
|
||||
|
||||
StableCrateId(hasher.finish())
|
||||
}
|
||||
|
37
src/test/run-make-fulldeps/crate-hash-rustc-version/Makefile
Normal file
37
src/test/run-make-fulldeps/crate-hash-rustc-version/Makefile
Normal file
@ -0,0 +1,37 @@
|
||||
-include ../../run-make-fulldeps/tools.mk
|
||||
|
||||
# Ensure that crates compiled with different rustc versions cannot
|
||||
# be dynamically linked.
|
||||
|
||||
FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0
|
||||
UNAME := $(shell uname)
|
||||
ifeq ($(UNAME),Linux)
|
||||
EXT=".so"
|
||||
NM_CMD := nm -D
|
||||
endif
|
||||
ifeq ($(UNAME),Darwin)
|
||||
EXT=".dylib"
|
||||
NM_CMD := nm
|
||||
endif
|
||||
|
||||
ifndef NM_CMD
|
||||
all:
|
||||
exit 0
|
||||
else
|
||||
all:
|
||||
# a.rs is a dylib
|
||||
$(RUSTC) a.rs --crate-type=dylib $(FLAGS)
|
||||
# Write symbols to disk.
|
||||
$(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore
|
||||
# b.rs is a binary
|
||||
$(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS)
|
||||
$(call RUN,b)
|
||||
# Now re-compile a.rs with another rustc version
|
||||
RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS)
|
||||
# After compiling with a different rustc version, write symbols to disk again.
|
||||
$(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter
|
||||
# As a sanity check, test if the symbols changed:
|
||||
# If the symbols are identical, there's been an error.
|
||||
if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi
|
||||
$(call FAIL,b)
|
||||
endif
|
4
src/test/run-make-fulldeps/crate-hash-rustc-version/a.rs
Normal file
4
src/test/run-make-fulldeps/crate-hash-rustc-version/a.rs
Normal file
@ -0,0 +1,4 @@
|
||||
pub fn foo(mut x: String) -> String {
|
||||
x.push_str(", world!");
|
||||
x
|
||||
}
|
8
src/test/run-make-fulldeps/crate-hash-rustc-version/b.rs
Normal file
8
src/test/run-make-fulldeps/crate-hash-rustc-version/b.rs
Normal file
@ -0,0 +1,8 @@
|
||||
extern crate a;
|
||||
|
||||
use a::foo;
|
||||
|
||||
fn main() {
|
||||
let x = String::from("Hello");
|
||||
println!("{}", foo(x));
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB0_8UnsignedKhb_E)
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_8UnsignedKhb_E)
|
||||
--> $DIR/const-generics-demangling.rs:8:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -16,7 +16,7 @@ error: demangling-alt(<c::Unsigned<11>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB2_6SignedKsn98_E)
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_6SignedKsn98_E)
|
||||
--> $DIR/const-generics-demangling.rs:16:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -34,7 +34,7 @@ error: demangling-alt(<c::Signed<-152>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB3_4BoolKb1_E)
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_4BoolKb1_E)
|
||||
--> $DIR/const-generics-demangling.rs:24:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -52,7 +52,7 @@ error: demangling-alt(<c::Bool<true>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB3_4CharKc2202_E)
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_4CharKc2202_E)
|
||||
--> $DIR/const-generics-demangling.rs:32:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB0_3StrKRe616263_E)
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_3StrKRe616263_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:9:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -16,7 +16,7 @@ error: demangling-alt(<c::Str<"abc">>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB2_3StrKRe27_E)
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_3StrKRe27_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:15:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -34,7 +34,7 @@ error: demangling-alt(<c::Str<"'">>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB3_3StrKRe090a_E)
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_3StrKRe090a_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:21:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -52,7 +52,7 @@ error: demangling-alt(<c::Str<"\t\n">>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB3_3StrKRee28882c3bc_E)
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_3StrKRee28882c3bc_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:27:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -70,7 +70,7 @@ error: demangling-alt(<c::Str<"∂ü">>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB3_3StrKRee183a1e18390e183ade1839be18394e1839ae18390e183935fe18392e18394e1839be183a0e18398e18394e1839ae183985fe183a1e18390e18393e18398e1839ae18398_E)
|
||||
error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB<REF>_3StrKRee183a1e18390e183ade1839be18394e1839ae18390e183935fe18392e18394e1839be183a0e18398e18394e1839ae183985fe183a1e18390e18393e18398e1839ae18398_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:33:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -88,7 +88,7 @@ error: demangling-alt(<c::Str<"საჭმელად_გემრიელი
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB3_3StrKRef09f908af09fa688f09fa686f09f90ae20c2a720f09f90b6f09f9192e29895f09f94a520c2a720f09fa7a1f09f929bf09f929af09f9299f09f929c_E)
|
||||
error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB<REF>_3StrKRef09f908af09fa688f09fa686f09f90ae20c2a720f09f90b6f09f9192e29895f09f94a520c2a720f09fa7a1f09f929bf09f929af09f9299f09f929c_E)
|
||||
--> $DIR/const-generics-str-demangling.rs:39:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB0_7RefByteKRh7b_E)
|
||||
error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_7RefByteKRh7b_E)
|
||||
--> $DIR/const-generics-structural-demangling.rs:14:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -16,7 +16,7 @@ error: demangling-alt(<c::RefByte<{&123}>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB2_6RefZstKRAEE)
|
||||
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_6RefZstKRAEE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:24:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -34,7 +34,7 @@ error: demangling-alt(<c::RefZst<{&[]}>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB3_11Array3BytesKAh1_h2_h3_EE)
|
||||
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_11Array3BytesKAh1_h2_h3_EE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:32:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -52,7 +52,7 @@ error: demangling-alt(<c::Array3Bytes<{[1, 2, 3]}>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB3_13TupleByteBoolKTh1_b0_EE)
|
||||
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_13TupleByteBoolKTh1_b0_EE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:40:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -70,7 +70,7 @@ error: demangling-alt(<c::TupleByteBool<{(1, false)}>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB3_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4NoneUE)
|
||||
error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB<REF>_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4NoneUE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:50:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -88,7 +88,7 @@ error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::None}>>)
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB3_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4SomeTj0_EE)
|
||||
error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB<REF>_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4SomeTj0_EE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:58:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -106,7 +106,7 @@ error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::Some(0)}>>
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs4_CsCRATE_HASH_1cINtB3_4Foo_KVNtB3_3FooS1sRe616263_2chc78_5sliceRAh1_h2_h3_EEE)
|
||||
error: symbol-name(_RMs4_CsCRATE_HASH_1cINtB<REF>_4Foo_KVNtB<REF>_3FooS1sRe616263_2chc78_5sliceRAh1_h2_h3_EEE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:72:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -124,7 +124,7 @@ error: demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RMs9_CsCRATE_HASH_1cINtB3_4Bar_KVNtB3_3BarS1xh7b_s_1xt1000_EE)
|
||||
error: symbol-name(_RMs9_CsCRATE_HASH_1cINtB<REF>_4Bar_KVNtB<REF>_3BarS1xh7b_s_1xt1000_EE)
|
||||
--> $DIR/const-generics-structural-demangling.rs:88:5
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13fooNtB2_3Foo3bar)
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13fooNtB<REF>_3Foo3bar)
|
||||
--> $DIR/impl1.rs:14:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -22,7 +22,7 @@ error: def-path(foo::Foo::bar)
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13barNtNtB4_3foo3Foo3baz)
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13barNtNtB<REF>_3foo3Foo3baz)
|
||||
--> $DIR/impl1.rs:32:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -46,7 +46,7 @@ error: def-path(bar::<impl foo::Foo>::baz)
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RNvXNCNvCsCRATE_HASH_5impl14mains_0ARDNtB6_3Foop5AssocFG_KCRL0_hvEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method)
|
||||
error: symbol-name(_RNvXNCNvCsCRATE_HASH_5impl14mains_0ARDNtB<REF>_3Foop5AssocFG_KCRL0_hvEuNtB<REF>_9AutoTraitEL_j3_NtB<REF>_3Bar6method)
|
||||
--> $DIR/impl1.rs:62:13
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_11issue_609253fooINtB2_3FooNtNtB4_4llvm3FooE3foo)
|
||||
error: symbol-name(_RNvMNtCsCRATE_HASH_11issue_609253fooINtB<REF>_3FooNtNtB<REF>_4llvm3FooE3foo)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RNvXINICsCRATE_HASH_11issue_75326s_0pppEINtB5_3FooppENtB5_9Iterator24nextB5_)
|
||||
error: symbol-name(_RNvXINICsCRATE_HASH_11issue_75326s_0pppEINtB<REF>_3FooppENtB<REF>_9Iterator24nextB<REF>_)
|
||||
--> $DIR/issue-75326.rs:41:5
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: symbol-name(_RNvXCsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuEL_NtB2_3Bar6method)
|
||||
error: symbol-name(_RNvXCsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuEL_NtB<REF>_3Bar6method)
|
||||
--> $DIR/trait-objects.rs:15:5
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -16,7 +16,7 @@ error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RNvXs_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBI_6marker4SendEL_NtB4_3Foo6method)
|
||||
error: symbol-name(_RNvXs_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtB<REF>_6marker4SendEL_NtB<REF>_3Foo6method)
|
||||
--> $DIR/trait-objects.rs:27:5
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
@ -34,7 +34,7 @@ error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RNvXs0_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBJ_6marker4SendEL_NtB5_3Baz6method)
|
||||
error: symbol-name(_RNvXs0_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtB<REF>_6marker4SendEL_NtB<REF>_3Baz6method)
|
||||
--> $DIR/trait-objects.rs:39:5
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
|
@ -3513,6 +3513,9 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
|
||||
const V0_CRATE_HASH_PREFIX_REGEX: &str = r"_R.*?Cs[0-9a-zA-Z]+_";
|
||||
const V0_CRATE_HASH_REGEX: &str = r"Cs[0-9a-zA-Z]+_";
|
||||
const V0_CRATE_HASH_PLACEHOLDER: &str = r"CsCRATE_HASH_";
|
||||
const V0_BACK_REF_PREFIX_REGEX: &str = r"\(_R.*?B[0-9a-zA-Z]_";
|
||||
const V0_BACK_REF_REGEX: &str = r"B[0-9a-zA-Z]_";
|
||||
const V0_BACK_REF_PLACEHOLDER: &str = r"B<REF>_";
|
||||
const LEGACY_SYMBOL_HASH_REGEX: &str = r"h[\w]{16}E?\)";
|
||||
const LEGACY_SYMBOL_HASH_PLACEHOLDER: &str = r"h<SYMBOL_HASH>)";
|
||||
let test_name = self
|
||||
@ -3547,6 +3550,16 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
|
||||
.replace_all(&normalized, V0_CRATE_HASH_PLACEHOLDER)
|
||||
.into_owned();
|
||||
}
|
||||
let back_ref_prefix_re = Regex::new(V0_BACK_REF_PREFIX_REGEX).unwrap();
|
||||
if back_ref_prefix_re.is_match(&normalized) {
|
||||
// Normalize back references (see RFC 2603)
|
||||
let back_ref_regex = format!("{}", V0_BACK_REF_REGEX);
|
||||
let back_ref_placeholder = format!("{}", V0_BACK_REF_PLACEHOLDER);
|
||||
normalized = Regex::new(&back_ref_regex)
|
||||
.unwrap()
|
||||
.replace_all(&normalized, back_ref_placeholder)
|
||||
.into_owned();
|
||||
}
|
||||
// Normalize legacy mangled symbols
|
||||
normalized = Regex::new(LEGACY_SYMBOL_HASH_REGEX)
|
||||
.unwrap()
|
||||
|
Loading…
Reference in New Issue
Block a user