Skip to content

Commit 015b325

Browse files
committed
Auto merge of #52931 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 31 pull requests Successful merges: - #52332 (dead-code lint: say "constructed" for structs) - #52340 (Document From trait implementations for OsStr, OsString, CString, and CStr) - #52628 (Cleanup some rustdoc code) - #52732 (Remove unstable and deprecated APIs) - #52745 (Update clippy to latest master) - #52756 (rustc: Disallow machine applicability in foreign macros) - #52771 (Clarify thread::park semantics) - #52810 ([NLL] Don't make "fake" match variables mutable) - #52821 (pretty print for std::collections::vecdeque) - #52822 (Fix From<LocalWaker>) - #52824 (Fix -Wpessimizing-move warnings in rustllvm/PassWrapper) - #52831 (remove references to AUTHORS.txt file) - #52835 (Fix Alias intra doc ICE) - #52842 (update comment) - #52846 (Add timeout to use of `curl` in bootstrap.py.) - #52851 (Make the tool_lints actually usable) - #52853 (Improve bootstrap help on stages) - #52859 (Use Vec::extend in SmallVec::extend when applicable) - #52861 (Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.) - #52867 (releases.md: fix 2 typos) - #52870 (Implement Unpin for FutureObj and LocalFutureObj) - #52876 (run-pass/const-endianness: negate before to_le()) - #52878 (Fix wrong issue number in the test name) - #52883 (Include lifetime in mutability suggestion in NLL messages) - #52904 (NLL: sort diagnostics by span) - #52905 (Fix a typo in unsize.rs) - #52907 (NLL: On "cannot move out of type" error, print original before rewrite) - #52908 (Use SetLenOnDrop in Vec::truncate()) - #52914 (Only run the sparc-abi test on sparc) - #52918 (Backport 1.27.2 release notes) - #52929 (Update compatibility note for 1.28.0 to be correct) Failed merges: - #52758 (Cleanup for librustc::session) - #52799 (Use BitVector for global sets of AttrId) r? @ghost
2 parents e94df4a + dcb71f0 commit 015b325

File tree

134 files changed

+2198
-1677
lines changed

Some content is hidden

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

134 files changed

+2198
-1677
lines changed

COPYRIGHT

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Copyrights in the Rust project are retained by their contributors. No
1010
copyright assignment is required to contribute to the Rust project.
1111

1212
Some files include explicit copyright notices and/or license notices.
13-
For full authorship information, see AUTHORS.txt and the version control
14-
history.
13+
For full authorship information, see the version control history or
14+
https://thanks.rust-lang.org
1515

1616
Except as otherwise noted (below and/or in individual files), Rust is
1717
licensed under the Apache License, Version 2.0 <LICENSE-APACHE> or

RELEASES.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ Misc
9494

