Skip to content

Commit 67fae22

Browse files
committed
Auto merge of #68587 - JohnTitor:rollup-fz45xwc, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #68200 (Stabilize the debug_map_key_value feature) - #68383 (Clean up E0205 explanation) - #68412 (Clean up E0207 explanation) - #68454 (clean up E0214 explanation) - #68482 (clean up error codes explanation) - #68563 (Don't call `tcx.fn_sig` on closures) - #68570 (Bump LLVM submodule to fix LLVM assertion failure in MSP430 interrupt generation.) - #68571 (check_match: extract common logic) - #68573 (Clean up E0262 explanation) - #68575 (Disable the testcase for Vxworks.) - #68581 (Add support for icebreakers-cleanup-crew commands) Failed merges: r? @ghost
2 parents 0859451 + aac5788 commit 67fae22

File tree

18 files changed

+103
-48
lines changed

18 files changed

+103
-48
lines changed

src/doc/unstable-book/src/library-features/debug-map-key-value.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/libcore/fmt/builders.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
778778
/// # Examples
779779
///
780780
/// ```
781-
/// # #![feature(debug_map_key_value)]
782781
/// use std::fmt;
783782
///
784783
/// struct Foo(Vec<(String, i32)>);
@@ -796,7 +795,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
796795
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
797796
/// );
798797
/// ```
799-
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
798+
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
800799
pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut Self {
801800
self.result = self.result.and_then(|_| {
802801
assert!(
@@ -843,7 +842,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
843842
/// # Examples
844843
///
845844
/// ```
846-
/// # #![feature(debug_map_key_value)]
847845
/// use std::fmt;
848846
///
849847
/// struct Foo(Vec<(String, i32)>);
@@ -861,7 +859,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
861859
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
862860
/// );
863861
/// ```
864-
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
862+
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
865863
pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut Self {
866864
self.result = self.result.and_then(|_| {
867865
assert!(self.has_key, "attempted to format a map value before its key");

src/libcore/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![feature(cell_update)]
55
#![feature(core_private_bignum)]
66
#![feature(core_private_diy_float)]
7-
#![feature(debug_map_key_value)]
87
#![feature(debug_non_exhaustive)]
98
#![feature(dec2flt)]
109
#![feature(exact_size_is_empty)]
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
You can only implement `Copy` for a struct or enum. Both of the following
2-
examples will fail, because neither `[u8; 256]` nor `&'static mut Bar`
3-
(mutable reference to `Bar`) is a struct or enum:
1+
The `Copy` trait was implemented on a type which is neither a struct nor an
2+
enum.
3+
4+
Erroneous code example:
45

56
```compile_fail,E0206
67
type Foo = [u8; 256];
7-
impl Copy for Foo { } // error
8+
impl Copy for Foo { } // error!
89
910
#[derive(Copy, Clone)]
1011
struct Bar;
11-
impl Copy for &'static mut Bar { } // error
12+
13+
impl Copy for &'static mut Bar { } // error!
1214
```
15+
16+
You can only implement `Copy` for a struct or an enum. Both of the previous
17+
examples will fail, because neither `[u8; 256]` nor `&'static mut Bar`
18+
(mutable reference to `Bar`) is a struct or enum.

src/librustc_error_codes/error_codes/E0207.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
A type or lifetime parameter that is specified for `impl` is not constrained.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0207
6+
struct Foo;
7+
8+
impl<T: Default> Foo {
9+
// error: the type parameter `T` is not constrained by the impl trait, self
10+
// type, or predicates [E0207]
11+
fn get(&self) -> T {
12+
<T as Default>::default()
13+
}
14+
}
15+
```
16+
117
Any type parameter or lifetime parameter of an `impl` must meet at least one of
218
the following criteria:
319

@@ -10,19 +26,7 @@ the following criteria:
1026
### Error example 1
1127

1228
Suppose we have a struct `Foo` and we would like to define some methods for it.
13-
The following definition leads to a compiler error:
14-
15-
```compile_fail,E0207
16-
struct Foo;
17-
18-
impl<T: Default> Foo {
19-
// error: the type parameter `T` is not constrained by the impl trait, self
20-
// type, or predicates [E0207]
21-
fn get(&self) -> T {
22-
<T as Default>::default()
23-
}
24-
}
25-
```
29+
The previous code example has a definition which leads to a compiler error:
2630

2731
The problem is that the parameter `T` does not appear in the implementing type
2832
(`Foo`) of the impl. In this case, we can fix the error by moving the type
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
A generic type was described using parentheses rather than angle brackets.
2-
For example:
2+
3+
Erroneous code example:
34

45
```compile_fail,E0214
5-
fn main() {
6-
let v: Vec(&str) = vec!["foo"];
7-
}
6+
let v: Vec(&str) = vec!["foo"];
87
```
98

109
This is not currently supported: `v` should be defined as `Vec<&str>`.
1110
Parentheses are currently only used with generic types when defining parameters
1211
for `Fn`-family traits.
12+
13+
The previous code example fixed:
14+
15+
```
16+
let v: Vec<&str> = vec!["foo"];
17+
```

src/librustc_error_codes/error_codes/E0220.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
You used an associated type which isn't defined in the trait.
1+
The associated type used was not defined in the trait.
2+
23
Erroneous code example:
34

45
```compile_fail,E0220

src/librustc_error_codes/error_codes/E0221.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
An attempt was made to retrieve an associated type, but the type was ambiguous.
2-
For example:
2+
3+
Erroneous code example:
34

45
```compile_fail,E0221
56
trait T1 {}

src/librustc_error_codes/error_codes/E0222.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
An attempt was made to constrain an associated type.
2-
For example:
2+
3+
Erroneous code example:
34

45
```compile_fail,E0222
56
pub trait Vehicle {
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
Declaring certain lifetime names in parameters is disallowed. For example,
2-
because the `'static` lifetime is a special built-in lifetime name denoting
3-
the lifetime of the entire program, this is an error:
1+
An invalid name was used for a lifetime parameter.
2+
3+
Erroneous code example:
44

55
```compile_fail,E0262
66
// error, invalid lifetime parameter name `'static`
77
fn foo<'static>(x: &'static str) { }
88
```
9+
10+
Declaring certain lifetime names in parameters is disallowed. For example,
11+
because the `'static` lifetime is a special built-in lifetime name denoting
12+
the lifetime of the entire program, this is an error:

0 commit comments

Comments
 (0)