Skip to content

Commit 910c481

Browse files
committed
Auto merge of #41246 - TimNN:rollup, r=TimNN
Rollup of 9 pull requests - Successful merges: #41063, #41087, #41141, #41166, #41183, #41205, #41206, #41232, #41243 - Failed merges:
2 parents 1dca19a + d4d35cf commit 910c481

File tree

94 files changed

+2049
-724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2049
-724
lines changed

COPYRIGHT

-22
Original file line numberDiff line numberDiff line change
@@ -197,28 +197,6 @@ their own copyright notices and license terms:
197197
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
198198
OF SUCH DAMAGE.
199199

200-
* Hoedown, the markdown parser, under src/rt/hoedown, is
201-
licensed as follows.
202-
203-
Copyright (c) 2008, Natacha Porté
204-
Copyright (c) 2011, Vicent Martí
205-
Copyright (c) 2013, Devin Torres and the Hoedown authors
206-
207-
Permission to use, copy, modify, and distribute this
208-
software for any purpose with or without fee is hereby
209-
granted, provided that the above copyright notice and
210-
this permission notice appear in all copies.
211-
212-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
213-
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
214-
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
215-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
216-
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
217-
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
218-
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
219-
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
220-
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
221-
222200
* libbacktrace, under src/libbacktrace:
223201

224202
Copyright (C) 2012-2014 Free Software Foundation, Inc.

src/libcollections/str.rs

+24-13
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ impl str {
325325

326326
/// Returns a subslice of `str`.
327327
///
328-
/// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
329-
/// equivalent indexing operation would panic.
328+
/// This is the non-panicking alternative to indexing the `str`. Returns
329+
/// [`None`] whenever equivalent indexing operation would panic.
330+
///
331+
/// [`None`]: option/enum.Option.html#variant.None
330332
///
331333
/// # Examples
332334
///
@@ -346,8 +348,10 @@ impl str {
346348

347349
/// Returns a mutable subslice of `str`.
348350
///
349-
/// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
350-
/// equivalent indexing operation would panic.
351+
/// This is the non-panicking alternative to indexing the `str`. Returns
352+
/// [`None`] whenever equivalent indexing operation would panic.
353+
///
354+
/// [`None`]: option/enum.Option.html#variant.None
351355
///
352356
/// # Examples
353357
///
@@ -570,7 +574,7 @@ impl str {
570574
core_str::StrExt::split_at_mut(self, mid)
571575
}
572576

573-
/// Returns an iterator over the `char`s of a string slice.
577+
/// Returns an iterator over the [`char`]s of a string slice.
574578
///
575579
/// As a string slice consists of valid UTF-8, we can iterate through a
576580
/// string slice by [`char`]. This method returns such an iterator.
@@ -1657,13 +1661,13 @@ impl str {
16571661

16581662
/// Parses this string slice into another type.
16591663
///
1660-
/// Because `parse()` is so general, it can cause problems with type
1661-
/// inference. As such, `parse()` is one of the few times you'll see
1664+
/// Because `parse` is so general, it can cause problems with type
1665+
/// inference. As such, `parse` is one of the few times you'll see
16621666
/// the syntax affectionately known as the 'turbofish': `::<>`. This
16631667
/// helps the inference algorithm understand specifically which type
16641668
/// you're trying to parse into.
16651669
///
1666-
/// `parse()` can parse any type that implements the [`FromStr`] trait.
1670+
/// `parse` can parse any type that implements the [`FromStr`] trait.
16671671
///
16681672
/// [`FromStr`]: str/trait.FromStr.html
16691673
///
@@ -1746,7 +1750,7 @@ impl str {
17461750
///
17471751
/// `replacen` creates a new [`String`], and copies the data from this string slice into it.
17481752
/// While doing so, it attempts to find matches of a pattern. If it finds any, it
1749-
/// replaces them with the replacement string slice at most `N` times.
1753+
/// replaces them with the replacement string slice at most `count` times.
17501754
///
17511755
/// [`String`]: string/struct.String.html
17521756
///
@@ -1892,33 +1896,40 @@ impl str {
18921896
return s;
18931897
}
18941898

1895-
/// Escapes each char in `s` with `char::escape_debug`.
1899+
/// Escapes each char in `s` with [`char::escape_debug`].
1900+
///
1901+
/// [`char::escape_debug`]: primitive.char.html#method.escape_debug
18961902
#[unstable(feature = "str_escape",
18971903
reason = "return type may change to be an iterator",
18981904
issue = "27791")]
18991905
pub fn escape_debug(&self) -> String {
19001906
self.chars().flat_map(|c| c.escape_debug()).collect()
19011907
}
19021908

1903-
/// Escapes each char in `s` with `char::escape_default`.
1909+
/// Escapes each char in `s` with [`char::escape_default`].
1910+
///
1911+
/// [`char::escape_default`]: primitive.char.html#method.escape_default
19041912
#[unstable(feature = "str_escape",
19051913
reason = "return type may change to be an iterator",
19061914
issue = "27791")]
19071915
pub fn escape_default(&self) -> String {
19081916
self.chars().flat_map(|c| c.escape_default()).collect()
19091917
}
19101918

