Skip to content

Commit b188539

Browse files
committed
---
yaml --- r: 153035 b: refs/heads/try2 c: ccd7aaf h: refs/heads/master i: 153033: 9365c62 153031: 22b698d v: v3
1 parent bcd947d commit b188539

File tree

7 files changed

+112
-204
lines changed

7 files changed

+112
-204
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 67776ba3dab24a3e281931da437d30ccfc3b04c1
8+
refs/heads/try2: ccd7aaf17a4fa3c4851758ec70ffa755e25455be
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ script: |
4141
if [[ $LLVM_VERSION != '3.4' ]]; then exit 0; fi
4242
fi &&
4343
make tidy &&
44-
make -j4 rustc-stage1 RUSTFLAGS='-Z time-passes' &&
44+
travis_wait make -j4 rustc-stage1 &&
4545
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail check-stage1-doc
4646
4747
env:

branches/try2/src/etc/install.sh

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ need_ok() {
3535
fi
3636
}
3737

38+
need_cmd() {
39+
if command -v $1 >/dev/null 2>&1
40+
then msg "found $1"
41+
else err "need $1"
42+
fi
43+
}
44+
3845
putvar() {
3946
local T
4047
eval T=\$$1
@@ -198,6 +205,15 @@ absolutify() {
198205
ABSOLUTIFIED="${FILE_PATH}"
199206
}
200207

208+
msg "looking for install programs"
209+
need_cmd mkdir
210+
need_cmd printf
211+
need_cmd cut
212+
need_cmd grep
213+
need_cmd uname
214+
need_cmd tr
215+
need_cmd sed
216+
201217
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
202218
CFG_SELF="$0"
203219
CFG_ARGS="$@"
@@ -216,16 +232,65 @@ else
216232
step_msg "processing $CFG_SELF args"
217233
fi
218234

235+
# Check for mingw or cygwin in order to special case $CFG_LIBDIR_RELATIVE.
236+
# This logic is duplicated from configure in order to get the correct libdir
237+
# for Windows installs.
238+
CFG_OSTYPE=$(uname -s)
239+
240+
case $CFG_OSTYPE in
241+
242+
MINGW32*)
243+
CFG_OSTYPE=pc-mingw32
244+
;;
245+
246+
MINGW64*)
247+
# msys2, MSYSTEM=MINGW64
248+
CFG_OSTYPE=w64-mingw32
249+
;;
250+
251+
# Thad's Cygwin identifers below
252+
253+
# Vista 32 bit
254+
CYGWIN_NT-6.0)
255+
CFG_OSTYPE=pc-mingw32
256+
;;
257+
258+
# Vista 64 bit
259+
CYGWIN_NT-6.0-WOW64)
260+
CFG_OSTYPE=w64-mingw32
261+
;;
262+
263+
# Win 7 32 bit
264+
CYGWIN_NT-6.1)
265+
CFG_OSTYPE=pc-mingw32
266+
;;
267+
268+
# Win 7 64 bit
269+
CYGWIN_NT-6.1-WOW64)
270+
CFG_OSTYPE=w64-mingw32
271+
;;
272+
esac
273+
219274
OPTIONS=""
220275
BOOL_OPTIONS=""
221276
VAL_OPTIONS=""
222277

278+
# On windows we just store the libraries in the bin directory because
279+
# there's no rpath. This is where the build system itself puts libraries;
280+
# --libdir is used to configure the installation directory.
281+
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
282+
CFG_LIBDIR_RELATIVE=lib
283+
if [ "$CFG_OSTYPE" = "pc-mingw32" ] || [ "$CFG_OSTYPE" = "w64-mingw32" ]
284+
then
285+
CFG_LIBDIR_RELATIVE=bin
286+
fi
287+
223288
flag uninstall "only uninstall from the installation prefix"
224289
opt verify 1 "verify that the installed binaries run correctly"
225290
valopt prefix "/usr/local" "set installation prefix"
226291
# NB This isn't quite the same definition as in `configure`.
227292
# just using 'lib' instead of CFG_LIBDIR_RELATIVE
228-
valopt libdir "${CFG_PREFIX}/lib" "install libraries"
293+
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
229294
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
230295

231296
if [ $HELP -eq 1 ]
@@ -384,7 +449,7 @@ while read p; do
384449
need_ok "failed to update manifest"
385450

386451
# The manifest lists all files to install
387-
done < "${CFG_SRC_DIR}/lib/rustlib/manifest.in"
452+
done < "${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}/rustlib/manifest.in"
388453

