Skip to content

Commit cf5fd89

Browse files
committed
Auto merge of #96692 - ehuss:beta-backports, r=ehuss
[beta] Beta backports * Revert diagnostic duplication and accidental stabilization #96516 * Revert "Re-export core::ffi types from std::ffi" #96492 * Make [e]println macros eagerly drop temporaries (for backport) #96490 * Revert "impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>" #96489 * Cargo: * move workspace inheritance unstable docs to the correct place (rust-lang/cargo#10616)
2 parents 69a6d12 + 1c78743 commit cf5fd89

File tree

53 files changed

+111
-450
lines changed

Some content is hidden

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

53 files changed

+111
-450
lines changed

Diff for: compiler/rustc_typeck/src/check/check.rs

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ pub(super) fn check_fn<'a, 'tcx>(
102102
DUMMY_SP,
103103
param_env,
104104
));
105+
// HACK(oli-obk): we rewrite the declared return type, too, so that we don't end up inferring all
106+
// unconstrained RPIT to have `()` as their hidden type. This would happen because further down we
107+
// compare the ret_coercion with declared_ret_ty, and anything uninferred would be inferred to the
108+
// opaque type itself. That again would cause writeback to assume we have a recursive call site
109+
// and do the sadly stabilized fallback to `()`.
110+
let declared_ret_ty = ret_ty;
105111
fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(ret_ty)));
106112
fcx.ret_type_span = Some(decl.output.span());
107113

Diff for: library/alloc/src/vec/mod.rs

-42
Original file line numberDiff line numberDiff line change
@@ -2931,48 +2931,6 @@ impl<T, const N: usize> From<[T; N]> for Vec<T> {
29312931
}
29322932
}
29332933

2934-
#[cfg(not(no_global_oom_handling))]
2935-
#[stable(feature = "vec_from_array_ref", since = "1.61.0")]
2936-
impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T> {
2937-
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
2938-
///
2939-
/// # Examples
2940-
///
2941-
/// ```
2942-
/// assert_eq!(Vec::from(b"raw"), vec![b'r', b'a', b'w']);
2943-
/// ```
2944-
#[cfg(not(test))]
2945-
fn from(s: &[T; N]) -> Vec<T> {
2946-
s.to_vec()
2947-
}
2948-
2949-
#[cfg(test)]
2950-
fn from(s: &[T; N]) -> Vec<T> {
2951-
crate::slice::to_vec(s, Global)
2952-
}
2953-
}
2954-
2955-
#[cfg(not(no_global_oom_handling))]
2956-
#[stable(feature = "vec_from_array_ref", since = "1.61.0")]
2957-
impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T> {
2958-
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
2959-
///
2960-
/// # Examples
2961-
///
2962-
/// ```
2963-
/// assert_eq!(Vec::from(&mut [1, 2, 3]), vec![1, 2, 3]);
2964-
/// ```
2965-
#[cfg(not(test))]
2966-
fn from(s: &mut [T; N]) -> Vec<T> {
2967-
s.to_vec()
2968-
}
2969-
2970-
#[cfg(test)]
2971-
fn from(s: &mut [T; N]) -> Vec<T> {
2972-
crate::slice::to_vec(s, Global)
2973-
}
2974-
}
2975-
29762934
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
29772935
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
29782936
where

Diff for: library/std/src/ffi/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,6 @@ pub use self::os_str::{OsStr, OsString};
159159
#[stable(feature = "core_c_void", since = "1.30.0")]
160160
pub use core::ffi::c_void;
161161

162-
#[unstable(feature = "core_ffi_c", issue = "94501")]
163-
pub use core::ffi::{
164-
c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint,
165-
c_ulong, c_ulonglong, c_ushort,
166-
};
167-
168-
#[unstable(feature = "c_size_t", issue = "88345")]
169-
pub use core::ffi::{c_ptrdiff_t, c_size_t, c_ssize_t};
170-
171162
#[unstable(
172163
feature = "c_variadic",
173164
reason = "the `c_variadic` feature has not been properly tested on \

Diff for: library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@
303303
// Only for re-exporting:
304304
#![feature(assert_matches)]
305305
#![feature(async_iterator)]
306-
#![feature(c_size_t)]
307306
#![feature(c_variadic)]
308307
#![feature(cfg_accessible)]
309308
#![feature(cfg_eval)]

Diff for: library/std/src/macros.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ macro_rules! println {
9999
() => {
100100
$crate::print!("\n")
101101
};
102-
($($arg:tt)*) => {
103-
$crate::io::_print($crate::format_args_nl!($($arg)*))
104-
};
102+
($($arg:tt)*) => {{
103+
$crate::io::_print($crate::format_args_nl!($($arg)*));
104+
}};
105105
}
106106

107107
/// Prints to the standard error.
@@ -164,9 +164,9 @@ macro_rules! eprintln {
164164
() => {
165165
$crate::eprint!("\n")
166166
};
167-
($($arg:tt)*) => {
168-
$crate::io::_eprint($crate::format_args_nl!($($arg)*))
169-
};
167+
($($arg:tt)*) => {{
168+
$crate::io::_eprint($crate::format_args_nl!($($arg)*));
169+
}};
170170
}
171171

