Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cfc572c

Browse files
committed
Auto merge of rust-lang#74957 - Manishearth:rollup-3wudwlg, r=Manishearth
Rollup of 9 pull requests Successful merges: - rust-lang#74751 (Clean up E0730 explanation) - rust-lang#74782 (Don't use "weak count" around Weak::from_raw_ptr) - rust-lang#74835 (Clean up E0734 explanation) - rust-lang#74871 (Enable docs on dist-x86_64-musl) - rust-lang#74905 (Avoid bool-like naming) - rust-lang#74907 (Clean up E0740 explanation) - rust-lang#74915 (rustc: Ignore fs::canonicalize errors in metadata) - rust-lang#74934 (Improve diagnostics when constant pattern is too generic) - rust-lang#74951 (Cherry-pick the release notes for 1.45.1) Failed merges: r? @ghost
2 parents 438c59f + 9eb5026 commit cfc572c

File tree

14 files changed

+108
-81
lines changed

14 files changed

+108
-81
lines changed

RELEASES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Version 1.45.1 (2020-07-30)
2+
==========================
3+
4+
* [Fix const propagation with references.][73613]
5+
* [rustfmt accepts rustfmt_skip in cfg_attr again.][73078]
6+
* [Avoid spurious implicit region bound.][74509]
7+
* [Install clippy on x.py install][74457]
8+
9+
[73613]: https://github.com/rust-lang/rust/pull/73613
10+
[73078]: https://github.com/rust-lang/rust/issues/73078
11+
[74509]: https://github.com/rust-lang/rust/pull/74509
12+
[74457]: https://github.com/rust-lang/rust/pull/74457
13+
114
Version 1.45.0 (2020-07-16)
215
==========================
316

