about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-25 06:41:56 +0000
committerbors <bors@rust-lang.org>2024-09-25 06:41:56 +0000
commit34aff74fb06e78fb9cd1a66acafb6d150638de35 (patch)
tree14533de260c2f1834994e58af1d210a6884625a9 /compiler/rustc_error_codes
parent938c7b1162a38dca257c7004ef7ecf86397a8634 (diff)
parent8be19465ec14880160d294f2909202451a547740 (diff)
downloadrust-34aff74fb06e78fb9cd1a66acafb6d150638de35.tar.gz
rust-34aff74fb06e78fb9cd1a66acafb6d150638de35.zip
Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
Diffstat (limited to 'compiler/rustc_error_codes')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0074.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0075.md18
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0076.md10
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0077.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0511.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0582.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0764.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0775.md7
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0776.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0796.md6
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0799.md19
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0800.md11
-rw-r--r--compiler/rustc_error_codes/src/lib.rs4
13 files changed, 68 insertions, 29 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0074.md b/compiler/rustc_error_codes/src/error_codes/E0074.md
index 785d6de226d..71d89f5eb60 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0074.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0074.md
@@ -11,7 +11,7 @@ This will cause an error:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Bad<T>(T, T, T, T);
+struct Bad<T>([T; 4]);
 ```
 
 This will not:
@@ -20,5 +20,5 @@ This will not:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Good(u32, u32, u32, u32);
+struct Good([u32; 4]);
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0075.md b/compiler/rustc_error_codes/src/error_codes/E0075.md
index 969c1ee7131..b58018eafc3 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0075.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0075.md
@@ -1,6 +1,6 @@
-A `#[simd]` attribute was applied to an empty tuple struct.
+A `#[simd]` attribute was applied to an empty or multi-field struct.
 
-Erroneous code example:
+Erroneous code examples:
 
 ```compile_fail,E0075
 #![feature(repr_simd)]
@@ -9,9 +9,15 @@ Erroneous code example:
 struct Bad; // error!
 ```
 
-The `#[simd]` attribute can only be applied to non empty tuple structs, because
-it doesn't make sense to try to use SIMD operations when there are no values to
-operate on.
+```compile_fail,E0075
+#![feature(repr_simd)]
+
+#[repr(simd)]
+struct Bad([u32; 1], [u32; 1]); // error!
+```
+
+The `#[simd]` attribute can only be applied to a single-field struct, because
+the one field must be the array of values in the vector.
 
 Fixed example:
 
@@ -19,5 +25,5 @@ Fixed example:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Good(u32); // ok!
+struct Good([u32; 2]); // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0076.md b/compiler/rustc_error_codes/src/error_codes/E0076.md
index 1da8caa9506..b1943de63e5 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0076.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0076.md
@@ -1,4 +1,4 @@
-All types in a tuple struct aren't the same when using the `#[simd]`
+The type of the field in a tuple struct isn't an array when using the `#[simd]`
 attribute.
 
 Erroneous code example:
@@ -7,12 +7,12 @@ Erroneous code example:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Bad(u16, u32, u32 u32); // error!
+struct Bad(u16); // error!
 ```
 
 When using the `#[simd]` attribute to automatically use SIMD operations in tuple
-struct, the types in the struct must all be of the same type, or the compiler
-will trigger this error.
+structs, if you want a single-lane vector then the field must be a 1-element
+array, or the compiler will trigger this error.
 
 Fixed example:
 
@@ -20,5 +20,5 @@ Fixed example:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Good(u32, u32, u32, u32); // ok!
+struct Good([u16; 1]); // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0077.md b/compiler/rustc_error_codes/src/error_codes/E0077.md
index 91aa24d1f52..688bfd3e727 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0077.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0077.md
@@ -7,7 +7,7 @@ Erroneous code example:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Bad(String); // error!
+struct Bad([String; 2]); // error!
 ```
 
 When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
@@ -19,5 +19,5 @@ Fixed example:
 #![feature(repr_simd)]
 
 #[repr(simd)]
-struct Good(u32, u32, u32, u32); // ok!
+struct Good([u32; 4]); // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0511.md b/compiler/rustc_error_codes/src/error_codes/E0511.md
index 681f4e611c3..45ff49bdebb 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0511.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0511.md
@@ -23,11 +23,11 @@ The generic type has to be a SIMD type. Example:
 
 #[repr(simd)]
 #[derive(Copy, Clone)]
-struct i32x2(i32, i32);
+struct i32x2([i32; 2]);
 
 extern "rust-intrinsic" {
     fn simd_add<T>(a: T, b: T) -> T;
 }
 
-unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
+unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0582.md b/compiler/rustc_error_codes/src/error_codes/E0582.md
index b2cdb509c95..c4aaa17706a 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0582.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0582.md
@@ -44,7 +44,7 @@ where
 ```
 The latter scenario encounters this error because `Foo::Assoc<'a>` could be
 implemented by a type that does not use the `'a` parameter, so there is no
