Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #41246

Merged
merged 27 commits into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
768e707
kill the `CheckLoops` DepNode
nikomatsakis Apr 4, 2017
f3b876c
kill `CheckStaticRecursion`
nikomatsakis Apr 4, 2017
a83734d
remove `EffectCheck`
nikomatsakis Apr 4, 2017
a2a4fad
kill `Liveness`
nikomatsakis Apr 4, 2017
a4d7c1f
push `borrowck` into its own task
nikomatsakis Apr 4, 2017
44e414c
Use proper span for tuple index parsed as float
estebank Apr 5, 2017
d94f2c9
Update cargo submodules
alexcrichton Apr 8, 2017
0303a33
Fix pairs of doubles using an illegal <8 x i8> vector.
eddyb Apr 10, 2017
384ec80
store Spans for all MIR locals
arielb1 Apr 11, 2017
0144613
Move rvalue checking to MIR
arielb1 Apr 11, 2017
540a069
address review comments
arielb1 Apr 11, 2017
2389830
Highlight and simplify mismatched types
estebank Feb 17, 2017
ed7b6c3
Minor nits in primitive str
projektir Apr 12, 2017
f391451
COPYRIGHT: remove hoedown license
nodakai Apr 10, 2017
2e327a6
fix nit
nikomatsakis Apr 12, 2017
c008cd7
Make compiletest write test output to different files for different r…
michaelwoerister Apr 6, 2017
bc7af81
ICH: Hash everything that gets encoded into crate metadata.
michaelwoerister Apr 5, 2017
ca2dce9
ICH: Replace old, transitive metadata hashing with direct hashing app…
michaelwoerister Apr 5, 2017
49082ae
Rollup merge of #41063 - nikomatsakis:issue-40746-always-exec-loops, …
TimNN Apr 12, 2017
918e35a
Rollup merge of #41087 - estebank:tuple-float-index, r=arielb1
TimNN Apr 12, 2017
1b006b7
Rollup merge of #41141 - michaelwoerister:direct-metadata-ich-final, …
TimNN Apr 12, 2017
9275c9c
Rollup merge of #41166 - alexcrichton:update-cargo, r=brson
TimNN Apr 12, 2017
5c23e70
Rollup merge of #41183 - nodakai:remove-hoedown-license, r=TimNN
TimNN Apr 12, 2017
afb300d
Rollup merge of #41205 - estebank:shorter-mismatched-types-2, r=nikom…
TimNN Apr 12, 2017
092f19a
Rollup merge of #41206 - eddyb:avoid-illegal-vectors, r=nagisa
TimNN Apr 12, 2017
1dd9801
Rollup merge of #41232 - arielb1:mir-rvalues, r=eddyb
TimNN Apr 12, 2017
d4d35cf
Rollup merge of #41243 - projektir:prim_str_docs, r=GuillaumeGomez
TimNN Apr 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -197,28 +197,6 @@ their own copyright notices and license terms:
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.

* Hoedown, the markdown parser, under src/rt/hoedown, is
licensed as follows.

Copyright (c) 2008, Natacha Porté
Copyright (c) 2011, Vicent Martí
Copyright (c) 2013, Devin Torres and the Hoedown authors

Permission to use, copy, modify, and distribute this
software for any purpose with or without fee is hereby
granted, provided that the above copyright notice and
this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

* libbacktrace, under src/libbacktrace:

