Skip to content

Commit d558037

Browse files
committed
Auto merge of #40758 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #40612, #40627, #40668, #40715, #40753 - Failed merges:
2 parents 8dfc25e + ea76c5e commit d558037

20 files changed

+337
-198
lines changed

src/ci/docker/dist-s390x-linux-netbsd/Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ COPY patches/ /tmp/patches/
6464
COPY s390x-linux-gnu.config build-s390x-toolchain.sh /tmp/
6565
RUN ./build-s390x-toolchain.sh
6666

67-
USER root
68-
6967
COPY build-netbsd-toolchain.sh /tmp/
7068
RUN ./build-netbsd-toolchain.sh
7169

72-
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
70+
USER root
71+
72+
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin:/x-tools/x86_64-unknown-netbsd/bin
7373

7474
ENV \
75-
AR_x86_64_unknown_netbsd=x86_64-unknown-netbsd-ar \
76-
CC_x86_64_unknown_netbsd=x86_64-unknown-netbsd-gcc \
77-
CXX_x86_64_unknown_netbsd=x86_64-unknown-netbsd-g++ \
75+
AR_x86_64_unknown_netbsd=x86_64--netbsd-ar \
76+
CC_x86_64_unknown_netbsd=x86_64--netbsd-gcc-sysroot \
77+
CXX_x86_64_unknown_netbsd=x86_64--netbsd-g++-sysroot \
7878
CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
7979
AR_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-ar \
8080
CXX_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-g++

src/ci/docker/dist-s390x-linux-netbsd/build-netbsd-toolchain.sh

+64-101
Original file line numberDiff line numberDiff line change
@@ -13,108 +13,71 @@
1313

1414
set -ex
1515

16-
BINUTILS=2.25.1
17-
GCC=5.3.0
18-
19-
# First up, build binutils
20-
mkdir binutils
21-
cd binutils
22-
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
23-
mkdir binutils-build
24-
cd binutils-build
25-
../binutils-$BINUTILS/configure \
26-
--target=x86_64-unknown-netbsd
27-
make -j10
28-
make install
29-
cd ../..
30-
rm -rf binutils
16+
hide_output() {
17+
set +x
18+
on_err="
19+
echo ERROR: An error was encountered with the build.
20+
cat /tmp/build.log
21+
exit 1
22+
"
23+
trap "$on_err" ERR
24+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
25+
PING_LOOP_PID=$!
26+
$@ &> /tmp/build.log
27+
rm /tmp/build.log
28+
trap - ERR
29+
kill $PING_LOOP_PID
30+
set -x
31+
}
3132