389454
# Sanity check: can we run the installed binaries?
390455
if [ -z "${CFG_DISABLE_VERIFY}" ]

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 43 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,49 @@ fn compare_impl_method(tcx: &ty::ctxt,
920920
let it = trait_m.generics.types.get_vec(subst::FnSpace).iter()
921921
.zip(impl_m.generics.types.get_vec(subst::FnSpace).iter());
922922

923+
for (i, (trait_param_def, impl_param_def)) in it.enumerate() {
924+
// Check that the impl does not require any builtin-bounds
925+
// that the trait does not guarantee:
926+
let extra_bounds =
927+
impl_param_def.bounds.builtin_bounds -
928+
trait_param_def.bounds.builtin_bounds;
929+
if !extra_bounds.is_empty() {
930+
tcx.sess.span_err(
931+
impl_m_span,
932+
format!("in method `{}`, \
933+
type parameter {} requires `{}`, \
934+
which is not required by \
935+
the corresponding type parameter \
936+
in the trait declaration",
937+
token::get_ident(trait_m.ident),
938+
i,
939+
extra_bounds.user_string(tcx)).as_slice());
940+
return;
941+
}
942+
943+
// FIXME(#2687)---we should be checking that the bounds of the
944+
// trait imply the bounds of the subtype, but it appears we
945+
// are...not checking this.
946+
if impl_param_def.bounds.trait_bounds.len() !=
947+
trait_param_def.bounds.trait_bounds.len()
948+
{
949+
let found = impl_param_def.bounds.trait_bounds.len();
950+
let expected = trait_param_def.bounds.trait_bounds.len();
951+
tcx.sess.span_err(
952+
impl_m_span,
953+
format!("in method `{}`, type parameter {} has {} trait \
954+
bound{}, but the corresponding type parameter in \
955+
the trait declaration has {} trait bound{}",
956+
token::get_ident(trait_m.ident),
957+
i,
958+
found,
959+
if found == 1 {""} else {"s"},
960+
expected,
961+
if expected == 1 {""} else {"s"}).as_slice());
962+
return;
963+
}
964+
}
965+
923966
// This code is best explained by example. Consider a trait:
924967
//
925968
// trait Trait<T> {
@@ -994,70 +1037,6 @@ fn compare_impl_method(tcx: &ty::ctxt,
9941037
let trait_fty = ty::mk_bare_fn(tcx, trait_m.fty.clone());
9951038
let trait_fty = trait_fty.subst(tcx, &trait_to_skol_substs);
9961039

997-
// Check bounds.
998-
for (i, (trait_param_def, impl_param_def)) in it.enumerate() {
999-
// Check that the impl does not require any builtin-bounds
1000-
// that the trait does not guarantee:
1001-
let extra_bounds =
1002-
impl_param_def.bounds.builtin_bounds -
1003-
trait_param_def.bounds.builtin_bounds;
1004-
if !extra_bounds.is_empty() {
1005-
tcx.sess.span_err(
1006-
impl_m_span,
1007-
format!("in method `{}`, \
1008-
type parameter {} requires `{}`, \
1009-
which is not required by \
1010-
the corresponding type parameter \
1011-
in the trait declaration",
1012-
token::get_ident(trait_m.ident),
1013-
i,
1014-
extra_bounds.user_string(tcx)).as_slice());
1015-
return;
1016-
}
1017-
1018-
// Check that the trait bounds of the trait imply the bounds of its
1019-
// implementation.
1020-
//
1021-
// FIXME(pcwalton): We could be laxer here regarding sub- and super-
1022-
// traits, but I doubt that'll be wanted often, so meh.
1023-
for impl_trait_bound in impl_param_def.bounds.trait_bounds.iter() {
1024-
let impl_trait_bound =
1025-
impl_trait_bound.subst(tcx, &impl_to_skol_substs);
1026-
1027-
let mut ok = false;
1028-
for trait_bound in trait_param_def.bounds.trait_bounds.iter() {
1029-
let trait_bound =
1030-
trait_bound.subst(tcx, &trait_to_skol_substs);
1031-
let infcx = infer::new_infer_ctxt(tcx);
1032-
match infer::mk_sub_trait_refs(&infcx,
1033-
true,
1034-
infer::Misc(impl_m_span),
1035-
trait_bound,
1036-
impl_trait_bound.clone()) {
1037-
Ok(_) => {
1038-
ok = true;
1039-
break
1040-
}
1041-
Err(_) => continue,
1042-
}
1043-
}
1044-
1045-
if !ok {
1046-
tcx.sess.span_err(impl_m_span,
1047-
format!("in method `{}`, type parameter {} \
1048-
requires bound `{}`, which is not \
1049-
required by the corresponding \
1050-
type parameter in the trait \
1051-
declaration",
1052-
token::get_ident(trait_m.ident),
1053-
i,
1054-
ppaux::trait_ref_to_str(
1055-
tcx,
1056-
&*impl_trait_bound)).as_slice())
1057-
}
1058-
}
1059-
}
1060-
10611040
// Check the impl method type IM is a subtype of the trait method
10621041
// type TM. To see why this makes sense, think of a vtable. The
10631042
// expected type of the function pointers in the vtable is the

branches/try2/src/test/compile-fail/trait-bounds-impl-comparison-1.rs

Lines changed: 0 additions & 78 deletions
This file was deleted.

branches/try2/src/test/compile-fail/trait-bounds-impl-comparison-2.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

branches/try2/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)