Skip to content

Commit e958d29

Browse files
committed
---
yaml --- r: 123771 b: refs/heads/master c: f2d251d h: refs/heads/master i: 123769: a7667f2 123767: 70dd9fa v: v3
1 parent fa42c26 commit e958d29

Some content is hidden

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

49 files changed

+1001
-411
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: 207b83ae2f03bbd62011184fb6a01156054eee07
2+
refs/heads/master: f2d251d12e469e174630f7603df5ee5c80e5ce25
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8ddd286ea4ba4384a0dc9eae393ed515460a986e
55
refs/heads/try: 296eb104620b346d88bc4a2c2ab7693e6d3db019

trunk/man/rustc.1

Lines changed: 6 additions & 2 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`)
@@ -60,8 +63,9 @@ Parse only; do not compile, assemble, or link
6063
\fB\-\-pretty\fR [TYPE]
6164
Pretty-print the input instead of compiling; valid types are: normal
6265
(un-annotated source), expanded (crates expanded), typed (crates
63-
expanded, with type annotations), or identified (fully parenthesized,
64-
AST nodes and blocks with IDs)
66+
expanded, with type annotations), identified (fully parenthesized,
67+
AST nodes and blocks with IDs), or flowgraph=<nodeid> (graphviz
68+
formatted flowgraph for node)
6569
.TP
6670
\fB\-\-dep-info\fR [FILENAME]
6771
Output dependency info to <filename> after compiling, in o format suitable

trunk/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

trunk/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

trunk/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]'

trunk/src/libcollections/hash/sip.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pub fn hash_with_keys<T: Hash<SipState>>(k0: u64, k1: u64, value: &T) -> u64 {
269269
mod tests {
270270
use test::Bencher;
271271
use std::prelude::*;
272-
use std::num::ToStrRadix;
272+
use std::fmt;
273273

274274
use str::Str;
275275
use string::String;
@@ -370,7 +370,7 @@ mod tests {
370370
fn to_hex_str(r: &[u8, ..8]) -> String {
371371
let mut s = String::new();
372372
for b in r.iter() {
373-
s.push_str((*b as uint).to_str_radix(16u).as_slice());
373+
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
374374
}
375375
s
376376
}
@@ -391,7 +391,7 @@ mod tests {
391391
let r = result_bytes(h);
392392
let mut s = String::new();
393393
for b in r.iter() {
394-
s.push_str((*b as uint).to_str_radix(16u).as_slice());
394+
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
395395
}
396396
s
397397
}

trunk/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

trunk/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"]

trunk/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,

trunk/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", (), |_|

trunk/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,

trunk/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,

trunk/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,

0 commit comments

Comments
 (0)