9595
Compatibility Notes
9696
-------------------
97-
- [Rust will no longer consider trait objects with duplicated constraints to
98-
have implementations.][51276] For example the below code will now fail
99-
to compile.
97+
- [Rust will consider trait objects with duplicated constraints to be the same
98+
type as without the duplicated constraint.][51276] For example the below code will
99+
now fail to compile.
100100
```rust
101101
trait Trait {}
102102

@@ -160,6 +160,17 @@ Compatibility Notes
160160
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
161161
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2
162162

163+
Version 1.27.2 (2018-07-20)
164+
===========================
165+
166+
Compatibility Notes
167+
-------------------
168+
169+
- The borrow checker was fixed to avoid potential unsoundness when using
170+
match ergonomics: [#52213][52213].
171+
172+
[52213]: https://github.com./rust-lang/rust/issues/52213
173+
163174
Version 1.27.1 (2018-07-10)
164175
===========================
165176

@@ -190,7 +201,7 @@ Version 1.27.0 (2018-06-21)
190201
Language
191202
--------
192203
- [Removed 'proc' from the reserved keywords list.][49699] This allows `proc` to
193-
be used as an identifer.
204+
be used as an identifier.
194205
- [The dyn syntax is now available.][49968] This syntax is equivalent to the
195206
bare `Trait` syntax, and should make it clearer when being used in tandem with
196207
`impl Trait`. Since it is equivalent to the following syntax:
@@ -4795,7 +4806,7 @@ Language
47954806
--------
47964807

47974808
* Patterns with `ref mut` now correctly invoke [`DerefMut`] when
4798-
matching against dereferencable values.
4809+
matching against dereferenceable values.
47994810

48004811
Libraries
48014812
---------

src/Cargo.lock

-9
Original file line numberDiff line numberDiff line change
@@ -2612,18 +2612,9 @@ dependencies = [
26122612
"rustc_lsan 0.0.0",
26132613
"rustc_msan 0.0.0",
26142614
"rustc_tsan 0.0.0",
2615-
"std_unicode 0.0.0",
26162615
"unwind 0.0.0",
26172616
]
26182617

2619-
[[package]]
2620-
name = "std_unicode"
2621-
version = "0.0.0"
2622-
dependencies = [
2623-
"compiler_builtins 0.0.0",
2624-
"core 0.0.0",
2625-
]
2626-
26272618
[[package]]
26282619
name = "string_cache"
26292620
version = "0.7.3"

src/bootstrap/bootstrap.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ def _download(path, url, probably_big, verbose, exception):
8888
option = "-#"
8989
else:
9090
option = "-s"
91-
run(["curl", option, "--retry", "3", "-Sf", "-o", path, url],
91+
run(["curl", option,
92+
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
93+
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
94+
"--retry", "3", "-Sf", "-o", path, url],
9295
verbose=verbose,
9396
exception=exception)
9497

src/bootstrap/compile.rs

-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ pub fn std_cargo(builder: &Builder,
157157
cargo.arg("--features").arg("c mem")
158158
.args(&["-p", "alloc"])
159159
.args(&["-p", "compiler_builtins"])
160-
.args(&["-p", "std_unicode"])
161160
.arg("--manifest-path")
162161
.arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml"));
163162
} else {

src/bootstrap/dist.rs

-1
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,6 @@ impl Step for Src {
856856
"src/librustc_msan",
857857
"src/librustc_tsan",
858858
"src/libstd",
859-
"src/libstd_unicode",
860859
"src/libunwind",
861860
"src/rustc/compiler_builtins_shim",
862861
"src/rustc/libc_shim",

src/bootstrap/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl Step for Std {
489489
// Keep a whitelist so we do not build internal stdlib crates, these will be
490490
// build by the rustc step later if enabled.
491491
cargo.arg("--no-deps");
492-
for krate in &["alloc", "core", "std", "std_unicode"] {
492+
for krate in &["alloc", "core", "std"] {
493493
cargo.arg("-p").arg(krate);
494494
// Create all crate output directories first to make sure rustdoc uses
495495
// relative links.

src/bootstrap/flags.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
121121
opts.optmulti("", "exclude", "build paths to exclude", "PATH");
122122
opts.optopt("", "on-fail", "command to run on failure", "CMD");
123123
opts.optflag("", "dry-run", "dry run; don't build anything");
124-
opts.optopt("", "stage", "stage to build", "N");
124+
opts.optopt("", "stage",
125+
"stage to build (indicates compiler to use/test, e.g. stage 0 uses the \
126+
bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)",
127+
"N");
125128
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling", "N");
126129
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
127130
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
@@ -258,7 +261,7 @@ Arguments:
258261
259262
./x.py build --stage 1 src/libtest
260263
261-
This will first build everything once (like --stage 0 without further
264+
This will first build everything once (like `--stage 0` without further
262265
arguments would), and then use the compiler built in stage 0 to build
263266
src/libtest and its dependencies.
264267
Once this is done, build/$ARCH/stage1 contains a usable compiler.",
@@ -290,10 +293,14 @@ Arguments:
290293
291294
./x.py test src/test/run-pass
292295
./x.py test src/libstd --test-args hash_map
293-
./x.py test src/libstd --stage 0
296+
./x.py test src/libstd --stage 0 --no-doc
294297
./x.py test src/test/ui --bless
295298
./x.py test src/test/ui --compare-mode nll
296299
300+
Note that `test src/test/* --stage N` does NOT depend on `build src/rustc --stage N`;
301+
just like `build src/libstd --stage N` it tests the compiler produced by the previous
302+
stage.
303+
297304
If no arguments are passed then the complete artifacts for that stage are
298305
compiled and tested.
299306

src/doc/man/rustdoc.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ See <\fBhttps://github.com./rust\-lang/rust/issues\fR>
119119
for issues.
120120

121121
.SH "AUTHOR"
122-
See \fIAUTHORS.txt\fR in the Rust source distribution.
122+
See the version control history or <\fBhttps://thanks.rust\-lang.org\fR>
123123

124124
.SH "COPYRIGHT"
125125
This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.

src/etc/debugger_pretty_printers_common.py

+33
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
TYPE_KIND_FIXED_SIZE_VEC = 16
4848
TYPE_KIND_REGULAR_UNION = 17
4949
TYPE_KIND_OS_STRING = 18
50+
TYPE_KIND_STD_VECDEQUE = 19
5051

5152
ENCODED_ENUM_PREFIX = "RUST$ENCODED$ENUM$"
5253
ENUM_DISR_FIELD_NAME = "RUST$ENUM$DISR"
@@ -62,6 +63,14 @@
6263
STD_VEC_FIELD_NAMES = [STD_VEC_FIELD_NAME_BUF,
6364
STD_VEC_FIELD_NAME_LENGTH]
6465

66+
# std::collections::VecDeque<> related constants
67+
STD_VECDEQUE_FIELD_NAME_TAIL = "tail"
68+
STD_VECDEQUE_FIELD_NAME_HEAD = "head"
69+
STD_VECDEQUE_FIELD_NAME_BUF = "buf"
70+
STD_VECDEQUE_FIELD_NAMES = [STD_VECDEQUE_FIELD_NAME_TAIL,
71+
STD_VECDEQUE_FIELD_NAME_HEAD,
72+
STD_VECDEQUE_FIELD_NAME_BUF]
73+
6574
# std::String related constants
6675
STD_STRING_FIELD_NAMES = ["vec"]
6776

@@ -161,6 +170,11 @@ def __classify_struct(self):
161170
self.__conforms_to_field_layout(STD_VEC_FIELD_NAMES)):
162171
return TYPE_KIND_STD_VEC
163172

173+
# STD COLLECTION VECDEQUE
174+
if (unqualified_type_name.startswith("VecDeque<") and
175+
self.__conforms_to_field_layout(STD_VECDEQUE_FIELD_NAMES)):
176+
return TYPE_KIND_STD_VECDEQUE
177+
164178
# STD STRING
165179
if (unqualified_type_name.startswith("String") and
166180
self.__conforms_to_field_layout(STD_STRING_FIELD_NAMES)):
@@ -325,6 +339,25 @@ def extract_length_ptr_and_cap_from_std_vec(vec_val):
325339
assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR
326340
return (length, data_ptr, capacity)
327341

342+
343+
def extract_tail_head_ptr_and_cap_from_std_vecdeque(vec_val):
344+
assert vec_val.type.get_type_kind() == TYPE_KIND_STD_VECDEQUE
345+
tail_field_index = STD_VECDEQUE_FIELD_NAMES.index(STD_VECDEQUE_FIELD_NAME_TAIL)
346+
head_field_index = STD_VECDEQUE_FIELD_NAMES.index(STD_VECDEQUE_FIELD_NAME_HEAD)
347+
buf_field_index = STD_VECDEQUE_FIELD_NAMES.index(STD_VECDEQUE_FIELD_NAME_BUF)
348+
349+
tail = vec_val.get_child_at_index(tail_field_index).as_integer()
350+
head = vec_val.get_child_at_index(head_field_index).as_integer()
351+
buf = vec_val.get_child_at_index(buf_field_index)
352+
353+
vec_ptr_val = buf.get_child_at_index(0)
354+
capacity = buf.get_child_at_index(1).as_integer()
355+
unique_ptr_val = vec_ptr_val.get_child_at_index(0)
356+
data_ptr = unique_ptr_val.get_child_at_index(0)
357+
assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR
358+
return (tail, head, data_ptr, capacity)
359+
360+
328361
def extract_length_and_ptr_from_slice(slice_val):
329362
assert (slice_val.type.get_type_kind() == TYPE_KIND_SLICE or
330363
slice_val.type.get_type_kind() == TYPE_KIND_STR_SLICE)

src/etc/gdb_rust_pretty_printing.py

+25
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def rust_pretty_printer_lookup_function(gdb_val):
124124
if type_kind == rustpp.TYPE_KIND_STD_VEC:
125125
return RustStdVecPrinter(val)
126126

127+
if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE:
128+
return RustStdVecDequePrinter(val)
129+
127130
if type_kind == rustpp.TYPE_KIND_STD_STRING:
128131
return RustStdStringPrinter(val)
129132

@@ -274,6 +277,28 @@ def children(self):
274277
yield (str(index), (gdb_ptr + index).dereference())
275278

276279

280+
class RustStdVecDequePrinter(object):
281+
def __init__(self, val):
282+
self.__val = val
283+
284+
@staticmethod
285+
def display_hint():
286+
return "array"
287+
288+
def to_string(self):
289+
(tail, head, data_ptr, cap) = \
290+
rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val)
291+
return (self.__val.type.get_unqualified_type_name() +
292+
("(len: %i, cap: %i)" % (head - tail, cap)))
293+
294+
def children(self):
295+
(tail, head, data_ptr, cap) = \
296+
rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val)
297+
gdb_ptr = data_ptr.get_wrapped_value()
298+
for index in xrange(tail, head):
299+
yield (str(index), (gdb_ptr + index).dereference())
300+
301+
277302
class RustStdStringPrinter(object):
278303
def __init__(self, val):
279304
self.__val = val

src/liballoc/vec.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -690,14 +690,20 @@ impl<T> Vec<T> {
690690
/// [`drain`]: #method.drain
691691
#[stable(feature = "rust1", since = "1.0.0")]
692692
pub fn truncate(&mut self, len: usize) {
693+
let current_len = self.len;
693694
unsafe {
695+
let mut ptr = self.as_mut_ptr().offset(self.len as isize);
696+
// Set the final length at the end, keeping in mind that
697+
// dropping an element might panic. Works around a missed
698+
// optimization, as seen in the following issue:
699+
// https://github.com./rust-lang/rust/issues/51802
700+
let mut local_len = SetLenOnDrop::new(&mut self.len);
701+
694702
// drop any extra elements
695-
while len < self.len {
696-
// decrement len before the drop_in_place(), so a panic on Drop
697-
// doesn't re-drop the just-failed value.
698-
self.len -= 1;
699-
let len = self.len;
700-
ptr::drop_in_place(self.get_unchecked_mut(len));
703+
for _ in len..current_len {
704+
local_len.decrement_len(1);
705+
ptr = ptr.offset(-1);
706+
ptr::drop_in_place(ptr);
701707
}
702708
}
703709
}
@@ -1512,6 +1518,11 @@ impl<'a> SetLenOnDrop<'a> {
15121518
fn increment_len(&mut self, increment: usize) {
15131519
self.local_len += increment;
15141520
}
1521+
1522+
#[inline]
1523+
fn decrement_len(&mut self, decrement: usize) {
1524+
self.local_len -= decrement;
1525+
}
15151526
}
15161527

15171528
impl<'a> Drop for SetLenOnDrop<'a> {

src/liballoc_system/lib.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ mod platform {
174174
}
175175
}
176176

177-
#[cfg(any(target_os = "android", target_os = "redox", target_os = "solaris"))]
177+
#[cfg(any(target_os = "android",
178+
target_os = "hermit",
179+
target_os = "redox",
180+
target_os = "solaris"))]
178181
#[inline]
179182
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
180183
// On android we currently target API level 9 which unfortunately
@@ -197,7 +200,10 @@ mod platform {
197200
libc::memalign(layout.align(), layout.size()) as *mut u8
198201
}
199202

200-
#[cfg(not(any(target_os = "android", target_os = "redox", target_os = "solaris")))]
203+
#[cfg(not(any(target_os = "android",
204+
target_os = "hermit",
205+
target_os = "redox",
206+
target_os = "solaris")))]
201207
#[inline]
202208
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
203209
let mut out = ptr::null_mut();

0 commit comments

Comments
 (0)