1911-
/// Escapes each char in `s` with `char::escape_unicode`.
1919+
/// Escapes each char in `s` with [`char::escape_unicode`].
1920+
///
1921+
/// [`char::escape_unicode`]: primitive.char.html#method.escape_unicode
19121922
#[unstable(feature = "str_escape",
19131923
reason = "return type may change to be an iterator",
19141924
issue = "27791")]
19151925
pub fn escape_unicode(&self) -> String {
19161926
self.chars().flat_map(|c| c.escape_unicode()).collect()
19171927
}
19181928

1919-
/// Converts a `Box<str>` into a [`String`] without copying or allocating.
1929+
/// Converts a [`Box<str>`] into a [`String`] without copying or allocating.
19201930
///
19211931
/// [`String`]: string/struct.String.html
1932+
/// [`Box<str>`]: boxed/struct.Box.html
19221933
///
19231934
/// # Examples
19241935
///

src/librustc/dep_graph/dep_node.rs

-8
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ pub enum DepNode<D: Clone + Debug> {
5757

5858
// Represents different phases in the compiler.
5959
CollectLanguageItems,
60-
CheckStaticRecursion,
6160
ResolveLifetimes,
6261
RegionResolveCrate,
63-
CheckLoops,
6462
PluginRegistrar,
6563
StabilityIndex,
6664
CollectItem(D),
6765
CollectItemSig(D),
6866
Coherence,
69-
EffectCheck,
70-
Liveness,
7167
Resolve,
7268
EntryPoint,
7369
CheckEntryFn,
@@ -216,15 +212,11 @@ impl<D: Clone + Debug> DepNode<D> {
216212
MirKrate => Some(MirKrate),
217213
TypeckBodiesKrate => Some(TypeckBodiesKrate),
218214
CollectLanguageItems => Some(CollectLanguageItems),
219-
CheckStaticRecursion => Some(CheckStaticRecursion),
220215
ResolveLifetimes => Some(ResolveLifetimes),
221216
RegionResolveCrate => Some(RegionResolveCrate),
222-
CheckLoops => Some(CheckLoops),
223217
PluginRegistrar => Some(PluginRegistrar),
224218
StabilityIndex => Some(StabilityIndex),
225219
Coherence => Some(Coherence),
226-
EffectCheck => Some(EffectCheck),
227-
Liveness => Some(Liveness),
228220
Resolve => Some(Resolve),
229221
EntryPoint => Some(EntryPoint),
230222
CheckEntryFn => Some(CheckEntryFn),

src/librustc/hir/map/mod.rs

+21
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,27 @@ impl<'hir> Map<'hir> {
442442
self.local_def_id(self.body_owner(id))
443443
}
444444

445+
/// Given a body owner's id, returns the `BodyId` associated with it.
446+
pub fn body_owned_by(&self, id: NodeId) -> BodyId {
447+
if let Some(entry) = self.find_entry(id) {
448+
if let Some(body_id) = entry.associated_body() {
449+
// For item-like things and closures, the associated
450+
// body has its own distinct id, and that is returned
451+
// by `associated_body`.
452+
body_id
453+
} else {
454+
// For some expressions, the expression is its own body.
455+
if let EntryExpr(_, expr) = entry {
456+
BodyId { node_id: expr.id }
457+
} else {
458+
span_bug!(self.span(id), "id `{}` has no associated body", id);
459+
}
460+
}
461+
} else {
462+
bug!("no entry for id `{}`", id)
463+
}
464+
}
465+
445466
pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
446467
match self.get(id) {
447468
NodeItem(&Item { node: ItemTrait(..), .. }) => id,

src/librustc/ich/hcx.rs

+52
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ use hir::def_id::DefId;
1313
use ich::{self, CachingCodemapView};
1414
use session::config::DebugInfoLevel::NoDebugInfo;
1515
use ty;
16+
use util::nodemap::NodeMap;
1617

1718
use std::hash as std_hash;
19+
use std::collections::{HashMap, HashSet};
1820

1921
use syntax::ast;
2022
use syntax::attr;
@@ -296,3 +298,53 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for Span {
296298
}
297299
}
298300
}
301+
302+
pub fn hash_stable_hashmap<'a, 'tcx, K, V, R, SK, F, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
303+
hasher: &mut StableHasher<W>,
304+
map: &HashMap<K, V, R>,
305+
extract_stable_key: F)
306+
where K: Eq + std_hash::Hash,
307+
V: HashStable<StableHashingContext<'a, 'tcx>>,
308+
R: std_hash::BuildHasher,
309+
SK: HashStable<StableHashingContext<'a, 'tcx>> + Ord + Clone,
310+
F: Fn(&mut StableHashingContext<'a, 'tcx>, &K) -> SK,
311+
W: StableHasherResult,
312+
{
313+
let mut keys: Vec<_> = map.keys()
314+
.map(|k| (extract_stable_key(hcx, k), k))
315+
.collect();
316+
keys.sort_unstable_by_key(|&(ref stable_key, _)| stable_key.clone());
317+
keys.len().hash_stable(hcx, hasher);
318+
for (stable_key, key) in keys {
319+
stable_key.hash_stable(hcx, hasher);
320+
map[key].hash_stable(hcx, hasher);
321+
}
322+
}
323+
324+
pub fn hash_stable_hashset<'a, 'tcx, K, R, SK, F, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
325+
hasher: &mut StableHasher<W>,
326+
set: &HashSet<K, R>,
327+
extract_stable_key: F)
328+
where K: Eq + std_hash::Hash,
329+
R: std_hash::BuildHasher,
330+
SK: HashStable<StableHashingContext<'a, 'tcx>> + Ord + Clone,
331+
F: Fn(&mut StableHashingContext<'a, 'tcx>, &K) -> SK,
332+
W: StableHasherResult,
333+
{
334+
let mut keys: Vec<_> = set.iter()
335+
.map(|k| extract_stable_key(hcx, k))
336+
.collect();
337+
keys.sort_unstable();
338+
keys.hash_stable(hcx, hasher);
339+
}
340+
341+
pub fn hash_stable_nodemap<'a, 'tcx, V, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
342+
hasher: &mut StableHasher<W>,
343+
map: &NodeMap<V>)
344+
where V: HashStable<StableHashingContext<'a, 'tcx>>,
345+
W: StableHasherResult,
346+
{
347+
hash_stable_hashmap(hcx, hasher, map, |hcx, node_id| {
348+
hcx.tcx.hir.definitions().node_to_hir_id(*node_id).local_id
349+
});
350+
}

src/librustc/ich/impls_mir.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ impl_stable_hash_for!(struct mir::SourceInfo { span, scope });
2222
impl_stable_hash_for!(enum mir::Mutability { Mut, Not });
2323
impl_stable_hash_for!(enum mir::BorrowKind { Shared, Unique, Mut });
2424
impl_stable_hash_for!(enum mir::LocalKind { Var, Temp, Arg, ReturnPointer });
25-
impl_stable_hash_for!(struct mir::LocalDecl<'tcx> { mutability, ty, name, source_info });
25+
impl_stable_hash_for!(struct mir::LocalDecl<'tcx> { mutability, ty, name, source_info,
26+
is_user_variable});
2627
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref });
2728
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
2829
impl_stable_hash_for!(struct mir::Terminator<'tcx> { source_info, kind });

0 commit comments

Comments
 (0)