Skip to content

Commit 2b6720e

Browse files
committed
---
yaml --- r: 123765 b: refs/heads/master c: 6323e86 h: refs/heads/master i: 123763: 94ef67a v: v3
1 parent e1f2216 commit 2b6720e

Some content is hidden

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

74 files changed

+1508
-522
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: 20a6a6d8485f6c5f9f31fa44b7029da188ab5e2b
2+
refs/heads/master: 6323e8653cf46da4b4d445db491fc5b0c78e86d4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8ddd286ea4ba4384a0dc9eae393ed515460a986e
55
refs/heads/try: 296eb104620b346d88bc4a2c2ab7693e6d3db019

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

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/diagnostics.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
register_diagnostic!(E0001, r##"
12+
This error suggests that the expression arm corresponding to the noted pattern
13+
will never be reached as for all possible values of the expression being matched,
14+
one of the preceeding patterns will match.
15+
16+
This means that perhaps some of the preceeding patterns are too general, this
17+
one is too specific or the ordering is incorrect.
18+
"##)

trunk/src/librustc/driver/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
532532
optopt("", "opt-level", "Optimize with possible levels 0-3", "LEVEL"),
533533
optopt( "", "out-dir", "Write output to compiler-chosen filename in <dir>", "DIR"),
534534
optflag("", "parse-only", "Parse only; do not compile, assemble, or link"),
535+
optopt("", "explain", "Provide a detailed explanation of an error message", "OPT"),
535536
optflagopt("", "pretty",
536537
"Pretty-print the input instead of compiling;
537538
valid types are: `normal` (un-annotated source),
@@ -807,6 +808,7 @@ mod test {
807808
use getopts::getopts;
808809
use syntax::attr;
809810
use syntax::attr::AttrMetaMethods;
811+
use syntax::diagnostics;
810812

811813
// When the user supplies --test we should implicitly supply --cfg test
812814
#[test]
@@ -816,8 +818,9 @@ mod test {
816818
Ok(m) => m,
817819
Err(f) => fail!("test_switch_implies_cfg_test: {}", f)
818820
};
821+
let registry = diagnostics::registry::Registry::new([]);
819822
let sessopts = build_session_options(matches);
820-
let sess = build_session(sessopts, None);
823+
let sess = build_session(sessopts, None, registry);
821824
let cfg = build_configuration(&sess);
822825
assert!((attr::contains_name(cfg.as_slice(), "test")));
823826
}
@@ -834,8 +837,9 @@ mod test {
834837
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
835838
}
836839
};
840+
let registry = diagnostics::registry::Registry::new([]);
837841
let sessopts = build_session_options(matches);
838-
let sess = build_session(sessopts, None);
842+
let sess = build_session(sessopts, None, registry);
839843
let cfg = build_configuration(&sess);
840844
let mut test_items = cfg.iter().filter(|m| m.name().equiv(&("test")));
841845
assert!(test_items.next().is_some());

trunk/src/librustc/driver/driver.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use driver::{PpmFlowGraph, PpmExpanded, PpmExpandedIdentified, PpmTyped};
1616
use driver::{PpmIdentified};
1717
use front;
1818
use lib::llvm::{ContextRef, ModuleRef};
19+
use lint;
1920
use metadata::common::LinkMeta;
2021
use metadata::creader;
2122
use middle::cfg;
@@ -26,7 +27,7 @@ use middle;
2627
use plugin::load::Plugins;
2728
use plugin::registry::Registry;
2829
use plugin;
29-
use lint;
30+
3031
use util::common::time;
3132
use util::ppaux;
3233
use util::nodemap::{NodeSet};
@@ -41,6 +42,7 @@ use std::io::MemReader;
4142
use syntax::ast;
4243
use syntax::attr;
4344
use syntax::attr::{AttrMetaMethods};
45+
use syntax::diagnostics;
4446
use syntax::parse;
4547
use syntax::parse::token;
4648
use syntax::print::{pp, pprust};
@@ -213,6 +215,15 @@ pub fn phase_2_configure_and_expand(sess: &Session,
213215
let mut registry = Registry::new(&krate);
214216

215217
time(time_passes, "plugin registration", (), |_| {
218+
if sess.features.rustc_diagnostic_macros.get() {
219+
registry.register_macro("__diagnostic_used",
220+
diagnostics::plugin::expand_diagnostic_used);
221+
registry.register_macro("__register_diagnostic",
222+
diagnostics::plugin::expand_register_diagnostic);
223+
registry.register_macro("__build_diagnostic_array",
224+
diagnostics::plugin::expand_build_diagnostic_array);
225+
}
226+
216227
for &registrar in registrars.iter() {
217228
registrar(&mut registry);
218229
}
@@ -259,6 +270,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
259270
}
260271
);
261272

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

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+
282298
Some((krate, map))
283299
}
284300

@@ -291,14 +307,14 @@ pub struct CrateAnalysis {
291307
pub name: String,
292308
}
293309

310+
294311
/// Run the resolution, typechecking, region checking and other
295312
/// miscellaneous analysis passes on the crate. Return various
296313
/// structures carrying the results of the analysis.
297314
pub fn phase_3_run_analysis_passes(sess: Session,
298315
krate: &ast::Crate,
299316
ast_map: syntax::ast_map::Map,
300317
name: String) -> CrateAnalysis {
301-
302318
let time_passes = sess.time_passes();
303319

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

0 commit comments

Comments
 (0)