diff --git a/compiler/rustc_data_structures/src/vec_map.rs b/compiler/rustc_data_structures/src/vec_map.rs index e3fa587985df0..cc7ec9432faed 100644 --- a/compiler/rustc_data_structures/src/vec_map.rs +++ b/compiler/rustc_data_structures/src/vec_map.rs @@ -1,4 +1,5 @@ use std::borrow::Borrow; +use std::fmt::Debug; use std::iter::FromIterator; use std::slice::Iter; use std::vec::IntoIter; @@ -12,7 +13,8 @@ pub struct VecMap(Vec<(K, V)>); impl VecMap where - K: PartialEq, + K: Debug + PartialEq, + V: Debug, { pub fn new() -> Self { VecMap(Default::default()) @@ -37,14 +39,31 @@ where self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1) } - /// Returns the value corresponding to the supplied predicate filter. + /// Returns the any value corresponding to the supplied predicate filter. /// /// The supplied predicate will be applied to each (key, value) pair and it will return a /// reference to the values where the predicate returns `true`. - pub fn get_by(&self, mut predicate: impl FnMut(&(K, V)) -> bool) -> Option<&V> { + pub fn any_value_matching(&self, mut predicate: impl FnMut(&(K, V)) -> bool) -> Option<&V> { self.0.iter().find(|kv| predicate(kv)).map(|elem| &elem.1) } + /// Returns the value corresponding to the supplied predicate filter. It crashes if there's + /// more than one matching element. + /// + /// The supplied predicate will be applied to each (key, value) pair and it will return a + /// reference to the value where the predicate returns `true`. + pub fn get_value_matching(&self, mut predicate: impl FnMut(&(K, V)) -> bool) -> Option<&V> { + let mut filter = self.0.iter().filter(|kv| predicate(kv)); + let (_, value) = filter.next()?; + // This should return just one element, otherwise it's a bug + assert!( + filter.next().is_none(), + "Collection {:?} should have just one matching element", + self + ); + Some(value) + } + /// Returns `true` if the map contains a value for the specified key. /// /// The key may be any borrowed form of the map's key type, @@ -131,7 +150,7 @@ impl IntoIterator for VecMap { } } -impl Extend<(K, V)> for VecMap { +impl Extend<(K, V)> for VecMap { fn extend>(&mut self, iter: I) { for (k, v) in iter { self.insert(k, v); 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 1c6a83b578305..9a33875d6e493 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1857,12 +1857,37 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } } GeneratorInteriorOrUpvar::Upvar(upvar_span) => { + // `Some(ref_ty)` if `target_ty` is `&T` and `T` fails to impl `Sync` + let refers_to_non_sync = match target_ty.kind() { + ty::Ref(_, ref_ty, _) => match self.evaluate_obligation(&obligation) { + Ok(eval) if !eval.may_apply() => Some(ref_ty), + _ => None, + }, + _ => None, + }; + + let (span_label, span_note) = match refers_to_non_sync { + // if `target_ty` is `&T` and `T` fails to impl `Sync`, + // include suggestions to make `T: Sync` so that `&T: Send` + Some(ref_ty) => ( + format!( + "has type `{}` which {}, because `{}` is not `Sync`", + target_ty, trait_explanation, ref_ty + ), + format!( + "captured value {} because `&` references cannot be sent unless their referent is `Sync`", + trait_explanation + ), + ), + None => ( + format!("has type `{}` which {}", target_ty, trait_explanation), + format!("captured value {}", trait_explanation), + ), + }; + let mut span = MultiSpan::from_span(upvar_span); - span.push_span_label( - upvar_span, - format!("has type `{}` which {}", target_ty, trait_explanation), - ); - err.span_note(span, &format!("captured value {}", trait_explanation)); + span.push_span_label(upvar_span, span_label); + err.span_note(span, &span_note); } } diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 15469cb0066c5..50e4ba4fe6c3e 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -364,7 +364,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { let concrete_ty = tcx .mir_borrowck(owner.expect_local()) .concrete_opaque_types - .get_by(|(key, _)| key.def_id == def_id.to_def_id()) + .get_value_matching(|(key, _)| key.def_id == def_id.to_def_id()) .map(|concrete_ty| *concrete_ty) .unwrap_or_else(|| { tcx.sess.delay_span_bug( @@ -512,8 +512,15 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { struct ConstraintLocator<'tcx> { tcx: TyCtxt<'tcx>, + + /// def_id of the opaque type whose defining uses are being checked def_id: DefId, - // (first found type span, actual type) + + /// as we walk the defining uses, we are checking that all of them + /// define the same hidden type. This variable is set to `Some` + /// with the first type that we find, and then later types are + /// checked against it (we also carry the span of that first + /// type). found: Option<(Span, Ty<'tcx>)>, } @@ -531,7 +538,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { .tcx .typeck(def_id) .concrete_opaque_types - .get_by(|(key, _)| key.def_id == self.def_id) + .any_value_matching(|(key, _)| key.def_id == self.def_id) .is_none() { debug!("no constraints in typeck results"); diff --git a/config.toml.example b/config.toml.example index 9a820f0803f0a..775133f2ab319 100644 --- a/config.toml.example +++ b/config.toml.example @@ -38,7 +38,7 @@ changelog-seen = 2 # This is false by default so that distributions don't unexpectedly download # LLVM from the internet. # -# All tier 1 targets are currently supported; set this to `"if-supported"` if +# All tier 1 targets are currently supported; set this to `"if-available"` if # you are not sure whether you're on a tier 1 target. # # We also currently only support this when building LLVM for the build triple. diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index dfd693d13b330..79042ab739c74 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -935,6 +935,7 @@ impl BTreeMap { /// Retains only the elements specified by the predicate. /// /// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` returns `false`. + /// The elements are visited in ascending key order. /// /// # Examples /// diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index be740b05fb8ee..9711214aea623 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -846,6 +846,7 @@ impl BTreeSet { /// Retains only the elements specified by the predicate. /// /// In other words, remove all elements `e` such that `f(&e)` returns `false`. + /// The elements are visited in ascending order. /// /// # Examples /// diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index e8bd4bcb01f29..fa1f361a5b6d1 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -56,6 +56,10 @@ //! [`Rc`]: rc //! [`RefCell`]: core::cell +// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be +// able to "empty" this crate. See . +// rustc itself never sets the feature, so this line has no affect there. +#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))] #![allow(unused_attributes)] #![stable(feature = "alloc", since = "1.36.0")] #![doc( diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 540cdf124ee9c..6d87a7ab055c2 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -49,6 +49,10 @@ // // This cfg won't affect doc tests. #![cfg(not(test))] +// To run libcore tests without x.py without ending up with two copies of libcore, Miri needs to be +// able to "empty" this crate. See . +// rustc itself never sets the feature, so this line has no affect there. +#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))] #![stable(feature = "core", since = "1.6.0")] #![doc( html_playground_url = "https://play.rust-lang.org/", diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index fac285c96f00d..4a5efab9055b3 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -934,6 +934,7 @@ where /// Retains only the elements specified by the predicate. /// /// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` returns `false`. + /// The elements are visited in unsorted (and unspecified) order. /// /// # Examples /// diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index 272e1c2be2b40..1a2a8afac8bed 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -912,6 +912,7 @@ where /// Retains only the elements specified by the predicate. /// /// In other words, remove all elements `e` such that `f(&e)` returns `false`. + /// The elements are visited in unsorted (and unspecified) order. /// /// # Examples /// diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs index ef2769d431fbb..c98244132befd 100644 --- a/library/std/src/io/buffered/bufwriter.rs +++ b/library/std/src/io/buffered/bufwriter.rs @@ -68,7 +68,7 @@ use crate::ptr; /// [`flush`]: BufWriter::flush #[stable(feature = "rust1", since = "1.0.0")] pub struct BufWriter { - inner: Option, + inner: W, // The buffer. Avoid using this like a normal `Vec` in common code paths. // That is, don't use `buf.push`, `buf.extend_from_slice`, or any other // methods that require bounds checking or the like. This makes an enormous @@ -112,7 +112,7 @@ impl BufWriter { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn with_capacity(capacity: usize, inner: W) -> BufWriter { - BufWriter { inner: Some(inner), buf: Vec::with_capacity(capacity), panicked: false } + BufWriter { inner, buf: Vec::with_capacity(capacity), panicked: false } } /// Send data in our local buffer into the inner writer, looping as @@ -161,10 +161,9 @@ impl BufWriter { } let mut guard = BufGuard::new(&mut self.buf); - let inner = self.inner.as_mut().unwrap(); while !guard.done() { self.panicked = true; - let r = inner.write(guard.remaining()); + let r = self.inner.write(guard.remaining()); self.panicked = false; match r { @@ -212,7 +211,7 @@ impl BufWriter { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn get_ref(&self) -> &W { - self.inner.as_ref().unwrap() + &self.inner } /// Gets a mutable reference to the underlying writer. @@ -232,7 +231,7 @@ impl BufWriter { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn get_mut(&mut self) -> &mut W { - self.inner.as_mut().unwrap() + &mut self.inner } /// Returns a reference to the internally buffered data. @@ -308,7 +307,7 @@ impl BufWriter { pub fn into_inner(mut self) -> Result>> { match self.flush_buf() { Err(e) => Err(IntoInnerError::new(self, e)), - Ok(()) => Ok(self.inner.take().unwrap()), + Ok(()) => Ok(self.into_raw_parts().0), } } @@ -339,7 +338,12 @@ impl BufWriter { pub fn into_raw_parts(mut self) -> (W, Result, WriterPanicked>) { let buf = mem::take(&mut self.buf); let buf = if !self.panicked { Ok(buf) } else { Err(WriterPanicked { buf }) }; - (self.inner.take().unwrap(), buf) + + // SAFETY: forget(self) prevents double dropping inner + let inner = unsafe { ptr::read(&mut self.inner) }; + mem::forget(self); + + (inner, buf) } // Ensure this function does not get inlined into `write`, so that it @@ -643,7 +647,7 @@ where { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("BufWriter") - .field("writer", &self.inner.as_ref().unwrap()) + .field("writer", &self.inner) .field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity())) .finish() } @@ -663,7 +667,7 @@ impl Seek for BufWriter { #[stable(feature = "rust1", since = "1.0.0")] impl Drop for BufWriter { fn drop(&mut self) { - if self.inner.is_some() && !self.panicked { + if !self.panicked { // dtors should not panic, so we ignore a failed flush let _r = self.flush_buf(); } diff --git a/library/std/src/io/buffered/mod.rs b/library/std/src/io/buffered/mod.rs index 65497817f8160..38076ab3a2b7b 100644 --- a/library/std/src/io/buffered/mod.rs +++ b/library/std/src/io/buffered/mod.rs @@ -133,7 +133,6 @@ impl IntoInnerError { /// /// # Example /// ``` - /// #![feature(io_into_inner_error_parts)] /// use std::io::{BufWriter, ErrorKind, Write}; /// /// let mut not_enough_space = [0u8; 10]; @@ -143,7 +142,7 @@ impl IntoInnerError { /// let err = into_inner_err.into_error(); /// assert_eq!(err.kind(), ErrorKind::WriteZero); /// ``` - #[unstable(feature = "io_into_inner_error_parts", issue = "79704")] + #[stable(feature = "io_into_inner_error_parts", since = "1.55.0")] pub fn into_error(self) -> Error { self.1 } @@ -156,7 +155,6 @@ impl IntoInnerError { /// /// # Example /// ``` - /// #![feature(io_into_inner_error_parts)] /// use std::io::{BufWriter, ErrorKind, Write}; /// /// let mut not_enough_space = [0u8; 10]; @@ -167,7 +165,7 @@ impl IntoInnerError { /// assert_eq!(err.kind(), ErrorKind::WriteZero); /// assert_eq!(recovered_writer.buffer(), b"t be actually written"); /// ``` - #[unstable(feature = "io_into_inner_error_parts", issue = "79704")] + #[stable(feature = "io_into_inner_error_parts", since = "1.55.0")] pub fn into_parts(self) -> (Error, W) { (self.1, self.0) } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 77d2684b5d2a4..78c9a25262243 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -3,7 +3,7 @@ //! //! This module contains some of the real meat in the rustbuild build system //! which is where Cargo is used to compile the standard library, libtest, and -//! compiler. This module is also responsible for assembling the sysroot as it +//! the compiler. This module is also responsible for assembling the sysroot as it //! goes along from the output of the previous stage. use std::borrow::Cow; diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 483816b98d689..4b3c25b02c278 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -13,6 +13,7 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use crate::cache::{Interned, INTERNER}; +use crate::channel::GitInfo; pub use crate::flags::Subcommand; use crate::flags::{Color, Flags}; use crate::util::exe; @@ -48,7 +49,7 @@ pub struct Config { /// Call Build::ninja() instead of this. pub ninja_in_file: bool, pub verbose: usize, - pub submodules: bool, + pub submodules: Option, pub fast_submodules: bool, pub compiler_docs: bool, pub docs_minification: bool, @@ -552,7 +553,7 @@ impl Config { config.backtrace = true; config.rust_optimize = true; config.rust_optimize_tests = true; - config.submodules = true; + config.submodules = None; config.fast_submodules = true; config.docs = true; config.docs_minification = true; @@ -658,11 +659,11 @@ impl Config { config.npm = build.npm.map(PathBuf::from); config.gdb = build.gdb.map(PathBuf::from); config.python = build.python.map(PathBuf::from); + config.submodules = build.submodules; set(&mut config.low_priority, build.low_priority); set(&mut config.compiler_docs, build.compiler_docs); set(&mut config.docs_minification, build.docs_minification); set(&mut config.docs, build.docs); - set(&mut config.submodules, build.submodules); set(&mut config.fast_submodules, build.fast_submodules); set(&mut config.locked_deps, build.locked_deps); set(&mut config.vendor, build.vendor); @@ -792,8 +793,16 @@ impl Config { // CI-built LLVM can be either dynamic or static. let ci_llvm = config.out.join(&*config.build.triple).join("ci-llvm"); - let link_type = t!(std::fs::read_to_string(ci_llvm.join("link-type.txt"))); - config.llvm_link_shared = link_type == "dynamic"; + config.llvm_link_shared = if config.dry_run { + // just assume dynamic for now + true + } else { + let link_type = t!( + std::fs::read_to_string(ci_llvm.join("link-type.txt")), + format!("CI llvm missing: {}", ci_llvm.display()) + ); + link_type == "dynamic" + }; } if config.llvm_thin_lto { @@ -1075,6 +1084,10 @@ impl Config { pub fn llvm_enabled(&self) -> bool { self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) } + + pub fn submodules(&self, rust_info: &GitInfo) -> bool { + self.submodules.unwrap_or(rust_info.is_git()) + } } fn set(field: &mut T, val: Option) { diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 999882a1c04b0..8d9f169e6c50d 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -160,6 +160,7 @@ def v(*args): o("extended", "build.extended", "build an extended rust tool set") v("tools", None, "List of extended tools will be installed") +v("codegen-backends", None, "List of codegen backends to build") v("build", "build.build", "GNUs ./configure syntax LLVM build triple") v("host", None, "GNUs ./configure syntax LLVM host triples") v("target", None, "GNUs ./configure syntax LLVM target triples") @@ -339,6 +340,8 @@ def set(key, value): set('target.{}.llvm-filecheck'.format(build()), value) elif option.name == 'tools': set('build.tools', value.split(',')) + elif option.name == 'codegen-backends': + set('rust.codegen-backends', value.split(',')) elif option.name == 'host': set('build.host', value.split(',')) elif option.name == 'target': diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 92853378e5881..c37763243c0a5 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1955,8 +1955,16 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir cmd.arg("--libfiles"); builder.verbose(&format!("running {:?}", cmd)); let files = output(&mut cmd); + let build_llvm_out = &builder.llvm_out(builder.config.build); + let target_llvm_out = &builder.llvm_out(target); for file in files.trim_end().split(' ') { - builder.install(Path::new(file), dst_libdir, 0o644); + // If we're not using a custom LLVM, make sure we package for the target. + let file = if let Ok(relative_path) = Path::new(file).strip_prefix(build_llvm_out) { + target_llvm_out.join(relative_path) + } else { + PathBuf::from(file) + }; + builder.install(&file, dst_libdir, 0o644); } !builder.config.dry_run } else { diff --git a/src/bootstrap/job.rs b/src/bootstrap/job.rs index 2fe9b06e42643..5c0322e18a4ab 100644 --- a/src/bootstrap/job.rs +++ b/src/bootstrap/job.rs @@ -103,12 +103,20 @@ pub unsafe fn setup(build: &mut Build) { }; let parent = OpenProcess(PROCESS_DUP_HANDLE, FALSE, pid.parse().unwrap()); - assert!( - !parent.is_null(), - "PID `{}` doesn't seem to exist: {}", - pid, - io::Error::last_os_error() - ); + + // If we get a null parent pointer here, it is possible that either + // we have got an invalid pid or the parent process has been closed. + // Since the first case rarely happens + // (only when wrongly setting the environmental variable), + // so it might be better to improve the experience of the second case + // when users have interrupted the parent process and we don't finish + // duplicating the handle yet. + // We just need close the job object if that occurs. + if parent.is_null() { + CloseHandle(job); + return; + } + let mut parent_handle = ptr::null_mut(); let r = DuplicateHandle( GetCurrentProcess(), diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 6bcdbe3e4bbbb..245f3eada2af7 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -486,7 +486,7 @@ impl Build { t!(std::fs::read_dir(dir)).next().is_none() } - if !self.config.submodules { + if !self.config.submodules(&self.rust_info) { return; } @@ -562,7 +562,7 @@ impl Build { "library/stdarch", ]; // Avoid running git when there isn't a git checkout. - if !self.config.submodules { + if !self.config.submodules(&self.rust_info) { return; } let output = output( diff --git a/src/test/rustdoc-gui/module-items-font.goml b/src/test/rustdoc-gui/module-items-font.goml new file mode 100644 index 0000000000000..817b148bee1a6 --- /dev/null +++ b/src/test/rustdoc-gui/module-items-font.goml @@ -0,0 +1,4 @@ +// This test checks that the correct font is used on module items (in index.html pages). +goto: file://|DOC_PATH|/test_docs/index.html +assert-css: (".item-table .module-item a", {"font-family": '"Fira Sans", Arial, sans-serif'}, ALL) +assert-css: (".item-table .docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}, ALL) diff --git a/src/test/ui/async-await/issue-86507.rs b/src/test/ui/async-await/issue-86507.rs new file mode 100644 index 0000000000000..317f0317664b6 --- /dev/null +++ b/src/test/ui/async-await/issue-86507.rs @@ -0,0 +1,25 @@ +// edition:2018 + +use ::core::pin::Pin; +use ::core::future::Future; +use ::core::marker::Send; + +trait Foo { + fn bar<'me, 'async_trait, T: Send>(x: &'me T) + -> Pin + Send + 'async_trait>> + where 'me: 'async_trait; +} + +impl Foo for () { + fn bar<'me, 'async_trait, T: Send>(x: &'me T) + -> Pin + Send + 'async_trait>> + where 'me:'async_trait { + Box::pin( //~ ERROR future cannot be sent between threads safely + async move { + let x = x; + } + ) + } +} + +fn main() { } diff --git a/src/test/ui/async-await/issue-86507.stderr b/src/test/ui/async-await/issue-86507.stderr new file mode 100644 index 0000000000000..51e8f61085b22 --- /dev/null +++ b/src/test/ui/async-await/issue-86507.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-86507.rs:17:13 + | +LL | / Box::pin( +LL | | async move { +LL | | let x = x; +LL | | } +LL | | ) + | |_____________^ future created by async block is not `Send` + | +note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` + --> $DIR/issue-86507.rs:19:29 + | +LL | let x = x; + | ^ has type `&T` which is not `Send`, because `T` is not `Sync` + = note: required for the cast to the object type `dyn Future + Send` +help: consider further restricting type parameter `T` + | +LL | where 'me:'async_trait, T: std::marker::Sync { + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/auxiliary/impl-const.rs b/src/test/ui/const-generics/issues/auxiliary/impl-const.rs similarity index 100% rename from src/test/ui/const-generics/auxiliary/impl-const.rs rename to src/test/ui/const-generics/issues/auxiliary/impl-const.rs diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.full.stderr b/src/test/ui/const-generics/issues/issue-61522-array-len-succ.full.stderr similarity index 100% rename from src/test/ui/const-generics/issue-61522-array-len-succ.full.stderr rename to src/test/ui/const-generics/issues/issue-61522-array-len-succ.full.stderr diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr b/src/test/ui/const-generics/issues/issue-61522-array-len-succ.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr rename to src/test/ui/const-generics/issues/issue-61522-array-len-succ.min.stderr diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.rs b/src/test/ui/const-generics/issues/issue-61522-array-len-succ.rs similarity index 100% rename from src/test/ui/const-generics/issue-61522-array-len-succ.rs rename to src/test/ui/const-generics/issues/issue-61522-array-len-succ.rs diff --git a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr b/src/test/ui/const-generics/issues/issue-66596-impl-trait-for-str-const-arg.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr rename to src/test/ui/const-generics/issues/issue-66596-impl-trait-for-str-const-arg.min.stderr diff --git a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs b/src/test/ui/const-generics/issues/issue-66596-impl-trait-for-str-const-arg.rs similarity index 100% rename from src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs rename to src/test/ui/const-generics/issues/issue-66596-impl-trait-for-str-const-arg.rs diff --git a/src/test/ui/const-generics/issue-67375.full.stderr b/src/test/ui/const-generics/issues/issue-67375.full.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67375.full.stderr rename to src/test/ui/const-generics/issues/issue-67375.full.stderr diff --git a/src/test/ui/const-generics/issue-67375.min.stderr b/src/test/ui/const-generics/issues/issue-67375.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67375.min.stderr rename to src/test/ui/const-generics/issues/issue-67375.min.stderr diff --git a/src/test/ui/const-generics/issue-67375.rs b/src/test/ui/const-generics/issues/issue-67375.rs similarity index 100% rename from src/test/ui/const-generics/issue-67375.rs rename to src/test/ui/const-generics/issues/issue-67375.rs diff --git a/src/test/ui/const-generics/issue-67945-1.full.stderr b/src/test/ui/const-generics/issues/issue-67945-1.full.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-1.full.stderr rename to src/test/ui/const-generics/issues/issue-67945-1.full.stderr diff --git a/src/test/ui/const-generics/issue-67945-1.min.stderr b/src/test/ui/const-generics/issues/issue-67945-1.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-1.min.stderr rename to src/test/ui/const-generics/issues/issue-67945-1.min.stderr diff --git a/src/test/ui/const-generics/issue-67945-1.rs b/src/test/ui/const-generics/issues/issue-67945-1.rs similarity index 100% rename from src/test/ui/const-generics/issue-67945-1.rs rename to src/test/ui/const-generics/issues/issue-67945-1.rs diff --git a/src/test/ui/const-generics/issue-67945-2.full.stderr b/src/test/ui/const-generics/issues/issue-67945-2.full.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-2.full.stderr rename to src/test/ui/const-generics/issues/issue-67945-2.full.stderr diff --git a/src/test/ui/const-generics/issue-67945-2.min.stderr b/src/test/ui/const-generics/issues/issue-67945-2.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-2.min.stderr rename to src/test/ui/const-generics/issues/issue-67945-2.min.stderr diff --git a/src/test/ui/const-generics/issue-67945-2.rs b/src/test/ui/const-generics/issues/issue-67945-2.rs similarity index 100% rename from src/test/ui/const-generics/issue-67945-2.rs rename to src/test/ui/const-generics/issues/issue-67945-2.rs diff --git a/src/test/ui/const-generics/issue-67945-3.full.stderr b/src/test/ui/const-generics/issues/issue-67945-3.full.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-3.full.stderr rename to src/test/ui/const-generics/issues/issue-67945-3.full.stderr diff --git a/src/test/ui/const-generics/issue-67945-3.min.stderr b/src/test/ui/const-generics/issues/issue-67945-3.min.stderr similarity index 100% rename from src/test/ui/const-generics/issue-67945-3.min.stderr rename to src/test/ui/const-generics/issues/issue-67945-3.min.stderr diff --git a/src/test/ui/const-generics/issue-67945-3.rs b/src/test/ui/const-generics/issues/issue-67945-3.rs similarity index 100% rename from src/test/ui/const-generics/issue-67945-3.rs rename to src/test/ui/const-generics/issues/issue-67945-3.rs diff --git a/src/test/ui/const-generics/issue-68104-print-stack-overflow.rs b/src/test/ui/const-generics/issues/issue-68104-print-stack-overflow.rs similarity index 100% rename from src/test/ui/const-generics/issue-68104-print-stack-overflow.rs rename to src/test/ui/const-generics/issues/issue-68104-print-stack-overflow.rs diff --git a/src/test/ui/const-generics/issue-70180-1-stalled_on.rs b/src/test/ui/const-generics/issues/issue-70180-1-stalled_on.rs similarity index 100% rename from src/test/ui/const-generics/issue-70180-1-stalled_on.rs rename to src/test/ui/const-generics/issues/issue-70180-1-stalled_on.rs diff --git a/src/test/ui/const-generics/issue-70180-2-stalled_on.rs b/src/test/ui/const-generics/issues/issue-70180-2-stalled_on.rs similarity index 100% rename from src/test/ui/const-generics/issue-70180-2-stalled_on.rs rename to src/test/ui/const-generics/issues/issue-70180-2-stalled_on.rs diff --git a/src/test/ui/const-generics/issue-71202.rs b/src/test/ui/const-generics/issues/issue-71202.rs similarity index 100% rename from src/test/ui/const-generics/issue-71202.rs rename to src/test/ui/const-generics/issues/issue-71202.rs diff --git a/src/test/ui/const-generics/issue-71986.rs b/src/test/ui/const-generics/issues/issue-71986.rs similarity index 100% rename from src/test/ui/const-generics/issue-71986.rs rename to src/test/ui/const-generics/issues/issue-71986.rs diff --git a/src/test/ui/const-generics/issue-73899.rs b/src/test/ui/const-generics/issues/issue-73899.rs similarity index 100% rename from src/test/ui/const-generics/issue-73899.rs rename to src/test/ui/const-generics/issues/issue-73899.rs diff --git a/src/test/ui/const-generics/issue-74906.rs b/src/test/ui/const-generics/issues/issue-74906.rs similarity index 100% rename from src/test/ui/const-generics/issue-74906.rs rename to src/test/ui/const-generics/issues/issue-74906.rs diff --git a/src/test/ui/const-generics/issue-75763.rs b/src/test/ui/const-generics/issues/issue-75763.rs similarity index 100% rename from src/test/ui/const-generics/issue-75763.rs rename to src/test/ui/const-generics/issues/issue-75763.rs diff --git a/src/test/ui/const-generics/issue-79518-default_trait_method_normalization.rs b/src/test/ui/const-generics/issues/issue-79518-default_trait_method_normalization.rs similarity index 100% rename from src/test/ui/const-generics/issue-79518-default_trait_method_normalization.rs rename to src/test/ui/const-generics/issues/issue-79518-default_trait_method_normalization.rs diff --git a/src/test/ui/const-generics/issue-79518-default_trait_method_normalization.stderr b/src/test/ui/const-generics/issues/issue-79518-default_trait_method_normalization.stderr similarity index 100% rename from src/test/ui/const-generics/issue-79518-default_trait_method_normalization.stderr rename to src/test/ui/const-generics/issues/issue-79518-default_trait_method_normalization.stderr diff --git a/src/test/ui/const-generics/issue-80561-incorrect-param-env.rs b/src/test/ui/const-generics/issues/issue-80561-incorrect-param-env.rs similarity index 100% rename from src/test/ui/const-generics/issue-80561-incorrect-param-env.rs rename to src/test/ui/const-generics/issues/issue-80561-incorrect-param-env.rs diff --git a/src/test/ui/const-generics/issue-86820.rs b/src/test/ui/const-generics/issues/issue-86820.rs similarity index 100% rename from src/test/ui/const-generics/issue-86820.rs rename to src/test/ui/const-generics/issues/issue-86820.rs diff --git a/src/test/ui/const-generics/issue-86820.stderr b/src/test/ui/const-generics/issues/issue-86820.stderr similarity index 100% rename from src/test/ui/const-generics/issue-86820.stderr rename to src/test/ui/const-generics/issues/issue-86820.stderr diff --git a/src/test/ui/const-generics/issues/issue-87076.rs b/src/test/ui/const-generics/issues/issue-87076.rs new file mode 100644 index 0000000000000..5dfda943bf69c --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-87076.rs @@ -0,0 +1,20 @@ +// build-pass + +#![feature(const_generics)] +#![allow(incomplete_features)] + +#[derive(PartialEq, Eq)] +pub struct UnitDims { + pub time: u8, + pub length: u8, +} + +pub struct UnitValue; + +impl UnitValue { + fn crash() {} +} + +fn main() { + UnitValue::<{ UnitDims { time: 1, length: 2 } }>::crash(); +} diff --git a/src/tools/clippy/tests/ui/future_not_send.stderr b/src/tools/clippy/tests/ui/future_not_send.stderr index b59dbb3e76c64..c734051ccf320 100644 --- a/src/tools/clippy/tests/ui/future_not_send.stderr +++ b/src/tools/clippy/tests/ui/future_not_send.stderr @@ -55,11 +55,11 @@ note: captured value is not `Send` LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell) -> bool { | ^^ has type `std::rc::Rc<[u8]>` which is not `Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` -note: captured value is not `Send` +note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> $DIR/future_not_send.rs:20:40 | LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell) -> bool { - | ^^^^ has type `&std::cell::Cell` which is not `Send` + | ^^^^ has type `&std::cell::Cell` which is not `Send`, because `std::cell::Cell` is not `Sync` = note: `std::cell::Cell` doesn't implement `std::marker::Sync` error: future cannot be sent between threads safely