Skip to content

Commit 579ebee

Browse files
committed
---
yaml --- r: 131775 b: refs/heads/dist-snap c: da4e4e4 h: refs/heads/master i: 131773: 50cdf37 131771: f85fe41 131767: 88c6a56 131759: aaf4c7d 131743: 38c719c 131711: 2e0d848 v: v3
1 parent 9d2a303 commit 579ebee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+981
-403
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: f26c31d695666a6863f86bfeede2bea91f4ba942
9+
refs/heads/dist-snap: da4e4e4e0a7778a85748aa4a303b13f603e96b4b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/man/rustc.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ This program is a compiler for the Rust language, available at
1111

1212
.SH OPTIONS
1313

14+
.TP
15+
\fB\-\-crate-name NAME\fR
16+
Specify the name of the crate being built
1417
.TP
1518
\fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
1619
Configure the flavor of rust crate that is generated (default `bin`)

branches/dist-snap/mk/install.mk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD)-with-target-libs
18-
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
17+
install: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
18+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
1919
# Remove tmp files while we can because they may have been created under sudo
2020
$(Q)rm -R tmp/dist
2121

22-
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs
23-
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
22+
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
23+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2424
# Remove tmp files while we can because they may have been created under sudo
2525
$(Q)rm -R tmp/dist
2626

27+
tmp/empty_dir:
28+
mkdir -p $@
2729

2830
######################################################################
2931
# Android remote installation

branches/dist-snap/src/etc/install.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ while read p; do
466466
# The manifest lists all files to install
467467
done < "${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}/rustlib/manifest.in"
468468

469+
# Run ldconfig to make dynamic libraries available to the linker
470+
if [ "$CFG_OSTYPE" = "Linux" ]
471+
then
472+
ldconfig
473+
if [ $? -ne 0 ]
474+
then
475+
warn "failed to run ldconfig."
476+
warn "this may happen when not installing as root and may be fine"
477+
fi
478+
fi
479+
469480
# Sanity check: can we run the installed binaries?
470481
#
471482
# As with the verification above, make sure the right LD_LIBRARY_PATH-equivalent
@@ -489,13 +500,11 @@ then
489500
err "${ERR}"
490501
else
491502
echo
492-
echo " please ensure '${CFG_PREFIX}/lib' is added to ${CFG_LD_PATH_VAR}"
493-
echo
503+
echo " Note: please ensure '${CFG_PREFIX}/lib' is added to ${CFG_LD_PATH_VAR}"
494504
fi
495505
fi
496506
fi
497507

498-
499508
echo
500509
echo " Rust is ready to roll."
501510
echo

