From 19041cde499b6d4b69b394f4d74f96f7ed0a154c Mon Sep 17 00:00:00 2001 From: William Throwe Date: Sun, 18 Oct 2015 15:24:08 -0400 Subject: [PATCH 1/7] Add a regression test for #29122 (fixed in #29134) --- src/test/run-make/linker-output-non-utf8/Makefile | 12 ++++++++++++ src/test/run-make/linker-output-non-utf8/exec.rs | 6 ++++++ src/test/run-make/linker-output-non-utf8/library.rs | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 src/test/run-make/linker-output-non-utf8/Makefile create mode 100644 src/test/run-make/linker-output-non-utf8/exec.rs create mode 100644 src/test/run-make/linker-output-non-utf8/library.rs diff --git a/src/test/run-make/linker-output-non-utf8/Makefile b/src/test/run-make/linker-output-non-utf8/Makefile new file mode 100644 index 0000000000000..b26940cb1b483 --- /dev/null +++ b/src/test/run-make/linker-output-non-utf8/Makefile @@ -0,0 +1,12 @@ +-include ../tools.mk + +# Make sure we don't ICE if the linker prints a non-UTF-8 error message. + +# The zzz it to allow humans to tab complete or glob this thing. +bad_dir := $(TMPDIR)/zzz$$'\xff' + +all: + $(RUSTC) library.rs + mkdir $(bad_dir) + mv $(call DYLIB,library) $(bad_dir) + LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined diff --git a/src/test/run-make/linker-output-non-utf8/exec.rs b/src/test/run-make/linker-output-non-utf8/exec.rs new file mode 100644 index 0000000000000..6864018d64e97 --- /dev/null +++ b/src/test/run-make/linker-output-non-utf8/exec.rs @@ -0,0 +1,6 @@ +#[link(name="library")] +extern "C" { + fn foo(); +} + +fn main() { unsafe { foo(); } } diff --git a/src/test/run-make/linker-output-non-utf8/library.rs b/src/test/run-make/linker-output-non-utf8/library.rs new file mode 100644 index 0000000000000..1a5138c3c20d6 --- /dev/null +++ b/src/test/run-make/linker-output-non-utf8/library.rs @@ -0,0 +1,9 @@ +#![crate_type = "dylib"] + +extern "C" { + fn this_symbol_not_defined(); +} + +pub extern "C" fn foo() { + unsafe { this_symbol_not_defined(); } +} From 9c3a06219adec4854df90423e87afdcd42c4a2ae Mon Sep 17 00:00:00 2001 From: arcnmx Date: Mon, 19 Oct 2015 00:36:28 -0400 Subject: [PATCH 2/7] Add missing #[test] attribute to test --- src/libstd/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 4e80fb2ceb09e..c01e2ff40f940 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -625,8 +625,8 @@ mod tests { drop(p.wait()); } - #[cfg(unix)] #[cfg(all(unix, not(target_os="android")))] + #[test] fn signal_reported_right() { use os::unix::process::ExitStatusExt; From 8222970f7981713cefb6aaab303741808e109cc0 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Mon, 19 Oct 2015 01:43:48 -0600 Subject: [PATCH 3/7] Fix minor syntax error in example. --- src/doc/nomicon/leaking.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/nomicon/leaking.md b/src/doc/nomicon/leaking.md index 1f72a4c172470..a5d5742a4c621 100644 --- a/src/doc/nomicon/leaking.md +++ b/src/doc/nomicon/leaking.md @@ -135,7 +135,7 @@ impl Rc { fn new(data: T) -> Self { unsafe { // Wouldn't it be nice if heap::allocate worked like this? - let ptr = heap::allocate>(); + let ptr = heap::allocate::>(); ptr::write(ptr, RcBox { data: data, ref_count: 1, From f1e06db8c2a9d1549008c377c4ccfe7338a11608 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Mon, 19 Oct 2015 20:14:38 -0400 Subject: [PATCH 4/7] fix markdown in nomicon/dropck --- src/doc/nomicon/dropck.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/nomicon/dropck.md b/src/doc/nomicon/dropck.md index 95bcdc02ba029..ad7c65032c769 100644 --- a/src/doc/nomicon/dropck.md +++ b/src/doc/nomicon/dropck.md @@ -220,6 +220,7 @@ checking the implicit assertion that no potentially expired data It is sometimes obvious that no such access can occur, like the case above. However, when dealing with a generic type parameter, such access can occur indirectly. Examples of such indirect access are: + * invoking a callback, * via a trait method call. From 44dd8dcf93e16bc3af190211cbfdce78882d59d4 Mon Sep 17 00:00:00 2001 From: William Throwe Date: Mon, 19 Oct 2015 19:06:13 -0400 Subject: [PATCH 5/7] Add copyright headers --- src/test/run-make/linker-output-non-utf8/exec.rs | 10 ++++++++++ src/test/run-make/linker-output-non-utf8/library.rs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/test/run-make/linker-output-non-utf8/exec.rs b/src/test/run-make/linker-output-non-utf8/exec.rs index 6864018d64e97..1c03eb479fdea 100644 --- a/src/test/run-make/linker-output-non-utf8/exec.rs +++ b/src/test/run-make/linker-output-non-utf8/exec.rs @@ -1,3 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[link(name="library")] extern "C" { fn foo(); diff --git a/src/test/run-make/linker-output-non-utf8/library.rs b/src/test/run-make/linker-output-non-utf8/library.rs index 1a5138c3c20d6..3fe7dda47c287 100644 --- a/src/test/run-make/linker-output-non-utf8/library.rs +++ b/src/test/run-make/linker-output-non-utf8/library.rs @@ -1,3 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #![crate_type = "dylib"] extern "C" { From 9c877c2b57c758bc40f605cb14986c811bb420c6 Mon Sep 17 00:00:00 2001 From: William Throwe Date: Mon, 19 Oct 2015 19:07:07 -0400 Subject: [PATCH 6/7] Use a staticlib instead of a dylib for utf8 test On OS X the linker doesn't like producing a dylib with undefined symbols. --- src/test/run-make/linker-output-non-utf8/Makefile | 2 +- src/test/run-make/linker-output-non-utf8/library.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/run-make/linker-output-non-utf8/Makefile b/src/test/run-make/linker-output-non-utf8/Makefile index b26940cb1b483..08cfa333010b8 100644 --- a/src/test/run-make/linker-output-non-utf8/Makefile +++ b/src/test/run-make/linker-output-non-utf8/Makefile @@ -8,5 +8,5 @@ bad_dir := $(TMPDIR)/zzz$$'\xff' all: $(RUSTC) library.rs mkdir $(bad_dir) - mv $(call DYLIB,library) $(bad_dir) + mv $(call STATICLIB,library) $(bad_dir) LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined diff --git a/src/test/run-make/linker-output-non-utf8/library.rs b/src/test/run-make/linker-output-non-utf8/library.rs index 3fe7dda47c287..194be26424ad8 100644 --- a/src/test/run-make/linker-output-non-utf8/library.rs +++ b/src/test/run-make/linker-output-non-utf8/library.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_type = "dylib"] +#![crate_type = "staticlib"] extern "C" { fn this_symbol_not_defined(); } +#[no_mangle] pub extern "C" fn foo() { unsafe { this_symbol_not_defined(); } } From 94e9a073b0edb3633b2adbcfff1dabf2da44334e Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Tue, 20 Oct 2015 11:49:08 +1100 Subject: [PATCH 7/7] Point core::ptr::Shared to tracking issue #27730. --- src/libcore/ptr.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 8adbaf56f143c..f3ddb2a9fffe4 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -538,7 +538,7 @@ impl fmt::Pointer for Unique { /// building abstractions like `Rc` or `Arc`, which internally /// use raw pointers to manage the memory that they own. #[unstable(feature = "shared", reason = "needs an RFC to flesh out design", - issue = "0")] + issue = "27730")] pub struct Shared { pointer: NonZero<*const T>, // NOTE: this marker has no consequences for variance, but is necessary @@ -551,15 +551,15 @@ pub struct Shared { /// `Shared` pointers are not `Send` because the data they reference may be aliased. // NB: This impl is unnecessary, but should provide better error messages. -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl !Send for Shared { } /// `Shared` pointers are not `Sync` because the data they reference may be aliased. // NB: This impl is unnecessary, but should provide better error messages. -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl !Sync for Shared { } -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl Shared { /// Creates a new `Shared`. pub unsafe fn new(ptr: *mut T) -> Self { @@ -567,21 +567,21 @@ impl Shared { } } -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl Clone for Shared { fn clone(&self) -> Self { *self } } -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl Copy for Shared { } #[cfg(not(stage0))] // remove cfg after new snapshot -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl CoerceUnsized> for Shared where T: Unsize { } -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl Deref for Shared { type Target = *mut T; @@ -591,7 +591,7 @@ impl Deref for Shared { } } -#[unstable(feature = "shared", issue = "0")] +#[unstable(feature = "shared", issue = "27730")] impl fmt::Pointer for Shared { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Pointer::fmt(&*self.pointer, f)