diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 3d05fc15b38f4..6d2ad70af276c 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -395,18 +395,14 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option { } pub(crate) fn should_use_new_llvm_pass_manager( - cgcx: &CodegenContext, + _cgcx: &CodegenContext, config: &ModuleConfig, ) -> bool { - // The new pass manager is enabled by default for LLVM >= 13. - // This matches Clang, which also enables it since Clang 13. - - // FIXME: There are some perf issues with the new pass manager - // when targeting s390x, so it is temporarily disabled for that - // arch, see https://github.com/rust-lang/rust/issues/89609 + // The new pass manager is causing significant performance issues such as #91128, and is + // therefore disabled in stable versions of rustc by default. config .new_llvm_pass_manager - .unwrap_or_else(|| cgcx.target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0)) + .unwrap_or(false) } pub(crate) unsafe fn optimize_with_new_llvm_pass_manager( diff --git a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs index 3ffc852d65080..f01ff02da072f 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs @@ -9,7 +9,6 @@ pub fn target() -> Target { base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD; base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]); - base.link_env.extend(super::apple_base::macos_link_env("arm64")); base.link_env_remove.extend(super::apple_base::macos_link_env_remove()); // Clang automatically chooses a more specific target based on diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs index ba8f9a8ce1160..db6aee59a5dd3 100644 --- a/compiler/rustc_target/src/spec/apple_base.rs +++ b/compiler/rustc_target/src/spec/apple_base.rs @@ -79,18 +79,6 @@ pub fn macos_llvm_target(arch: &str) -> String { format!("{}-apple-macosx{}.{}.0", arch, major, minor) } -pub fn macos_link_env(arch: &str) -> Vec<(String, String)> { - // Use the default deployment target for linking just as with the LLVM target if not - // specified via MACOSX_DEPLOYMENT_TARGET, otherwise the system linker would use its - // default which varies with Xcode version. - if env::var("MACOSX_DEPLOYMENT_TARGET").is_err() { - let default = macos_default_deployment_target(arch); - vec![("MACOSX_DEPLOYMENT_TARGET".to_string(), format!("{}.{}", default.0, default.1))] - } else { - vec![] - } -} - pub fn macos_link_env_remove() -> Vec { let mut env_remove = Vec::with_capacity(2); // Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which diff --git a/compiler/rustc_target/src/spec/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/i686_apple_darwin.rs index 05217c09aedd0..f2635f0656d7a 100644 --- a/compiler/rustc_target/src/spec/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/i686_apple_darwin.rs @@ -5,7 +5,6 @@ pub fn target() -> Target { base.cpu = "yonah".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]); - base.link_env.extend(super::apple_base::macos_link_env("i686")); base.link_env_remove.extend(super::apple_base::macos_link_env_remove()); // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved base.stack_probes = StackProbeType::Call; diff --git a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs index 3e20cb0b272ce..22fdaabfcb89b 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs @@ -10,7 +10,6 @@ pub fn target() -> Target { LinkerFlavor::Gcc, vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()], ); - base.link_env.extend(super::apple_base::macos_link_env("x86_64")); base.link_env_remove.extend(super::apple_base::macos_link_env_remove()); // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved base.stack_probes = StackProbeType::Call; diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index b8c66931cbe52..4a23206402e26 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -20,6 +20,7 @@ use super::{Normalized, NormalizedTy, ProjectionCacheEntry, ProjectionCacheKey}; use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use crate::traits::error_reporting::InferCtxtExt as _; +use rustc_data_structures::sso::SsoHashSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::ErrorReported; use rustc_hir::def_id::DefId; @@ -944,9 +945,14 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>( Normalized { value: projected_ty, obligations: projected_obligations } }; + let mut deduped: SsoHashSet<_> = Default::default(); let mut canonical = SelectionContext::with_query_mode(selcx.infcx(), TraitQueryMode::Canonical); + result.obligations.drain_filter(|projected_obligation| { + if !deduped.insert(projected_obligation.clone()) { + return true; + } // If any global obligations always apply, considering regions, then we don't // need to include them. The `is_global` check rules out inference variables, // so there's no need for the caller of `opt_normalize_projection_type` diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index 91dbbec782f89..f11c93e933996 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -559,6 +559,7 @@ impl HashStable for FloatTy { impl HashStable for InferTy { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { use InferTy::*; + discriminant(self).hash_stable(ctx, hasher); match self { TyVar(v) => v.as_u32().hash_stable(ctx, hasher), IntVar(v) => v.index.hash_stable(ctx, hasher), diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index fdb23529599c8..cb2854bc5ffdc 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -398,27 +398,4 @@ pub mod arch { } } -// Pull in the `core_simd` crate directly into libcore. The contents of -// `core_simd` are in a different repository: rust-lang/portable-simd. -// -// `core_simd` depends on libcore, but the contents of this module are -// set up in such a way that directly pulling it here works such that the -// crate uses this crate as its libcore. -#[path = "../../portable-simd/crates/core_simd/src/mod.rs"] -#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)] -#[allow(rustdoc::bare_urls)] -#[unstable(feature = "portable_simd", issue = "86656")] -#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -#[cfg(not(bootstrap))] -mod core_simd; - -#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")] -#[unstable(feature = "portable_simd", issue = "86656")] -#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -#[cfg(not(bootstrap))] -pub mod simd { - #[unstable(feature = "portable_simd", issue = "86656")] - pub use crate::core_simd::simd::*; -} - include!("primitive_docs.rs"); diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 4563c2085c129..4d37ed1942825 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -61,7 +61,6 @@ #![feature(never_type)] #![feature(unwrap_infallible)] #![feature(result_into_ok_or_err)] -#![cfg_attr(not(bootstrap), feature(portable_simd))] #![feature(ptr_metadata)] #![feature(once_cell)] #![feature(unsized_tuple_coercion)] @@ -107,8 +106,6 @@ mod pattern; mod pin; mod ptr; mod result; -#[cfg(not(bootstrap))] -mod simd; mod slice; mod str; mod str_lossy; diff --git a/library/core/tests/simd.rs b/library/core/tests/simd.rs deleted file mode 100644 index 50c92968c9d82..0000000000000 --- a/library/core/tests/simd.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![cfg(not(miri))] // Miri does not support all SIMD intrinsics - -use core::simd::f32x4; - -#[test] -fn testing() { - let x = f32x4::from_array([1.0, 1.0, 1.0, 1.0]); - let y = -x; - - let h = x * 0.5; - - let r = y.abs(); - assert_eq!(x, r); - assert_eq!(h, f32x4::splat(0.5)); -} diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 504c3b7e9f99c..133cda4f450e0 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -323,7 +323,6 @@ #![feature(panic_internals)] #![feature(panic_unwind)] #![feature(pin_static_ref)] -#![cfg_attr(not(bootstrap), feature(portable_simd))] #![feature(prelude_import)] #![feature(ptr_internals)] #![feature(rustc_attrs)] @@ -475,9 +474,6 @@ pub use core::pin; pub use core::ptr; #[stable(feature = "rust1", since = "1.0.0")] pub use core::result; -#[unstable(feature = "portable_simd", issue = "86656")] -#[cfg(not(bootstrap))] -pub use core::simd; #[unstable(feature = "async_stream", issue = "79024")] pub use core::stream; #[stable(feature = "i128", since = "1.26.0")] diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index 67b747e410732..e5cdc4737068a 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -4,6 +4,10 @@ use super::{Command, Output, Stdio}; use crate::io::ErrorKind; use crate::str; +fn known_command() -> Command { + if cfg!(windows) { Command::new("help") } else { Command::new("echo") } +} + #[cfg(target_os = "android")] fn shell_cmd() -> Command { Command::new("/system/bin/sh") @@ -305,7 +309,7 @@ fn test_interior_nul_in_progname_is_error() { #[test] fn test_interior_nul_in_arg_is_error() { - match Command::new("rustc").arg("has-some-\0\0s-inside").spawn() { + match known_command().arg("has-some-\0\0s-inside").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } @@ -313,7 +317,7 @@ fn test_interior_nul_in_arg_is_error() { #[test] fn test_interior_nul_in_args_is_error() { - match Command::new("rustc").args(&["has-some-\0\0s-inside"]).spawn() { + match known_command().args(&["has-some-\0\0s-inside"]).spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } @@ -321,7 +325,7 @@ fn test_interior_nul_in_args_is_error() { #[test] fn test_interior_nul_in_current_dir_is_error() { - match Command::new("rustc").current_dir("has-some-\0\0s-inside").spawn() { + match known_command().current_dir("has-some-\0\0s-inside").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } @@ -416,3 +420,22 @@ fn env_empty() { let p = Command::new("cmd").args(&["/C", "exit 0"]).env_clear().spawn(); assert!(p.is_ok()); } + +// See issue #91991 +#[test] +#[cfg(windows)] +fn run_bat_script() { + let tempdir = crate::sys_common::io::test::tmpdir(); + let script_path = tempdir.join("hello.cmd"); + + crate::fs::write(&script_path, "@echo Hello, %~1!").unwrap(); + let output = Command::new(&script_path) + .arg("fellow Rustaceans") + .stdout(crate::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!"); +} diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index 66b210ce1bfb3..e84dfbce4a754 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -704,6 +704,19 @@ fn make_command_line(prog: &OsStr, args: &[Arg], force_quotes: bool) -> io::Resu // Encode the command and arguments in a command line string such // that the spawned process may recover them using CommandLineToArgvW. let mut cmd: Vec = Vec::new(); + + // CreateFileW has special handling for .bat and .cmd files, which means we + // need to add an extra pair of quotes surrounding the whole command line + // so they are properly passed on to the script. + // See issue #91991. + let is_batch_file = Path::new(prog) + .extension() + .map(|ext| ext.eq_ignore_ascii_case("cmd") || ext.eq_ignore_ascii_case("bat")) + .unwrap_or(false); + if is_batch_file { + cmd.push(b'"' as u16); + } + // Always quote the program name so CreateProcess doesn't interpret args as // part of the name if the binary wasn't found first time. append_arg(&mut cmd, prog, Quote::Always)?; @@ -715,6 +728,9 @@ fn make_command_line(prog: &OsStr, args: &[Arg], force_quotes: bool) -> io::Resu }; append_arg(&mut cmd, arg, quote)?; } + if is_batch_file { + cmd.push(b'"' as u16); + } return Ok(cmd); fn append_arg(cmd: &mut Vec, arg: &OsStr, quote: Quote) -> io::Result<()> { diff --git a/library/std/src/sys/windows/process/tests.rs b/library/std/src/sys/windows/process/tests.rs index 6c862edc2370a..6159a679c0e69 100644 --- a/library/std/src/sys/windows/process/tests.rs +++ b/library/std/src/sys/windows/process/tests.rs @@ -160,6 +160,8 @@ fn windows_exe_resolver() { io::ErrorKind::InvalidInput ); + /* FIXME: fix and re-enable these tests before making changes to the resolver. + /* Some of the following tests may need to be changed if you are deliberately changing the behaviour of `resolve_exe`. @@ -179,4 +181,6 @@ fn windows_exe_resolver() { // The application's directory is also searched. let current_exe = env::current_exe().unwrap(); assert!(resolve_exe(current_exe.file_name().unwrap().as_ref(), None).is_ok()); + + */ } diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index d3738cfa3e781..1bdd6cbc1c25a 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -296,7 +296,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl let (short, name) = item_ty_to_strs(myty.unwrap()); write!( w, - "

\ + "

\ {name}\

\n{}", ITEM_TABLE_OPEN, diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 13e8dc85a243c..532bc0e351dbd 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -219,7 +219,7 @@ a { a.srclink, a#toggle-all-docs, a.anchor, -.section-header a, +.small-section-header a, #source-sidebar a, pre.rust a, .sidebar a, diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 8caf8a05d507f..56ed8a2006d09 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -181,7 +181,7 @@ a { a.srclink, a#toggle-all-docs, a.anchor, -.section-header a, +.small-section-header a, #source-sidebar a, pre.rust a, .sidebar a, diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index fec71674e634f..d63614191822e 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -176,7 +176,7 @@ a { a.srclink, a#toggle-all-docs, a.anchor, -.section-header a, +.small-section-header a, #source-sidebar a, pre.rust a, .sidebar a, diff --git a/src/test/incremental/issue-85360-eval-obligation-ice.rs b/src/test/incremental/issue-85360-eval-obligation-ice.rs new file mode 100644 index 0000000000000..1796c9d197c2b --- /dev/null +++ b/src/test/incremental/issue-85360-eval-obligation-ice.rs @@ -0,0 +1,118 @@ +// revisions:cfail1 cfail2 +//[cfail1] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=not-loaded +//[cfail2] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=loaded +// build-pass + +use core::any::Any; +use core::marker::PhantomData; + +struct DerefWrap(T); + +impl core::ops::Deref for DerefWrap { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +struct Storage { + phantom: PhantomData<(T, D)>, +} + +type ReadStorage = Storage>>; + +pub trait Component { + type Storage; +} + +struct VecStorage; + +struct Pos; + +impl Component for Pos { + type Storage = VecStorage; +} + +struct GenericComp { + _t: T, +} + +impl Component for GenericComp { + type Storage = VecStorage; +} +struct ReadData { + pos_interpdata: ReadStorage>, +} + +trait System { + type SystemData; + + fn run(data: Self::SystemData, any: Box); +} + +struct Sys; + +impl System for Sys { + type SystemData = (ReadData, ReadStorage); + + fn run((data, pos): Self::SystemData, any: Box) { + > as SystemData>::setup(any); + + ParJoin::par_join((&pos, &data.pos_interpdata)); + } +} + +trait ParJoin { + fn par_join(self) + where + Self: Sized, + { + } +} + +impl<'a, T, D> ParJoin for &'a Storage +where + T: Component, + D: core::ops::Deref>, + T::Storage: Sync, +{ +} + +impl ParJoin for (A, B) +where + A: ParJoin, + B: ParJoin, +{ +} + +pub trait SystemData { + fn setup(any: Box); +} + +impl SystemData for ReadStorage +where + T: Component, +{ + fn setup(any: Box) { + let storage: &MaskedStorage = any.downcast_ref().unwrap(); + + >>::cast(&storage); + } +} + +pub struct MaskedStorage { + _inner: T::Storage, +} + +pub unsafe trait CastFrom { + fn cast(t: &T) -> &Self; +} + +unsafe impl CastFrom for dyn Any +where + T: Any + 'static, +{ + fn cast(t: &T) -> &Self { + t + } +} diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml index 7002812bb62c4..03b10e3f78d43 100644 --- a/src/test/rustdoc-gui/headers-color.goml +++ b/src/test/rustdoc-gui/headers-color.goml @@ -18,7 +18,10 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL) goto: file://|DOC_PATH|/test_docs/index.html -assert-css: (".section-header a", {"color": "rgb(197, 197, 197)"}, ALL) +assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL) + +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html +assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL) // Dark theme local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"} @@ -34,7 +37,10 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use assert-css: ("#method\.must_use", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, ALL) goto: file://|DOC_PATH|/test_docs/index.html -assert-css: (".section-header a", {"color": "rgb(221, 221, 221)"}, ALL) +assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL) + +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html +assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL) // Light theme local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} @@ -52,4 +58,7 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use assert-css: ("#method\.must_use", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, ALL) goto: file://|DOC_PATH|/test_docs/index.html -assert-css: (".section-header a", {"color": "rgb(0, 0, 0)"}, ALL) +assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL) + +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html +assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL) diff --git a/src/test/ui/simd/libm_no_std_cant_float.rs b/src/test/ui/simd/libm_no_std_cant_float.rs deleted file mode 100644 index abe460a326bb3..0000000000000 --- a/src/test/ui/simd/libm_no_std_cant_float.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![crate_type = "rlib"] -#![no_std] -#![feature(portable_simd)] -use core::simd::f32x4; - -// For SIMD float ops, the LLIR version which is used to implement the portable -// forms of them may become calls to math.h AKA libm. So, we can't guarantee -// we can compile them for #![no_std] crates. -// Someday we may solve this. -// Until then, this test at least guarantees these functions require std. -fn guarantee_no_std_nolibm_calls() -> f32x4 { - let x = f32x4::from_array([0.1, 0.5, 0.6, -1.5]); - let x2 = x + x; - let _xc = x.ceil(); //~ ERROR E0599 - let _xf = x.floor(); //~ ERROR E0599 - let _xr = x.round(); //~ ERROR E0599 - let _xt = x.trunc(); //~ ERROR E0599 - let _xfma = x.mul_add(x, x); //~ ERROR E0599 - let _xsqrt = x.sqrt(); //~ ERROR E0599 - x2.abs() * x2 -} diff --git a/src/test/ui/simd/libm_no_std_cant_float.stderr b/src/test/ui/simd/libm_no_std_cant_float.stderr deleted file mode 100644 index dc8638f6ab72d..0000000000000 --- a/src/test/ui/simd/libm_no_std_cant_float.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0599]: no method named `ceil` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:14:17 - | -LL | let _xc = x.ceil(); - | ^^^^ method not found in `Simd` - -error[E0599]: no method named `floor` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:15:17 - | -LL | let _xf = x.floor(); - | ^^^^^ method not found in `Simd` - -error[E0599]: no method named `round` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:16:17 - | -LL | let _xr = x.round(); - | ^^^^^ method not found in `Simd` - -error[E0599]: no method named `trunc` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:17:17 - | -LL | let _xt = x.trunc(); - | ^^^^^ method not found in `Simd` - -error[E0599]: no method named `mul_add` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:18:19 - | -LL | let _xfma = x.mul_add(x, x); - | ^^^^^^^ method not found in `Simd` - -error[E0599]: no method named `sqrt` found for struct `Simd` in the current scope - --> $DIR/libm_no_std_cant_float.rs:19:20 - | -LL | let _xsqrt = x.sqrt(); - | ^^^^ method not found in `Simd` - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/simd/portable-intrinsics-arent-exposed.rs b/src/test/ui/simd/portable-intrinsics-arent-exposed.rs deleted file mode 100644 index 4d7590323550c..0000000000000 --- a/src/test/ui/simd/portable-intrinsics-arent-exposed.rs +++ /dev/null @@ -1,8 +0,0 @@ -// May not matter, since people can use them with a nightly feature. -// However this tests to guarantee they don't leak out via portable_simd, -// and thus don't accidentally get stabilized. -use std::simd::intrinsics; //~ERROR E0603 - -fn main() { - () -} diff --git a/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr b/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr deleted file mode 100644 index 9ac73eca19345..0000000000000 --- a/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0603]: module `intrinsics` is private - --> $DIR/portable-intrinsics-arent-exposed.rs:4:16 - | -LL | use std::simd::intrinsics; - | ^^^^^^^^^^ private module - | -note: the module `intrinsics` is defined here - --> $SRC_DIR/core/src/lib.rs:LL:COL - | -LL | pub use crate::core_simd::simd::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0603`. diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 7972437771399..355f2038df889 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -4,9 +4,6 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied LL | let _: &[i8] = data.into(); | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` | - = help: the following implementations were found: - <[T; LANES] as From>> - <[bool; LANES] as From>> = note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]` error: aborting due to previous error diff --git a/src/test/ui/traits/issue-85360-eval-obligation-ice.rs b/src/test/ui/traits/issue-85360-eval-obligation-ice.rs new file mode 100644 index 0000000000000..2dbf912d214da --- /dev/null +++ b/src/test/ui/traits/issue-85360-eval-obligation-ice.rs @@ -0,0 +1,130 @@ +// compile-flags: --edition=2021 + +#![feature(rustc_attrs)] + +use core::any::Any; +use core::marker::PhantomData; + +fn main() { + test::>>(make()); + //~^ ERROR evaluate(Binder(TraitPredicate(> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) + //~| ERROR evaluate(Binder(TraitPredicate(> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) +} + +#[rustc_evaluate_where_clauses] +fn test(_: T) {} + +fn make() -> T { + todo!() +} + +struct DerefWrap(T); + +impl core::ops::Deref for DerefWrap { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +struct Storage { + phantom: PhantomData<(T, D)>, +} + +type ReadStorage = Storage>>; + +pub trait Component { + type Storage; +} + +struct VecStorage; + +struct Pos; + +impl Component for Pos { + type Storage = VecStorage; +} + +struct GenericComp { + _t: T, +} + +impl Component for GenericComp { + type Storage = VecStorage; +} +struct ReadData { + pos_interpdata: ReadStorage>, +} + +trait System { + type SystemData; + + fn run(data: Self::SystemData, any: Box); +} + +struct Sys; + +impl System for Sys { + type SystemData = (ReadData, ReadStorage); + + fn run((data, pos): Self::SystemData, any: Box) { + > as SystemData>::setup(any); + + ParJoin::par_join((&pos, &data.pos_interpdata)); + } +} + +trait ParJoin { + fn par_join(self) + where + Self: Sized, + { + } +} + +impl<'a, T, D> ParJoin for &'a Storage +where + T: Component, + D: core::ops::Deref>, + T::Storage: Sync, +{ +} + +impl ParJoin for (A, B) +where + A: ParJoin, + B: ParJoin, +{ +} + +pub trait SystemData { + fn setup(any: Box); +} + +impl SystemData for ReadStorage +where + T: Component, +{ + fn setup(any: Box) { + let storage: &MaskedStorage = any.downcast_ref().unwrap(); + + >>::cast(&storage); + } +} + +pub struct MaskedStorage { + _inner: T::Storage, +} + +pub unsafe trait CastFrom { + fn cast(t: &T) -> &Self; +} + +unsafe impl CastFrom for dyn Any +where + T: Any + 'static, +{ + fn cast(t: &T) -> &Self { + t + } +} diff --git a/src/test/ui/traits/issue-85360-eval-obligation-ice.stderr b/src/test/ui/traits/issue-85360-eval-obligation-ice.stderr new file mode 100644 index 0000000000000..c62aba30f05d2 --- /dev/null +++ b/src/test/ui/traits/issue-85360-eval-obligation-ice.stderr @@ -0,0 +1,20 @@ +error: evaluate(Binder(TraitPredicate(> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) + --> $DIR/issue-85360-eval-obligation-ice.rs:9:5 + | +LL | test::>>(make()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | fn test(_: T) {} + | - predicate + +error: evaluate(Binder(TraitPredicate(> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) + --> $DIR/issue-85360-eval-obligation-ice.rs:9:5 + | +LL | test::>>(make()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | fn test(_: T) {} + | ----- predicate + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/traits/vtable/issue-91807.rs b/src/test/ui/traits/vtable/issue-91807.rs new file mode 100644 index 0000000000000..f435ff09dc3af --- /dev/null +++ b/src/test/ui/traits/vtable/issue-91807.rs @@ -0,0 +1,17 @@ +// check-pass +// incremental + +struct Struct(T); + +impl std::ops::Deref for Struct { + type Target = dyn Fn(T); + fn deref(&self) -> &Self::Target { + unimplemented!() + } +} + +fn main() { + let f = Struct(Default::default()); + f(0); + f(0); +}