library/alloc/src/rc.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,8 +1692,9 @@ impl<T> Weak<T> {
16921692

16931693
/// Consumes the `Weak<T>` and turns it into a raw pointer.
16941694
///
1695-
/// This converts the weak pointer into a raw pointer, preserving the original weak count. It
1696-
/// can be turned back into the `Weak<T>` with [`from_raw`].
1695+
/// This converts the weak pointer into a raw pointer, while still preserving the ownership of
1696+
/// one weak reference (the weak count is not modified by this operation). It can be turned
1697+
/// back into the `Weak<T>` with [`from_raw`].
16971698
///
16981699
/// The same restrictions of accessing the target of the pointer as with
16991700
/// [`as_ptr`] apply.
@@ -1728,17 +1729,18 @@ impl<T> Weak<T> {
17281729
/// This can be used to safely get a strong reference (by calling [`upgrade`]
17291730
/// later) or to deallocate the weak count by dropping the `Weak<T>`.
17301731
///
1731-
/// It takes ownership of one weak count (with the exception of pointers created by [`new`],
1732-
/// as these don't have any corresponding weak count).
1732+
/// It takes ownership of one weak reference (with the exception of pointers created by [`new`],
1733+
/// as these don't own anything; the method still works on them).
17331734
///
17341735
/// # Safety
17351736
///
1736-
/// The pointer must have originated from the [`into_raw`] and must still own its potential
1737-
/// weak reference count.
1737+
/// The pointer must have originated from the [`into_raw`] and must still own its potential
1738+
/// weak reference.
17381739
///
1739-
/// It is allowed for the strong count to be 0 at the time of calling this, but the weak count
1740-
/// must be non-zero or the pointer must have originated from a dangling `Weak<T>` (one created
1741-
/// by [`new`]).
1740+
/// It is allowed for the strong count to be 0 at the time of calling this. Nevertheless, this
1741+
/// takes ownership of one weak reference currently represented as a raw pointer (the weak
1742+
/// count is not modified by this operation) and therefore it must be paired with a previous
1743+
/// call to [`into_raw`].
17421744
///
17431745
/// # Examples
17441746
///

library/alloc/src/sync.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,8 +1462,9 @@ impl<T> Weak<T> {
14621462

14631463
/// Consumes the `Weak<T>` and turns it into a raw pointer.
14641464
///
1465-
/// This converts the weak pointer into a raw pointer, preserving the original weak count. It
1466-
/// can be turned back into the `Weak<T>` with [`from_raw`].
1465+
/// This converts the weak pointer into a raw pointer, while still preserving the ownership of
1466+
/// one weak reference (the weak count is not modified by this operation). It can be turned
1467+
/// back into the `Weak<T>` with [`from_raw`].
14671468
///
14681469
/// The same restrictions of accessing the target of the pointer as with
14691470
/// [`as_ptr`] apply.
@@ -1493,24 +1494,23 @@ impl<T> Weak<T> {
14931494
result
14941495
}
14951496

1496-
/// Converts a raw pointer previously created by [`into_raw`] back into
1497-
/// `Weak<T>`.
1497+
/// Converts a raw pointer previously created by [`into_raw`] back into `Weak<T>`.
14981498
///
14991499
/// This can be used to safely get a strong reference (by calling [`upgrade`]
15001500
/// later) or to deallocate the weak count by dropping the `Weak<T>`.
15011501
///
1502-
/// It takes ownership of one weak count (with the exception of pointers created by [`new`],
1503-
/// as these don't have any corresponding weak count).
1502+
/// It takes ownership of one weak reference (with the exception of pointers created by [`new`],
1503+
/// as these don't own anything; the method still works on them).
15041504
///
15051505
/// # Safety
15061506
///
15071507
/// The pointer must have originated from the [`into_raw`] and must still own its potential
1508-
/// weak reference count.
1509-
///
1510-
/// It is allowed for the strong count to be 0 at the time of calling this, but the weak count
1511-
/// must be non-zero or the pointer must have originated from a dangling `Weak<T>` (one created
1512-
/// by [`new`]).
1508+
/// weak reference.
15131509
///
1510+
/// It is allowed for the strong count to be 0 at the time of calling this. Nevertheless, this
1511+
/// takes ownership of one weak reference currently represented as a raw pointer (the weak
1512+
/// count is not modified by this operation) and therefore it must be paired with a previous
1513+
/// call to [`into_raw`].
15141514
/// # Examples
15151515
///
15161516
/// ```

src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ ENV HOSTS=x86_64-unknown-linux-musl
3333
ENV RUST_CONFIGURE_ARGS \
3434
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
3535
--enable-extended \
36-
--disable-docs \
3736
--enable-lld \
3837
--set target.x86_64-unknown-linux-musl.crt-static=false \
3938
--build $HOSTS

src/etc/test-float-parse/runtests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,8 @@ def main():
195195
global MAILBOX
196196
tests = [os.path.splitext(f)[0] for f in glob('*.rs')
197197
if not f.startswith('_')]
198-
listed = sys.argv[1:]
199-
if listed:
200-
tests = [test for test in tests if test in listed]
198+
args = sys.argv[1:]
199+
tests = [test for test in tests if test in args]
201200
if not tests:
202201
print("Error: No tests to run")
203202
sys.exit(1)
Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
An array without a fixed length was pattern-matched.
22

3-
Example of erroneous code:
3+
Erroneous code example:
44

55
```compile_fail,E0730
66
#![feature(const_generics)]
@@ -14,14 +14,28 @@ fn is_123<const N: usize>(x: [u32; N]) -> bool {
1414
}
1515
```
1616

17-
Ensure that the pattern is consistent with the size of the matched
18-
array. Additional elements can be matched with `..`:
17+
To fix this error, you have two solutions:
18+
1. Use an array with a fixed length.
19+
2. Use a slice.
1920

21+
Example with an array with a fixed length:
22+
23+
```
24+
fn is_123(x: [u32; 3]) -> bool { // We use an array with a fixed size
25+
match x {
26+
[1, 2, ..] => true, // ok!
27+
_ => false
28+
}
29+
}
2030
```
21-
let r = &[1, 2, 3, 4];
22-
match r {
23-
&[a, b, ..] => { // ok!
24-
println!("a={}, b={}", a, b);
31+
32+
Example with a slice:
33+
34+
```
35+
fn is_123(x: &[u32]) -> bool { // We use a slice
36+
match x {
37+
[1, 2, ..] => true, // ok!
38+
_ => false
2539
}
2640
}
2741
```

src/librustc_error_codes/error_codes/E0734.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
A stability attribute has been used outside of the standard library.
22

3-
Erroneous code examples:
3+
Erroneous code example:
44

55
```compile_fail,E0734
66
#[rustc_deprecated(since = "b", reason = "text")] // invalid

src/librustc_error_codes/error_codes/E0740.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A `union` cannot have fields with destructors.
1+
A `union` was declared with fields with destructors.
22

33
Erroneous code example:
44

@@ -14,3 +14,5 @@ impl Drop for A {
1414
fn drop(&mut self) { println!("A"); }
1515
}
1616
```
17+
18+
A `union` cannot have fields with destructors.

src/librustc_metadata/creader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ impl<'a> CrateLoader<'a> {
248248
// Only use `--extern crate_name=path` here, not `--extern crate_name`.
249249
if let Some(mut files) = entry.files() {
250250
if files.any(|l| {
251-
let l = fs::canonicalize(l).ok();
252-
source.dylib.as_ref().map(|p| &p.0) == l.as_ref()
253-
|| source.rlib.as_ref().map(|p| &p.0) == l.as_ref()
251+
let l = fs::canonicalize(l).unwrap_or(l.clone().into());
252+
source.dylib.as_ref().map(|p| &p.0) == Some(&l)
253+
|| source.rlib.as_ref().map(|p| &p.0) == Some(&l)
254254
}) {
255255
ret = Some(cnum);
256256
}

src/librustc_metadata/locator.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -426,20 +426,17 @@ impl<'a> CrateLocator<'a> {
426426
info!("lib candidate: {}", spf.path.display());
427427

428428
let (rlibs, rmetas, dylibs) = candidates.entry(hash.to_string()).or_default();
429-
fs::canonicalize(&spf.path)
430-
.map(|p| {
431-
if seen_paths.contains(&p) {
432-
return FileDoesntMatch;
433-
};
434-
seen_paths.insert(p.clone());
435-
match found_kind {
436-
CrateFlavor::Rlib => rlibs.insert(p, kind),
437-
CrateFlavor::Rmeta => rmetas.insert(p, kind),
438-
CrateFlavor::Dylib => dylibs.insert(p, kind),
439-
};
440-
FileMatches
441-
})
442-
.unwrap_or(FileDoesntMatch)
429+
let path = fs::canonicalize(&spf.path).unwrap_or_else(|_| spf.path.clone());
430+
if seen_paths.contains(&path) {
431+
return FileDoesntMatch;
432+
};
433+
seen_paths.insert(path.clone());
434+
match found_kind {
435+
CrateFlavor::Rlib => rlibs.insert(path, kind),
436+
CrateFlavor::Rmeta => rmetas.insert(path, kind),
437+
CrateFlavor::Dylib => dylibs.insert(path, kind),
438+
};
439+
FileMatches
443440
});
444441
self.rejected_via_kind.extend(staticlibs);
445442

@@ -688,12 +685,13 @@ impl<'a> CrateLocator<'a> {
688685
&& file.ends_with(&self.target.options.dll_suffix)
689686
{
690687
// Make sure there's at most one rlib and at most one dylib.
688+
let loc = fs::canonicalize(&loc).unwrap_or_else(|_| loc.clone());
691689
if loc.file_name().unwrap().to_str().unwrap().ends_with(".rlib") {
692-
rlibs.insert(fs::canonicalize(&loc).unwrap(), PathKind::ExternFlag);
690+
rlibs.insert(loc, PathKind::ExternFlag);
693691
} else if loc.file_name().unwrap().to_str().unwrap().ends_with(".rmeta") {
694-
rmetas.insert(fs::canonicalize(&loc).unwrap(), PathKind::ExternFlag);
692+
rmetas.insert(loc, PathKind::ExternFlag);
695693
} else {
696-
dylibs.insert(fs::canonicalize(&loc).unwrap(), PathKind::ExternFlag);
694+
dylibs.insert(loc, PathKind::ExternFlag);
697695
}
698696
} else {
699697
self.rejected_via_filename

0 commit comments

Comments
 (0)