Skip to content

Commit 3a49e62

Browse files
committed
Auto merge of rust-lang#135388 - jhpratt:rollup-zeyd0r8, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#132232 (CI: build FreeBSD artifacts on FreeBSD 13.4) - rust-lang#135266 (Remove emsdk version update from 1.84.0 relnotes) - rust-lang#135364 (Cleanup `suggest_binding_for_closure_capture_self` diag in borrowck) - rust-lang#135375 (allow rustdoc-js tests to be run at stage0) - rust-lang#135379 (Make (unstable API) `UniqueRc` invariant for soundness) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 12445e0 + 948f071 commit 3a49e62

File tree

10 files changed

+72
-27
lines changed

10 files changed

+72
-27
lines changed

RELEASES.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ Compatibility Notes
111111
- Support for the target named `wasm32-wasi` has been removed as the target is now named `wasm32-wasip1`. This completes the [transition](https://github.com/rust-lang/compiler-team/issues/607) [plan](https://github.com/rust-lang/compiler-team/issues/695) for this target following [the introduction of `wasm32-wasip1`](https://github.com/rust-lang/rust/pull/120468) in Rust 1.78. Compiler warnings on [use of `wasm32-wasi`](https://github.com/rust-lang/rust/pull/126662) introduced in Rust 1.81 are now gone as well as the target is removed.
112112
- [The syntax `&pin (mut|const) T` is now parsed as a type which in theory could affect macro expansion results in some edge cases](https://github.com/rust-lang/rust/pull/130635#issuecomment-2375462821)
113113
- [Legacy syntax for calling `std::arch` functions is no longer permitted to declare items or bodies (such as closures, inline consts, or async blocks).](https://github.com/rust-lang/rust/pull/130443#issuecomment-2445678945)
114-
- The `wasm32-unknown-emscripten` target's binary release of the standard library is now [built with the latest emsdk 3.1.68](https://github.com/rust-lang/rust/pull/131533), which fixes an ABI-incompatibility with Emscripten >= 3.1.42. If you are locally using a version of emsdk with an incompatible ABI (e.g. before 3.1.42 or a future one), you should build your code with `-Zbuild-std` to ensure that `std` uses the correct ABI.
115114
- [Declaring functions with a calling convention not supported on the current target now triggers a hard error](https://github.com/rust-lang/rust/pull/129935)
116115
- [The next-generation trait solver is now enabled for coherence, fixing multiple soundness issues](https://github.com/rust-lang/rust/pull/130654)
117116

@@ -2184,7 +2183,7 @@ Language
21842183
--------
21852184

21862185
- [Stabilize default_alloc_error_handler](https://github.com/rust-lang/rust/pull/102318/)
2187-
This allows usage of `alloc` on stable without requiring the
2186+
This allows usage of `alloc` on stable without requiring the
21882187
definition of a handler for allocation failure. Defining custom handlers is still unstable.
21892188
- [Stabilize `efiapi` calling convention.](https://github.com/rust-lang/rust/pull/105795/)
21902189
- [Remove implicit promotion for types with drop glue](https://github.com/rust-lang/rust/pull/105085/)

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -2680,22 +2680,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
26802680
return;
26812681
}
26822682

2683-
let mut sugg = vec![];
26842683
let sm = self.infcx.tcx.sess.source_map();
2685-
2686-
if let Some(span) = finder.closure_arg_span {
2687-
sugg.push((sm.next_point(span.shrink_to_lo()).shrink_to_hi(), finder.suggest_arg));
2688-
}
2689-
for span in finder.closure_change_spans {
2690-
sugg.push((span, "this".to_string()));
2691-
}
2692-
2693-
for (span, suggest) in finder.closure_call_changes {
2694-
sugg.push((span, suggest));
2695-
}
2684+
let sugg = finder
2685+
.closure_arg_span
2686+
.map(|span| (sm.next_point(span.shrink_to_lo()).shrink_to_hi(), finder.suggest_arg))
2687+
.into_iter()
2688+
.chain(
2689+
finder.closure_change_spans.into_iter().map(|span| (span, "this".to_string())),
2690+
)
2691+
.chain(finder.closure_call_changes)
2692+
.collect();
26962693

26972694
err.multipart_suggestion_verbose(
2698-
"try explicitly pass `&Self` into the Closure as an argument",
2695+
"try explicitly passing `&Self` into the closure as an argument",
26992696
sugg,
27002697
Applicability::MachineApplicable,
27012698
);

compiler/rustc_errors/src/diagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
880880
)
881881
} }
882882

883-
/// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
883+
/// Show a suggestion that has multiple parts to it, always as its own subdiagnostic.
884884
/// In other words, multiple changes need to be applied as part of this suggestion.
885885
#[rustc_lint_diagnostics]
886886
pub fn multipart_suggestion_verbose(

library/alloc/src/rc.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -3708,7 +3708,11 @@ pub struct UniqueRc<
37083708
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
37093709
> {
37103710
ptr: NonNull<RcInner<T>>,
3711-
phantom: PhantomData<RcInner<T>>,
3711+
// Define the ownership of `RcInner<T>` for drop-check
3712+
_marker: PhantomData<RcInner<T>>,
3713+
// Invariance is necessary for soundness: once other `Weak`
3714+
// references exist, we already have a form of shared mutability!
3715+
_marker2: PhantomData<*mut T>,
37123716
alloc: A,
37133717
}
37143718

@@ -3994,7 +3998,7 @@ impl<T, A: Allocator> UniqueRc<T, A> {
39943998
},
39953999
alloc,
39964000
));
3997-
Self { ptr: ptr.into(), phantom: PhantomData, alloc }
4001+
Self { ptr: ptr.into(), _marker: PhantomData, _marker2: PhantomData, alloc }
39984002
}
39994003
}
40004004

src/bootstrap/src/core/build_steps/test.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,10 @@ impl Step for Compiletest {
16371637
return;
16381638
}
16391639

1640-
if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() {
1640+
if builder.top_stage == 0
1641+
&& env::var("COMPILETEST_FORCE_STAGE0").is_err()
1642+
&& self.mode != "js-doc-test"
1643+
{
16411644
eprintln!("\
16421645
ERROR: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
16431646
HELP: to test the compiler, use `--stage 1` instead

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ COPY scripts/cmake.sh /scripts/
2929
RUN /scripts/cmake.sh
3030

3131
ENV \
32-
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-ar \
33-
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-clang \
34-
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-clang++
32+
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd13-ar \
33+
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd13-clang \
34+
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd13-clang++
3535

3636
ENV HOSTS=x86_64-unknown-freebsd
3737

src/ci/docker/scripts/freebsd-toolchain.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -eux
55

66
arch=$1
77
binutils_version=2.40
8-
freebsd_version=12.3
9-
triple=$arch-unknown-freebsd12
8+
freebsd_version=13.4
9+
triple=$arch-unknown-freebsd13
1010
sysroot=/usr/local/$triple
1111

1212
hide_output() {
@@ -59,7 +59,7 @@ done
5959

6060
# Originally downloaded from:
6161
# URL=https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz
62-
URL=https://ci-mirrors.rust-lang.org/rustc/2022-05-06-freebsd-${freebsd_version}-${freebsd_arch}-base.txz
62+
URL=https://ci-mirrors.rust-lang.org/rustc/2024-09-13-freebsd-${freebsd_version}-${freebsd_arch}-base.txz
6363
curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}"
6464

6565
# Clang can do cross-builds out of the box, if we give it the right

tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | self.qux();
1111
LL | x(1);
1212
| - immutable borrow later used here
1313
|
14-
help: try explicitly pass `&Self` into the Closure as an argument
14+
help: try explicitly passing `&Self` into the closure as an argument
1515
|
1616
LL ~ let x = |this: &Self, v: i32| {
1717
LL ~ this.bar();
@@ -35,7 +35,7 @@ LL | self.qux();
3535
LL | y();
3636
| - immutable borrow later used here
3737
|
38-
help: try explicitly pass `&Self` into the Closure as an argument
38+
help: try explicitly passing `&Self` into the closure as an argument
3939
|
4040
LL ~ let y = |this: &Self| {
4141
LL ~ this.bar();
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// regression test of https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164
2+
// we should also test UniqueArc once implemented
3+
//
4+
// inline comments explain how this code *would* compile if UniqueRc was still covariant
5+
6+
#![feature(unique_rc_arc)]
7+
8+
use std::rc::UniqueRc;
9+
10+
fn extend_lifetime<'a, 'b>(x: &'a str) -> &'b str {
11+
let r = UniqueRc::new(""); // UniqueRc<&'static str>
12+
let w = UniqueRc::downgrade(&r); // Weak<&'static str>
13+
let mut r = r; // [IF COVARIANT]: ==>> UniqueRc<&'a str>
14+
*r = x; // assign the &'a str
15+
let _r = UniqueRc::into_rc(r); // Rc<&'a str>, but we only care to activate the weak
16+
let r = w.upgrade().unwrap(); // Rc<&'static str>
17+
*r // &'static str, coerces to &'b str
18+
//~^ ERROR lifetime may not live long enough
19+
}
20+
21+
fn main() {
22+
let s = String::from("Hello World!");
23+
let r = extend_lifetime(&s);
24+
println!("{r}");
25+
drop(s);
26+
println!("{r}");
27+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/variance-uniquerc.rs:17:5
3+
|
4+
LL | fn extend_lifetime<'a, 'b>(x: &'a str) -> &'b str {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | *r // &'static str, coerces to &'b str
10+
| ^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11+
|
12+
= help: consider adding the following bound: `'a: 'b`
13+
14+
error: aborting due to 1 previous error
15+

0 commit comments

Comments
 (0)