172172
/// Prints and returns the value of a given expression for quick and dirty

Diff for: src/test/pretty/dollar-crate.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// pp-exact:dollar-crate.pp
1010

1111
fn main() {
12-
::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[]));
12+
{ ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[])); };
1313
}

Diff for: src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
116| 1|
117117
117| 1| let
118118
118| 1| _unused_closure
119-
119| 1| =
120-
120| 1| |
119+
119| | =
120+
120| | |
121121
121| | mut countdown
122122
122| | |
123123
123| 0| {
@@ -173,7 +173,7 @@
173173
169| | ;
174174
170| |
175175
171| 1| let short_used_not_covered_closure_line_break_no_block_embedded_branch =
176-
172| 1| | _unused_arg: u8 |
176+
172| | | _unused_arg: u8 |
177177
173| 0| println!(
178178
174| 0| "not called: {}",
179179
175| 0| if is_true { "check" } else { "me" }
@@ -191,7 +191,7 @@
191191
187| | ;
192192
188| |
193193
189| 1| let short_used_covered_closure_line_break_no_block_embedded_branch =
194-
190| | | _unused_arg: u8 |
194+
190| 1| | _unused_arg: u8 |
195195
191| 1| println!(
196196
192| 1| "not called: {}",
197197
193| 1| if is_true { "check" } else { "me" }

Diff for: src/test/ui/associated-types/impl-trait-return-missing-constraint.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn bar() -> impl Bar {
2424

2525
fn baz() -> impl Bar<Item = i32> {
2626
//~^ ERROR type mismatch resolving `<impl Bar as Foo>::Item == i32`
27-
//~| ERROR type mismatch resolving `<impl Bar as Foo>::Item == i32`
2827
bar()
2928
}
3029

Diff for: src/test/ui/associated-types/impl-trait-return-missing-constraint.stderr

+1-24
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,6 @@ help: consider constraining the associated type `<impl Bar as Foo>::Item` to `i3
1616
LL | fn bar() -> impl Bar<Item = i32> {
1717
| ++++++++++++
1818

19-
error[E0271]: type mismatch resolving `<impl Bar as Foo>::Item == i32`
20-
--> $DIR/impl-trait-return-missing-constraint.rs:25:34
21-
|
22-
LL | fn bar() -> impl Bar {
23-
| -------- the expected opaque type
24-
...
25-
LL | fn baz() -> impl Bar<Item = i32> {
26-
| __________________________________^
27-
LL | |
28-
LL | |
29-
LL | | bar()
30-
LL | | }
31-
| |_^ expected associated type, found `i32`
32-
|
33-
= note: expected associated type `<impl Bar as Foo>::Item`
34-
found type `i32`
35-
= help: consider constraining the associated type `<impl Bar as Foo>::Item` to `i32` or calling a method that returns `<impl Bar as Foo>::Item`
36-
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
37-
help: consider constraining the associated type `<impl Bar as Foo>::Item` to `i32`
38-
|
39-
LL | fn bar() -> impl Bar<Item = i32> {
40-
| ++++++++++++
41-
42-
error: aborting due to 2 previous errors
19+
error: aborting due to previous error
4320

4421
For more information about this error, try `rustc --explain E0271`.

Diff for: src/test/ui/conservative_impl_trait.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
44
//~^ ERROR `()` is not an iterator
5-
//~| ERROR `()` is not an iterator
65
}
76

87
fn main() {}

Diff for: src/test/ui/conservative_impl_trait.stderr

+1-13
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
66
|
77
= help: the trait `Iterator` is not implemented for `()`
88

9-
error[E0277]: `()` is not an iterator
10-
--> $DIR/conservative_impl_trait.rs:3:60
11-
|
12-
LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
13-
| ____________________________________________________________^
14-
LL | |
15-
LL | |
16-
LL | | }
17-
| |_^ `()` is not an iterator
18-
|
19-
= help: the trait `Iterator` is not implemented for `()`
20-
21-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
2210

2311
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/const-generics/defaults/rp_impl_trait_fail.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ impl<const N: u32> Trait for Uwu<N> {}
55

66
fn rawr() -> impl Trait {
77
//~^ error: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied
8-
//~| error: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied
98
Uwu::<10, 12>
109
}
1110

@@ -17,13 +16,11 @@ impl Traitor<1, 2> for u64 {}
1716

1817
fn uwu<const N: u8>() -> impl Traitor<N> {
1918
//~^ error: the trait bound `u32: Traitor<N, N>` is not satisfied
20-
//~| error: the trait bound `u32: Traitor<N, N>` is not satisfied
2119
1_u32
2220
}
2321

2422
fn owo() -> impl Traitor {
2523
//~^ error: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
26-
//~| error: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
2724
1_u64
2825
}
2926

Diff for: src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr

+3-47
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,8 @@ LL | fn rawr() -> impl Trait {
77
= help: the following implementations were found:
88
<Uwu<N> as Trait>
99

10-
error[E0277]: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied
11-
--> $DIR/rp_impl_trait_fail.rs:6:25
12-
|
13-
LL | fn rawr() -> impl Trait {
14-
| _________________________^
15-
LL | |
16-
LL | |
17-
LL | | Uwu::<10, 12>
18-
LL | | }
19-
| |_^ the trait `Trait` is not implemented for `Uwu<10_u32, 12_u32>`
20-
|
21-
= help: the following implementations were found:
22-
<Uwu<N> as Trait>
23-
2410
error[E0277]: the trait bound `u32: Traitor<N, N>` is not satisfied
25-
--> $DIR/rp_impl_trait_fail.rs:18:26
11+
--> $DIR/rp_impl_trait_fail.rs:17:26
2612
|
2713
LL | fn uwu<const N: u8>() -> impl Traitor<N> {
2814
| ^^^^^^^^^^^^^^^ the trait `Traitor<N, N>` is not implemented for `u32`
@@ -31,23 +17,8 @@ LL | fn uwu<const N: u8>() -> impl Traitor<N> {
3117
<u32 as Traitor<N, 2_u8>>
3218
<u64 as Traitor<1_u8, 2_u8>>
3319

34-
error[E0277]: the trait bound `u32: Traitor<N, N>` is not satisfied
35-
--> $DIR/rp_impl_trait_fail.rs:18:42
36-
|
37-
LL | fn uwu<const N: u8>() -> impl Traitor<N> {
38-
| __________________________________________^
39-
LL | |
40-
LL | |
41-
LL | | 1_u32
42-
LL | | }
43-
| |_^ the trait `Traitor<N, N>` is not implemented for `u32`
44-
|
45-
= help: the following implementations were found:
46-
<u32 as Traitor<N, 2_u8>>
47-
<u64 as Traitor<1_u8, 2_u8>>
48-
4920
error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
50-
--> $DIR/rp_impl_trait_fail.rs:24:13
21+
--> $DIR/rp_impl_trait_fail.rs:22:13
5122
|
5223
LL | fn owo() -> impl Traitor {
5324
| ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64`
@@ -56,21 +27,6 @@ LL | fn owo() -> impl Traitor {
5627
<u64 as Traitor<1_u8, 2_u8>>
5728
<u32 as Traitor<N, 2_u8>>
5829

59-
error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
60-
--> $DIR/rp_impl_trait_fail.rs:24:26
61-
|
62-
LL | fn owo() -> impl Traitor {
63-
| __________________________^
64-
LL | |
65-
LL | |
66-
LL | | 1_u64
67-
LL | | }
68-
| |_^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64`
69-
|
70-
= help: the following implementations were found:
71-
<u64 as Traitor<1_u8, 2_u8>>
72-
<u32 as Traitor<N, 2_u8>>
73-
74-
error: aborting due to 6 previous errors
30+
error: aborting due to 3 previous errors
7531

7632
For more information about this error, try `rustc --explain E0277`.

Diff for: src/test/ui/generator/issue-88653.rs

-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ use std::ops::Generator;
77

88
fn foo(bar: bool) -> impl Generator<(bool,)> {
99
//~^ ERROR: type mismatch in generator arguments [E0631]
10-
//~| ERROR: type mismatch in generator arguments [E0631]
11-
//~| NOTE: expected signature of `fn((bool,)) -> _`
1210
//~| NOTE: expected signature of `fn((bool,)) -> _`
1311
//~| NOTE: in this expansion of desugaring of `impl Trait`
1412
|bar| {
1513
//~^ NOTE: found signature of `fn(bool) -> _`
16-
//~| NOTE: found signature of `fn(bool) -> _`
1714
if bar {
1815
yield bar;
1916
}

Diff for: src/test/ui/generator/issue-88653.stderr

+1-17
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,6 @@ LL | fn foo(bar: bool) -> impl Generator<(bool,)> {
77
LL | |bar| {
88
| ----- found signature of `fn(bool) -> _`
99

10-
error[E0631]: type mismatch in generator arguments
11-
--> $DIR/issue-88653.rs:8:46
12-
|
13-
LL | fn foo(bar: bool) -> impl Generator<(bool,)> {
14-
| ______________________________________________^
15-
LL | |
16-
LL | |
17-
LL | |
18-
... |
19-
LL | | |bar| {
20-
| | ----- found signature of `fn(bool) -> _`
21-
... |
22-
LL | | }
23-
LL | | }
24-
| |_^ expected signature of `fn((bool,)) -> _`
25-
26-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2711

2812
For more information about this error, try `rustc --explain E0631`.

Diff for: src/test/ui/generator/type-mismatch-signature-deduction.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::ops::Generator;
44

55
fn foo() -> impl Generator<Return = i32> {
66
//~^ ERROR type mismatch
7-
//~| ERROR type mismatch
87
|| {
98
if false {
109
return Ok(6);

0 commit comments

Comments
 (0)