Skip to content

Commit f5a689d

Browse files
committed
---
yaml --- r: 137209 b: refs/heads/release-prep c: c586490 h: refs/heads/master i: 137207: 3b097f0 v: v3
1 parent d38aa4b commit f5a689d

File tree

23 files changed

+230
-43
lines changed

23 files changed

+230
-43
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2929
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
3030
refs/heads/libuv-update-temp-branch: 6ed22c618766f1f2a2e108eef8ce3f51be0f70b7
3131
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
32-
refs/heads/release-prep: cc31d9cabcc6c8ad396c1aae6257a4b5ea25cb46
32+
refs/heads/release-prep: c586490715a35d3c9dae17de7f8907c2f73168d3

branches/release-prep/mk/docs.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ HTML_DEPS += doc/version_info.html
112112
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
113113
$(wildcard $(D)/*.*) | doc/
114114
@$(call E, version-info: $@)
115-
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$( \
116-
CFG_SHORT_VER_HASH)/; \
115+
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \
116+
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
117117
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
118118

119119
GENERATED += doc/version.tex doc/version_info.html

branches/release-prep/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ endif
246246
######################################################################
247247

248248
# FIXME: x86-ism
249-
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
249+
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser mcjit \
250250
interpreter instrumentation
251251

252252
# Only build these LLVM tools

branches/release-prep/src/doc/rustdoc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub use std::option::Option;
6767
```
6868

6969
Doc comments are markdown, and are currently parsed with the
70-
[sundown][sundown] library. rustdoc does not yet do any fanciness such as
70+
[hoedown][hoedown] library. rustdoc does not yet do any fanciness such as
7171
referencing other items inline, like javadoc's `@see`. One exception to this
7272
is that the first paragraph will be used as the "summary" of an item in the
7373
generated documentation:
@@ -123,7 +123,7 @@ documentation. There is a search bar at the top, which is powered by some
123123
JavaScript and a statically-generated search index. No special web server is
124124
required for the search.
125125

126-
[sundown]: https://github.com/vmg/sundown/
126+
[hoedown]: https://github.com/hoedown/hoedown
127127

128128
# Testing the Documentation
129129

branches/release-prep/src/libcollections/str.rs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,11 @@ pub trait StrAllocating: Str {
778778
/// Returns the Levenshtein Distance between two strings.
779779
fn lev_distance(&self, t: &str) -> uint {
780780
let me = self.as_slice();
781-
let slen = me.len();
782-
let tlen = t.len();
781+
if me.is_empty() { return t.char_len(); }
782+
if t.is_empty() { return me.char_len(); }
783783

784-
if slen == 0 { return tlen; }
785-
if tlen == 0 { return slen; }
786-
787-
let mut dcol = Vec::from_fn(tlen + 1, |x| x);
784+
let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
785+
let mut t_last = 0;
788786

789787
for (i, sc) in me.chars().enumerate() {
790788

@@ -799,15 +797,15 @@ pub trait StrAllocating: Str {
799797
*dcol.get_mut(j + 1) = current;
800798
} else {
801799
*dcol.get_mut(j + 1) = cmp::min(current, next);
802-
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1],
803-
dcol[j]) + 1;
800+
*dcol.get_mut(j + 1) = cmp::min(dcol[j + 1], dcol[j]) + 1;
804801
}
805802

806803
current = next;
804+
t_last = j;
807805
}
808806
}
809807

810-
return dcol[tlen];
808+
dcol[t_last + 1]
811809
}
812810

813811
/// Returns an iterator over the string in Unicode Normalization Form D
@@ -1878,6 +1876,27 @@ mod tests {
18781876
assert_eq!(words, vec!["Märy", "häd", "ä", "little", "lämb", "Little", "lämb"])
18791877
}
18801878

1879+
#[test]
1880+
fn test_lev_distance() {
1881+
use std::char::{ from_u32, MAX };
1882+
// Test bytelength agnosticity
1883+
for c in range(0u32, MAX as u32)
1884+
.filter_map(|i| from_u32(i))
1885+
.map(|i| String::from_char(1, i)) {
1886+
assert_eq!(c[].lev_distance(c[]), 0);
1887+
}
1888+
1889+
let a = "\nMäry häd ä little lämb\n\nLittle lämb\n";
1890+
let b = "\nMary häd ä little lämb\n\nLittle lämb\n";
1891+
let c = "Mary häd ä little lämb\n\nLittle lämb\n";
1892+
assert_eq!(a.lev_distance(b), 1);
1893+
assert_eq!(b.lev_distance(a), 1);
1894+
assert_eq!(a.lev_distance(c), 2);
1895+
assert_eq!(c.lev_distance(a), 2);
1896+
assert_eq!(b.lev_distance(c), 1);
1897+
assert_eq!(c.lev_distance(b), 1);
1898+
}
1899+
18811900
#[test]
18821901
fn test_nfd_chars() {
18831902
macro_rules! t {

branches/release-prep/src/libcore/atomic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ impl AtomicInt {
382382
/// # Examples
383383
///
384384
/// ```
385-
/// use std::sync::atomic::{AtomicUint, SeqCst};
385+
/// use std::sync::atomic::{AtomicInt, SeqCst};
386386
///
387-
/// let foo = AtomicUint::new(0b101101);
387+
/// let foo = AtomicInt::new(0b101101);
388388
/// assert_eq!(0b101101, foo.fetch_and(0b110011, SeqCst));
389389
/// assert_eq!(0b100001, foo.load(SeqCst));
390390
#[inline]
@@ -397,9 +397,9 @@ impl AtomicInt {
397397
/// # Examples
398398
///
399399
/// ```
400-
/// use std::sync::atomic::{AtomicUint, SeqCst};
400+
/// use std::sync::atomic::{AtomicInt, SeqCst};
401401
///
402-
/// let foo = AtomicUint::new(0b101101);
402+
/// let foo = AtomicInt::new(0b101101);
403403
/// assert_eq!(0b101101, foo.fetch_or(0b110011, SeqCst));
404404
/// assert_eq!(0b111111, foo.load(SeqCst));
405405
#[inline]
@@ -412,9 +412,9 @@ impl AtomicInt {
412412
/// # Examples
413413
///
414414
/// ```
415-
/// use std::sync::atomic::{AtomicUint, SeqCst};
415+
/// use std::sync::atomic::{AtomicInt, SeqCst};
416416
///
417-
/// let foo = AtomicUint::new(0b101101);
417+
/// let foo = AtomicInt::new(0b101101);
418418
/// assert_eq!(0b101101, foo.fetch_xor(0b110011, SeqCst));
419419
/// assert_eq!(0b011110, foo.load(SeqCst));
420420
#[inline]

branches/release-prep/src/libcore/intrinsics.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ extern "rust-intrinsic" {
250250
/// Abort the execution of the process.
251251
pub fn abort() -> !;
252252

253+
/// Tell LLVM that this point in the code is not reachable,
254+
/// enabling further optimizations.
255+
///
256+
/// NB: This is very different from the `unreachable!()` macro!
257+
#[cfg(not(stage0))]
258+
pub fn unreachable() -> !;
259+
253260
/// Execute a breakpoint trap, for inspection by a debugger.
254261
pub fn breakpoint();
255262

branches/release-prep/src/librustc/middle/trans/debuginfo.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,8 +3164,7 @@ fn populate_scope_map(cx: &CrateContext,
31643164
parent_scope,
31653165
file_metadata,
31663166
loc.line as c_uint,
3167-
loc.col.to_uint() as c_uint,
3168-
0)
3167+
loc.col.to_uint() as c_uint)
31693168
};
31703169

31713170
scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata,
@@ -3290,8 +3289,7 @@ fn populate_scope_map(cx: &CrateContext,
32903289
parent_scope,
32913290
file_metadata,
32923291
loc.line as c_uint,
3293-
loc.col.to_uint() as c_uint,
3294-
0)
3292+
loc.col.to_uint() as c_uint)
32953293
};
32963294

32973295
scope_stack.push(ScopeStackEntry {

branches/release-prep/src/librustc/middle/trans/intrinsic.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N
228228
Unreachable(bcx);
229229
v
230230
}
231+
(_, "unreachable") => {
232+
Unreachable(bcx);
233+
C_nil(ccx)
234+
}
231235
(_, "breakpoint") => {
232236
let llfn = ccx.get_intrinsic(&("llvm.debugtrap"));
233237
Call(bcx, llfn, [], None)

branches/release-prep/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5591,6 +5591,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
55915591
} else {
55925592
match name.get() {
55935593
"abort" => (0, Vec::new(), ty::mk_bot()),
5594+
"unreachable" => (0, Vec::new(), ty::mk_bot()),
55945595
"breakpoint" => (0, Vec::new(), ty::mk_nil()),
55955596
"size_of" |
55965597
"pref_align_of" | "min_align_of" => (1u, Vec::new(), ty::mk_uint()),

branches/release-prep/src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,19 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
869869
ast::TypeImplItem(_) => None,
870870
}
871871
},
872+
ast_map::NodeTraitItem(ref item) => {
873+
match **item {
874+
ast::ProvidedMethod(ref m) => {
875+
Some((m.pe_fn_decl(),
876+
m.pe_generics(),
877+
m.pe_fn_style(),
878+
m.pe_ident(),
879+
Some(&m.pe_explicit_self().node),
880+
m.span))
881+
}
882+
_ => None
883+
}
884+
}
872885
_ => None
873886
},
874887
None => None

branches/release-prep/src/librustc_llvm/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,8 +1747,7 @@ extern {
17471747
Scope: DIDescriptor,
17481748
File: DIFile,
17491749
Line: c_uint,
1750-
Col: c_uint,
1751-
Discriminator: c_uint)
1750+
Col: c_uint)
17521751
-> DILexicalBlock;
17531752

17541753
pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
@@ -2179,12 +2178,10 @@ pub unsafe fn static_link_hack_this_sucks() {
21792178

21802179
LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
21812180

2182-
LLVMLinkInJIT();
21832181
LLVMLinkInMCJIT();
21842182
LLVMLinkInInterpreter();
21852183

21862184
extern {
2187-
fn LLVMLinkInJIT();
21882185
fn LLVMLinkInMCJIT();
21892186
fn LLVMLinkInInterpreter();
21902187
}

branches/release-prep/src/libstd/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,10 +1293,10 @@ impl<'a> Writer for Box<Writer+'a> {
12931293

12941294
impl<'a> Writer for &'a mut Writer+'a {
12951295
#[inline]
1296-
fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
1296+
fn write(&mut self, buf: &[u8]) -> IoResult<()> { (**self).write(buf) }
12971297

12981298
#[inline]
1299-
fn flush(&mut self) -> IoResult<()> { self.flush() }
1299+
fn flush(&mut self) -> IoResult<()> { (**self).flush() }
13001300
}
13011301

13021302
/// A `RefWriter` is a struct implementing `Writer` which contains a reference

branches/release-prep/src/llvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit e9d037419441d51ccb0f41aacbc64080b0c6e81b
1+
Subproject commit c9b823739d1357a058e7437c00bec6d2d0b00ed6

branches/release-prep/src/rustllvm/PassWrapper.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ LLVMRustAddAnalysisPasses(LLVMTargetMachineRef TM,
118118
LLVMPassManagerRef PMR,
119119
LLVMModuleRef M) {
120120
PassManagerBase *PM = unwrap(PMR);
121-
#if LLVM_VERSION_MINOR >= 5
121+
#if LLVM_VERSION_MINOR >= 6
122+
PM->add(new DataLayoutPass());
123+
#elif LLVM_VERSION_MINOR == 5
122124
PM->add(new DataLayoutPass(unwrap(M)));
123125
#else
124126
PM->add(new DataLayout(unwrap(M)));
@@ -187,7 +189,12 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
187189
PassManager *PM = unwrap<PassManager>(PMR);
188190

189191
std::string ErrorInfo;
190-
#if LLVM_VERSION_MINOR >= 4
192+
#if LLVM_VERSION_MINOR >= 6
193+
std::error_code EC;
194+
raw_fd_ostream OS(path, EC, sys::fs::F_None);
195+
if (EC)
196+
ErrorInfo = EC.message();
197+
#elif LLVM_VERSION_MINOR >= 4
191198
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
192199
#else
193200
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
@@ -210,7 +217,12 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
210217
PassManager *PM = unwrap<PassManager>(PMR);
211218
std::string ErrorInfo;
212219

213-
#if LLVM_VERSION_MINOR >= 4
220+
#if LLVM_VERSION_MINOR >= 6
221+
std::error_code EC;
222+
raw_fd_ostream OS(path, EC, sys::fs::F_None);
223+
if (EC)
224+
ErrorInfo = EC.message();
225+
#elif LLVM_VERSION_MINOR >= 4
214226
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
215227
#else
216228
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);

branches/release-prep/src/rustllvm/RustWrapper.cpp

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,12 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock(
393393
LLVMValueRef Scope,
394394
LLVMValueRef File,
395395
unsigned Line,
396-
unsigned Col,
397-
unsigned Discriminator) {
396+
unsigned Col) {
398397
return wrap(Builder->createLexicalBlock(
399398
unwrapDI<DIDescriptor>(Scope),
400399
unwrapDI<DIFile>(File), Line, Col
401-
#if LLVM_VERSION_MINOR >= 5
402-
, Discriminator
400+
#if LLVM_VERSION_MINOR == 5
401+
, 0
403402
#endif
404403
));
405404
}
@@ -415,7 +414,11 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable(
415414
bool isLocalToUnit,
416415
LLVMValueRef Val,
417416
LLVMValueRef Decl = NULL) {
417+
#if LLVM_VERSION_MINOR == 6
418+
return wrap(Builder->createGlobalVariable(unwrapDI<DIDescriptor>(Context),
419+
#else
418420
return wrap(Builder->createStaticVariable(unwrapDI<DIDescriptor>(Context),
421+
#endif
419422
Name,
420423
LinkageName,
421424
unwrapDI<DIFile>(File),
@@ -665,11 +668,18 @@ extern "C" void LLVMWriteValueToString(LLVMValueRef Value, RustStringRef str) {
665668
extern "C" bool
666669
LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
667670
Module *Dst = unwrap(dst);
671+
#if LLVM_VERSION_MINOR == 5
668672
MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
669673
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
674+
#else
675+
std::unique_ptr<MemoryBuffer> buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
676+
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(std::move(buf), Dst->getContext());
677+
#endif
670678
if (!Src) {
671679
LLVMRustSetLastError(Src.getError().message().c_str());
680+
#if LLVM_VERSION_MINOR == 5
672681
delete buf;
682+
#endif
673683
return false;
674684
}
675685

@@ -712,12 +722,26 @@ LLVMRustOpenArchive(char *path) {
712722
return nullptr;
713723
}
714724

725+
#if LLVM_VERSION_MINOR >= 6
726+
ErrorOr<std::unique_ptr<Archive>> archive_or =
727+
Archive::create(buf_or.get()->getMemBufferRef());
728+
729+
if (!archive_or) {
730+
LLVMRustSetLastError(archive_or.getError().message().c_str());
731+
return nullptr;
732+
}
733+
734+
OwningBinary<Archive> *ret = new OwningBinary<Archive>(
735+
std::move(archive_or.get()), std::move(buf_or.get()));
736+
#else
715737
std::error_code err;
716738
Archive *ret = new Archive(std::move(buf_or.get()), err);
717739
if (err) {
718740
LLVMRustSetLastError(err.message().c_str());
719-
return NULL;
741+
return nullptr;
720742
}
743+
#endif
744+
721745
return ret;
722746
}
723747
#else
@@ -739,7 +763,14 @@ LLVMRustOpenArchive(char *path) {
739763
#endif
740764

741765
extern "C" const char*
766+
#if LLVM_VERSION_MINOR >= 6
767+
LLVMRustArchiveReadSection(OwningBinary<Archive> *ob, char *name, size_t *size) {
768+
769+
std::unique_ptr<Archive> &ar = ob->getBinary();
770+
#else
742771
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
772+
#endif
773+
743774
#if LLVM_VERSION_MINOR >= 5
744775
Archive::child_iterator child = ar->child_begin(),
745776
end = ar->child_end();
@@ -765,7 +796,11 @@ LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
765796
}
766797

767798
extern "C" void
799+
#if LLVM_VERSION_MINOR >= 6
800+
LLVMRustDestroyArchive(OwningBinary<Archive> *ar) {
801+
#else
768802
LLVMRustDestroyArchive(Archive *ar) {
803+
#endif
769804
delete ar;
770805
}
771806

0 commit comments

Comments
 (0)