From 97beb074aff40cb1b6444e9eff734a1a5c17dfc7 Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Sat, 3 Oct 2020 15:44:19 +0200 Subject: [PATCH 01/18] BTreeMap: derive type-specific variants of node_as_mut and cast_unchecked --- library/alloc/src/collections/btree/node.rs | 52 +++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/library/alloc/src/collections/btree/node.rs b/library/alloc/src/collections/btree/node.rs index 880627e94c334..4fa97ff053e60 100644 --- a/library/alloc/src/collections/btree/node.rs +++ b/library/alloc/src/collections/btree/node.rs @@ -170,6 +170,22 @@ impl Root { NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData } } + /// Borrows and returns a mutable reference to the leaf node owned by the root. + /// # Safety + /// The root node is a leaf. + unsafe fn leaf_node_as_mut(&mut self) -> NodeRef, K, V, marker::Leaf> { + debug_assert!(self.height == 0); + NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData } + } + + /// Borrows and returns a mutable reference to the internal node owned by the root. + /// # Safety + /// The root node is not a leaf. + unsafe fn internal_node_as_mut(&mut self) -> NodeRef, K, V, marker::Internal> { + debug_assert!(self.height > 0); + NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData } + } + pub fn node_as_valmut(&mut self) -> NodeRef, K, V, marker::LeafOrInternal> { NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData } } @@ -188,14 +204,11 @@ impl Root { self.node = BoxedNode::from_internal(new_node); self.height += 1; - let mut ret = - NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData }; - unsafe { + let mut ret = self.internal_node_as_mut(); ret.reborrow_mut().first_edge().correct_parent_link(); + ret } - - ret } /// Removes the internal root node, using its first child as the new root node. @@ -212,11 +225,8 @@ impl Root { let top = self.node.ptr; - self.node = unsafe { - BoxedNode::from_ptr( - self.node_as_mut().cast_unchecked::().first_edge().descend().node, - ) - }; + let internal_node = unsafe { self.internal_node_as_mut() }; + self.node = unsafe { BoxedNode::from_ptr(internal_node.first_edge().descend().node) }; self.height -= 1; self.node_as_mut().as_leaf_mut().parent = None; @@ -443,9 +453,9 @@ impl NodeRef { } impl<'a, K, V, Type> NodeRef, K, V, Type> { - /// Unsafely asserts to the compiler some static information about whether this - /// node is a `Leaf` or an `Internal`. - unsafe fn cast_unchecked(self) -> NodeRef, K, V, NewType> { + /// Unsafely asserts to the compiler the static information that this node is an `Internal`. + unsafe fn cast_to_internal_unchecked(self) -> NodeRef, K, V, marker::Internal> { + debug_assert!(self.height > 0); NodeRef { height: self.height, node: self.node, _marker: PhantomData } } @@ -943,10 +953,7 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::Leaf>, mark Handle::new_edge(left.reborrow_mut(), insert_idx) }, InsertionPlace::Right(insert_idx) => unsafe { - Handle::new_edge( - right.node_as_mut().cast_unchecked::(), - insert_idx, - ) + Handle::new_edge(right.leaf_node_as_mut(), insert_idx) }, }; let val_ptr = insertion_edge.insert_fit(key, val); @@ -1006,10 +1013,7 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::Internal>, Handle::new_edge(left.reborrow_mut(), insert_idx) }, InsertionPlace::Right(insert_idx) => unsafe { - Handle::new_edge( - right.node_as_mut().cast_unchecked::(), - insert_idx, - ) + Handle::new_edge(right.internal_node_as_mut(), insert_idx) }, }; insertion_edge.insert_fit(key, val, edge); @@ -1205,7 +1209,7 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::Internal>, let mut new_root = Root { node: BoxedNode::from_internal(new_node), height }; - new_root.node_as_mut().cast_unchecked().correct_childrens_parent_links(0..=new_len); + new_root.internal_node_as_mut().correct_childrens_parent_links(0..=new_len); (self.node, k, v, new_root) } @@ -1258,8 +1262,8 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::Internal>, if self.node.height > 1 { // SAFETY: the height of the nodes being merged is one below the height // of the node of this edge, thus above zero, so they are internal. - let mut left_node = left_node.cast_unchecked::(); - let right_node = right_node.cast_unchecked::(); + let mut left_node = left_node.cast_to_internal_unchecked(); + let right_node = right_node.cast_to_internal_unchecked(); ptr::copy_nonoverlapping( right_node.edge_at(0), left_node.edges_mut().as_mut_ptr().add(left_len + 1), From e55d27fbcefffbddb85f28cf4eb913674f2188c6 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 8 Oct 2020 22:29:13 +0200 Subject: [PATCH 02/18] Remove unnecessary rustc_const_stable attributes. --- library/std/src/sys/unsupported/mutex.rs | 1 - library/std/src/sys_common/mutex.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/library/std/src/sys/unsupported/mutex.rs b/library/std/src/sys/unsupported/mutex.rs index 06ea9a1e2c109..ed4605f0595fc 100644 --- a/library/std/src/sys/unsupported/mutex.rs +++ b/library/std/src/sys/unsupported/mutex.rs @@ -10,7 +10,6 @@ unsafe impl Send for Mutex {} unsafe impl Sync for Mutex {} // no threads on this platform impl Mutex { - #[rustc_const_stable(feature = "const_sys_mutex_new", since = "1.0.0")] pub const fn new() -> Mutex { Mutex { locked: UnsafeCell::new(false) } } diff --git a/library/std/src/sys_common/mutex.rs b/library/std/src/sys_common/mutex.rs index a1e11d24465ea..91d919a3f9b75 100644 --- a/library/std/src/sys_common/mutex.rs +++ b/library/std/src/sys_common/mutex.rs @@ -21,7 +21,6 @@ impl StaticMutex { /// first used with any of the functions below. /// Also, the behavior is undefined if this mutex is ever used reentrantly, /// i.e., `lock` is called by the thread currently holding the lock. - #[rustc_const_stable(feature = "const_sys_mutex_new", since = "1.0.0")] pub const fn new() -> Self { Self(imp::Mutex::new()) } From c25f69a1e3993bba59853767b366068685f64766 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 8 Oct 2020 22:52:26 +0200 Subject: [PATCH 03/18] Remove unsafety from unsupported/mutex.rs by using a Cell. Replacing the UnsafeCell by a Cell simplifies things and makes it all safe. --- library/std/src/sys/unsupported/mutex.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/library/std/src/sys/unsupported/mutex.rs b/library/std/src/sys/unsupported/mutex.rs index 06ea9a1e2c109..0e01edcaf397d 100644 --- a/library/std/src/sys/unsupported/mutex.rs +++ b/library/std/src/sys/unsupported/mutex.rs @@ -1,7 +1,9 @@ -use crate::cell::UnsafeCell; +#![deny(unsafe_op_in_unsafe_fn)] + +use crate::cell::Cell; pub struct Mutex { - locked: UnsafeCell, + locked: Cell, } pub type MovableMutex = Mutex; @@ -12,7 +14,7 @@ unsafe impl Sync for Mutex {} // no threads on this platform impl Mutex { #[rustc_const_stable(feature = "const_sys_mutex_new", since = "1.0.0")] pub const fn new() -> Mutex { - Mutex { locked: UnsafeCell::new(false) } + Mutex { locked: Cell::new(false) } } #[inline] @@ -20,25 +22,17 @@ impl Mutex { #[inline] pub unsafe fn lock(&self) { - let locked = self.locked.get(); - assert!(!*locked, "cannot recursively acquire mutex"); - *locked = true; + assert_eq!(self.locked.replace(true), false, "cannot recursively acquire mutex"); } #[inline] pub unsafe fn unlock(&self) { - *self.locked.get() = false; + self.locked.set(false); } #[inline] pub unsafe fn try_lock(&self) -> bool { - let locked = self.locked.get(); - if *locked { - false - } else { - *locked = true; - true - } + self.locked.replace(true) == false } #[inline] From 3d192ace34bcb13d3c033735cd7415260040c252 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 8 Oct 2020 22:52:26 +0200 Subject: [PATCH 04/18] Remove unsafety from unsupported/rwlosck.rs by using a Cell. Replacing the UnsafeCell by a Cell makes it all safe. --- library/std/src/sys/unsupported/rwlock.rs | 34 +++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/library/std/src/sys/unsupported/rwlock.rs b/library/std/src/sys/unsupported/rwlock.rs index d37f34ac9352d..4e4f0f00f69d4 100644 --- a/library/std/src/sys/unsupported/rwlock.rs +++ b/library/std/src/sys/unsupported/rwlock.rs @@ -1,7 +1,9 @@ -use crate::cell::UnsafeCell; +#![deny(unsafe_op_in_unsafe_fn)] + +use crate::cell::Cell; pub struct RWLock { - mode: UnsafeCell, + mode: Cell, } unsafe impl Send for RWLock {} @@ -9,14 +11,14 @@ unsafe impl Sync for RWLock {} // no threads on this platform impl RWLock { pub const fn new() -> RWLock { - RWLock { mode: UnsafeCell::new(0) } + RWLock { mode: Cell::new(0) } } #[inline] pub unsafe fn read(&self) { - let mode = self.mode.get(); - if *mode >= 0 { - *mode += 1; + let m = self.mode.get(); + if m >= 0 { + self.mode.set(m + 1); } else { rtabort!("rwlock locked for writing"); } @@ -24,9 +26,9 @@ impl RWLock { #[inline] pub unsafe fn try_read(&self) -> bool { - let mode = self.mode.get(); - if *mode >= 0 { - *mode += 1; + let m = self.mode.get(); + if m >= 0 { + self.mode.set(m + 1); true } else { false @@ -35,19 +37,15 @@ impl RWLock { #[inline] pub unsafe fn write(&self) { - let mode = self.mode.get(); - if *mode == 0 { - *mode = -1; - } else { + if self.mode.replace(-1) != 0 { rtabort!("rwlock locked for reading") } } #[inline] pub unsafe fn try_write(&self) -> bool { - let mode = self.mode.get(); - if *mode == 0 { - *mode = -1; + if self.mode.get() == 0 { + self.mode.set(-1); true } else { false @@ -56,12 +54,12 @@ impl RWLock { #[inline] pub unsafe fn read_unlock(&self) { - *self.mode.get() -= 1; + self.mode.set(self.mode.get() - 1); } #[inline] pub unsafe fn write_unlock(&self) { - *self.mode.get() += 1; + self.mode.set(0); } #[inline] From f4e884288d0a1d6210e15bc7f8b014ef4cf86c32 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 8 Oct 2020 23:37:23 +0200 Subject: [PATCH 05/18] Apply deny(unsafe_op_in_unsafe_fn) to all of sys/unsupported. --- library/std/src/sys/unsupported/common.rs | 13 ++++++++----- library/std/src/sys/unsupported/mod.rs | 2 ++ library/std/src/sys/unsupported/mutex.rs | 2 -- library/std/src/sys/unsupported/rwlock.rs | 2 -- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/library/std/src/sys/unsupported/common.rs b/library/std/src/sys/unsupported/common.rs index 80311d26819ad..2cdd9c4d19e6e 100644 --- a/library/std/src/sys/unsupported/common.rs +++ b/library/std/src/sys/unsupported/common.rs @@ -39,10 +39,13 @@ pub fn hashmap_random_keys() -> (u64, u64) { pub enum Void {} pub unsafe fn strlen(mut s: *const c_char) -> usize { - let mut n = 0; - while *s != 0 { - n += 1; - s = s.offset(1); + // SAFETY: The caller must guarantee `s` points to a valid 0-terminated string. + unsafe { + let mut n = 0; + while *s != 0 { + n += 1; + s = s.offset(1); + } + n } - return n; } diff --git a/library/std/src/sys/unsupported/mod.rs b/library/std/src/sys/unsupported/mod.rs index 8ba870c5dbc14..d9efdec33d937 100644 --- a/library/std/src/sys/unsupported/mod.rs +++ b/library/std/src/sys/unsupported/mod.rs @@ -1,3 +1,5 @@ +#![deny(unsafe_op_in_unsafe_fn)] + pub mod alloc; pub mod args; pub mod cmath; diff --git a/library/std/src/sys/unsupported/mutex.rs b/library/std/src/sys/unsupported/mutex.rs index 0e01edcaf397d..3b97d0875bdc1 100644 --- a/library/std/src/sys/unsupported/mutex.rs +++ b/library/std/src/sys/unsupported/mutex.rs @@ -1,5 +1,3 @@ -#![deny(unsafe_op_in_unsafe_fn)] - use crate::cell::Cell; pub struct Mutex { diff --git a/library/std/src/sys/unsupported/rwlock.rs b/library/std/src/sys/unsupported/rwlock.rs index 4e4f0f00f69d4..1a9c266196fe7 100644 --- a/library/std/src/sys/unsupported/rwlock.rs +++ b/library/std/src/sys/unsupported/rwlock.rs @@ -1,5 +1,3 @@ -#![deny(unsafe_op_in_unsafe_fn)] - use crate::cell::Cell; pub struct RWLock { From f1c3edbfaba6dd1723fcd63857f7de5ef2278f57 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Fri, 9 Oct 2020 00:39:03 +0200 Subject: [PATCH 06/18] Assert state in sys/unsupported's RwLock::write_unlock. Co-authored-by: Joshua Nelson --- library/std/src/sys/unsupported/rwlock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/unsupported/rwlock.rs b/library/std/src/sys/unsupported/rwlock.rs index 1a9c266196fe7..9aaba8bff1167 100644 --- a/library/std/src/sys/unsupported/rwlock.rs +++ b/library/std/src/sys/unsupported/rwlock.rs @@ -57,7 +57,7 @@ impl RWLock { #[inline] pub unsafe fn write_unlock(&self) { - self.mode.set(0); + assert_eq!(self.mode.replace(0), -1); } #[inline] From 23c3356f9a6069f566e9f6900f5575daed1d526d Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 10 Oct 2020 09:55:35 -0400 Subject: [PATCH 07/18] Mention rustdoc in `x.py setup` This also allows 'rustdoc' as a string for the compiler profile. --- src/bootstrap/setup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index dcfb9fd673421..f762dff2727f4 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -30,7 +30,7 @@ impl FromStr for Profile { fn from_str(s: &str) -> Result { match s { "a" | "lib" | "library" => Ok(Profile::Library), - "b" | "compiler" => Ok(Profile::Compiler), + "b" | "compiler" | "rustdoc" => Ok(Profile::Compiler), "c" | "llvm" | "codegen" => Ok(Profile::Codegen), "d" | "maintainer" | "user" => Ok(Profile::User), _ => Err(format!("unknown profile: '{}'", s)), @@ -107,7 +107,7 @@ pub fn interactive_path() -> io::Result { println!( "Welcome to the Rust project! What do you want to do with x.py? a) Contribute to the standard library -b) Contribute to the compiler +b) Contribute to the compiler or rustdoc c) Contribute to the compiler, and also modify LLVM or codegen d) Install Rust from source" ); From d7029cbd7e25405ab815d12d55c3f496d48f6084 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Sun, 11 Oct 2020 16:47:45 +0100 Subject: [PATCH 08/18] `min_const_generics` diagnostics improvements 2 3 --- compiler/rustc_resolve/src/diagnostics.rs | 21 ++++++---------- compiler/rustc_resolve/src/lib.rs | 2 +- ...ay-size-in-generic-struct-param.min.stderr | 12 +++++----- .../array-size-in-generic-struct-param.rs | 4 ++-- .../const-argument-if-length.min.stderr | 6 ++--- .../const-argument-if-length.rs | 2 +- ...-gate-const_evaluatable_checked.min.stderr | 6 ++--- .../feature-gate-const_evaluatable_checked.rs | 2 +- .../simple.min.stderr | 12 +++++----- .../simple_fail.min.stderr | 6 ++--- .../const_evaluatable_checked/simple_fail.rs | 2 +- ...c-function-call-in-array-length.min.stderr | 12 +++++----- .../generic-function-call-in-array-length.rs | 4 ++-- .../generic-sum-in-array-length.min.stderr | 12 +++++----- .../generic-sum-in-array-length.rs | 4 ++-- ...ics-type_name-as-const-argument.min.stderr | 6 ++--- .../intrinsics-type_name-as-const-argument.rs | 2 +- .../issue-61522-array-len-succ.min.stderr | 12 +++++----- .../ui/const-generics/issue-67375.min.stderr | 6 ++--- src/test/ui/const-generics/issue-67375.rs | 2 +- .../const-generics/issue-67945-1.min.stderr | 12 +++++----- src/test/ui/const-generics/issue-67945-1.rs | 4 ++-- .../const-generics/issue-67945-2.min.stderr | 12 +++++----- src/test/ui/const-generics/issue-67945-2.rs | 4 ++-- .../issues/issue-61747.min.stderr | 6 ++--- .../issues/issue-61935.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-61935.rs | 2 +- .../issues/issue-62220.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-62220.rs | 2 +- .../issues/issue-62456.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-62456.rs | 2 +- .../issues/issue-64494.min.stderr | 12 +++++----- .../ui/const-generics/issues/issue-64494.rs | 4 ++-- .../issues/issue-66205.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-66205.rs | 2 +- .../issues/issue-67739.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-67739.rs | 2 +- .../issues/issue-68366.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-68366.rs | 2 +- .../issues/issue-68977.min.stderr | 12 +++++----- .../ui/const-generics/issues/issue-68977.rs | 4 ++-- .../issues/issue-72787.min.stderr | 24 +++++++++---------- .../ui/const-generics/issues/issue-72787.rs | 8 +++---- ...sue-72819-generic-in-const-eval.min.stderr | 6 ++--- .../issue-72819-generic-in-const-eval.rs | 2 +- .../issue-76701-ty-param-in-const.min.stderr | 12 +++++----- .../issues/issue-76701-ty-param-in-const.rs | 4 ++-- .../min_const_generics/complex-expression.rs | 8 +++---- .../complex-expression.stderr | 24 +++++++++---------- .../self-ty-in-const-1.stderr | 6 ++--- ...ams-in-ct-in-ty-param-lazy-norm.min.stderr | 6 ++--- .../params-in-ct-in-ty-param-lazy-norm.rs | 2 +- src/test/ui/const-generics/wf-misc.min.stderr | 12 +++++----- src/test/ui/const-generics/wf-misc.rs | 4 ++-- 54 files changed, 182 insertions(+), 189 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index e3cf6d12bd5eb..83706e8a96f07 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -469,24 +469,17 @@ impl<'a> Resolver<'a> { ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => { let mut err = self.session.struct_span_err( span, - "generic parameters must not be used inside of non-trivial constant values", - ); - err.span_label( - span, - &format!( - "non-trivial anonymous constants must not depend on the parameter `{}`", - name - ), + "generic parameters must not be used inside const evaluations", ); + err.span_label(span, &format!("cannot perform const operation using `{}`", name)); if is_type { - err.note("type parameters are currently not permitted in anonymous constants"); + err.note("type parameters may not be used in anonymous constants"); } else { - err.help( - &format!("it is currently only allowed to use either `{0}` or `{{ {0} }}` as generic constants", - name - ) - ); + err.help(&format!( + "const parameters may only be used as standalone arguments `{}`", + name + )); } err diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index fe8f592638594..6677a5ffe2867 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -218,7 +218,7 @@ enum ResolutionError<'a> { ParamInTyOfConstParam(Symbol), /// constant values inside of type parameter defaults must not depend on generic parameters. ParamInAnonConstInTyDefault(Symbol), - /// generic parameters must not be used inside of non-trivial constant values. + /// generic parameters must not be used inside const evaluations. /// /// This error is only emitted when using `min_const_generics`. ParamInNonTrivialAnonConst { name: Symbol, is_type: bool }, diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr index 0fc45513cd78a..31073683870e9 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/array-size-in-generic-struct-param.rs:9:48 | LL | struct ArithArrayLen([u32; 0 + N]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/array-size-in-generic-struct-param.rs:20:15 | LL | arr: [u8; CFG.arr_size], - | ^^^ non-trivial anonymous constants must not depend on the parameter `CFG` + | ^^^ cannot perform const operation using `CFG` | - = help: it is currently only allowed to use either `CFG` or `{ CFG }` as generic constants + = help: const parameters may only be used as standalone arguments `CFG` error: `Config` is forbidden as the type of a const generic parameter --> $DIR/array-size-in-generic-struct-param.rs:18:21 diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index dd45b6ed278e8..84591c1b724c6 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -8,7 +8,7 @@ #[allow(dead_code)] struct ArithArrayLen([u32; 0 + N]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations #[derive(PartialEq, Eq)] struct Config { @@ -19,7 +19,7 @@ struct B { //[min]~^ ERROR `Config` is forbidden arr: [u8; CFG.arr_size], //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } const C: Config = Config { arr_size: 5 }; diff --git a/src/test/ui/const-generics/const-argument-if-length.min.stderr b/src/test/ui/const-generics/const-argument-if-length.min.stderr index c666dce479f65..60f860838139b 100644 --- a/src/test/ui/const-generics/const-argument-if-length.min.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/const-argument-if-length.rs:19:24 | LL | pad: [u8; is_zst::()], - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/const-argument-if-length.rs:17:12 diff --git a/src/test/ui/const-generics/const-argument-if-length.rs b/src/test/ui/const-generics/const-argument-if-length.rs index 481ff97d68dbe..b8b49e100e6c9 100644 --- a/src/test/ui/const-generics/const-argument-if-length.rs +++ b/src/test/ui/const-generics/const-argument-if-length.rs @@ -17,7 +17,7 @@ pub struct AtLeastByte { value: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::()], - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR evaluation of constant value failed } diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr index 4b3235fd08783..93c92682c1216 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | LL | type Arr = [u8; N - 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs index d552e0f543080..3961b2568860f 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs @@ -4,7 +4,7 @@ #![cfg_attr(min, feature(min_const_generics))] type Arr = [u8; N - 1]; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations fn test() -> Arr where Arr: Default { //[full]~^ ERROR constant expression depends diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr index 85a15b1e75fdc..a9a5e7b8f4ac2 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple.rs:8:53 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple.rs:8:35 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr index 2eac9505624dd..903baf9cc0add 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple_fail.rs:7:33 | LL | type Arr = [u8; N - 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs index 637c940f71432..47330c624c7e4 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs @@ -5,7 +5,7 @@ #![allow(incomplete_features)] type Arr = [u8; N - 1]; //[full]~ ERROR evaluation of constant -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations fn test() -> Arr where Arr: Sized { todo!() diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr index e7e968e4c2ad2..52262e33676fe 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-function-call-in-array-length.rs:9:39 | LL | fn bar() -> [u32; foo(N)] { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-function-call-in-array-length.rs:12:13 | LL | [0; foo(N)] - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/generic-function-call-in-array-length.rs index c8bbae29343dc..653ad84e10fc3 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.rs +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.rs @@ -7,10 +7,10 @@ const fn foo(n: usize) -> usize { n * 2 } fn bar() -> [u32; foo(N)] { - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR constant expression depends on a generic parameter [0; foo(N)] - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations } fn main() {} diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr index 6f157fbbbbb8a..611645b5eaac6 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-sum-in-array-length.rs:7:53 | LL | fn foo(bar: [usize; A + B]) {} - | ^ non-trivial anonymous constants must not depend on the parameter `A` + | ^ cannot perform const operation using `A` | - = help: it is currently only allowed to use either `A` or `{ A }` as generic constants + = help: const parameters may only be used as standalone arguments `A` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-sum-in-array-length.rs:7:57 | LL | fn foo(bar: [usize; A + B]) {} - | ^ non-trivial anonymous constants must not depend on the parameter `B` + | ^ cannot perform const operation using `B` | - = help: it is currently only allowed to use either `B` or `{ B }` as generic constants + = help: const parameters may only be used as standalone arguments `B` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.rs b/src/test/ui/const-generics/generic-sum-in-array-length.rs index 810095b384baa..b7ba70863826c 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.rs +++ b/src/test/ui/const-generics/generic-sum-in-array-length.rs @@ -5,8 +5,8 @@ #![cfg_attr(min, feature(min_const_generics))] fn foo(bar: [usize; A + B]) {} -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values -//[min]~| ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~| ERROR generic parameters must not be used inside const evaluations //[full]~^^^ ERROR constant expression depends on a generic parameter fn main() {} diff --git a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr index 307db088bf892..e58d4c4d37e48 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/intrinsics-type_name-as-const-argument.rs:15:44 | LL | T: Trait<{std::intrinsics::type_name::()}> - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error: `&'static str` is forbidden as the type of a const generic parameter --> $DIR/intrinsics-type_name-as-const-argument.rs:10:22 diff --git a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs index 37b6cf4bab92b..833e8ef06dde0 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs @@ -13,7 +13,7 @@ trait Trait {} struct Bug where T: Trait<{std::intrinsics::type_name::()}> - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR constant expression depends on a generic parameter { t: T diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr index 2c1bc055b28ae..ac3488b2aff42 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61522-array-len-succ.rs:7:45 | LL | pub struct MyArray([u8; COUNT + 1]); - | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | ^^^^^ cannot perform const operation using `COUNT` | - = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + = help: const parameters may only be used as standalone arguments `COUNT` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61522-array-len-succ.rs:12:30 | LL | fn inner(&self) -> &[u8; COUNT + 1] { - | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | ^^^^^ cannot perform const operation using `COUNT` | - = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + = help: const parameters may only be used as standalone arguments `COUNT` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issue-67375.min.stderr b/src/test/ui/const-generics/issue-67375.min.stderr index b13d9fdab0d96..405d83e7c7ee7 100644 --- a/src/test/ui/const-generics/issue-67375.min.stderr +++ b/src/test/ui/const-generics/issue-67375.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67375.rs:9:25 | LL | inner: [(); { [|_: &T| {}; 0].len() }], - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `T` is never used --> $DIR/issue-67375.rs:7:12 diff --git a/src/test/ui/const-generics/issue-67375.rs b/src/test/ui/const-generics/issue-67375.rs index 994ec92cfb501..78d3fcd89a73f 100644 --- a/src/test/ui/const-generics/issue-67375.rs +++ b/src/test/ui/const-generics/issue-67375.rs @@ -7,7 +7,7 @@ struct Bug { //~^ ERROR parameter `T` is never used inner: [(); { [|_: &T| {}; 0].len() }], - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ WARN cannot use constants which depend on generic parameters in types //[full]~^^^ WARN this was previously accepted by the compiler } diff --git a/src/test/ui/const-generics/issue-67945-1.min.stderr b/src/test/ui/const-generics/issue-67945-1.min.stderr index 949b5da5920b1..1833a011c65df 100644 --- a/src/test/ui/const-generics/issue-67945-1.min.stderr +++ b/src/test/ui/const-generics/issue-67945-1.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-1.rs:14:16 | LL | let x: S = MaybeUninit::uninit(); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-1.rs:17:45 | LL | let b = &*(&x as *const _ as *const S); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `S` is never used --> $DIR/issue-67945-1.rs:11:12 diff --git a/src/test/ui/const-generics/issue-67945-1.rs b/src/test/ui/const-generics/issue-67945-1.rs index d1a83e978d1b8..a97c16373533c 100644 --- a/src/test/ui/const-generics/issue-67945-1.rs +++ b/src/test/ui/const-generics/issue-67945-1.rs @@ -12,10 +12,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations 0 }], } diff --git a/src/test/ui/const-generics/issue-67945-2.min.stderr b/src/test/ui/const-generics/issue-67945-2.min.stderr index ed445b3e8f790..dddc4f220fe30 100644 --- a/src/test/ui/const-generics/issue-67945-2.min.stderr +++ b/src/test/ui/const-generics/issue-67945-2.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-2.rs:12:16 | LL | let x: S = MaybeUninit::uninit(); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-2.rs:15:45 | LL | let b = &*(&x as *const _ as *const S); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:9:12 diff --git a/src/test/ui/const-generics/issue-67945-2.rs b/src/test/ui/const-generics/issue-67945-2.rs index 7f789297df034..bc14a347b1c67 100644 --- a/src/test/ui/const-generics/issue-67945-2.rs +++ b/src/test/ui/const-generics/issue-67945-2.rs @@ -10,10 +10,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations 0 }], } diff --git a/src/test/ui/const-generics/issues/issue-61747.min.stderr b/src/test/ui/const-generics/issues/issue-61747.min.stderr index fdd9a569748e2..c1a4c67e84870 100644 --- a/src/test/ui/const-generics/issues/issue-61747.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61747.rs:8:30 | LL | fn successor() -> Const<{C + 1}> { - | ^ non-trivial anonymous constants must not depend on the parameter `C` + | ^ cannot perform const operation using `C` | - = help: it is currently only allowed to use either `C` or `{ C }` as generic constants + = help: const parameters may only be used as standalone arguments `C` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.min.stderr b/src/test/ui/const-generics/issues/issue-61935.min.stderr index f461a31eeae3a..4802d6d8cc061 100644 --- a/src/test/ui/const-generics/issues/issue-61935.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61935.rs:10:23 | LL | Self:FooImpl<{N==0}> - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.rs b/src/test/ui/const-generics/issues/issue-61935.rs index a181a8dabe5aa..5c0c4c2792b2e 100644 --- a/src/test/ui/const-generics/issues/issue-61935.rs +++ b/src/test/ui/const-generics/issues/issue-61935.rs @@ -9,7 +9,7 @@ impl Foo for [(); N] where Self:FooImpl<{N==0}> //[full]~^ERROR constant expression depends on a generic parameter -//[min]~^^ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ERROR generic parameters must not be used inside const evaluations {} trait FooImpl{} diff --git a/src/test/ui/const-generics/issues/issue-62220.min.stderr b/src/test/ui/const-generics/issues/issue-62220.min.stderr index 84975e8f3be6b..2a890c1966a97 100644 --- a/src/test/ui/const-generics/issues/issue-62220.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62220.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-62220.rs:8:59 | LL | pub type TruncatedVector = Vector; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62220.rs b/src/test/ui/const-generics/issues/issue-62220.rs index 5694dc6d04da1..d25643ead38e9 100644 --- a/src/test/ui/const-generics/issues/issue-62220.rs +++ b/src/test/ui/const-generics/issues/issue-62220.rs @@ -6,7 +6,7 @@ pub struct Vector([T; N]); pub type TruncatedVector = Vector; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations impl Vector { /// Drop the last component and return the vector with one fewer dimension. diff --git a/src/test/ui/const-generics/issues/issue-62456.min.stderr b/src/test/ui/const-generics/issues/issue-62456.min.stderr index f94ba8c0c9b87..2bf0d2130e776 100644 --- a/src/test/ui/const-generics/issues/issue-62456.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62456.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-62456.rs:7:20 | LL | let _ = [0u64; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62456.rs b/src/test/ui/const-generics/issues/issue-62456.rs index 338ec42799d17..53482a500bf69 100644 --- a/src/test/ui/const-generics/issues/issue-62456.rs +++ b/src/test/ui/const-generics/issues/issue-62456.rs @@ -6,7 +6,7 @@ fn foo() { let _ = [0u64; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-64494.min.stderr b/src/test/ui/const-generics/issues/issue-64494.min.stderr index f712171bbac61..900c4f0980df9 100644 --- a/src/test/ui/const-generics/issues/issue-64494.min.stderr +++ b/src/test/ui/const-generics/issues/issue-64494.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-64494.rs:16:38 | LL | impl MyTrait for T where Is<{T::VAL == 5}>: True {} - | ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T` + | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-64494.rs:19:38 | LL | impl MyTrait for T where Is<{T::VAL == 6}>: True {} - | ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T` + | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0119]: conflicting implementations of trait `MyTrait`: --> $DIR/issue-64494.rs:19:1 diff --git a/src/test/ui/const-generics/issues/issue-64494.rs b/src/test/ui/const-generics/issues/issue-64494.rs index b62ebf846d5b1..a822c79f51bbe 100644 --- a/src/test/ui/const-generics/issues/issue-64494.rs +++ b/src/test/ui/const-generics/issues/issue-64494.rs @@ -15,10 +15,10 @@ impl True for Is<{true}> {} impl MyTrait for T where Is<{T::VAL == 5}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations impl MyTrait for T where Is<{T::VAL == 6}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations //[min]~| ERROR conflicting implementations of trait `MyTrait` fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-66205.min.stderr b/src/test/ui/const-generics/issues/issue-66205.min.stderr index a18126ccfef6d..691d9ca34426b 100644 --- a/src/test/ui/const-generics/issues/issue-66205.min.stderr +++ b/src/test/ui/const-generics/issues/issue-66205.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-66205.rs:8:14 | LL | fact::<{ N - 1 }>(); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-66205.rs b/src/test/ui/const-generics/issues/issue-66205.rs index 668f49852e1ef..e295fe3574ad3 100644 --- a/src/test/ui/const-generics/issues/issue-66205.rs +++ b/src/test/ui/const-generics/issues/issue-66205.rs @@ -7,7 +7,7 @@ fn fact() { fact::<{ N - 1 }>(); //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-67739.min.stderr b/src/test/ui/const-generics/issues/issue-67739.min.stderr index ba378de415654..03a936c2f0201 100644 --- a/src/test/ui/const-generics/issues/issue-67739.min.stderr +++ b/src/test/ui/const-generics/issues/issue-67739.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67739.rs:12:30 | LL | [0u8; mem::size_of::()]; - | ^^^^^^^^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `Self` + | ^^^^^^^^^^^^^^^^ cannot perform const operation using `Self` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-67739.rs b/src/test/ui/const-generics/issues/issue-67739.rs index 296e4d423c48a..db64f4e40cc2a 100644 --- a/src/test/ui/const-generics/issues/issue-67739.rs +++ b/src/test/ui/const-generics/issues/issue-67739.rs @@ -11,7 +11,7 @@ pub trait Trait { fn associated_size(&self) -> usize { [0u8; mem::size_of::()]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations 0 } } diff --git a/src/test/ui/const-generics/issues/issue-68366.min.stderr b/src/test/ui/const-generics/issues/issue-68366.min.stderr index 73d6fec6f9b56..b5bcedcb529bc 100644 --- a/src/test/ui/const-generics/issues/issue-68366.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68366.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68366.rs:12:37 | LL | impl Collatz<{Some(N)}> {} - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-68366.rs:12:13 diff --git a/src/test/ui/const-generics/issues/issue-68366.rs b/src/test/ui/const-generics/issues/issue-68366.rs index ac313eb3b2ff3..b6f7171e3f320 100644 --- a/src/test/ui/const-generics/issues/issue-68366.rs +++ b/src/test/ui/const-generics/issues/issue-68366.rs @@ -11,7 +11,7 @@ struct Collatz>; impl Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters must not be used inside of non-trivial constant values +//[min]~^^ generic parameters must not be used inside const evaluations struct Foo; diff --git a/src/test/ui/const-generics/issues/issue-68977.min.stderr b/src/test/ui/const-generics/issues/issue-68977.min.stderr index 59d2be3ce4b42..fa5cdb62a63cd 100644 --- a/src/test/ui/const-generics/issues/issue-68977.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68977.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68977.rs:29:17 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - | ^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `INT_BITS` + | ^^^^^^^^ cannot perform const operation using `INT_BITS` | - = help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants + = help: const parameters may only be used as standalone arguments `INT_BITS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68977.rs:29:28 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - | ^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `FRAC_BITS` + | ^^^^^^^^^ cannot perform const operation using `FRAC_BITS` | - = help: it is currently only allowed to use either `FRAC_BITS` or `{ FRAC_BITS }` as generic constants + = help: const parameters may only be used as standalone arguments `FRAC_BITS` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-68977.rs b/src/test/ui/const-generics/issues/issue-68977.rs index 49b305a5a783f..d121d3382279f 100644 --- a/src/test/ui/const-generics/issues/issue-68977.rs +++ b/src/test/ui/const-generics/issues/issue-68977.rs @@ -27,8 +27,8 @@ fxp_storage_impls! { type FxpStorageHelper = PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values - //[min]~| ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~| ERROR generic parameters must not be used inside const evaluations struct Fxp where diff --git a/src/test/ui/const-generics/issues/issue-72787.min.stderr b/src/test/ui/const-generics/issues/issue-72787.min.stderr index a4c80b1d8c01e..68678259a3581 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:11:17 | LL | Condition<{ LHS <= RHS }>: True - | ^^^ non-trivial anonymous constants must not depend on the parameter `LHS` + | ^^^ cannot perform const operation using `LHS` | - = help: it is currently only allowed to use either `LHS` or `{ LHS }` as generic constants + = help: const parameters may only be used as standalone arguments `LHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:11:24 | LL | Condition<{ LHS <= RHS }>: True - | ^^^ non-trivial anonymous constants must not depend on the parameter `RHS` + | ^^^ cannot perform const operation using `RHS` | - = help: it is currently only allowed to use either `RHS` or `{ RHS }` as generic constants + = help: const parameters may only be used as standalone arguments `RHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:26:25 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ non-trivial anonymous constants must not depend on the parameter `I` + | ^ cannot perform const operation using `I` | - = help: it is currently only allowed to use either `I` or `{ I }` as generic constants + = help: const parameters may only be used as standalone arguments `I` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:26:36 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ non-trivial anonymous constants must not depend on the parameter `J` + | ^ cannot perform const operation using `J` | - = help: it is currently only allowed to use either `J` or `{ J }` as generic constants + = help: const parameters may only be used as standalone arguments `J` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:22:26 diff --git a/src/test/ui/const-generics/issues/issue-72787.rs b/src/test/ui/const-generics/issues/issue-72787.rs index 779c1d2950e4d..76e10ed36d1f6 100644 --- a/src/test/ui/const-generics/issues/issue-72787.rs +++ b/src/test/ui/const-generics/issues/issue-72787.rs @@ -10,8 +10,8 @@ pub trait True {} impl True for IsLessOrEqual where Condition<{ LHS <= RHS }>: True //[full]~^ Error constant expression depends on a generic parameter -//[min]~^^ Error generic parameters must not be used inside of non-trivial constant values -//[min]~| Error generic parameters must not be used inside of non-trivial constant values +//[min]~^^ Error generic parameters must not be used inside const evaluations +//[min]~| Error generic parameters must not be used inside const evaluations { } impl True for Condition {} @@ -28,8 +28,8 @@ where //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter -//[min]~^^^^^ Error generic parameters must not be used inside of non-trivial constant values -//[min]~| Error generic parameters must not be used inside of non-trivial constant values +//[min]~^^^^^ Error generic parameters must not be used inside const evaluations +//[min]~| Error generic parameters must not be used inside const evaluations // Condition<{ 8 - I <= 8 - J }>: True, { fn print() { diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr index afc14c7dcff57..41fe70c79b262 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72819-generic-in-const-eval.rs:9:17 | LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs index 65c7f00a72ae5..7eaa8bbddc534 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs @@ -8,7 +8,7 @@ struct Arr where Assert::<{N < usize::max_value() / 2}>: IsTrue, //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations { } diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr index 0db948d0a45db..fe683a3dfe311 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-76701-ty-param-in-const.rs:6:46 | LL | fn ty_param() -> [u8; std::mem::size_of::()] { - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 | LL | fn const_param() -> [u8; N + 1] { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs index 3c5bfb03f0801..3d05813f63726 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs @@ -5,13 +5,13 @@ fn ty_param() -> [u8; std::mem::size_of::()] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations todo!() } fn const_param() -> [u8; N + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations todo!() } diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index c6380f6394d01..3c9fd1ff47b29 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -7,19 +7,19 @@ fn ok() -> [u8; M] { } struct Break0([u8; { N + 1 }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters must not be used inside const evaluations struct Break1([u8; { { N } }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters must not be used inside const evaluations fn break2() { let _: [u8; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ ERROR generic parameters must not be used inside const evaluations } fn break3() { let _ = [0; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ ERROR generic parameters must not be used inside const evaluations } trait Foo { diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr index d8897f53d7f74..1282d7d7d620b 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:9:38 | LL | struct Break0([u8; { N + 1 }]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:12:40 | LL | struct Break1([u8; { { N } }]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:16:17 | LL | let _: [u8; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:21:17 | LL | let _ = [0; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 4 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr index 7dc81bf45af9a..381c20125426b 100644 --- a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr +++ b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/self-ty-in-const-1.rs:4:41 | LL | fn t1() -> [u8; std::mem::size_of::()]; - | ^^^^ non-trivial anonymous constants must not depend on the parameter `Self` + | ^^^^ cannot perform const operation using `Self` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error: generic `Self` types are currently not permitted in anonymous constants --> $DIR/self-ty-in-const-1.rs:14:41 diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr index 0dd591d891f2b..3bf3d41c88f8b 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr @@ -6,13 +6,13 @@ LL | struct Bar(T); | = note: using type defaults and const parameters in the same parameter list is currently not permitted -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo()]>(T, U); - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error: constant values inside of type parameter defaults must not depend on generic parameters --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:21 diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index b9d74850f37d6..da37be6d87ae0 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -6,7 +6,7 @@ struct Foo()]>(T, U); //[full]~^ ERROR constant values inside of type parameter defaults -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial +//[min]~^^ ERROR generic parameters must not be used inside const evaluations // FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. struct Bar(T); diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index 1c52d60174997..bd244a7d44d79 100644 --- a/src/test/ui/const-generics/wf-misc.min.stderr +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/wf-misc.rs:9:17 | LL | let _: [u8; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/wf-misc.rs:17:21 | LL | let _: Const::<{N + 1}>; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/wf-misc.rs b/src/test/ui/const-generics/wf-misc.rs index f8c41404c467b..8d68bf7765445 100644 --- a/src/test/ui/const-generics/wf-misc.rs +++ b/src/test/ui/const-generics/wf-misc.rs @@ -8,7 +8,7 @@ pub fn arr_len() { let _: [u8; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } struct Const; @@ -16,7 +16,7 @@ struct Const; pub fn func_call() { let _: Const::<{N + 1}>; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} From eec443681ef927d1c567c29401237f5c31f49aaf Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 07:18:29 -0500 Subject: [PATCH 09/18] Make error help clearer Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 83706e8a96f07..99773cd176426 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -477,7 +477,7 @@ impl<'a> Resolver<'a> { err.note("type parameters may not be used in anonymous constants"); } else { err.help(&format!( - "const parameters may only be used as standalone arguments `{}`", + "const parameters may only be used as standalone arguments, i.e. `{}`", name )); } From e62da8ff0b840f20107c17d1a1cd664b123e2b88 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 15:57:04 -0500 Subject: [PATCH 10/18] Remove a little jargon from error Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 99773cd176426..7e17f222a1589 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -474,7 +474,7 @@ impl<'a> Resolver<'a> { err.span_label(span, &format!("cannot perform const operation using `{}`", name)); if is_type { - err.note("type parameters may not be used in anonymous constants"); + err.note("type parameters may not be used in const expressions"); } else { err.help(&format!( "const parameters may only be used as standalone arguments, i.e. `{}`", From facb38d1dcdc7a311f96f965389a837829f8f8d6 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 15:58:06 -0500 Subject: [PATCH 11/18] A little rewording Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 7e17f222a1589..774a147c114ec 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -469,7 +469,7 @@ impl<'a> Resolver<'a> { ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => { let mut err = self.session.struct_span_err( span, - "generic parameters must not be used inside const evaluations", + "generic parameters may not be used in const operations", ); err.span_label(span, &format!("cannot perform const operation using `{}`", name)); From c16c8acae13e1a3b29b222fdb0be11244dc65937 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Mon, 12 Oct 2020 16:02:48 -0400 Subject: [PATCH 12/18] Include `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component Fixes #55890 It's useful to have `llc` and `opt` available when debugging an LLVM miscompilation,. --- src/bootstrap/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index bf81c4bf28e37..90bde2d99780f 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -177,6 +177,9 @@ const LLVM_TOOLS: &[&str] = &[ "llvm-size", // used to prints the size of the linker sections of a program "llvm-strip", // used to discard symbols from binary files to reduce their size "llvm-ar", // used for creating and modifying archive files + "llvm-dis", // used to disassemble LLVM bitcode + "llc", // used to compile LLVM bytecode + "opt", // used to optimize LLVM bytecode ]; /// A structure representing a Rust compiler. From 79351b1d4a8e48c683cbd719171b53bbd1673a83 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 22:27:59 +0100 Subject: [PATCH 13/18] Bless expected errors --- ...array-size-in-generic-struct-param.min.stderr | 8 ++++---- .../array-size-in-generic-struct-param.rs | 4 ++-- .../const-argument-if-length.min.stderr | 4 ++-- .../const-generics/const-argument-if-length.rs | 2 +- ...ure-gate-const_evaluatable_checked.min.stderr | 4 ++-- .../feature-gate-const_evaluatable_checked.rs | 2 +- .../const_evaluatable_checked/simple.min.stderr | 8 ++++---- .../simple_fail.min.stderr | 4 ++-- .../const_evaluatable_checked/simple_fail.rs | 2 +- ...eric-function-call-in-array-length.min.stderr | 8 ++++---- .../generic-function-call-in-array-length.rs | 4 ++-- .../generic-sum-in-array-length.min.stderr | 8 ++++---- .../generic-sum-in-array-length.rs | 4 ++-- ...insics-type_name-as-const-argument.min.stderr | 4 ++-- .../intrinsics-type_name-as-const-argument.rs | 2 +- .../issue-61522-array-len-succ.min.stderr | 8 ++++---- .../const-generics/issue-61522-array-len-succ.rs | 4 ++-- .../ui/const-generics/issue-67375.min.stderr | 4 ++-- src/test/ui/const-generics/issue-67375.rs | 2 +- .../ui/const-generics/issue-67945-1.min.stderr | 8 ++++---- src/test/ui/const-generics/issue-67945-1.rs | 4 ++-- .../ui/const-generics/issue-67945-2.min.stderr | 8 ++++---- src/test/ui/const-generics/issue-67945-2.rs | 4 ++-- .../const-generics/issues/issue-61747.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-61747.rs | 2 +- .../const-generics/issues/issue-61935.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-61935.rs | 2 +- .../const-generics/issues/issue-62220.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-62220.rs | 2 +- .../const-generics/issues/issue-62456.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-62456.rs | 2 +- .../const-generics/issues/issue-64494.min.stderr | 8 ++++---- src/test/ui/const-generics/issues/issue-64494.rs | 4 ++-- .../const-generics/issues/issue-66205.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-66205.rs | 2 +- .../const-generics/issues/issue-67739.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-67739.rs | 2 +- .../const-generics/issues/issue-68366.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-68366.rs | 2 +- .../const-generics/issues/issue-68977.min.stderr | 8 ++++---- src/test/ui/const-generics/issues/issue-68977.rs | 4 ++-- .../const-generics/issues/issue-72787.min.stderr | 16 ++++++++-------- src/test/ui/const-generics/issues/issue-72787.rs | 8 ++++---- .../issue-72819-generic-in-const-eval.min.stderr | 4 ++-- .../issues/issue-72819-generic-in-const-eval.rs | 2 +- .../issue-76701-ty-param-in-const.min.stderr | 8 ++++---- .../issues/issue-76701-ty-param-in-const.rs | 4 ++-- .../min_const_generics/complex-expression.rs | 8 ++++---- .../min_const_generics/complex-expression.stderr | 16 ++++++++-------- .../min_const_generics/self-ty-in-const-1.stderr | 4 ++-- ...params-in-ct-in-ty-param-lazy-norm.min.stderr | 4 ++-- .../params-in-ct-in-ty-param-lazy-norm.rs | 2 +- src/test/ui/const-generics/wf-misc.min.stderr | 8 ++++---- src/test/ui/const-generics/wf-misc.rs | 4 ++-- 54 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr index 31073683870e9..cfaacf7a5be33 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:9:48 | LL | struct ArithArrayLen([u32; 0 + N]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:20:15 | LL | arr: [u8; CFG.arr_size], | ^^^ cannot perform const operation using `CFG` | - = help: const parameters may only be used as standalone arguments `CFG` + = help: const parameters may only be used as standalone arguments, i.e. `CFG` error: `Config` is forbidden as the type of a const generic parameter --> $DIR/array-size-in-generic-struct-param.rs:18:21 diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index 84591c1b724c6..768180d0813a9 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -8,7 +8,7 @@ #[allow(dead_code)] struct ArithArrayLen([u32; 0 + N]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations #[derive(PartialEq, Eq)] struct Config { @@ -19,7 +19,7 @@ struct B { //[min]~^ ERROR `Config` is forbidden arr: [u8; CFG.arr_size], //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } const C: Config = Config { arr_size: 5 }; diff --git a/src/test/ui/const-generics/const-argument-if-length.min.stderr b/src/test/ui/const-generics/const-argument-if-length.min.stderr index 60f860838139b..bce701ade8651 100644 --- a/src/test/ui/const-generics/const-argument-if-length.min.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/const-argument-if-length.rs:19:24 | LL | pad: [u8; is_zst::()], | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/const-argument-if-length.rs:17:12 diff --git a/src/test/ui/const-generics/const-argument-if-length.rs b/src/test/ui/const-generics/const-argument-if-length.rs index b8b49e100e6c9..a8bffd17b912c 100644 --- a/src/test/ui/const-generics/const-argument-if-length.rs +++ b/src/test/ui/const-generics/const-argument-if-length.rs @@ -17,7 +17,7 @@ pub struct AtLeastByte { value: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::()], - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR evaluation of constant value failed } diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr index 93c92682c1216..359c2d2a22f02 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs index 3961b2568860f..9746adab29bf6 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs @@ -4,7 +4,7 @@ #![cfg_attr(min, feature(min_const_generics))] type Arr = [u8; N - 1]; -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations fn test() -> Arr where Arr: Default { //[full]~^ ERROR constant expression depends diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr index a9a5e7b8f4ac2..46485262cc46e 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:53 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:35 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr index 903baf9cc0add..981d993f58976 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple_fail.rs:7:33 | LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs index 47330c624c7e4..5e2c080927f86 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs @@ -5,7 +5,7 @@ #![allow(incomplete_features)] type Arr = [u8; N - 1]; //[full]~ ERROR evaluation of constant -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations fn test() -> Arr where Arr: Sized { todo!() diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr index 52262e33676fe..84449018e4609 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:9:39 | LL | fn bar() -> [u32; foo(N)] { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:12:13 | LL | [0; foo(N)] | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/generic-function-call-in-array-length.rs index 653ad84e10fc3..c838070dc95af 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.rs +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.rs @@ -7,10 +7,10 @@ const fn foo(n: usize) -> usize { n * 2 } fn bar() -> [u32; foo(N)] { - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR constant expression depends on a generic parameter [0; foo(N)] - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations } fn main() {} diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr index 611645b5eaac6..d3f7143327ead 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:53 | LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `A` | - = help: const parameters may only be used as standalone arguments `A` + = help: const parameters may only be used as standalone arguments, i.e. `A` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:57 | LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `B` | - = help: const parameters may only be used as standalone arguments `B` + = help: const parameters may only be used as standalone arguments, i.e. `B` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.rs b/src/test/ui/const-generics/generic-sum-in-array-length.rs index b7ba70863826c..84ddfe055dc3f 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.rs +++ b/src/test/ui/const-generics/generic-sum-in-array-length.rs @@ -5,8 +5,8 @@ #![cfg_attr(min, feature(min_const_generics))] fn foo(bar: [usize; A + B]) {} -//[min]~^ ERROR generic parameters must not be used inside const evaluations -//[min]~| ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations +//[min]~| ERROR generic parameters may not be used in const operations //[full]~^^^ ERROR constant expression depends on a generic parameter fn main() {} diff --git a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr index e58d4c4d37e48..20a8d9fdaab53 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/intrinsics-type_name-as-const-argument.rs:15:44 | LL | T: Trait<{std::intrinsics::type_name::()}> | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error: `&'static str` is forbidden as the type of a const generic parameter --> $DIR/intrinsics-type_name-as-const-argument.rs:10:22 diff --git a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs index 833e8ef06dde0..8971c00ed5a29 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs @@ -13,7 +13,7 @@ trait Trait {} struct Bug where T: Trait<{std::intrinsics::type_name::()}> - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR constant expression depends on a generic parameter { t: T diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr index ac3488b2aff42..526807f0a2474 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:7:45 | LL | pub struct MyArray([u8; COUNT + 1]); | ^^^^^ cannot perform const operation using `COUNT` | - = help: const parameters may only be used as standalone arguments `COUNT` + = help: const parameters may only be used as standalone arguments, i.e. `COUNT` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:12:30 | LL | fn inner(&self) -> &[u8; COUNT + 1] { | ^^^^^ cannot perform const operation using `COUNT` | - = help: const parameters may only be used as standalone arguments `COUNT` + = help: const parameters may only be used as standalone arguments, i.e. `COUNT` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.rs b/src/test/ui/const-generics/issue-61522-array-len-succ.rs index 81443b90d6156..8c0a3a0377468 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.rs +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.rs @@ -6,12 +6,12 @@ pub struct MyArray([u8; COUNT + 1]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used +//[min]~^^ ERROR generic parameters may not be used impl MyArray { fn inner(&self) -> &[u8; COUNT + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used + //[min]~^^ ERROR generic parameters may not be used &self.0 } } diff --git a/src/test/ui/const-generics/issue-67375.min.stderr b/src/test/ui/const-generics/issue-67375.min.stderr index 405d83e7c7ee7..3c344edbf1d15 100644 --- a/src/test/ui/const-generics/issue-67375.min.stderr +++ b/src/test/ui/const-generics/issue-67375.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67375.rs:9:25 | LL | inner: [(); { [|_: &T| {}; 0].len() }], | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0392]: parameter `T` is never used --> $DIR/issue-67375.rs:7:12 diff --git a/src/test/ui/const-generics/issue-67375.rs b/src/test/ui/const-generics/issue-67375.rs index 78d3fcd89a73f..ecc76bcae06c5 100644 --- a/src/test/ui/const-generics/issue-67375.rs +++ b/src/test/ui/const-generics/issue-67375.rs @@ -7,7 +7,7 @@ struct Bug { //~^ ERROR parameter `T` is never used inner: [(); { [|_: &T| {}; 0].len() }], - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ WARN cannot use constants which depend on generic parameters in types //[full]~^^^ WARN this was previously accepted by the compiler } diff --git a/src/test/ui/const-generics/issue-67945-1.min.stderr b/src/test/ui/const-generics/issue-67945-1.min.stderr index 1833a011c65df..804236c30bd81 100644 --- a/src/test/ui/const-generics/issue-67945-1.min.stderr +++ b/src/test/ui/const-generics/issue-67945-1.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-1.rs:14:16 | LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-1.rs:17:45 | LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0392]: parameter `S` is never used --> $DIR/issue-67945-1.rs:11:12 diff --git a/src/test/ui/const-generics/issue-67945-1.rs b/src/test/ui/const-generics/issue-67945-1.rs index a97c16373533c..6771603f2594b 100644 --- a/src/test/ui/const-generics/issue-67945-1.rs +++ b/src/test/ui/const-generics/issue-67945-1.rs @@ -12,10 +12,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations 0 }], } diff --git a/src/test/ui/const-generics/issue-67945-2.min.stderr b/src/test/ui/const-generics/issue-67945-2.min.stderr index dddc4f220fe30..2de942c1220cd 100644 --- a/src/test/ui/const-generics/issue-67945-2.min.stderr +++ b/src/test/ui/const-generics/issue-67945-2.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-2.rs:12:16 | LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-2.rs:15:45 | LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:9:12 diff --git a/src/test/ui/const-generics/issue-67945-2.rs b/src/test/ui/const-generics/issue-67945-2.rs index bc14a347b1c67..72dbb674e66bd 100644 --- a/src/test/ui/const-generics/issue-67945-2.rs +++ b/src/test/ui/const-generics/issue-67945-2.rs @@ -10,10 +10,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations 0 }], } diff --git a/src/test/ui/const-generics/issues/issue-61747.min.stderr b/src/test/ui/const-generics/issues/issue-61747.min.stderr index c1a4c67e84870..b176f9d1c75aa 100644 --- a/src/test/ui/const-generics/issues/issue-61747.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61747.rs:8:30 | LL | fn successor() -> Const<{C + 1}> { | ^ cannot perform const operation using `C` | - = help: const parameters may only be used as standalone arguments `C` + = help: const parameters may only be used as standalone arguments, i.e. `C` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61747.rs b/src/test/ui/const-generics/issues/issue-61747.rs index 4e5cde17f39a9..3a4dd1cdd181d 100644 --- a/src/test/ui/const-generics/issues/issue-61747.rs +++ b/src/test/ui/const-generics/issues/issue-61747.rs @@ -7,7 +7,7 @@ struct Const; impl Const<{C}> { fn successor() -> Const<{C + 1}> { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used + //[min]~^^ ERROR generic parameters may not be used Const } } diff --git a/src/test/ui/const-generics/issues/issue-61935.min.stderr b/src/test/ui/const-generics/issues/issue-61935.min.stderr index 4802d6d8cc061..9e31466259fd9 100644 --- a/src/test/ui/const-generics/issues/issue-61935.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61935.rs:10:23 | LL | Self:FooImpl<{N==0}> | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.rs b/src/test/ui/const-generics/issues/issue-61935.rs index 5c0c4c2792b2e..9fa02329a7124 100644 --- a/src/test/ui/const-generics/issues/issue-61935.rs +++ b/src/test/ui/const-generics/issues/issue-61935.rs @@ -9,7 +9,7 @@ impl Foo for [(); N] where Self:FooImpl<{N==0}> //[full]~^ERROR constant expression depends on a generic parameter -//[min]~^^ERROR generic parameters must not be used inside const evaluations +//[min]~^^ERROR generic parameters may not be used in const operations {} trait FooImpl{} diff --git a/src/test/ui/const-generics/issues/issue-62220.min.stderr b/src/test/ui/const-generics/issues/issue-62220.min.stderr index 2a890c1966a97..3bd127ee74a59 100644 --- a/src/test/ui/const-generics/issues/issue-62220.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62220.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-62220.rs:8:59 | LL | pub type TruncatedVector = Vector; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62220.rs b/src/test/ui/const-generics/issues/issue-62220.rs index d25643ead38e9..2017473fa9e24 100644 --- a/src/test/ui/const-generics/issues/issue-62220.rs +++ b/src/test/ui/const-generics/issues/issue-62220.rs @@ -6,7 +6,7 @@ pub struct Vector([T; N]); pub type TruncatedVector = Vector; -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations impl Vector { /// Drop the last component and return the vector with one fewer dimension. diff --git a/src/test/ui/const-generics/issues/issue-62456.min.stderr b/src/test/ui/const-generics/issues/issue-62456.min.stderr index 2bf0d2130e776..c73f62a4a07d9 100644 --- a/src/test/ui/const-generics/issues/issue-62456.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62456.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-62456.rs:7:20 | LL | let _ = [0u64; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62456.rs b/src/test/ui/const-generics/issues/issue-62456.rs index 53482a500bf69..cbb2a11a931ae 100644 --- a/src/test/ui/const-generics/issues/issue-62456.rs +++ b/src/test/ui/const-generics/issues/issue-62456.rs @@ -6,7 +6,7 @@ fn foo() { let _ = [0u64; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-64494.min.stderr b/src/test/ui/const-generics/issues/issue-64494.min.stderr index 900c4f0980df9..8b02fd108bd5b 100644 --- a/src/test/ui/const-generics/issues/issue-64494.min.stderr +++ b/src/test/ui/const-generics/issues/issue-64494.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:16:38 | LL | impl MyTrait for T where Is<{T::VAL == 5}>: True {} | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:19:38 | LL | impl MyTrait for T where Is<{T::VAL == 6}>: True {} | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0119]: conflicting implementations of trait `MyTrait`: --> $DIR/issue-64494.rs:19:1 diff --git a/src/test/ui/const-generics/issues/issue-64494.rs b/src/test/ui/const-generics/issues/issue-64494.rs index a822c79f51bbe..014742be03db6 100644 --- a/src/test/ui/const-generics/issues/issue-64494.rs +++ b/src/test/ui/const-generics/issues/issue-64494.rs @@ -15,10 +15,10 @@ impl True for Is<{true}> {} impl MyTrait for T where Is<{T::VAL == 5}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations impl MyTrait for T where Is<{T::VAL == 6}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations //[min]~| ERROR conflicting implementations of trait `MyTrait` fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-66205.min.stderr b/src/test/ui/const-generics/issues/issue-66205.min.stderr index 691d9ca34426b..282f72be6da6e 100644 --- a/src/test/ui/const-generics/issues/issue-66205.min.stderr +++ b/src/test/ui/const-generics/issues/issue-66205.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-66205.rs:8:14 | LL | fact::<{ N - 1 }>(); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-66205.rs b/src/test/ui/const-generics/issues/issue-66205.rs index e295fe3574ad3..4e37c247d008e 100644 --- a/src/test/ui/const-generics/issues/issue-66205.rs +++ b/src/test/ui/const-generics/issues/issue-66205.rs @@ -7,7 +7,7 @@ fn fact() { fact::<{ N - 1 }>(); //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-67739.min.stderr b/src/test/ui/const-generics/issues/issue-67739.min.stderr index 03a936c2f0201..35d97c4624811 100644 --- a/src/test/ui/const-generics/issues/issue-67739.min.stderr +++ b/src/test/ui/const-generics/issues/issue-67739.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67739.rs:12:30 | LL | [0u8; mem::size_of::()]; | ^^^^^^^^^^^^^^^^ cannot perform const operation using `Self` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-67739.rs b/src/test/ui/const-generics/issues/issue-67739.rs index db64f4e40cc2a..21d13de22ebfc 100644 --- a/src/test/ui/const-generics/issues/issue-67739.rs +++ b/src/test/ui/const-generics/issues/issue-67739.rs @@ -11,7 +11,7 @@ pub trait Trait { fn associated_size(&self) -> usize { [0u8; mem::size_of::()]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations 0 } } diff --git a/src/test/ui/const-generics/issues/issue-68366.min.stderr b/src/test/ui/const-generics/issues/issue-68366.min.stderr index b5bcedcb529bc..b900a0d096ac2 100644 --- a/src/test/ui/const-generics/issues/issue-68366.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68366.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68366.rs:12:37 | LL | impl Collatz<{Some(N)}> {} | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-68366.rs:12:13 diff --git a/src/test/ui/const-generics/issues/issue-68366.rs b/src/test/ui/const-generics/issues/issue-68366.rs index b6f7171e3f320..474cdb7258d96 100644 --- a/src/test/ui/const-generics/issues/issue-68366.rs +++ b/src/test/ui/const-generics/issues/issue-68366.rs @@ -11,7 +11,7 @@ struct Collatz>; impl Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters must not be used inside const evaluations +//[min]~^^ generic parameters may not be used in const operations struct Foo; diff --git a/src/test/ui/const-generics/issues/issue-68977.min.stderr b/src/test/ui/const-generics/issues/issue-68977.min.stderr index fa5cdb62a63cd..7828d85939497 100644 --- a/src/test/ui/const-generics/issues/issue-68977.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68977.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68977.rs:29:17 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; | ^^^^^^^^ cannot perform const operation using `INT_BITS` | - = help: const parameters may only be used as standalone arguments `INT_BITS` + = help: const parameters may only be used as standalone arguments, i.e. `INT_BITS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68977.rs:29:28 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; | ^^^^^^^^^ cannot perform const operation using `FRAC_BITS` | - = help: const parameters may only be used as standalone arguments `FRAC_BITS` + = help: const parameters may only be used as standalone arguments, i.e. `FRAC_BITS` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-68977.rs b/src/test/ui/const-generics/issues/issue-68977.rs index d121d3382279f..4fea94cb4652b 100644 --- a/src/test/ui/const-generics/issues/issue-68977.rs +++ b/src/test/ui/const-generics/issues/issue-68977.rs @@ -27,8 +27,8 @@ fxp_storage_impls! { type FxpStorageHelper = PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - //[min]~^ ERROR generic parameters must not be used inside const evaluations - //[min]~| ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations + //[min]~| ERROR generic parameters may not be used in const operations struct Fxp where diff --git a/src/test/ui/const-generics/issues/issue-72787.min.stderr b/src/test/ui/const-generics/issues/issue-72787.min.stderr index 68678259a3581..d960d9513b752 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:11:17 | LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `LHS` | - = help: const parameters may only be used as standalone arguments `LHS` + = help: const parameters may only be used as standalone arguments, i.e. `LHS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:11:24 | LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `RHS` | - = help: const parameters may only be used as standalone arguments `RHS` + = help: const parameters may only be used as standalone arguments, i.e. `RHS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:25 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `I` | - = help: const parameters may only be used as standalone arguments `I` + = help: const parameters may only be used as standalone arguments, i.e. `I` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:36 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `J` | - = help: const parameters may only be used as standalone arguments `J` + = help: const parameters may only be used as standalone arguments, i.e. `J` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:22:26 diff --git a/src/test/ui/const-generics/issues/issue-72787.rs b/src/test/ui/const-generics/issues/issue-72787.rs index 76e10ed36d1f6..57572e23aa4de 100644 --- a/src/test/ui/const-generics/issues/issue-72787.rs +++ b/src/test/ui/const-generics/issues/issue-72787.rs @@ -10,8 +10,8 @@ pub trait True {} impl True for IsLessOrEqual where Condition<{ LHS <= RHS }>: True //[full]~^ Error constant expression depends on a generic parameter -//[min]~^^ Error generic parameters must not be used inside const evaluations -//[min]~| Error generic parameters must not be used inside const evaluations +//[min]~^^ Error generic parameters may not be used in const operations +//[min]~| Error generic parameters may not be used in const operations { } impl True for Condition {} @@ -28,8 +28,8 @@ where //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter -//[min]~^^^^^ Error generic parameters must not be used inside const evaluations -//[min]~| Error generic parameters must not be used inside const evaluations +//[min]~^^^^^ Error generic parameters may not be used in const operations +//[min]~| Error generic parameters may not be used in const operations // Condition<{ 8 - I <= 8 - J }>: True, { fn print() { diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr index 41fe70c79b262..9fec3eb946d83 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72819-generic-in-const-eval.rs:9:17 | LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs index 7eaa8bbddc534..6182042bde781 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs @@ -8,7 +8,7 @@ struct Arr where Assert::<{N < usize::max_value() / 2}>: IsTrue, //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations { } diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr index fe683a3dfe311..c10db84ea6ecc 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:6:46 | LL | fn ty_param() -> [u8; std::mem::size_of::()] { | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 | LL | fn const_param() -> [u8; N + 1] { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs index 3d05813f63726..9051c36fe81f4 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs @@ -5,13 +5,13 @@ fn ty_param() -> [u8; std::mem::size_of::()] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations todo!() } fn const_param() -> [u8; N + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations todo!() } diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index 3c9fd1ff47b29..8257ffbf4915b 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -7,19 +7,19 @@ fn ok() -> [u8; M] { } struct Break0([u8; { N + 1 }]); -//~^ ERROR generic parameters must not be used inside const evaluations +//~^ ERROR generic parameters may not be used in const operations struct Break1([u8; { { N } }]); -//~^ ERROR generic parameters must not be used inside const evaluations +//~^ ERROR generic parameters may not be used in const operations fn break2() { let _: [u8; N + 1]; - //~^ ERROR generic parameters must not be used inside const evaluations + //~^ ERROR generic parameters may not be used in const operations } fn break3() { let _ = [0; N + 1]; - //~^ ERROR generic parameters must not be used inside const evaluations + //~^ ERROR generic parameters may not be used in const operations } trait Foo { diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr index 1282d7d7d620b..73768ac03a4b1 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:9:38 | LL | struct Break0([u8; { N + 1 }]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:12:40 | LL | struct Break1([u8; { { N } }]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:16:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:21:17 | LL | let _ = [0; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 4 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr index 381c20125426b..64da5e07df2f4 100644 --- a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr +++ b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/self-ty-in-const-1.rs:4:41 | LL | fn t1() -> [u8; std::mem::size_of::()]; | ^^^^ cannot perform const operation using `Self` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error: generic `Self` types are currently not permitted in anonymous constants --> $DIR/self-ty-in-const-1.rs:14:41 diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr index 3bf3d41c88f8b..39aa8087cec50 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr @@ -6,13 +6,13 @@ LL | struct Bar(T); | = note: using type defaults and const parameters in the same parameter list is currently not permitted -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo()]>(T, U); | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error: constant values inside of type parameter defaults must not depend on generic parameters --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:21 diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index da37be6d87ae0..51f0cff3f215e 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -6,7 +6,7 @@ struct Foo()]>(T, U); //[full]~^ ERROR constant values inside of type parameter defaults -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations // FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. struct Bar(T); diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index bd244a7d44d79..935f12dd2c304 100644 --- a/src/test/ui/const-generics/wf-misc.min.stderr +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/wf-misc.rs:9:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/wf-misc.rs:17:21 | LL | let _: Const::<{N + 1}>; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/wf-misc.rs b/src/test/ui/const-generics/wf-misc.rs index 8d68bf7765445..103c580f28fc4 100644 --- a/src/test/ui/const-generics/wf-misc.rs +++ b/src/test/ui/const-generics/wf-misc.rs @@ -8,7 +8,7 @@ pub fn arr_len() { let _: [u8; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } struct Const; @@ -16,7 +16,7 @@ struct Const; pub fn func_call() { let _: Const::<{N + 1}>; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {} From 61e722f3312d9669e2789ff76543adacf75e5e08 Mon Sep 17 00:00:00 2001 From: LingMan Date: Tue, 13 Oct 2020 01:05:35 +0200 Subject: [PATCH 14/18] Use Option::unwrap_or instead of open-coding it --- compiler/rustc_ast_pretty/src/pp.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs index ca7f127ced60d..ba9081bb8a695 100644 --- a/compiler/rustc_ast_pretty/src/pp.rs +++ b/compiler/rustc_ast_pretty/src/pp.rs @@ -491,12 +491,9 @@ impl Printer { } fn get_top(&mut self) -> PrintStackElem { - match self.print_stack.last() { - Some(el) => *el, - None => { - PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) } - } - } + *self.print_stack.last().unwrap_or({ + &PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) } + }) } fn print_begin(&mut self, b: BeginToken, l: isize) { From 45a34fc66c7d5ffd95b48085788be8a6d7b96898 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Tue, 13 Oct 2020 07:19:54 -0400 Subject: [PATCH 15/18] Include aarch64-apple-darwin in the dist manifests --- src/tools/build-manifest/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 7ee28cd6e5d95..c9c95d4b1aa00 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -22,6 +22,7 @@ use std::sync::Mutex; use std::time::Instant; static HOSTS: &[&str] = &[ + "aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "arm-unknown-linux-gnueabi", @@ -55,6 +56,7 @@ static HOSTS: &[&str] = &[ ]; static TARGETS: &[&str] = &[ + "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", From a0fc455d301ba715a10e81bedb1358abbc1d133b Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 13 Oct 2020 10:17:05 +0200 Subject: [PATCH 16/18] Replace absolute paths with relative ones Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs. --- compiler/rustc_codegen_llvm/src/llvm_util.rs | 2 +- compiler/rustc_codegen_ssa/src/back/write.rs | 2 +- compiler/rustc_codegen_ssa/src/base.rs | 6 ++--- compiler/rustc_codegen_ssa/src/traits/mod.rs | 2 +- .../rustc_data_structures/src/fingerprint.rs | 4 ++-- .../src/obligation_forest/mod.rs | 2 +- .../rustc_data_structures/src/sorted_map.rs | 6 ++--- .../src/stable_hasher.rs | 2 +- compiler/rustc_hir/src/definitions.rs | 2 +- .../rustc_infer/src/infer/nll_relate/mod.rs | 6 ++--- .../src/infer/outlives/obligations.rs | 2 +- compiler/rustc_middle/src/ich/impls_syntax.rs | 22 +++++++------------ .../src/mir/interpret/allocation.rs | 2 +- .../rustc_middle/src/mir/interpret/value.rs | 4 ++-- compiler/rustc_middle/src/mir/mod.rs | 2 +- compiler/rustc_middle/src/ty/layout.rs | 2 +- .../src/ty/normalize_erasing_regions.rs | 2 +- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- .../src/ty/query/on_disk_cache.rs | 4 ++-- compiler/rustc_middle/src/ty/util.rs | 4 ++-- compiler/rustc_mir/src/interpret/machine.rs | 7 +++--- compiler/rustc_mir/src/interpret/operand.rs | 6 ++--- compiler/rustc_mir/src/interpret/place.rs | 13 ++++++----- compiler/rustc_mir/src/transform/mod.rs | 2 +- .../src/thir/pattern/check_match.rs | 4 ++-- .../rustc_mir_build/src/thir/pattern/mod.rs | 8 +++---- compiler/rustc_serialize/src/opaque.rs | 6 ++--- compiler/rustc_symbol_mangling/src/v0.rs | 2 +- .../src/traits/error_reporting/suggestions.rs | 7 +++--- .../src/traits/query/normalize.rs | 6 ++--- library/core/tests/num/int_macros.rs | 4 ++-- library/test/src/formatters/json.rs | 4 ++-- 32 files changed, 73 insertions(+), 76 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index a4605f4630952..88d73f2a86473 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -122,7 +122,7 @@ unsafe fn configure_llvm(sess: &Session) { llvm::LLVMInitializePasses(); - ::rustc_llvm::initialize_available_targets(); + rustc_llvm::initialize_available_targets(); llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr()); } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 0edf0fcd1a264..69a94d8f79560 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1175,7 +1175,7 @@ fn start_executing_work( // necessary. There's already optimizations in place to avoid sending work // back to the coordinator if LTO isn't requested. return thread::spawn(move || { - let max_workers = ::num_cpus::get(); + let max_workers = num_cpus::get(); let mut worker_id_counter = 0; let mut free_worker_ids = Vec::new(); let mut get_worker_id = |free_worker_ids: &mut Vec| { diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 8e6f8e193c0e2..7f918bd168e0e 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -695,7 +695,7 @@ pub fn codegen_crate( total_codegen_time.into_inner(), ); - ::rustc_incremental::assert_module_sources::assert_module_sources(tcx); + rustc_incremental::assert_module_sources::assert_module_sources(tcx); symbol_names_test::report_symbol_names(tcx); @@ -754,8 +754,8 @@ impl Drop for AbortCodegenOnDrop { } fn finalize_tcx(tcx: TyCtxt<'_>) { - tcx.sess.time("assert_dep_graph", || ::rustc_incremental::assert_dep_graph(tcx)); - tcx.sess.time("serialize_dep_graph", || ::rustc_incremental::save_dep_graph(tcx)); + tcx.sess.time("assert_dep_graph", || rustc_incremental::assert_dep_graph(tcx)); + tcx.sess.time("serialize_dep_graph", || rustc_incremental::save_dep_graph(tcx)); // We assume that no queries are run past here. If there are new queries // after this point, they'll show up as "" in self-profiling data. diff --git a/compiler/rustc_codegen_ssa/src/traits/mod.rs b/compiler/rustc_codegen_ssa/src/traits/mod.rs index 698ef6083e674..82518b7f0c388 100644 --- a/compiler/rustc_codegen_ssa/src/traits/mod.rs +++ b/compiler/rustc_codegen_ssa/src/traits/mod.rs @@ -85,7 +85,7 @@ impl<'tcx, T> CodegenMethods<'tcx> for T where } pub trait HasCodegen<'tcx>: - Backend<'tcx> + ::std::ops::Deref>::CodegenCx> + Backend<'tcx> + std::ops::Deref>::CodegenCx> { type CodegenCx: CodegenMethods<'tcx> + BackendTypes< diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index aba0bbbac804f..ec2f9597b1827 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -71,8 +71,8 @@ impl Fingerprint { } } -impl ::std::fmt::Display for Fingerprint { - fn fmt(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { +impl std::fmt::Display for Fingerprint { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "{:x}-{:x}", self.0, self.1) } } diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index 7cf5202d919f8..c0193e9fa0c4e 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -129,7 +129,7 @@ pub enum ProcessResult { struct ObligationTreeId(usize); type ObligationTreeIdGenerator = - ::std::iter::Map<::std::ops::RangeFrom, fn(usize) -> ObligationTreeId>; + std::iter::Map, fn(usize) -> ObligationTreeId>; pub struct ObligationForest { /// The list of obligations. In between calls to `process_obligations`, diff --git a/compiler/rustc_data_structures/src/sorted_map.rs b/compiler/rustc_data_structures/src/sorted_map.rs index 4807380595db7..9a28f8f4e2106 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -93,7 +93,7 @@ impl SortedMap { /// Iterate over elements, sorted by key #[inline] - pub fn iter(&self) -> ::std::slice::Iter<'_, (K, V)> { + pub fn iter(&self) -> std::slice::Iter<'_, (K, V)> { self.data.iter() } @@ -134,7 +134,7 @@ impl SortedMap { R: RangeBounds, { let (start, end) = self.range_slice_indices(range); - self.data.splice(start..end, ::std::iter::empty()); + self.data.splice(start..end, std::iter::empty()); } /// Mutate all keys with the given function `f`. This mutation must not @@ -241,7 +241,7 @@ impl SortedMap { impl IntoIterator for SortedMap { type Item = (K, V); - type IntoIter = ::std::vec::IntoIter<(K, V)>; + type IntoIter = std::vec::IntoIter<(K, V)>; fn into_iter(self) -> Self::IntoIter { self.data.into_iter() diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 68875b3fbde9b..579eb1cb7da66 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -20,7 +20,7 @@ pub struct StableHasher { } impl ::std::fmt::Debug for StableHasher { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.state) } } diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs index afefde07f9297..8f76551677c1d 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir/src/definitions.rs @@ -118,7 +118,7 @@ impl DefKey { let DisambiguatedDefPathData { ref data, disambiguator } = self.disambiguated_data; - ::std::mem::discriminant(data).hash(&mut hasher); + std::mem::discriminant(data).hash(&mut hasher); if let Some(name) = data.get_opt_name() { // Get a stable hash by considering the symbol chars rather than // the symbol index. diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs index 839891f322c81..5295ebfafa870 100644 --- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs +++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs @@ -341,7 +341,7 @@ where // been fully instantiated and hence the set of scopes we have // doesn't matter -- just to be sure, put an empty vector // in there. - let old_a_scopes = ::std::mem::take(pair.vid_scopes(self)); + let old_a_scopes = std::mem::take(pair.vid_scopes(self)); // Relate the generalized kind to the original one. let result = pair.relate_generalized_ty(self, generalized_ty); @@ -680,7 +680,7 @@ where // itself occurs. Note that `'b` and `'c` must both // include P. At the point, the call works because of // subtyping (i.e., `&'b u32 <: &{P} u32`). - let variance = ::std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant); + let variance = std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant); self.relate(a.skip_binder(), b.skip_binder())?; @@ -709,7 +709,7 @@ where // Reset ambient variance to contravariance. See the // covariant case above for an explanation. let variance = - ::std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant); + std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant); self.relate(a.skip_binder(), b.skip_binder())?; diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index 2851da89ab2db..eb1a7806256c3 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -110,7 +110,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { /// Trait queries just want to pass back type obligations "as is" pub fn take_registered_region_obligations(&self) -> Vec<(hir::HirId, RegionObligation<'tcx>)> { - ::std::mem::take(&mut self.inner.borrow_mut().region_obligations) + std::mem::take(&mut self.inner.borrow_mut().region_obligations) } /// Process the region obligations that must be proven (during diff --git a/compiler/rustc_middle/src/ich/impls_syntax.rs b/compiler/rustc_middle/src/ich/impls_syntax.rs index e3d4655831b32..7aba4fc64a929 100644 --- a/compiler/rustc_middle/src/ich/impls_syntax.rs +++ b/compiler/rustc_middle/src/ich/impls_syntax.rs @@ -5,7 +5,7 @@ use crate::ich::StableHashingContext; use rustc_ast as ast; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_span::SourceFile; +use rustc_span::{BytePos, NormalizedPos, SourceFile}; use smallvec::SmallVec; @@ -102,22 +102,19 @@ impl<'a> HashStable> for SourceFile { } } -fn stable_byte_pos(pos: ::rustc_span::BytePos, source_file_start: ::rustc_span::BytePos) -> u32 { +fn stable_byte_pos(pos: BytePos, source_file_start: BytePos) -> u32 { pos.0 - source_file_start.0 } -fn stable_multibyte_char( - mbc: ::rustc_span::MultiByteChar, - source_file_start: ::rustc_span::BytePos, -) -> (u32, u32) { - let ::rustc_span::MultiByteChar { pos, bytes } = mbc; +fn stable_multibyte_char(mbc: rustc_span::MultiByteChar, source_file_start: BytePos) -> (u32, u32) { + let rustc_span::MultiByteChar { pos, bytes } = mbc; (pos.0 - source_file_start.0, bytes as u32) } fn stable_non_narrow_char( - swc: ::rustc_span::NonNarrowChar, - source_file_start: ::rustc_span::BytePos, + swc: rustc_span::NonNarrowChar, + source_file_start: BytePos, ) -> (u32, u32) { let pos = swc.pos(); let width = swc.width(); @@ -125,11 +122,8 @@ fn stable_non_narrow_char( (pos.0 - source_file_start.0, width as u32) } -fn stable_normalized_pos( - np: ::rustc_span::NormalizedPos, - source_file_start: ::rustc_span::BytePos, -) -> (u32, u32) { - let ::rustc_span::NormalizedPos { pos, diff } = np; +fn stable_normalized_pos(np: NormalizedPos, source_file_start: BytePos) -> (u32, u32) { + let NormalizedPos { pos, diff } = np; (pos.0 - source_file_start.0, diff) } diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index ee1ea816e0192..5ebe38b2d7e09 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -40,7 +40,7 @@ pub struct Allocation { pub extra: Extra, } -pub trait AllocationExtra: ::std::fmt::Debug + Clone { +pub trait AllocationExtra: std::fmt::Debug + Clone { // There is no constructor in here because the constructor's type depends // on `MemoryKind`, and making things sufficiently generic leads to painful // inference failure. diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs index 3751249853fda..893ab79f4f5cf 100644 --- a/compiler/rustc_middle/src/mir/interpret/value.rs +++ b/compiler/rustc_middle/src/mir/interpret/value.rs @@ -58,7 +58,7 @@ impl<'tcx> ConstValue<'tcx> { pub fn try_to_str_slice(&self) -> Option<&'tcx str> { if let ConstValue::Slice { data, start, end } = *self { - ::std::str::from_utf8(data.inspect_with_uninit_and_ptr_outside_interpreter(start..end)) + std::str::from_utf8(data.inspect_with_uninit_and_ptr_outside_interpreter(start..end)) .ok() } else { None @@ -465,7 +465,7 @@ impl<'tcx, Tag> Scalar { pub fn to_char(self) -> InterpResult<'tcx, char> { let val = self.to_u32()?; - match ::std::char::from_u32(val) { + match std::char::from_u32(val) { Some(c) => Ok(c), None => throw_ub!(InvalidChar(val)), } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 92a2baa30ee8c..ef0639bcd7918 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -775,7 +775,7 @@ mod binding_form_impl { impl<'a, 'tcx> HashStable> for super::BindingForm<'tcx> { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { use super::BindingForm::*; - ::std::mem::discriminant(self).hash_stable(hcx, hasher); + std::mem::discriminant(self).hash_stable(hcx, hasher); match self { Var(binding) => binding.hash_stable(hcx, hasher), diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index f6f71d002a88a..fd24de1529d37 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -1894,7 +1894,7 @@ impl<'tcx, T: HasTyCtxt<'tcx>> HasTyCtxt<'tcx> for LayoutCx<'tcx, T> { } } -pub type TyAndLayout<'tcx> = ::rustc_target::abi::TyAndLayout<'tcx, Ty<'tcx>>; +pub type TyAndLayout<'tcx> = rustc_target::abi::TyAndLayout<'tcx, Ty<'tcx>>; impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx>> { type Ty = Ty<'tcx>; diff --git a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs index 48a62b6460467..a594a8ad51240 100644 --- a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs +++ b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs @@ -23,7 +23,7 @@ impl<'tcx> TyCtxt<'tcx> { { debug!( "normalize_erasing_regions::<{}>(value={:?}, param_env={:?})", - ::std::any::type_name::(), + std::any::type_name::(), value, param_env, ); diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index e1f02d0f70418..68c36642c88bc 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1142,7 +1142,7 @@ pub trait PrettyPrinter<'tcx>: // relocations (we have an active `str` reference here). We don't use this // result to affect interpreter execution. let slice = data.inspect_with_uninit_and_ptr_outside_interpreter(start..end); - let s = ::std::str::from_utf8(slice).expect("non utf8 str from miri"); + let s = std::str::from_utf8(slice).expect("non utf8 str from miri"); p!(write("{:?}", s)); Ok(self) } diff --git a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs index b0c48a860ebaf..6cfa6dbeccd96 100644 --- a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs @@ -543,7 +543,7 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> { // tag matches and the correct amount of bytes was read. fn decode_tagged(decoder: &mut D, expected_tag: T) -> Result where - T: Decodable + Eq + ::std::fmt::Debug, + T: Decodable + Eq + std::fmt::Debug, V: Decodable, D: DecoderWithPosition, { @@ -1023,7 +1023,7 @@ where let _timer = tcx .sess .prof - .extra_verbose_generic_activity("encode_query_results_for", ::std::any::type_name::()); + .extra_verbose_generic_activity("encode_query_results_for", std::any::type_name::()); let state = Q::query_state(tcx); assert!(state.all_inactive()); diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index d8ea2f67393b2..49e3304906206 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -646,8 +646,8 @@ impl<'tcx> ty::TyS<'tcx> { } ty::Char => Some(std::char::MAX as u128), ty::Float(fty) => Some(match fty { - ast::FloatTy::F32 => ::rustc_apfloat::ieee::Single::INFINITY.to_bits(), - ast::FloatTy::F64 => ::rustc_apfloat::ieee::Double::INFINITY.to_bits(), + ast::FloatTy::F32 => rustc_apfloat::ieee::Single::INFINITY.to_bits(), + ast::FloatTy::F64 => rustc_apfloat::ieee::Double::INFINITY.to_bits(), }), _ => None, }; diff --git a/compiler/rustc_mir/src/interpret/machine.rs b/compiler/rustc_mir/src/interpret/machine.rs index 3718da1723b16..66dbacb2f9d4d 100644 --- a/compiler/rustc_mir/src/interpret/machine.rs +++ b/compiler/rustc_mir/src/interpret/machine.rs @@ -3,6 +3,7 @@ //! interpreting common C functions leak into CTFE. use std::borrow::{Borrow, Cow}; +use std::fmt::Debug; use std::hash::Hash; use rustc_middle::mir; @@ -79,19 +80,19 @@ pub trait AllocMap { /// and some use case dependent behaviour can instead be applied. pub trait Machine<'mir, 'tcx>: Sized { /// Additional memory kinds a machine wishes to distinguish from the builtin ones - type MemoryKind: ::std::fmt::Debug + ::std::fmt::Display + MayLeak + Eq + 'static; + type MemoryKind: Debug + std::fmt::Display + MayLeak + Eq + 'static; /// Tag tracked alongside every pointer. This is used to implement "Stacked Borrows" /// . /// The `default()` is used for pointers to consts, statics, vtables and functions. /// The `Debug` formatting is used for displaying pointers; we cannot use `Display` /// as `()` does not implement that, but it should be "nice" output. - type PointerTag: ::std::fmt::Debug + Copy + Eq + Hash + 'static; + type PointerTag: Debug + Copy + Eq + Hash + 'static; /// Machines can define extra (non-instance) things that represent values of function pointers. /// For example, Miri uses this to return a function pointer from `dlsym` /// that can later be called to execute the right thing. - type ExtraFnVal: ::std::fmt::Debug + Copy; + type ExtraFnVal: Debug + Copy; /// Extra data stored in every call frame. type FrameExtra; diff --git a/compiler/rustc_mir/src/interpret/operand.rs b/compiler/rustc_mir/src/interpret/operand.rs index 735f890a33bdc..d8f27ec95458b 100644 --- a/compiler/rustc_mir/src/interpret/operand.rs +++ b/compiler/rustc_mir/src/interpret/operand.rs @@ -133,7 +133,7 @@ impl std::fmt::Display for ImmTy<'tcx, Tag> { } } -impl<'tcx, Tag> ::std::ops::Deref for ImmTy<'tcx, Tag> { +impl<'tcx, Tag> std::ops::Deref for ImmTy<'tcx, Tag> { type Target = Immediate; #[inline(always)] fn deref(&self) -> &Immediate { @@ -156,7 +156,7 @@ pub struct OpTy<'tcx, Tag = ()> { pub layout: TyAndLayout<'tcx>, } -impl<'tcx, Tag> ::std::ops::Deref for OpTy<'tcx, Tag> { +impl<'tcx, Tag> std::ops::Deref for OpTy<'tcx, Tag> { type Target = Operand; #[inline(always)] fn deref(&self) -> &Operand { @@ -340,7 +340,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { pub fn read_str(&self, mplace: MPlaceTy<'tcx, M::PointerTag>) -> InterpResult<'tcx, &str> { let len = mplace.len(self)?; let bytes = self.memory.read_bytes(mplace.ptr, Size::from_bytes(len))?; - let str = ::std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?; + let str = std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?; Ok(str) } diff --git a/compiler/rustc_mir/src/interpret/place.rs b/compiler/rustc_mir/src/interpret/place.rs index 72551b23370dd..fe25f8ce962f0 100644 --- a/compiler/rustc_mir/src/interpret/place.rs +++ b/compiler/rustc_mir/src/interpret/place.rs @@ -3,6 +3,7 @@ //! All high-level functions to write to memory work on places as destinations. use std::convert::TryFrom; +use std::fmt::Debug; use std::hash::Hash; use rustc_macros::HashStable; @@ -86,7 +87,7 @@ pub struct PlaceTy<'tcx, Tag = ()> { pub layout: TyAndLayout<'tcx>, } -impl<'tcx, Tag> ::std::ops::Deref for PlaceTy<'tcx, Tag> { +impl<'tcx, Tag> std::ops::Deref for PlaceTy<'tcx, Tag> { type Target = Place; #[inline(always)] fn deref(&self) -> &Place { @@ -101,7 +102,7 @@ pub struct MPlaceTy<'tcx, Tag = ()> { pub layout: TyAndLayout<'tcx>, } -impl<'tcx, Tag> ::std::ops::Deref for MPlaceTy<'tcx, Tag> { +impl<'tcx, Tag> std::ops::Deref for MPlaceTy<'tcx, Tag> { type Target = MemPlace; #[inline(always)] fn deref(&self) -> &MemPlace { @@ -226,7 +227,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> { } // These are defined here because they produce a place. -impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> { +impl<'tcx, Tag: Debug + Copy> OpTy<'tcx, Tag> { #[inline(always)] /// Note: do not call `as_ref` on the resulting place. This function should only be used to /// read from the resulting mplace, not to get its address back. @@ -251,7 +252,7 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> { } } -impl Place { +impl Place { #[inline] pub fn assert_mem_place(self) -> MemPlace { match self { @@ -261,7 +262,7 @@ impl Place { } } -impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { +impl<'tcx, Tag: Debug> PlaceTy<'tcx, Tag> { #[inline] pub fn assert_mem_place(self) -> MPlaceTy<'tcx, Tag> { MPlaceTy { mplace: self.place.assert_mem_place(), layout: self.layout } @@ -272,7 +273,7 @@ impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { impl<'mir, 'tcx: 'mir, Tag, M> InterpCx<'mir, 'tcx, M> where // FIXME: Working around https://github.com/rust-lang/rust/issues/54385 - Tag: ::std::fmt::Debug + Copy + Eq + Hash + 'static, + Tag: Debug + Copy + Eq + Hash + 'static, M: Machine<'mir, 'tcx, PointerTag = Tag>, // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs index 4bafcb2535f0c..ffb84950fc92c 100644 --- a/compiler/rustc_mir/src/transform/mod.rs +++ b/compiler/rustc_mir/src/transform/mod.rs @@ -137,7 +137,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> FxHashSet { /// Generates a default name for the pass based on the name of the /// type `T`. pub fn default_name() -> Cow<'static, str> { - let name = ::std::any::type_name::(); + let name = std::any::type_name::(); if let Some(tail) = name.rfind(':') { Cow::from(&name[tail + 1..]) } else { Cow::from(name) } } diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 047bf7db4c867..25a8565fb43b3 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -96,14 +96,14 @@ impl PatCtxt<'_, '_> { } PatternError::FloatBug => { // FIXME(#31407) this is only necessary because float parsing is buggy - ::rustc_middle::mir::interpret::struct_error( + rustc_middle::mir::interpret::struct_error( self.tcx.at(pat_span), "could not evaluate float literal (see issue #31407)", ) .emit(); } PatternError::NonConstPath(span) => { - ::rustc_middle::mir::interpret::struct_error( + rustc_middle::mir::interpret::struct_error( self.tcx.at(span), "runtime values cannot be referenced in patterns", ) diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 718ed78889f09..d46e9a98825a7 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -1060,13 +1060,13 @@ crate fn compare_const_vals<'tcx>( use rustc_apfloat::Float; return match *ty.kind() { ty::Float(ast::FloatTy::F32) => { - let l = ::rustc_apfloat::ieee::Single::from_bits(a); - let r = ::rustc_apfloat::ieee::Single::from_bits(b); + let l = rustc_apfloat::ieee::Single::from_bits(a); + let r = rustc_apfloat::ieee::Single::from_bits(b); l.partial_cmp(&r) } ty::Float(ast::FloatTy::F64) => { - let l = ::rustc_apfloat::ieee::Double::from_bits(a); - let r = ::rustc_apfloat::ieee::Double::from_bits(b); + let l = rustc_apfloat::ieee::Double::from_bits(a); + let r = rustc_apfloat::ieee::Double::from_bits(b); l.partial_cmp(&r) } ty::Int(ity) => { diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index fa4423e261d1c..8b79c93e7605b 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -107,7 +107,7 @@ impl serialize::Encoder for Encoder { #[inline] fn emit_i8(&mut self, v: i8) -> EncodeResult { - let as_u8: u8 = unsafe { ::std::mem::transmute(v) }; + let as_u8: u8 = unsafe { std::mem::transmute(v) }; self.emit_u8(as_u8) } @@ -300,13 +300,13 @@ impl<'a> serialize::Decoder for Decoder<'a> { #[inline] fn read_char(&mut self) -> Result { let bits = self.read_u32()?; - Ok(::std::char::from_u32(bits).unwrap()) + Ok(std::char::from_u32(bits).unwrap()) } #[inline] fn read_str(&mut self) -> Result, Self::Error> { let len = self.read_usize()?; - let s = ::std::str::from_utf8(&self.data[self.position..self.position + len]).unwrap(); + let s = std::str::from_utf8(&self.data[self.position..self.position + len]).unwrap(); self.position += len; Ok(Cow::Borrowed(s)) } diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index da9c93143bfb3..183a11a527723 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -132,7 +132,7 @@ impl SymbolMangler<'tcx> { self.push("u"); // FIXME(eddyb) we should probably roll our own punycode implementation. - let mut punycode_bytes = match ::punycode::encode(ident) { + let mut punycode_bytes = match punycode::encode(ident) { Ok(s) => s.into_bytes(), Err(()) => bug!("symbol_names: punycode encoding failed for ident {:?}", ident), }; diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 967374ffdc2c0..0584c56c9cb66 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -22,6 +22,7 @@ use rustc_middle::ty::{ use rustc_middle::ty::{TypeAndMut, TypeckResults}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; +use rustc_target::spec::abi; use std::fmt; use super::InferCtxtPrivExt; @@ -1157,15 +1158,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { tcx.mk_ty_infer(ty::TyVar(ty::TyVid { index: 0 })), false, hir::Unsafety::Normal, - ::rustc_target::spec::abi::Abi::Rust, + abi::Abi::Rust, ) } else { tcx.mk_fn_sig( - ::std::iter::once(inputs), + std::iter::once(inputs), tcx.mk_ty_infer(ty::TyVar(ty::TyVid { index: 0 })), false, hir::Unsafety::Normal, - ::rustc_target::spec::abi::Abi::Rust, + abi::Abi::Rust, ) }; ty::Binder::bind(sig).to_string() diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index bdbf45f78a23b..d748fc8235e7f 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -44,7 +44,7 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> { { debug!( "normalize::<{}>(value={:?}, param_env={:?})", - ::std::any::type_name::(), + std::any::type_name::(), value, self.param_env, ); @@ -65,13 +65,13 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> { let result = value.fold_with(&mut normalizer); debug!( "normalize::<{}>: result={:?} with {} obligations", - ::std::any::type_name::(), + std::any::type_name::(), result, normalizer.obligations.len(), ); debug!( "normalize::<{}>: obligations={:?}", - ::std::any::type_name::(), + std::any::type_name::(), normalizer.obligations, ); if normalizer.error { diff --git a/library/core/tests/num/int_macros.rs b/library/core/tests/num/int_macros.rs index 27e6760e7cbb9..fcb0d6031be62 100644 --- a/library/core/tests/num/int_macros.rs +++ b/library/core/tests/num/int_macros.rs @@ -204,8 +204,8 @@ macro_rules! int_module { #[test] fn test_from_str() { - fn from_str(t: &str) -> Option { - ::std::str::FromStr::from_str(t).ok() + fn from_str(t: &str) -> Option { + std::str::FromStr::from_str(t).ok() } assert_eq!(from_str::<$T>("0"), Some(0 as $T)); assert_eq!(from_str::<$T>("3"), Some(3 as $T)); diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 9ebc991d638cb..41e7e6adcf16d 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -182,8 +182,8 @@ impl OutputFormatter for JsonFormatter { /// Base code taken form `libserialize::json::escape_str` struct EscapedString>(S); -impl> ::std::fmt::Display for EscapedString { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { +impl> std::fmt::Display for EscapedString { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { let mut start = 0; for (i, byte) in self.0.as_ref().bytes().enumerate() { From b26aa5d97353bed9ace56d8f247c88b2f9d4f8fd Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Tue, 13 Oct 2020 15:29:38 +0200 Subject: [PATCH 17/18] Add note about using cells in the locks on the 'unsupported' platform. --- library/std/src/sys/unsupported/mutex.rs | 1 + library/std/src/sys/unsupported/rwlock.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/library/std/src/sys/unsupported/mutex.rs b/library/std/src/sys/unsupported/mutex.rs index 3b97d0875bdc1..7830faae601a0 100644 --- a/library/std/src/sys/unsupported/mutex.rs +++ b/library/std/src/sys/unsupported/mutex.rs @@ -1,6 +1,7 @@ use crate::cell::Cell; pub struct Mutex { + // This platform has no threads, so we can use a Cell here. locked: Cell, } diff --git a/library/std/src/sys/unsupported/rwlock.rs b/library/std/src/sys/unsupported/rwlock.rs index 9aaba8bff1167..6982b2b155fa5 100644 --- a/library/std/src/sys/unsupported/rwlock.rs +++ b/library/std/src/sys/unsupported/rwlock.rs @@ -1,6 +1,7 @@ use crate::cell::Cell; pub struct RWLock { + // This platform has no threads, so we can use a Cell here. mode: Cell, } From b7080e6fd4655d3c9b0c325be84f1b714c99c608 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 9 Oct 2020 23:15:16 -0400 Subject: [PATCH 18/18] Give an error when running `x.py test --stage 0 src/test/ui` --- src/bootstrap/test.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 00522ee6b673c..bda9e0f57841c 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -966,6 +966,15 @@ impl Step for Compiletest { /// compiletest `mode` and `suite` arguments. For example `mode` can be /// "run-pass" or `suite` can be something like `debuginfo`. fn run(self, builder: &Builder<'_>) { + if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() { + eprintln!("\ +error: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail +help: use `--stage 1` instead +note: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`." + ); + std::process::exit(1); + } + let compiler = self.compiler; let target = self.target; let mode = self.mode;