Skip to content

Commit 2e8be8f

Browse files
committed
---
yaml --- r: 49531 b: refs/heads/master c: a919e5e h: refs/heads/master i: 49529: 66ce92e 49527: 57d9303 v: v3
1 parent 38b20f8 commit 2e8be8f

File tree

8 files changed

+101
-437
lines changed

8 files changed

+101
-437
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6f4273854438e8f9b034e1342f30392f70c0eaae
2+
refs/heads/master: a919e5ede5465cfab27cdc7cae59f2c015735753
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
55
refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea

trunk/configure

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,9 @@ validate_opt () {
136136
isArgValid=1
137137
fi
138138
done
139-
if [ "$arg" = "--help" ]
139+
if test $isArgValid -eq 0
140140
then
141-
echo ""
142-
echo "No more help available for Configure options,"
143-
echo "check the Uncyclo or join our IRC channel"
144-
break
145-
else
146-
if test $isArgValid -eq 0
147-
then
148-
err "Option '$arg' is not recognized"
149-
fi
141+
err "Option '$arg' is not recognized"
150142
fi
151143
done
152144
}
@@ -274,42 +266,13 @@ case $CFG_OSTYPE in
274266
MINGW32*)
275267
CFG_OSTYPE=pc-mingw32
276268
;;
277-
# Thad's Cygwin identifers below
278-
279-
# Vista 32 bit
280-
CYGWIN_NT-6.0)
281-
CFG_OSTYPE=pc-mingw32
282-
CFG_CPUTYPE=i686
283-
;;
284-
285-
# Vista 64 bit
286-
CYGWIN_NT-6.0-WOW64)
287-
CFG_OSTYPE=w64-mingw32
288-
CFG_CPUTYPE=x86_64
289-
;;
290-
291-
# Win 7 32 bit
292-
CYGWIN_NT-6.1)
293-
CFG_OSTYPE=pc-mingw32
294-
CFG_CPUTYPE=i686
295-
;;
296269

297-
# Win 7 64 bit
298-
CYGWIN_NT-6.1-WOW64)
299-
CFG_OSTYPE=w64-mingw32
300-
CFG_CPUTYPE=x86_64
301-
;;
302-
303-
# We do not detect other OS such as XP/2003 using 64 bit using uname.
304-
# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
305270
*)
306271
err "unknown OS type: $CFG_OSTYPE"
307272
;;
308273
esac
309274

310275

311-
if [ -z "$CFG_CPUTYPE" ]
312-
then
313276
case $CFG_CPUTYPE in
314277

315278
i386 | i486 | i686 | i786 | x86)
@@ -327,7 +290,6 @@ case $CFG_CPUTYPE in
327290
*)
328291
err "unknown CPU type: $CFG_CPUTYPE"
329292
esac
330-
fi
331293

332294
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
333295
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]

trunk/src/librustc/metadata/cstore.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,28 @@ pub fn find_extern_mod_stmt_cnum(cstore: @mut CStore,
141141
extern_mod_crate_map.find(&emod_id)
142142
}
143143

144-
// returns hashes of crates directly used by this crate. Hashes are
145-
// sorted by crate name.
144+
// returns hashes of crates directly used by this crate. Hashes are sorted by
145+
// (crate name, crate version, crate hash) in lexicographic order (not semver)
146146
pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
147-
struct crate_hash { name: @~str, hash: @~str }
147+
struct crate_hash { name: @~str, vers: @~str, hash: @~str }
148148
let mut result = ~[];
149149

150150
let extern_mod_crate_map = cstore.extern_mod_crate_map;
151151
for extern_mod_crate_map.each_value |&cnum| {
152152
let cdata = cstore::get_crate_data(cstore, cnum);
153153
let hash = decoder::get_crate_hash(cdata.data);
154-
debug!("Add hash[%s]: %s", *cdata.name, *hash);
154+
let vers = decoder::get_crate_vers(cdata.data);
155+
debug!("Add hash[%s]: %s %s", *cdata.name, *vers, *hash);
155156
result.push(crate_hash {
156157
name: cdata.name,
158+
vers: vers,
157159
hash: hash
158160
});
159161
}
160162

161-
let sorted = std::sort::merge_sort(result, |a, b| a.name <= b.name);
163+
let sorted = do std::sort::merge_sort(result) |a, b| {
164+
(a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash)
165+
};
162166