-guarentee that `X::Assoc<'a>` actually uses `'a`.
+guarantee that `X::Assoc<'a>` actually uses `'a`.
 
 To fix this we can pass a dummy parameter:
 ```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0764.md b/compiler/rustc_error_codes/src/error_codes/E0764.md
index 152627cf654..4d5091cd954 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0764.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0764.md
@@ -3,8 +3,6 @@ A mutable reference was used in a constant.
 Erroneous code example:
 
 ```compile_fail,E0764
-#![feature(const_mut_refs)]
-
 fn main() {
     const OH_NO: &'static mut usize = &mut 1; // error!
 }
@@ -26,8 +24,6 @@ Remember: you cannot use a function call inside a constant or static. However,
 you can totally use it in constant functions:
 
 ```
-#![feature(const_mut_refs)]
-
 const fn foo(x: usize) -> usize {
     let mut y = 1;
     let z = &mut y;
diff --git a/compiler/rustc_error_codes/src/error_codes/E0775.md b/compiler/rustc_error_codes/src/error_codes/E0775.md
index 9bafd52f75c..efbd51e89ea 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0775.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0775.md
@@ -1,13 +1,14 @@
+#### Note: this error code is no longer emitted by the compiler.
+
 `#[cmse_nonsecure_entry]` is only valid for targets with the TrustZone-M
 extension.
 
 Erroneous code example:
 
-```compile_fail,E0775
+```ignore (no longer emitted)
 #![feature(cmse_nonsecure_entry)]
 
-#[cmse_nonsecure_entry]
-pub extern "C" fn entry_function() {}
+pub extern "C-cmse-nonsecure-entry" fn entry_function() {}
 ```
 
 To fix this error, compile your code for a Rust target that supports the
diff --git a/compiler/rustc_error_codes/src/error_codes/E0776.md b/compiler/rustc_error_codes/src/error_codes/E0776.md
index d65beebe07c..e46d498d1c2 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0776.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0776.md
@@ -1,8 +1,10 @@
+#### Note: this error code is no longer emitted by the compiler.
+
 `#[cmse_nonsecure_entry]` functions require a C ABI
 
 Erroneous code example:
 
-```compile_fail,E0776
+```ignore (no longer emitted)
 #![feature(cmse_nonsecure_entry)]
 
 #[no_mangle]
diff --git a/compiler/rustc_error_codes/src/error_codes/E0796.md b/compiler/rustc_error_codes/src/error_codes/E0796.md
index 7ac429e5215..ced163e98f7 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0796.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0796.md
@@ -1,14 +1,14 @@
+#### Note: this error code is no longer emitted by the compiler.
+
 You have created a reference to a mutable static.
 
 Erroneous code example:
 
-```compile_fail,edition2024,E0796
+```
 static mut X: i32 = 23;
-
 fn work() {
   let _val = unsafe { X };
 }
-
 let x_ref = unsafe { &mut X };
 work();
 // The next line has Undefined Behavior!
diff --git a/compiler/rustc_error_codes/src/error_codes/E0799.md b/compiler/rustc_error_codes/src/error_codes/E0799.md
new file mode 100644
index 00000000000..38ebc840604
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0799.md
@@ -0,0 +1,19 @@
+Something other than a type or const parameter has been used when one was
+expected.
+
+Erroneous code example:
+
+```compile_fail,E0799
+fn bad1() -> impl Sized + use<main> {}
+
+fn bad2(x: ()) -> impl Sized + use<x> {}
+
+fn main() {}
+```
+
+In the given examples, for `bad1`, the name `main` corresponds to a function
+rather than a type or const parameter. In `bad2`, the name `x` corresponds to
+a function argument rather than a type or const parameter.
+
+Only type and const parameters, including `Self`, may be captured by
+`use<...>` precise capturing bounds.
diff --git a/compiler/rustc_error_codes/src/error_codes/E0800.md b/compiler/rustc_error_codes/src/error_codes/E0800.md
new file mode 100644
index 00000000000..3e08cd499b7
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0800.md
@@ -0,0 +1,11 @@
+A type or const parameter of the given name is not in scope.
+
+Erroneous code examples:
+
+```compile_fail,E0800
+fn missing() -> impl Sized + use<T> {}
+```
+
+To fix this error, please verify you didn't misspell the type or const
+parameter, or double-check if you forgot to declare the parameter in
+the list of generics.
diff --git a/compiler/rustc_error_codes/src/lib.rs b/compiler/rustc_error_codes/src/lib.rs
index 150f99a3ee7..8631de65ec8 100644
--- a/compiler/rustc_error_codes/src/lib.rs
+++ b/compiler/rustc_error_codes/src/lib.rs
@@ -538,6 +538,8 @@ E0795: 0795,
 E0796: 0796,
 E0797: 0797,
 E0798: 0798,
+E0799: 0799,
+E0800: 0800,
         );
     )
 }
@@ -679,3 +681,5 @@ E0798: 0798,
 //  E0723, // unstable feature in `const` context
 //  E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
 //  E0744, // merged into E0728
+//  E0776, // Removed; cmse_nonsecure_entry is now `C-cmse-nonsecure-entry`
+//  E0796, // unused error code. We use `static_mut_refs` lint instead.