32-
# Next, download the NetBSD libc and relevant header files
3333
mkdir netbsd
34-
# originally from:
35-
# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz
36-
curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-base.tgz | \
37-
tar xzf - -C netbsd ./usr/include ./usr/lib ./lib
38-
# originally from:
39-
# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/comp.tgz
40-
curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-comp.tgz | \
41-
tar xzf - -C netbsd ./usr/include ./usr/lib
42-
43-
dst=/usr/local/x86_64-unknown-netbsd
44-
cp -r netbsd/usr/include $dst
45-
cp netbsd/usr/lib/crt0.o $dst/lib
46-
cp netbsd/usr/lib/crti.o $dst/lib
47-
cp netbsd/usr/lib/crtn.o $dst/lib
48-
cp netbsd/usr/lib/crtbeginS.o $dst/lib
49-
cp netbsd/usr/lib/crtendS.o $dst/lib
50-
cp netbsd/usr/lib/crtbegin.o $dst/lib
51-
cp netbsd/usr/lib/crtend.o $dst/lib
52-
cp netbsd/usr/lib/gcrt0.o $dst/lib
53-
cp netbsd/usr/lib/libc.a $dst/lib
54-
cp netbsd/usr/lib/libc_p.a $dst/lib
55-
cp netbsd/usr/lib/libc_pic.a $dst/lib
56-
cp netbsd/lib/libc.so.12.193.1 $dst/lib
57-
cp netbsd/lib/libutil.so.7.21 $dst/lib
58-
cp netbsd/usr/lib/libm.a $dst/lib
59-
cp netbsd/usr/lib/libm_p.a $dst/lib
60-
cp netbsd/usr/lib/libm_pic.a $dst/lib
61-
cp netbsd/lib/libm.so.0.11 $dst/lib
62-
cp netbsd/usr/lib/librt.so.1.1 $dst/lib
63-
cp netbsd/usr/lib/libpthread.a $dst/lib
64-
cp netbsd/usr/lib/libpthread_p.a $dst/lib
65-
cp netbsd/usr/lib/libpthread_pic.a $dst/lib
66-
cp netbsd/usr/lib/libpthread.so.1.2 $dst/lib
67-
68-
ln -s libc.so.12.193.1 $dst/lib/libc.so
69-
ln -s libc.so.12.193.1 $dst/lib/libc.so.12
70-
ln -s libm.so.0.11 $dst/lib/libm.so
71-
ln -s libm.so.0.11 $dst/lib/libm.so.0
72-
ln -s libutil.so.7.21 $dst/lib/libutil.so
73-
ln -s libutil.so.7.21 $dst/lib/libutil.so.7
74-
ln -s libpthread.so.1.2 $dst/lib/libpthread.so
75-
ln -s libpthread.so.1.2 $dst/lib/libpthread.so.1
76-
ln -s librt.so.1.1 $dst/lib/librt.so
77-
78-
rm -rf netbsd
79-
80-
# Finally, download and build gcc to target NetBSD
81-
mkdir gcc
82-
cd gcc
83-
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
84-
cd gcc-$GCC
85-
./contrib/download_prerequisites
86-
87-
# Originally from
88-
# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__base.h
89-
PATCHES="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch1.patch"
90-
91-
# Originally from
92-
# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__configure__char.cc
93-
PATCHES="$PATCHES https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch2.patch"
94-
95-
for patch in $PATCHES; do
96-
curl $patch | patch -Np0
97-
done
98-
99-
mkdir ../gcc-build
100-
cd ../gcc-build
101-
../gcc-$GCC/configure \
102-
--enable-languages=c,c++ \
103-
--target=x86_64-unknown-netbsd \
104-
--disable-libcilkrts \
105-
--disable-multilib \
106-
--disable-nls \
107-
--disable-libgomp \
108-
--disable-libquadmath \
109-
--disable-libssp \
110-
--disable-libvtv \
111-
--disable-libcilkrt \
112-
--disable-libada \
113-
--disable-libsanitizer \
114-
--disable-libquadmath-support \
115-
--disable-lto
116-
make -j10
117-
make install
34+
cd netbsd
35+
36+
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
37+
38+
URL=https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
39+
40+
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz
41+
curl $URL/2017-03-17-netbsd-src.tgz | tar xzf -
42+
curl $URL/2017-03-17-netbsd-gnusrc.tgz | tar xzf -
43+
curl $URL/2017-03-17-netbsd-sharesrc.tgz | tar xzf -
44+
curl $URL/2017-03-17-netbsd-syssrc.tgz | tar xzf -
45+
46+
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/amd64/binary/sets/*.tgz
47+
curl $URL/2017-03-17-netbsd-base.tgz | \
48+
tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
49+
curl $URL/2017-03-17-netbsd-comp.tgz | \
50+
tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib
51+
52+
cd usr/src
53+
54+
# The options, in order, do the following
55+
# * this is an unpriviledged build
56+
# * output to a predictable location
57+
# * disable various uneeded stuff
58+
MKUNPRIVED=yes TOOLDIR=/x-tools/x86_64-unknown-netbsd \
59+
MKSHARE=no MKDOC=no MKHTML=no MKINFO=no MKKMOD=no MKLINT=no MKMAN=no MKNLS=no MKPROFILE=no \
60+
hide_output ./build.sh -j10 -m amd64 tools
11861

11962
cd ../..
120-
rm -rf gcc
63+
64+
rm -rf usr
65+
66+
cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot <<'EOF'
67+
#!/bin/bash
68+
exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@"
69+
EOF
70+
71+
cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot <<'EOF'
72+
#!/bin/bash
73+
exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++ --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@"
74+
EOF
75+
76+
GCC_SHA1=`sha1sum -b /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc | cut -d' ' -f1`
77+
GPP_SHA1=`sha1sum -b /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++ | cut -d' ' -f1`
78+
79+
echo "# $GCC_SHA1" >> /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot
80+
echo "# $GPP_SHA1" >> /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot
81+
82+
chmod +x /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot
83+
chmod +x /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot

src/libcore/iter/traits.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,17 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
536536
/// # }
537537
/// # }
538538
/// impl ExactSizeIterator for Counter {
539-
/// // We already have the number of iterations, so we can use it directly.
539+
/// // We can easily calculate the remaining number of iterations.
540540
/// fn len(&self) -> usize {
541-
/// self.count
541+
/// 5 - self.count
542542
/// }
543543
/// }
544544
///
545545
/// // And now we can use it!
546546
///
547547
/// let counter = Counter::new();
548548
///
549-
/// assert_eq!(0, counter.len());
549+
/// assert_eq!(5, counter.len());
550550
/// ```
551551
#[stable(feature = "rust1", since = "1.0.0")]
552552
pub trait ExactSizeIterator: Iterator {

src/librustc/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl ObjectSafetyViolation {
4646
"the trait cannot require that `Self : Sized`".into(),
4747
ObjectSafetyViolation::SupertraitSelf =>
4848
"the trait cannot use `Self` as a type parameter \
49-
in the supertrait listing".into(),
49+
in the supertraits or where-clauses".into(),
5050
ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod) =>
5151
format!("method `{}` has no receiver", name).into(),
5252
ObjectSafetyViolation::Method(name, MethodViolationCode::ReferencesSelf) =>

src/librustc/ty/mod.rs

+43-49
Original file line numberDiff line numberDiff line change
@@ -2059,55 +2059,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
20592059
}
20602060

20612061
pub fn associated_item(self, def_id: DefId) -> AssociatedItem {
2062-
if !def_id.is_local() {
2063-
return queries::associated_item::get(self, DUMMY_SP, def_id);
2064-
}
2065-
2066-
self.maps.associated_item.memoize(def_id, || {
2067-
// When the user asks for a given associated item, we
2068-
// always go ahead and convert all the associated items in
2069-
// the container. Note that we are also careful only to
2070-
// ever register a read on the *container* of the assoc
2071-
// item, not the assoc item itself. This prevents changes
2072-
// in the details of an item (for example, the type to
2073-
// which an associated type is bound) from contaminating
2074-
// those tasks that just need to scan the names of items
2075-
// and so forth.
2076-
2077-
let id = self.hir.as_local_node_id(def_id).unwrap();
2078-
let parent_id = self.hir.get_parent(id);
2079-
let parent_def_id = self.hir.local_def_id(parent_id);
2080-
let parent_item = self.hir.expect_item(parent_id);
2081-
match parent_item.node {
2082-
hir::ItemImpl(.., ref impl_trait_ref, _, ref impl_item_refs) => {
2083-
for impl_item_ref in impl_item_refs {
2084-
let assoc_item =
2085-
self.associated_item_from_impl_item_ref(parent_def_id,
2086-
impl_trait_ref.is_some(),
2087-
impl_item_ref);
2088-
self.maps.associated_item.borrow_mut()
2089-
.insert(assoc_item.def_id, assoc_item);
2090-
}
2091-
}
2092-
2093-
hir::ItemTrait(.., ref trait_item_refs) => {
2094-
for trait_item_ref in trait_item_refs {
2095-
let assoc_item =
2096-
self.associated_item_from_trait_item_ref(parent_def_id, trait_item_ref);
2097-
self.maps.associated_item.borrow_mut()
2098-
.insert(assoc_item.def_id, assoc_item);
2099-
}
2100-
}
2101-
2102-
ref r => {
2103-
panic!("unexpected container of associated items: {:?}", r)
2104-
}
2105-
}
2106-
2107-
// memoize wants us to return something, so return
2108-
// the one we generated for this def-id
2109-
*self.maps.associated_item.borrow().get(&def_id).unwrap()
2110-
})
2062+
queries::associated_item::get(self, DUMMY_SP, def_id)
21112063
}
21122064

21132065
fn associated_item_from_trait_item_ref(self,
@@ -2643,3 +2595,45 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
26432595
}
26442596
}
26452597
}
2598+
2599+
fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
2600+
-> AssociatedItem
2601+
{
2602+
let id = tcx.hir.as_local_node_id(def_id).unwrap();
2603+
let parent_id = tcx.hir.get_parent(id);
2604+
let parent_def_id = tcx.hir.local_def_id(parent_id);
2605+
let parent_item = tcx.hir.expect_item(parent_id);
2606+
match parent_item.node {
2607+
hir::ItemImpl(.., ref impl_trait_ref, _, ref impl_item_refs) => {
2608+
if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.node_id == id) {
2609+
let assoc_item =
2610+
tcx.associated_item_from_impl_item_ref(parent_def_id,
2611+
impl_trait_ref.is_some(),
2612+
impl_item_ref);
2613+
debug_assert_eq!(assoc_item.def_id, def_id);
2614+
return assoc_item;
2615+
}
2616+
}
2617+
2618+
hir::ItemTrait(.., ref trait_item_refs) => {
2619+
if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.node_id == id) {
2620+
let assoc_item =
2621+
tcx.associated_item_from_trait_item_ref(parent_def_id, trait_item_ref);
2622+
debug_assert_eq!(assoc_item.def_id, def_id);
2623+
return assoc_item;
2624+
}
2625+
}
2626+
2627+
ref r => {
2628+
panic!("unexpected container of associated items: {:?}", r)
2629+
}
2630+
}
2631+
panic!("associated item not found for def_id: {:?}", def_id);
2632+
}
2633+
2634+
pub fn provide(providers: &mut ty::maps::Providers) {
2635+
*providers = ty::maps::Providers {
2636+
associated_item,
2637+
..*providers
2638+
};
2639+
}

src/librustc_driver/driver.rs

+1
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
889889
let mut local_providers = ty::maps::Providers::default();
890890
mir::provide(&mut local_providers);
891891
typeck::provide(&mut local_providers);
892+
ty::provide(&mut local_providers);
892893

893894
let mut extern_providers = ty::maps::Providers::default();
894895
cstore::provide(&mut extern_providers);

src/librustc_llvm/build.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ fn main() {
131131
if is_crossed && flag.starts_with("-m") {
132132
continue;
133133
}
134+
135+
// -Wdate-time is not supported by the netbsd cross compiler
136+
if is_crossed && target.contains("netbsd") && flag.contains("date-time") {
137+
continue;
138+
}
139+
134140
cfg.flag(flag);
135141
}
136142

@@ -227,16 +233,21 @@ fn main() {
227233
}
228234
}
229235

230-
// OpenBSD has a particular C++ runtime library name
236+
let llvm_static_stdcpp = env::var_os("LLVM_STATIC_STDCPP");
237+
231238
let stdcppname = if target.contains("openbsd") {
239+
// OpenBSD has a particular C++ runtime library name
232240
"estdc++"
241+
} else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
242+
// NetBSD uses a separate library when relocation is required
243+
"stdc++_pic"
233244
} else {
234245
"stdc++"
235246
};
236247

237248
// C++ runtime library
238249
if !target.contains("msvc") {
239-
if let Some(s) = env::var_os("LLVM_STATIC_STDCPP") {
250+
if let Some(s) = llvm_static_stdcpp {
240251
assert!(!cxxflags.contains("stdlib=libc++"));
241252
let path = PathBuf::from(s);
242253
println!("cargo:rustc-link-search=native={}",

0 commit comments

Comments
 (0)