Copyright (C) 2012-2014 Free Software Foundation, Inc.
Expand Down
37 changes: 24 additions & 13 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ impl str {

/// Returns a subslice of `str`.
///
/// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
/// equivalent indexing operation would panic.
/// This is the non-panicking alternative to indexing the `str`. Returns
/// [`None`] whenever equivalent indexing operation would panic.
///
/// [`None`]: option/enum.Option.html#variant.None
///
/// # Examples
///
Expand All @@ -346,8 +348,10 @@ impl str {

/// Returns a mutable subslice of `str`.
///
/// This is the non-panicking alternative to indexing the `str`. Returns `None` whenever
/// equivalent indexing operation would panic.
/// This is the non-panicking alternative to indexing the `str`. Returns
/// [`None`] whenever equivalent indexing operation would panic.
///
/// [`None`]: option/enum.Option.html#variant.None
///
/// # Examples
///
Expand Down Expand Up @@ -570,7 +574,7 @@ impl str {
core_str::StrExt::split_at_mut(self, mid)
}

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

/// Parses this string slice into another type.
///
/// Because `parse()` is so general, it can cause problems with type
/// inference. As such, `parse()` is one of the few times you'll see
/// Because `parse` is so general, it can cause problems with type
/// inference. As such, `parse` is one of the few times you'll see
/// the syntax affectionately known as the 'turbofish': `::<>`. This
/// helps the inference algorithm understand specifically which type
/// you're trying to parse into.
///
/// `parse()` can parse any type that implements the [`FromStr`] trait.
/// `parse` can parse any type that implements the [`FromStr`] trait.
///
/// [`FromStr`]: str/trait.FromStr.html
///
Expand Down Expand Up @@ -1746,7 +1750,7 @@ impl str {
///
/// `replacen` creates a new [`String`], and copies the data from this string slice into it.
/// While doing so, it attempts to find matches of a pattern. If it finds any, it
/// replaces them with the replacement string slice at most `N` times.
/// replaces them with the replacement string slice at most `count` times.
///
/// [`String`]: string/struct.String.html
///
Expand Down Expand Up @@ -1892,33 +1896,40 @@ impl str {
return s;
}

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

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

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

/// Converts a `Box<str>` into a [`String`] without copying or allocating.
/// Converts a [`Box<str>`] into a [`String`] without copying or allocating.
///
/// [`String`]: string/struct.String.html
/// [`Box<str>`]: boxed/struct.Box.html
///
/// # Examples
///
Expand Down
8 changes: 0 additions & 8 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,13 @@ pub enum DepNode<D: Clone + Debug> {

// Represents different phases in the compiler.
CollectLanguageItems,
CheckStaticRecursion,
ResolveLifetimes,
RegionResolveCrate,
CheckLoops,
PluginRegistrar,
StabilityIndex,
CollectItem(D),
CollectItemSig(D),
Coherence,
EffectCheck,
Liveness,
Resolve,
EntryPoint,
CheckEntryFn,
Expand Down Expand Up @@ -216,15 +212,11 @@ impl<D: Clone + Debug> DepNode<D> {
MirKrate => Some(MirKrate),
TypeckBodiesKrate => Some(TypeckBodiesKrate),
CollectLanguageItems => Some(CollectLanguageItems),
CheckStaticRecursion => Some(CheckStaticRecursion),
ResolveLifetimes => Some(ResolveLifetimes),
RegionResolveCrate => Some(RegionResolveCrate),
CheckLoops => Some(CheckLoops),
PluginRegistrar => Some(PluginRegistrar),
StabilityIndex => Some(StabilityIndex),
Coherence => Some(Coherence),
EffectCheck => Some(EffectCheck),
Liveness => Some(Liveness),
Resolve => Some(Resolve),
EntryPoint => Some(EntryPoint),
CheckEntryFn => Some(CheckEntryFn),
Expand Down
21 changes: 21 additions & 0 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,27 @@ impl<'hir> Map<'hir> {
self.local_def_id(self.body_owner(id))
}

/// Given a body owner's id, returns the `BodyId` associated with it.
pub fn body_owned_by(&self, id: NodeId) -> BodyId {
if let Some(entry) = self.find_entry(id) {
if let Some(body_id) = entry.associated_body() {
// For item-like things and closures, the associated
// body has its own distinct id, and that is returned
// by `associated_body`.
body_id
} else {
// For some expressions, the expression is its own body.
if let EntryExpr(_, expr) = entry {
BodyId { node_id: expr.id }
} else {
span_bug!(self.span(id), "id `{}` has no associated body", id);
}
}
} else {
bug!("no entry for id `{}`", id)
}
}

pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
match self.get(id) {
NodeItem(&Item { node: ItemTrait(..), .. }) => id,
Expand Down
52 changes: 52 additions & 0 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ use hir::def_id::DefId;
use ich::{self, CachingCodemapView};
use session::config::DebugInfoLevel::NoDebugInfo;
use ty;
use util::nodemap::NodeMap;

use std::hash as std_hash;
use std::collections::{HashMap, HashSet};

use syntax::ast;
use syntax::attr;
Expand Down Expand Up @@ -296,3 +298,53 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for Span {
}
}
}

pub fn hash_stable_hashmap<'a, 'tcx, K, V, R, SK, F, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>,
map: &HashMap<K, V, R>,
extract_stable_key: F)
where K: Eq + std_hash::Hash,
V: HashStable<StableHashingContext<'a, 'tcx>>,
R: std_hash::BuildHasher,
SK: HashStable<StableHashingContext<'a, 'tcx>> + Ord + Clone,
F: Fn(&mut StableHashingContext<'a, 'tcx>, &K) -> SK,
W: StableHasherResult,
{
let mut keys: Vec<_> = map.keys()
.map(|k| (extract_stable_key(hcx, k), k))
.collect();
keys.sort_unstable_by_key(|&(ref stable_key, _)| stable_key.clone());
keys.len().hash_stable(hcx, hasher);
for (stable_key, key) in keys {
stable_key.hash_stable(hcx, hasher);
map[key].hash_stable(hcx, hasher);
}
}

pub fn hash_stable_hashset<'a, 'tcx, K, R, SK, F, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>,
set: &HashSet<K, R>,
extract_stable_key: F)
where K: Eq + std_hash::Hash,
R: std_hash::BuildHasher,
SK: HashStable<StableHashingContext<'a, 'tcx>> + Ord + Clone,
F: Fn(&mut StableHashingContext<'a, 'tcx>, &K) -> SK,
W: StableHasherResult,
{
let mut keys: Vec<_> = set.iter()
.map(|k| extract_stable_key(hcx, k))
.collect();
keys.sort_unstable();
keys.hash_stable(hcx, hasher);
}

pub fn hash_stable_nodemap<'a, 'tcx, V, W>(hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>,
map: &NodeMap<V>)
where V: HashStable<StableHashingContext<'a, 'tcx>>,
W: StableHasherResult,
{
hash_stable_hashmap(hcx, hasher, map, |hcx, node_id| {
hcx.tcx.hir.definitions().node_to_hir_id(*node_id).local_id
});
}
3 changes: 2 additions & 1 deletion src/librustc/ich/impls_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ impl_stable_hash_for!(struct mir::SourceInfo { span, scope });
impl_stable_hash_for!(enum mir::Mutability { Mut, Not });
impl_stable_hash_for!(enum mir::BorrowKind { Shared, Unique, Mut });
impl_stable_hash_for!(enum mir::LocalKind { Var, Temp, Arg, ReturnPointer });
impl_stable_hash_for!(struct mir::LocalDecl<'tcx> { mutability, ty, name, source_info });
impl_stable_hash_for!(struct mir::LocalDecl<'tcx> { mutability, ty, name, source_info,
is_user_variable});
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref });
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
impl_stable_hash_for!(struct mir::Terminator<'tcx> { source_info, kind });
Expand Down
Loading