diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-08-07 22:30:39 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-08-09 11:44:21 -0700 |
| commit | c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5 (patch) | |
| tree | 9715e57405ae14bd7877dec129bce733daf72dc1 /src/libsyntax_pos | |
| parent | cc4ff8f4d169562ff4ae22b94197a191215e6d56 (diff) | |
| parent | c5e2051f070c01241f68720a92a0957bcb070597 (diff) | |
| download | rust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.tar.gz rust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.zip | |
Merge remote-tracking branch 'origin/master' into gen
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 3a701f91314..7006f45455e 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -618,8 +618,11 @@ impl FileMap { /// If the hash of the input doesn't match or no input is supplied via None, /// it is interpreted as an error and the corresponding enum variant is set. /// The return value signifies whether some kind of source is present. - pub fn add_external_src(&self, src: Option<String>) -> bool { + pub fn add_external_src<F>(&self, get_src: F) -> bool + where F: FnOnce() -> Option<String> + { if *self.external_src.borrow() == ExternalSource::AbsentOk { + let src = get_src(); let mut external_src = self.external_src.borrow_mut(); if let Some(src) = src { let mut hasher: StableHasher<u128> = StableHasher::new(); diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index debac70545a..e49f1f28e5f 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -326,7 +326,7 @@ fn with_interner<T, F: FnOnce(&mut Interner) -> T>(f: F) -> T { /// destroyed. In particular, they must not access string contents. This can /// be fixed in the future by just leaking all strings until thread death /// somehow. -#[derive(Clone, Hash, PartialOrd, Eq, Ord)] +#[derive(Clone, Copy, Hash, PartialOrd, Eq, Ord)] pub struct InternedString { string: &'static str, } |