163167
debug!("sorted:");
164168
for sorted.each |x| {

trunk/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,8 +4741,8 @@ pub impl Resolver {
47414741
let mut j = this.value_ribs.len();
47424742
while j != 0 {
47434743
j -= 1;
4744-
for this.value_ribs[j].bindings.each_entry |e| {
4745-
vec::push(&mut maybes, copy *this.session.str_of(e.key));
4744+
for this.value_ribs[j].bindings.each_key |&k| {
4745+
vec::push(&mut maybes, copy *this.session.str_of(k));
47464746
vec::push(&mut values, uint::max_value);
47474747
}
47484748
}

trunk/src/librustc/middle/typeck/coherence.rs

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -104,32 +104,6 @@ pub fn get_base_type(inference_context: @mut InferCtxt,
104104
}
105105
}
106106

107-
pub fn type_is_defined_in_local_crate(original_type: t) -> bool {
108-
/*!
109-
*
110-
* For coherence, when we have `impl Trait for Type`, we need to
111-
* guarantee that `Type` is "local" to the
112-
* crate. For our purposes, this means that it must contain
113-
* some nominal type defined in this crate.
114-
*/
115-
116-
let mut found_nominal = false;
117-
do ty::walk_ty(original_type) |t| {
118-
match get(t).sty {
119-
ty_enum(def_id, _) |
120-
ty_trait(def_id, _, _) |
121-
ty_struct(def_id, _) => {
122-
if def_id.crate == ast::local_crate {
123-
found_nominal = true;
124-
}
125-
}
126-
127-
_ => { }
128-
}
129-
}
130-
return found_nominal;
131-
}
132-
133107
// Returns the def ID of the base type, if there is one.
134108
pub fn get_base_type_def_id(inference_context: @mut InferCtxt,
135109
span: span,
@@ -187,7 +161,8 @@ pub fn CoherenceChecker(crate_context: @mut CrateCtxt) -> CoherenceChecker {
187161
crate_context: crate_context,
188162
inference_context: new_infer_ctxt(crate_context.tcx),
189163
190-
base_type_def_ids: HashMap()
164+
base_type_def_ids: HashMap(),
165+
privileged_implementations: HashMap()
191166
}
192167
}
193168
@@ -199,6 +174,11 @@ pub struct CoherenceChecker {
199174
// definition ID.
200175
201176
base_type_def_ids: HashMap<def_id,def_id>,
177+
178+
// A set of implementations in privileged scopes; i.e. those
179+
// implementations that are defined in the same scope as their base types.
180+
181+
privileged_implementations: HashMap<node_id,()>,
202182
}
203183
204184
pub impl CoherenceChecker {
@@ -635,11 +615,27 @@ pub impl CoherenceChecker {
635615
visit_mod(module_, item.span, item.id, (), visitor);
636616
}
637617
item_impl(_, opt_trait, _, _) => {
638-
// `for_ty` is `Type` in `impl Trait for Type`
639-
let for_ty =
640-
ty::node_id_to_type(self.crate_context.tcx,
641-
item.id);
642-
if !type_is_defined_in_local_crate(for_ty) {
618+
let mut ok = false;
619+
match self.base_type_def_ids.find(
620+
&local_def(item.id)) {
621+
622+
None => {
623+
// Nothing to do.
624+
}
625+
Some(base_type_def_id) => {
626+
// Check to see whether the implementation is
627+
// in the same crate as its base type.
628+
629+
if base_type_def_id.crate == local_crate {
630+
// Record that this implementation is OK.
631+
self.privileged_implementations.insert
632+
(item.id, ());
633+
ok = true;
634+
}
635+
}
636+
}
637+
638+
if !ok {
643639
// This implementation is not in scope of its base
644640
// type. This still might be OK if the trait is
645641
// defined in the same crate.
@@ -659,24 +655,25 @@ pub impl CoherenceChecker {
659655
implement a trait or \
660656
new type instead");
661657
}
658+
_ => ()
659+
}
662660

663-
Some(trait_ref) => {
664-
// This is OK if and only if the trait was
665-
// defined in this crate.
666-
667-
let trait_def_id =
668-
self.trait_ref_to_trait_def_id(
669-
trait_ref);
670-
671-
if trait_def_id.crate != local_crate {
672-
let session = self.crate_context.tcx.sess;
673-
session.span_err(item.span,
674-
~"cannot provide an \
675-
extension \
676-
implementation for a \
677-
trait not defined in \
678-
this crate");
679-
}
661+
for opt_trait.each |trait_ref| {
662+
// This is OK if and only if the trait was
663+
// defined in this crate.
664+
665+
let trait_def_id =
666+
self.trait_ref_to_trait_def_id(
667+
*trait_ref);
668+
669+
if trait_def_id.crate != local_crate {
670+
let session = self.crate_context.tcx.sess;
671+
session.span_err(item.span,
672+
~"cannot provide an \
673+
extension \
674+
implementation for a \
675+
trait not defined in \
676+
this crate");
680677
}
681678
}
682679
}

0 commit comments

Comments
 (0)