branches/dist-snap/src/etc/zsh/_rust

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ _rustc_opts_switches=(
99
-c'[Compile and assemble, but do not link]'
1010
--cfg'[Configure the compilation environment]'
1111
--crate-id'[Output the crate id and exit]'
12-
--crate-file-name'[Output the file(s) that would be written if compilation continued and exit]'
13-
--crate-name'[Output the crate name and exit]'
14-
--dep-info'[Output dependency info to <filename> after compiling]'
12+
--crate-file-name'[deprecated in favor of --print-file-name]'
13+
--crate-name'[Specify the name of the crate being built]'
1514
--crate-type'[Specify the type of crate to crate]'
15+
--debuginfo'[Emit DWARF debug info to the objects created: 0 = no debug info, 1 = line-tables only (for stacktraces and breakpoints), 2 = full debug info with variable and type information (same as -g)]'
16+
--dep-info'[Output dependency info to <filename> after compiling]'
17+
-g'[Equivalent to --debuginfo=2]'
1618
{-h,--help}'[Display this message]'
1719
-L'[Add a directory to the library search path]'
1820
--linker'[Program to use for linking instead of the default.]'
@@ -29,6 +31,8 @@ _rustc_opts_switches=(
2931
--parse-only'[Parse only; do not compile, assemble, or link]'
3032
--passes'[Comma or space separated list of pass names to use]'
3133
--pretty'[Pretty-print the input instead of compiling]'
34+
--print-crate-name'[Output the crate name and exit]'
35+
--print-file-name'[Output the file(s) that would be written if compilation continued and exit]'
3236
--save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
3337
--sysroot'[Override the system root]'
3438
--test'[Build a test harness]'

branches/dist-snap/src/libcore/atomics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl AtomicBool {
141141
///
142142
/// fn with_lock(spinlock: &Arc<AtomicBool>, f: || -> ()) {
143143
/// // CAS loop until we are able to replace `false` with `true`
144-
/// while spinlock.compare_and_swap(false, true, SeqCst) == false {
144+
/// while spinlock.compare_and_swap(false, true, SeqCst) != false {
145145
/// // Since tasks may not be preemptive (if they are green threads)
146146
/// // yield to the scheduler to let the other task run. Low level
147147
/// // concurrent code needs to take into account Rust's two threading

branches/dist-snap/src/libgreen/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@
164164
//! possibly pinned to a particular scheduler thread:
165165
//!
166166
//! ```rust
167+
//! extern crate green;
168+
//! extern crate rustuv;
169+
//!
170+
//! # fn main() {
167171
//! use std::task::TaskBuilder;
168172
//! use green::{SchedPool, PoolConfig, GreenTaskBuilder};
169173
//!
170-
//! let config = PoolConfig::new();
174+
//! let mut config = PoolConfig::new();
175+
//!
176+
//! // Optional: Set the event loop to be rustuv's to allow I/O to work
177+
//! config.event_loop_factory = rustuv::event_loop;
178+
//!
171179
//! let mut pool = SchedPool::new(config);
172180
//!
173181
//! // Spawn tasks into the pool of schedulers
@@ -195,6 +203,7 @@
195203
//! // Required to shut down this scheduler pool.
196204
//! // The task will fail if `shutdown` is not called.
197205
//! pool.shutdown();
206+
//! # }
198207
//! ```
199208
200209
#![crate_name = "green"]

branches/dist-snap/src/libgreen/stack.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::ptr;
1112
use std::sync::atomics;
1213
use std::os::{errno, page_size, MemoryMap, MapReadable, MapWritable,
13-
MapNonStandardFlags, MapVirtual, getenv};
14+
MapNonStandardFlags, getenv};
1415
use libc;
1516

1617
/// A task's stack. The name "Stack" is a vestige of segmented stacks.
1718
pub struct Stack {
18-
buf: MemoryMap,
19+
buf: Option<MemoryMap>,
1920
min_size: uint,
2021
valgrind_id: libc::c_uint,
2122
}
@@ -52,11 +53,11 @@ impl Stack {
5253
// guaranteed to be aligned properly.
5354
if !protect_last_page(&stack) {
5455
fail!("Could not memory-protect guard page. stack={}, errno={}",
55-
stack.data, errno());
56+
stack.data(), errno());
5657
}
5758

5859
let mut stk = Stack {
59-
buf: stack,
60+
buf: Some(stack),
6061
min_size: size,
6162
valgrind_id: 0
6263
};
@@ -71,22 +72,23 @@ impl Stack {
7172
/// Create a 0-length stack which starts (and ends) at 0.
7273
pub unsafe fn dummy_stack() -> Stack {
7374
Stack {
74-
buf: MemoryMap { data: 0 as *mut u8, len: 0, kind: MapVirtual },
75+
buf: None,
7576
min_size: 0,
7677
valgrind_id: 0
7778
}
7879
}
7980

8081
/// Point to the low end of the allocated stack
8182
pub fn start(&self) -> *const uint {
82-
self.buf.data as *const uint
83+
self.buf.as_ref().map(|m| m.data() as *const uint)
84+
.unwrap_or(ptr::null())
8385
}
8486

8587
/// Point one uint beyond the high end of the allocated stack
8688
pub fn end(&self) -> *const uint {
87-
unsafe {
88-
self.buf.data.offset(self.buf.len as int) as *const uint
89-
}
89+
self.buf.as_ref().map(|buf| unsafe {
90+
buf.data().offset(buf.len() as int) as *const uint
91+
}).unwrap_or(ptr::null())
9092
}
9193
}
9294

@@ -96,7 +98,7 @@ fn protect_last_page(stack: &MemoryMap) -> bool {
9698
// This may seem backwards: the start of the segment is the last page?
9799
// Yes! The stack grows from higher addresses (the end of the allocated
98100
// block) to lower addresses (the start of the allocated block).
99-
let last_page = stack.data as *mut libc::c_void;
101+
let last_page = stack.data() as *mut libc::c_void;
100102
libc::mprotect(last_page, page_size() as libc::size_t,
101103
libc::PROT_NONE) != -1
102104
}
@@ -106,7 +108,7 @@ fn protect_last_page(stack: &MemoryMap) -> bool {
106108
fn protect_last_page(stack: &MemoryMap) -> bool {
107109
unsafe {
108110
// see above
109-
let last_page = stack.data as *mut libc::c_void;
111+
let last_page = stack.data() as *mut libc::c_void;
110112
let mut old_prot: libc::DWORD = 0;
111113
libc::VirtualProtect(last_page, page_size() as libc::SIZE_T,
112114
libc::PAGE_NOACCESS,

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
270270
}
271271
);
272272

273+
// JBC: make CFG processing part of expansion to avoid this problem:
274+
273275
// strip again, in case expansion added anything with a #[cfg].
274276
krate = time(time_passes, "configuration 2", krate, |krate|
275277
front::config::strip_unconfigured_items(krate));
@@ -290,6 +292,9 @@ pub fn phase_2_configure_and_expand(sess: &Session,
290292
krate.encode(&mut json).unwrap();
291293
}
292294

295+
time(time_passes, "checking that all macro invocations are gone", &krate, |krate|
296+
syntax::ext::expand::check_for_macros(&sess.parse_sess, krate));
297+
293298
Some((krate, map))
294299
}
295300

@@ -302,14 +307,14 @@ pub struct CrateAnalysis {
302307
pub name: String,
303308
}
304309

310+
305311
/// Run the resolution, typechecking, region checking and other
306312
/// miscellaneous analysis passes on the crate. Return various
307313
/// structures carrying the results of the analysis.
308314
pub fn phase_3_run_analysis_passes(sess: Session,
309315
krate: &ast::Crate,
310316
ast_map: syntax::ast_map::Map,
311317
name: String) -> CrateAnalysis {
312-
313318
let time_passes = sess.time_passes();
314319

315320
time(time_passes, "external crate/lib resolution", (), |_|

branches/dist-snap/src/librustc/driver/session.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ use syntax::{ast, codemap};
2929
use std::os;
3030
use std::cell::{Cell, RefCell};
3131

32-
32+
// Represents the data associated with a compilation
33+
// session for a single crate.
3334
pub struct Session {
3435
pub targ_cfg: config::Config,
3536
pub opts: config::Options,

branches/dist-snap/src/librustc/front/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use syntax::codemap;
1414

1515
use std::gc::{Gc, GC};
1616

17+
/// A folder that strips out items that do not belong in the current
18+
/// configuration.
1719
struct Context<'a> {
1820
in_cfg: |attrs: &[ast::Attribute]|: 'a -> bool,
1921
}
@@ -41,6 +43,9 @@ impl<'a> fold::Folder for Context<'a> {
4143
fn fold_expr(&mut self, expr: Gc<ast::Expr>) -> Gc<ast::Expr> {
4244
fold_expr(self, expr)
4345
}
46+
fn fold_mac(&mut self, mac: &ast::Mac) -> ast::Mac {
47+
fold::fold_mac(mac, self)
48+
}
4449
}
4550

4651
pub fn strip_items(krate: ast::Crate,

branches/dist-snap/src/librustc/metadata/creader.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl<'a> PluginMetadataReader<'a> {
446446
should_match_name: true,
447447
};
448448
let library = match load_ctxt.maybe_load_library_crate() {
449-
Some (l) => l,
449+
Some(l) => l,
450450
None if is_cross => {
451451
// try loading from target crates (only valid if there are
452452
// no syntax extensions)
@@ -473,6 +473,14 @@ impl<'a> PluginMetadataReader<'a> {
473473
let registrar = decoder::get_plugin_registrar_fn(library.metadata.as_slice()).map(|id| {
474474
decoder::get_symbol(library.metadata.as_slice(), id)
475475
});
476+
if library.dylib.is_none() && registrar.is_some() {
477+
let message = format!("plugin crate `{}` only found in rlib format, \
478+
but must be available in dylib format",
479+
info.ident);
480+
self.env.sess.span_err(krate.span, message.as_slice());
481+
// No need to abort because the loading code will just ignore this
482+
// empty dylib.
483+
}
476484
let pc = PluginMetadata {
477485
lib: library.dylib.clone(),
478486
macros: macros,

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ fn encode_info_for_struct(ecx: &EncodeContext,
693693
encode_name(ebml_w, nm);
694694
encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
695695
encode_def_id(ebml_w, local_def(id));
696+
697+
let stab = stability::lookup(ecx.tcx, field.id);
698+
encode_stability(ebml_w, stab);
699+
696700
ebml_w.end_tag();
697701
}
698702
index
@@ -1584,37 +1588,25 @@ fn encode_plugin_registrar_fn(ecx: &EncodeContext, ebml_w: &mut Encoder) {
15841588
}
15851589
}
15861590

1587-
struct MacroDefVisitor<'a, 'b, 'c> {
1588-
ecx: &'a EncodeContext<'b>,
1589-
ebml_w: &'a mut Encoder<'c>
1590-
}
1591-
1592-
impl<'a, 'b, 'c> Visitor<()> for MacroDefVisitor<'a, 'b, 'c> {
1593-
fn visit_item(&mut self, item: &Item, _: ()) {
1594-
match item.node {
1595-
ItemMac(..) => {
1596-
let def = self.ecx.tcx.sess.codemap().span_to_snippet(item.span)
1597-
.expect("Unable to find source for macro");
1598-
self.ebml_w.start_tag(tag_macro_def);
1599-
self.ebml_w.wr_str(def.as_slice());
1600-
self.ebml_w.end_tag();
1601-
}
1602-
_ => {}
1603-
}
1604-
visit::walk_item(self, item, ());
1605-
}
1591+
/// Given a span, write the text of that span into the output stream
1592+
/// as an exported macro
1593+
fn encode_macro_def(ecx: &EncodeContext,
1594+
ebml_w: &mut Encoder,
1595+
span: &syntax::codemap::Span) {
1596+
let def = ecx.tcx.sess.codemap().span_to_snippet(*span)
1597+
.expect("Unable to find source for macro");
1598+
ebml_w.start_tag(tag_macro_def);
1599+
ebml_w.wr_str(def.as_slice());
1600+
ebml_w.end_tag();
16061601
}
16071602

1608-
fn encode_macro_defs<'a>(ecx: &'a EncodeContext,
1609-
krate: &Crate,
1610-
ebml_w: &'a mut Encoder) {
1603+
/// Serialize the text of the exported macros
1604+
fn encode_macro_defs(ecx: &EncodeContext,
1605+
krate: &Crate,
1606+
ebml_w: &mut Encoder) {
16111607
ebml_w.start_tag(tag_exported_macros);
1612-
{
1613-
let mut visitor = MacroDefVisitor {
1614-
ecx: ecx,
1615-
ebml_w: ebml_w,
1616-
};
1617-
visit::walk_crate(&mut visitor, krate, ());
1608+
for span in krate.exported_macros.iter() {
1609+
encode_macro_def(ecx, ebml_w, span);
16181610
}
16191611
ebml_w.end_tag();
16201612
}

0 commit comments

Comments
 (0)