diff options
| author | bors <bors@rust-lang.org> | 2020-10-13 22:13:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-13 22:13:09 +0000 |
| commit | f243a2ad904705a1e340a08639dca105605b4175 (patch) | |
| tree | bf7ed498ee090350df2cc33ed6f5805cb8175287 | |
| parent | adef9da30f1ecbfeb81312d01ed94ac53f7161ba (diff) | |
| parent | b4a3b5617fb8b504bf216057adc36043c60f511e (diff) | |
| download | rust-f243a2ad904705a1e340a08639dca105605b4175.tar.gz rust-f243a2ad904705a1e340a08639dca105605b4175.zip | |
Auto merge of #77917 - JohnTitor:rollup-e47h2qt, r=JohnTitor
Rollup of 14 pull requests Successful merges: - #77239 (Enable building Cargo for aarch64-apple-darwin) - #77569 (BTreeMap: type-specific variants of node_as_mut and cast_unchecked) - #77719 (Remove unnecessary rustc_const_stable attributes.) - #77722 (Remove unsafety from sys/unsupported and add deny(unsafe_op_in_unsafe_fn).) - #77725 (Add regression issue template) - #77776 ( Give an error when running `x.py test --stage 0 src/test/ui`) - #77786 (Mention rustdoc in `x.py setup`) - #77825 (`min_const_generics` diagnostics improvements) - #77868 (Include `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component) - #77884 (Use Option::unwrap_or instead of open-coding it) - #77886 (Replace trivial bool matches with the `matches!` macro) - #77892 (Replace absolute paths with relative ones) - #77895 (Include aarch64-apple-darwin in the dist manifests) - #77909 (bootstrap: set correct path for the build-manifest binary) Failed merges: - #77902 (Include aarch64-pc-windows-msvc in the dist manifests) r? `@ghost`
107 files changed, 426 insertions, 359 deletions
diff --git a/.github/ISSUE_TEMPLATE/regression.md b/.github/ISSUE_TEMPLATE/regression.md new file mode 100644 index 00000000000..ffab883987c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/regression.md @@ -0,0 +1,68 @@ +--- +name: Regression +about: Report something that unexpectedly changed between Rust versions. +labels: C-bug regression-untriaged +--- +<!-- +Thank you for filing a regression report! 🐛 A regression is something that changed between versions of Rust but was not supposed to. + +Please provide a short summary of the regression, along with any information you feel is relevant to replicate it. +--> + +### Code + +I tried this code: + +```rust +<code> +``` + +I expected to see this happen: *explanation* + +Instead, this happened: *explanation* + +### Version it worked on + +<!-- +Provide the most recent version this worked on, for example: + +It most recently worked on: Rust 1.47 +--> + +It most recently worked on: <!-- version --> + +### Version with regression + +<!-- +Provide the version you are using that has the regression. +--> + +`rustc --version --verbose`: +``` +<version> +``` + +<!-- +Did the compiler crash? If so, please provide a backtrace. +--> + +### Backtrace +<!-- +Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your +environment. E.g. `RUST_BACKTRACE=1 cargo build`. +--> +<details><summary>Backtrace</summary> +<p> + +``` +<backtrace> +``` + +</p> +</details> + +<!-- +If you know when this regression occurred, please add a line like below, replacing `{channel}` with one of stable, beta, or nightly. + +@rustbot modify labels: +regression-from-stable-to-{channel} -regression-untriaged +--> diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4659c3ddec..828a3bc71b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -306,7 +306,7 @@ jobs: - name: dist-aarch64-apple env: SCRIPT: "./x.py dist --stage 2" - RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --tools=rls,clippy,rustfmt,analysis,src" + RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false" RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 SELECT_XCODE: /Applications/Xcode_12_beta.app USE_XCODE_CLANG: 1 @@ -314,6 +314,8 @@ jobs: MACOSX_STD_DEPLOYMENT_TARGET: 11.0 NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 + DIST_REQUIRE_ALL_TOOLS: 1 + JEMALLOC_SYS_WITH_LG_PAGE: 14 os: macos-latest - name: x86_64-msvc-1 env: diff --git a/Cargo.lock b/Cargo.lock index 83ac8396a16..9c48ff86769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2192,9 +2192,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-src" -version = "111.10.2+1.1.1g" +version = "111.12.0+1.1.1h" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a287fdb22e32b5b60624d4a5a7a02dbe82777f730ec0dbc42a0554326fef5a70" +checksum = "858a4132194f8570a7ee9eb8629e85b23cbc4565f2d4a162e87556e5956abf61" dependencies = [ "cc", ] diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs index ca7f127ced6..95f969d7691 100644 --- a/compiler/rustc_ast_pretty/src/pp.rs +++ b/compiler/rustc_ast_pretty/src/pp.rs @@ -170,17 +170,11 @@ pub enum Token { impl Token { crate fn is_eof(&self) -> bool { - match *self { - Token::Eof => true, - _ => false, - } + matches!(self, Token::Eof) } pub fn is_hardbreak_tok(&self) -> bool { - match *self { - Token::Break(BreakToken { offset: 0, blank_space: bs }) if bs == SIZE_INFINITY => true, - _ => false, - } + matches!(self, Token::Break(BreakToken { offset: 0, blank_space: SIZE_INFINITY })) } } @@ -491,12 +485,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) { diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index a4605f46309..88d73f2a864 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 0edf0fcd1a2..69a94d8f795 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<B: ExtraBackendMethods>( // 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<usize>| { diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 8e6f8e193c0..7f918bd168e 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<B: ExtraBackendMethods>( 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<B: ExtraBackendMethods> Drop for AbortCodegenOnDrop<B> { } 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 "<unknown>" 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 698ef6083e6..82518b7f0c3 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<Target = <Self as HasCodegen<'tcx>>::CodegenCx> + Backend<'tcx> + std::ops::Deref<Target = <Self as HasCodegen<'tcx>>::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 aba0bbbac80..ec2f9597b18 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 7cf5202d919..c0193e9fa0c 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<O, E> { struct ObligationTreeId(usize); type ObligationTreeIdGenerator = - ::std::iter::Map<::std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>; + std::iter::Map<std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>; pub struct ObligationForest<O: ForestObligation> { /// 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 4807380595d..9a28f8f4e21 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -93,7 +93,7 @@ impl<K: Ord, V> SortedMap<K, V> { /// 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<K: Ord, V> SortedMap<K, V> { R: RangeBounds<K>, { 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<K: Ord, V> SortedMap<K, V> { impl<K: Ord, V> IntoIterator for SortedMap<K, V> { 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 68875b3fbde..579eb1cb7da 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 afefde07f92..8f76551677c 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 839891f322c..5295ebfafa8 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 2851da89ab2..eb1a7806256 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 e3d4655831b..7aba4fc64a9 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<StableHashingContext<'a>> 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 ee1ea816e01..5ebe38b2d7e 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<Tag = (), Extra = ()> { pub extra: Extra, } -pub trait AllocationExtra<Tag>: ::std::fmt::Debug + Clone { +pub trait AllocationExtra<Tag>: 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 3751249853f..893ab79f4f5 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<Tag> { 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 92a2baa30ee..ef0639bcd79 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<StableHashingContext<'a>> 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 f6f71d002a8..fd24de1529d 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 48a62b64604..a594a8ad512 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::<T>(), + std::any::type_name::<T>(), value, param_env, ); diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index e1f02d0f704..68c36642c88 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 b0c48a860eb..6cfa6dbeccd 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<D, T, V>(decoder: &mut D, expected_tag: T) -> Result<V, D::Error> where - T: Decodable<D> + Eq + ::std::fmt::Debug, + T: Decodable<D> + Eq + std::fmt::Debug, V: Decodable<D>, D: DecoderWithPosition, { @@ -1023,7 +1023,7 @@ where let _timer = tcx .sess .prof - .extra_verbose_generic_activity("encode_query_results_for", ::std::any::type_name::<Q>()); + .extra_verbose_generic_activity("encode_query_results_for", std::any::type_name::<Q>()); 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 5ac12dfa993..8734acad9b2 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 3718da1723b..66dbacb2f9d 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<K: Hash + Eq, V> { /// 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" /// <https://www.ralfj.de/blog/2018/08/07/stacked-borrows.html>. /// 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 735f890a33b..d8f27ec9545 100644 --- a/compiler/rustc_mir/src/interpret/operand.rs +++ b/compiler/rustc_mir/src/interpret/operand.rs @@ -133,7 +133,7 @@ impl<Tag: Copy> 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<Tag>; #[inline(always)] fn deref(&self) -> &Immediate<Tag> { @@ -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<Tag>; #[inline(always)] fn deref(&self) -> &Operand<Tag> { @@ -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 72551b23370..fe25f8ce962 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<Tag>; #[inline(always)] fn deref(&self) -> &Place<Tag> { @@ -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<Tag>; #[inline(always)] fn deref(&self) -> &MemPlace<Tag> { @@ -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<Tag: ::std::fmt::Debug> Place<Tag> { +impl<Tag: Debug> Place<Tag> { #[inline] pub fn assert_mem_place(self) -> MemPlace<Tag> { match self { @@ -261,7 +262,7 @@ impl<Tag: ::std::fmt::Debug> Place<Tag> { } } -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<AllocId, (MemoryKind<M::MemoryKind>, Allocation<Tag, M::AllocExtra>)>, diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs index 4bafcb2535f..ffb84950fc9 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<LocalDefId> { /// Generates a default name for the pass based on the name of the /// type `T`. pub fn default_name<T: ?Sized>() -> Cow<'static, str> { - let name = ::std::any::type_name::<T>(); + let name = std::any::type_name::<T>(); 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 047bf7db4c8..25a8565fb43 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 718ed78889f..d46e9a98825 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_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index e3cf6d12bd5..774a147c114 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 may not be used in const operations", ); + 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 const expressions"); } 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, i.e. `{}`", + name + )); } err diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index fe8f5926385..6677a5ffe28 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/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index fa4423e261d..8b79c93e760 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<char, Self::Error> { 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<Cow<'_, str>, 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 da9c93143bf..183a11a5277 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 967374ffdc2..0584c56c9cb 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 bdbf45f78a2..d748fc8235e 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::<T>(), + std::any::type_name::<T>(), 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::<T>(), + std::any::type_name::<T>(), result, normalizer.obligations.len(), ); debug!( "normalize::<{}>: obligations={:?}", - ::std::any::type_name::<T>(), + std::any::type_name::<T>(), normalizer.obligations, ); if normalizer.error { diff --git a/library/alloc/src/collections/btree/node.rs b/library/alloc/src/collections/btree/node.rs index 880627e94c3..4fa97ff053e 100644 --- a/library/alloc/src/collections/btree/node.rs +++ b/library/alloc/src/collections/btree/node.rs @@ -170,6 +170,22 @@ impl<K, V> Root<K, V> { 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<marker::Mut<'_>, 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<marker::Mut<'_>, 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<marker::ValMut<'_>, K, V, marker::LeafOrInternal> { NodeRef { height: self.height, node: self.node.as_ptr(), _marker: PhantomData } } @@ -188,14 +204,11 @@ impl<K, V> Root<K, V> { 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<K, V> Root<K, V> { let top = self.node.ptr; - self.node = unsafe { - BoxedNode::from_ptr( - self.node_as_mut().cast_unchecked::<marker::Internal>().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<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> { } impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, 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<NewType>(self) -> NodeRef<marker::Mut<'a>, 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<marker::Mut<'a>, 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<NodeRef<marker::Mut<'a>, 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::<marker::Leaf>(), - 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<NodeRef<marker::Mut<'a>, 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::<marker::Internal>(), - 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<NodeRef<marker::Mut<'a>, 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<NodeRef<marker::Mut<'a>, 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::<marker::Internal>(); - let right_node = right_node.cast_unchecked::<marker::Internal>(); + 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), diff --git a/library/core/tests/num/int_macros.rs b/library/core/tests/num/int_macros.rs index 27e6760e7cb..fcb0d6031be 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: ::std::str::FromStr>(t: &str) -> Option<T> { - ::std::str::FromStr::from_str(t).ok() + fn from_str<T: std::str::FromStr>(t: &str) -> Option<T> { + 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/std/src/sys/unsupported/common.rs b/library/std/src/sys/unsupported/common.rs index 80311d26819..2cdd9c4d19e 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 8ba870c5dbc..d9efdec33d9 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 06ea9a1e2c1..b3203c16c50 100644 --- a/library/std/src/sys/unsupported/mutex.rs +++ b/library/std/src/sys/unsupported/mutex.rs @@ -1,7 +1,8 @@ -use crate::cell::UnsafeCell; +use crate::cell::Cell; pub struct Mutex { - locked: UnsafeCell<bool>, + // This platform has no threads, so we can use a Cell here. + locked: Cell<bool>, } pub type MovableMutex = Mutex; @@ -10,9 +11,8 @@ 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) } + Mutex { locked: Cell::new(false) } } #[inline] @@ -20,25 +20,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] diff --git a/library/std/src/sys/unsupported/rwlock.rs b/library/std/src/sys/unsupported/rwlock.rs index d37f34ac935..6982b2b155f 100644 --- a/library/std/src/sys/unsupported/rwlock.rs +++ b/library/std/src/sys/unsupported/rwlock.rs @@ -1,7 +1,8 @@ -use crate::cell::UnsafeCell; +use crate::cell::Cell; pub struct RWLock { - mode: UnsafeCell<isize>, + // This platform has no threads, so we can use a Cell here. + mode: Cell<isize>, } unsafe impl Send for RWLock {} @@ -9,14 +10,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 +25,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 +36,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 +53,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; + assert_eq!(self.mode.replace(0), -1); } #[inline] diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs index a7a4407ac38..a0a37ef8316 100644 --- a/library/std/src/sys/wasi/mod.rs +++ b/library/std/src/sys/wasi/mod.rs @@ -53,6 +53,7 @@ pub mod thread_local_key; pub mod time; #[path = "../unsupported/common.rs"] +#[deny(unsafe_op_in_unsafe_fn)] #[allow(unused)] mod common; pub use common::*; diff --git a/library/std/src/sys/wasm/mod.rs b/library/std/src/sys/wasm/mod.rs index 2934ea59ab5..18295e1129a 100644 --- a/library/std/src/sys/wasm/mod.rs +++ b/library/std/src/sys/wasm/mod.rs @@ -66,5 +66,6 @@ cfg_if::cfg_if! { } #[path = "../unsupported/common.rs"] +#[deny(unsafe_op_in_unsafe_fn)] mod common; pub use common::*; diff --git a/library/std/src/sys_common/mutex.rs b/library/std/src/sys_common/mutex.rs index a1e11d24465..91d919a3f9b 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()) } diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 9ebc991d638..41e7e6adcf1 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -182,8 +182,8 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> { /// Base code taken form `libserialize::json::escape_str` struct EscapedString<S: AsRef<str>>(S); -impl<S: AsRef<str>> ::std::fmt::Display for EscapedString<S> { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { +impl<S: AsRef<str>> std::fmt::Display for EscapedString<S> { + 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() { diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index dd4cf9d5953..1887b805da1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2617,7 +2617,7 @@ impl Step for BuildManifest { let image_bin = image.join("bin"); let _ = fs::remove_dir_all(&image); t!(fs::create_dir_all(&image_bin)); - builder.install(&build_manifest, &image_bin.join("build-manifest"), 0o755); + builder.install(&build_manifest, &image_bin, 0o755); // Prepare the overlay. let overlay = tmp.join("build-manifest-overlay"); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 493bfff9181..22a8e828862 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 ]; pub const VERSION: usize = 2; diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index 512224156d8..2a9507cfc4c 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<Self, Self::Err> { 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)), @@ -108,7 +108,7 @@ pub fn interactive_path() -> io::Result<Profile> { 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" ); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 00522ee6b67..bda9e0f5784 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; diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 7346330bfb7..090b06f2a0a 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -469,11 +469,11 @@ jobs: --build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin + --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false - --tools=rls,clippy,rustfmt,analysis,src RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 SELECT_XCODE: /Applications/Xcode_12_beta.app USE_XCODE_CLANG: 1 @@ -481,12 +481,15 @@ jobs: MACOSX_STD_DEPLOYMENT_TARGET: 11.0 NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 - # TODO: Cargo is disabled until OpenSSL 1.1.1 can be - # compiled for aarch64-apple-darwin:: - # https://github.com/openssl/openssl/pull/12369. Once - # fixed, remove `--tools`, add back - # `--enable-full-tools`, and enable this again - # DIST_REQUIRE_ALL_TOOLS: 1 + DIST_REQUIRE_ALL_TOOLS: 1 + # Corresponds to 16K page size + # + # Shouldn't be needed if jemalloc-sys is updated to + # handle this platform like iOS or if we build on + # aarch64-apple-darwin itself. + # + # https://github.com/gnzlbg/jemallocator/blob/c27a859e98e3cb790dc269773d9da71a1e918458/jemalloc-sys/build.rs#L237 + JEMALLOC_SYS_WITH_LG_PAGE: 14 <<: *job-macos-xl ###################### diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 2cb6bcdb966..ae55297b78c 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -57,7 +57,7 @@ Specifically, these platforms are required to have each of the following: target | std | host | notes -------|-----|------|------- -`aarch64-apple-darwin` | ✓ | | ARM64 macOS (11.0+, Big Sur+) +`aarch64-apple-darwin` | ✓ | ✓ | ARM64 macOS (11.0+, Big Sur+) `aarch64-apple-ios` | ✓ | | ARM64 iOS `aarch64-fuchsia` | ✓ | | ARM64 Fuchsia `aarch64-linux-android` | ✓ | | ARM64 Android 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 0fc45513cd7..cfaacf7a5be 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 may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:9:48 | LL | struct ArithArrayLen<const N: usize>([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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +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], - | ^^^ 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, 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 dd45b6ed278..768180d0813 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<const N: usize>([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 may not be used in const operations #[derive(PartialEq, Eq)] struct Config { @@ -19,7 +19,7 @@ struct B<const CFG: Config> { //[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 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 c666dce479f..bce701ade86 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 may not be used in const operations --> $DIR/const-argument-if-length.rs:19:24 | LL | pad: [u8; is_zst::<T>()], - | ^ 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 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 481ff97d68d..a8bffd17b91 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<T: ?Sized> { value: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::<T>()], - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[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 4b3235fd087..359c2d2a22f 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 may not be used in const operations --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | LL | type Arr<const N: usize> = [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, 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 d552e0f5430..9746adab29b 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<const N: usize> = [u8; N - 1]; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters may not be used in const operations fn test<const N: usize>() -> Arr<N> where Arr<N>: 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 85a15b1e75f..46485262cc4 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 may not be used in const operations --> $DIR/simple.rs:8:53 | LL | fn test<const N: usize>() -> [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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:35 | LL | fn test<const N: usize>() -> [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, 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 2eac9505624..981d993f589 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 may not be used in const operations --> $DIR/simple_fail.rs:7:33 | LL | type Arr<const N: usize> = [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, 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 637c940f714..5e2c080927f 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<const N: usize> = [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 may not be used in const operations fn test<const N: usize>() -> Arr<N> where Arr<N>: 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 e7e968e4c2a..84449018e46 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 may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:9:39 | LL | fn bar<const N: usize>() -> [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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, 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 c8bbae29343..c838070dc95 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<const N: usize>() -> [u32; foo(N)] { - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[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 of non-trivial constant values + //[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 6f157fbbbbb..d3f7143327e 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 may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:53 | LL | fn foo<const A: usize, const B: usize>(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, i.e. `A` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:57 | LL | fn foo<const A: usize, const B: usize>(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, 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 810095b384b..84ddfe055dc 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<const A: usize, const B: usize>(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 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 307db088bf8..20a8d9fdaab 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 may not be used in const operations --> $DIR/intrinsics-type_name-as-const-argument.rs:15:44 | LL | T: Trait<{std::intrinsics::type_name::<T>()}> - | ^ 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 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 37b6cf4bab9..8971c00ed5a 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<const S: &'static str> {} struct Bug<T> where T: Trait<{std::intrinsics::type_name::<T>()}> - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[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 2c1bc055b28..526807f0a24 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 may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:7:45 | LL | pub struct MyArray<const COUNT: usize>([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, i.e. `COUNT` -error: generic parameters must not be used inside of non-trivial constant values +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] { - | ^^^^^ 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, 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 81443b90d61..8c0a3a03774 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<const COUNT: usize>([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<const COUNT: usize> MyArray<COUNT> { 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 b13d9fdab0d..3c344edbf1d 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 may not be used in const operations --> $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 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 994ec92cfb5..ecc76bcae06 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<T> { //~^ 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 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 949b5da5920..804236c30bd 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 may not be used in const operations --> $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 const expressions -error: generic parameters must not be used inside of non-trivial constant values +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); - | ^ 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 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 d1a83e978d1..6771603f259 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<S> { //~^ 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 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 of non-trivial constant values + //[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 ed445b3e8f7..2de942c1220 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 may not be used in const operations --> $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 const expressions -error: generic parameters must not be used inside of non-trivial constant values +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); - | ^ 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 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 7f789297df0..72dbb674e66 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<S> { //~^ 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 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 of non-trivial constant values + //[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 fdd9a569748..b176f9d1c75 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 may not be used in const operations --> $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, 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 4e5cde17f39..3a4dd1cdd18 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<const N: usize>; impl<const C: usize> 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 f461a31eeae..9e31466259f 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 may not be used in const operations --> $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, 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 a181a8dabe5..9fa02329a71 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<const N: usize> 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 may not be used in const operations {} trait FooImpl<const IS_ZERO: bool>{} 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 84975e8f3be..3bd127ee74a 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 may not be used in const operations --> $DIR/issue-62220.rs:8:59 | LL | pub type TruncatedVector<T, const N: usize> = Vector<T, { 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, 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 5694dc6d04d..2017473fa9e 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, const N: usize>([T; N]); pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters may not be used in const operations impl<T, const N: usize> Vector<T, { N }> { /// 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 f94ba8c0c9b..c73f62a4a07 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 may not be used in const operations --> $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, 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 338ec42799d..cbb2a11a931 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<const N: usize>() { 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 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 f712171bbac..8b02fd108bd 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 may not be used in const operations --> $DIR/issue-64494.rs:16:38 | LL | impl<T: Foo> 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 const expressions -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:19:38 | LL | impl<T: Foo> 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 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 b62ebf846d5..014742be03d 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<T: Foo> 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 may not be used in const operations impl<T: Foo> 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 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 a18126ccfef..282f72be6da 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 may not be used in const operations --> $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, 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 668f49852e1..4e37c247d00 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<const N: usize>() { 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 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 ba378de4156..35d97c46248 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 may not be used in const operations --> $DIR/issue-67739.rs:12:30 | LL | [0u8; mem::size_of::<Self::Associated>()]; - | ^^^^^^^^^^^^^^^^ 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 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 296e4d423c4..21d13de22eb 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::<Self::Associated>()]; //[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 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 73d6fec6f9b..b900a0d096a 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 may not be used in const operations --> $DIR/issue-68366.rs:12:37 | LL | impl <const N: usize> 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, 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 ac313eb3b2f..474cdb7258d 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<const N: Option<usize>>; impl <const N: usize> Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters must not be used inside of non-trivial constant values +//[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 59d2be3ce4b..7828d859394 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 may not be used in const operations --> $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, i.e. `INT_BITS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, 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 49b305a5a78..4fea94cb465 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<const INT_BITS: u8, const FRAC_BITS: u8> = 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 may not be used in const operations + //[min]~| ERROR generic parameters may not be used in const operations struct Fxp<const INT_BITS: u8, const FRAC_BITS: u8> 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 a4c80b1d8c0..d960d9513b7 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 may not be used in const operations --> $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, i.e. `LHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, i.e. `RHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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.e. `I` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, 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 779c1d2950e..57572e23aa4 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<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> 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 may not be used in const operations +//[min]~| Error generic parameters may not be used in const operations { } impl True for Condition<true> {} @@ -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 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 afc14c7dcff..9fec3eb946d 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 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, - | ^ 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, 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 65c7f00a72a..6182042bde7 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<const N: usize> 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 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 0db948d0a45..c10db84ea6e 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 may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:6:46 | LL | fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] { - | ^ 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 const expressions -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 | LL | fn const_param<const N: usize>() -> [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, 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 3c5bfb03f08..9051c36fe81 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<T>() -> [u8; std::mem::size_of::<T>()] { //[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 may not be used in const operations todo!() } fn const_param<const N: usize>() -> [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 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 c6380f6394d..8257ffbf491 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<const M: usize>() -> [u8; M] { } struct Break0<const N: usize>([u8; { N + 1 }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters may not be used in const operations struct Break1<const N: usize>([u8; { { N } }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters may not be used in const operations fn break2<const N: usize>() { let _: [u8; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ ERROR generic parameters may not be used in const operations } fn break3<const N: usize>() { let _ = [0; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ 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 d8897f53d7f..73768ac03a4 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 may not be used in const operations --> $DIR/complex-expression.rs:9:38 | LL | struct Break0<const N: usize>([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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:12:40 | LL | struct Break1<const N: usize>([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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, 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 7dc81bf45af..64da5e07df2 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 may not be used in const operations --> $DIR/self-ty-in-const-1.rs:4:41 | LL | fn t1() -> [u8; std::mem::size_of::<Self>()]; - | ^^^^ 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 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 0dd591d891f..39aa8087cec 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 = [u8; N], const N: usize>(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 may not be used in const operations --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(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 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 b9d74850f37..51f0cff3f21 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 = [u8; std::mem::size_of::<T>()]>(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 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 = [u8; N], const N: usize>(T); diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index 1c52d601749..935f12dd2c3 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 may not be used in const operations --> $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, i.e. `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters may not be used in const operations --> $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, 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 f8c41404c46..103c580f28f 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<const N: usize>() { 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 may not be used in const operations } struct Const<const N: usize>; @@ -16,7 +16,7 @@ struct Const<const N: usize>; pub fn func_call<const N: usize>() { 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 may not be used in const operations } fn main() {} diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index cb04900c737..f8c517a9395 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", |
