diff --git a/Cargo.lock b/Cargo.lock index 8d68be636fa92..3fa6ce694755d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -561,9 +561,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chacha20" @@ -1400,10 +1400,11 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.12" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3" dependencies = [ + "autocfg", "indenter", "once_cell", ] diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index 7bb8979e8820f..f8166b8c766d2 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -70,8 +70,8 @@ fn get_rpath_relative_to_output(config: &RPathConfig<'_>, lib: &Path) -> OsStrin let output = config.out_filename.parent().unwrap(); // If output or lib is empty, just assume it locates in current path - let lib = if lib == Path::new("") { Path::new(".") } else { lib }; - let output = if output == Path::new("") { Path::new(".") } else { output }; + let lib = if lib.is_empty() { Path::new(".") } else { lib }; + let output = if output.is_empty() { Path::new(".") } else { output }; let lib = try_canonicalize(lib).unwrap(); let output = try_canonicalize(output).unwrap(); diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 18ea454f82c65..d63bffab88221 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -75,20 +75,15 @@ fn check_transmute<'tcx>( hir_id: HirId, ) -> Result<(), ErrorGuaranteed> { let span = tcx.hir_span(hir_id); - let normalize = |ty| { - if let Ok(ty) = tcx.try_normalize_erasing_regions(typing_env, ty) { - ty - } else { - Ty::new_error_with_message( - tcx, - span, - format!("tried to normalize non-wf type {ty:#?} in check_transmute"), - ) - } + let normalize = |ty: Unnormalized<'tcx, Ty<'tcx>>| -> Result, ErrorGuaranteed> { + tcx.try_normalize_erasing_regions(typing_env, ty).map_err(|err| { + let err = LayoutError::NormalizationFailure(ty.skip_normalization(), err); + tcx.dcx().struct_span_err(span, err.to_string()).emit() + }) }; - let from = normalize(from); - let to = normalize(to); + let from = normalize(from)?; + let to = normalize(to)?; trace!(?from, ?to); // Transmutes that are only changing lifetimes are always ok. diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 60de9d179cb98..a9a99336d1894 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -86,12 +86,6 @@ pub struct CStore { has_crate_resolve_with_fail: bool, } -impl std::fmt::Debug for CStore { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("CStore").finish_non_exhaustive() - } -} - pub enum LoadedMacro { MacroDef { def: MacroDef, @@ -113,12 +107,10 @@ enum LoadResult { Loaded(Library), } -struct CrateDump<'a>(&'a CStore); - -impl<'a> std::fmt::Debug for CrateDump<'a> { +impl std::fmt::Debug for CStore { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(fmt, "resolved crates:")?; - for (cnum, data) in self.0.iter_crate_data() { + for (cnum, data) in self.iter_crate_data() { writeln!(fmt, " name: {}", data.name())?; writeln!(fmt, " cnum: {cnum}")?; writeln!(fmt, " hash: {}", data.hash())?; @@ -1288,7 +1280,7 @@ impl CStore { self.report_unused_deps_in_crate(tcx, krate); self.report_future_incompatible_deps(tcx, krate); - info!("{:?}", CrateDump(self)); + info!("{:?}", self); } /// Process an `extern crate foo` AST node. diff --git a/compiler/rustc_parse/src/diagnostics.rs b/compiler/rustc_parse/src/diagnostics.rs index 7897239d248ea..397baa0ae4ddb 100644 --- a/compiler/rustc_parse/src/diagnostics.rs +++ b/compiler/rustc_parse/src/diagnostics.rs @@ -1118,6 +1118,27 @@ pub(crate) struct ArrayBracketsInsteadOfBracesSugg { pub right: Span, } +#[derive(Diagnostic)] +#[diag("attributes are not allowed inside imports")] +pub(crate) struct AttrInUseTree { + #[primary_span] + pub attr_span: Span, + #[subdiagnostic] + pub sub: Option, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion("move the import to its own item", style = "verbose")] +pub(crate) struct AttrInUseTreeSugg { + #[suggestion_part(code = "{code}")] + pub use_lo: Span, + #[suggestion_part(code = "")] + pub attr_span: Span, + #[suggestion_part(code = "")] + pub tree_span: Span, + pub code: String, +} + #[derive(Diagnostic)] #[diag("`match` arm body without braces")] pub(crate) struct MatchArmBodyWithoutBraces { diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index fae58c29954d0..0f49e3c02873d 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -310,11 +310,15 @@ impl<'a> Parser<'a> { /// Parses an inner part of an attribute (the path and following tokens). /// The tokens must be either a delimited token stream, or empty token stream, /// or the "legacy" key-value form. - /// PATH `(` TOKEN_STREAM `)` - /// PATH `[` TOKEN_STREAM `]` - /// PATH `{` TOKEN_STREAM `}` - /// PATH - /// PATH `=` UNSUFFIXED_LIT + /// + /// ```text + /// PATH `(` TOKEN_STREAM `)` + /// PATH `[` TOKEN_STREAM `]` + /// PATH `{` TOKEN_STREAM `}` + /// PATH + /// PATH `=` UNSUFFIXED_LIT + /// ``` + /// /// The delimiters or `=` are still put into the resulting token stream. pub fn parse_attr_item( &mut self, diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 1306f1fcfb1ce..44ce647568d00 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -434,7 +434,8 @@ impl<'a> Parser<'a> { } fn parse_use_item(&mut self) -> PResult<'a, ItemKind> { - let tree = self.parse_use_tree()?; + let use_token_span = self.prev_token.span; + let tree = self.parse_use_tree(use_token_span, None)?; if let Err(mut e) = self.expect_semi() { match tree.kind { UseTreeKind::Glob(_) => { @@ -1317,7 +1318,11 @@ impl<'a> Parser<'a> { /// PATH `::` `{` USE_TREE_LIST `}` | /// PATH [`as` IDENT] /// ``` - fn parse_use_tree(&mut self) -> PResult<'a, UseTree> { + fn parse_use_tree<'b>( + &mut self, + use_token_span: Span, + use_path: Option<&'b UsePathList<'b>>, + ) -> PResult<'a, UseTree> { let lo = self.token.span; let mut prefix = ast::Path { segments: ThinVec::new(), span: lo.shrink_to_lo() }; @@ -1331,13 +1336,14 @@ impl<'a> Parser<'a> { .push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))); } - self.parse_use_tree_glob_or_nested()? + self.parse_use_tree_glob_or_nested(use_token_span, use_path)? } else { // `use path::*;` or `use path::{...};` or `use path;` or `use path as bar;` prefix = self.parse_path(PathStyle::Mod)?; if self.eat_path_sep() { - self.parse_use_tree_glob_or_nested()? + let use_path = UsePathList { elements: &prefix.segments, prev: use_path }; + self.parse_use_tree_glob_or_nested(use_token_span, Some(&use_path))? } else { // Recover from using a colon as path separator. while self.eat_noexpect(&token::Colon) { @@ -1358,13 +1364,17 @@ impl<'a> Parser<'a> { } /// Parses `*` or `{...}`. - fn parse_use_tree_glob_or_nested(&mut self) -> PResult<'a, UseTreeKind> { + fn parse_use_tree_glob_or_nested<'b>( + &mut self, + use_token_span: Span, + use_path: Option<&'b UsePathList<'b>>, + ) -> PResult<'a, UseTreeKind> { Ok(if self.eat(exp!(Star)) { UseTreeKind::Glob(self.prev_token.span) } else { let lo = self.token.span; UseTreeKind::Nested { - items: self.parse_use_tree_list()?, + items: self.parse_use_tree_list(use_token_span, use_path)?, span: lo.to(self.prev_token.span), } }) @@ -1375,14 +1385,85 @@ impl<'a> Parser<'a> { /// ```text /// USE_TREE_LIST = ∅ | (USE_TREE `,`)* USE_TREE [`,`] /// ``` - fn parse_use_tree_list(&mut self) -> PResult<'a, ThinVec<(UseTree, ast::NodeId)>> { + fn parse_use_tree_list<'b>( + &mut self, + use_token_span: Span, + prefix: Option<&'b UsePathList<'b>>, + ) -> PResult<'a, ThinVec<(UseTree, ast::NodeId)>> { self.parse_delim_comma_seq(exp!(OpenBrace), exp!(CloseBrace), |p| { p.recover_vcs_conflict_marker(); - Ok((p.parse_use_tree()?, DUMMY_NODE_ID)) + + let mut attr_span = None; + let attrs = p.parse_outer_attributes()?; + if !attrs.is_empty() { + let raw_attrs = attrs.take_for_recovery(&p.psess); + attr_span = + Some(raw_attrs.first().unwrap().span.to(raw_attrs.last().unwrap().span)); + } + + let use_tree = p.parse_use_tree(use_token_span, prefix)?; + + if let Some(attr_span) = attr_span { + p.emit_error_attr_in_use_tree(use_token_span, prefix, use_tree.span(), attr_span); + } + + Ok((use_tree, DUMMY_NODE_ID)) }) .map(|(r, _)| r) } + fn emit_error_attr_in_use_tree( + &self, + use_token_span: Span, + mut prefix: Option<&UsePathList<'_>>, + use_tree_span: Span, + attr_span: Span, + ) { + let Ok(attr) = self.psess.source_map().span_to_snippet(attr_span) else { return }; + + let prefix: Vec<_> = { + let mut tmp = Vec::new(); + while let Some(prefix_) = prefix { + tmp.push(prefix_.elements); + prefix = prefix_.prev; + } + tmp.reverse(); + tmp.into_iter().flatten().collect() + }; + + let prefix: String = prefix + .iter() + .map(|seg| if seg.ident.name == kw::PathRoot { "" } else { seg.ident.as_str() }) + .intersperse("::") + .collect(); + + let mut comma_reached = false; + let Ok(tree_span) = self.psess.source_map().span_extend_while(use_tree_span, |c| { + if comma_reached { + return false; + } + comma_reached = c == ','; + c.is_whitespace() || comma_reached + }) else { + return; + }; + + let Ok(use_tree) = self.psess.source_map().span_to_snippet(use_tree_span) else { return }; + + // FIXME: duplicate the attributes that are at the root of the initial use-item. + let code = format!("{attr}\nuse {prefix}::{use_tree};\n"); + + self.dcx().emit_err(crate::diagnostics::AttrInUseTree { + attr_span, + sub: Some(crate::diagnostics::AttrInUseTreeSugg { + use_lo: use_token_span.shrink_to_lo(), + attr_span, + tree_span, + code, + }), + }); + } + fn parse_rename(&mut self) -> PResult<'a, Option> { if self.eat_keyword(exp!(As)) { self.parse_ident_or_underscore().map(Some) @@ -2737,7 +2818,13 @@ impl<'a> Parser<'a> { } } } + enum IsMacroRulesItem { Yes { has_bang: bool }, No, } + +struct UsePathList<'a> { + elements: &'a [ast::PathSegment], + prev: Option<&'a Self>, +} diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 38248013557a1..90459090ced87 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2335,10 +2335,12 @@ options! { parse_symbol_mangling_version, [TRACKED], "which mangling version to use for symbol names ('legacy', 'v0' (default), or 'hashed')"), target_cpu: Option = (None, parse_opt_string, [TRACKED] { TARGET_MODIFIER: TargetCpu }, - "select target processor (`rustc --print target-cpus` for details)"), + "select target processor (`rustc --print target-cpus` for details) \ + The resulting binary must only be executed on CPUs that have all the features \ + of the given CPU."), target_feature: String = (String::new(), parse_target_feature, [TRACKED], - "target specific attributes. (`rustc --print target-features` for details). \ - This feature is unsafe."), + "target-specific attributes (`rustc --print target-features` for details). \ + The resulting binary must only be executed on CPUs that have all the given features."), unsafe_allow_abi_mismatch: Vec = (Vec::new(), parse_comma_list, [UNTRACKED], "Allow incompatible target modifiers in dependency crates (comma separated list)"), // tidy-alphabetical-end diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 80d1bae71ae89..f394765ab9f8e 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -596,9 +596,13 @@ impl SourceMap { /// Extracts the source surrounding the given `Span` using the `extract_source` function. The /// extract function takes three arguments: a string slice containing the source, an index in /// the slice for the beginning of the span and an index in the slice for the end of the span. - pub fn span_to_source(&self, sp: Span, extract_source: F) -> Result + pub fn span_to_source( + &self, + sp: Span, + mut extract_source: F, + ) -> Result where - F: Fn(&str, usize, usize) -> Result, + F: FnMut(&str, usize, usize) -> Result, { let local_begin = self.lookup_byte_offset(sp.lo()); let local_end = self.lookup_byte_offset(sp.hi()); @@ -753,7 +757,7 @@ impl SourceMap { pub fn span_extend_while( &self, span: Span, - f: impl Fn(char) -> bool, + mut f: impl FnMut(char) -> bool, ) -> Result { self.span_to_source(span, |s, _start, end| { let n = s[end..].char_indices().find(|&(_, c)| !f(c)).map_or(s.len() - end, |(i, _)| i); diff --git a/compiler/rustc_target/src/callconv/s390x.rs b/compiler/rustc_target/src/callconv/s390x.rs index 581c1e2e862c5..f0d9675de34f4 100644 --- a/compiler/rustc_target/src/callconv/s390x.rs +++ b/compiler/rustc_target/src/callconv/s390x.rs @@ -42,6 +42,11 @@ where return; } + if arg.layout.is_complex_number(cx) { + arg.make_indirect(); + return; + } + let size = arg.layout.size; if size.bits() <= 128 { if let BackendRepr::SimdVector { .. } = arg.layout.backend_repr { diff --git a/library/coretests/tests/pattern.rs b/library/coretests/tests/pattern.rs index d4bec996d89a1..b5cd019c59e76 100644 --- a/library/coretests/tests/pattern.rs +++ b/library/coretests/tests/pattern.rs @@ -3,10 +3,10 @@ use std::str::pattern::*; // This macro makes it easier to write // tests that do a series of iterations macro_rules! search_asserts { - ($haystack:expr, $needle:expr, $testname:expr, [$($func:ident),*], $result:expr) => { + ($haystack:expr, $needle:expr, $testname:literal, $($func:ident => $result:expr),*) => { let mut searcher = $needle.into_searcher($haystack); - let arr = [$( Step::from(searcher.$func()) ),*]; - assert_eq!(&arr[..], &$result, $testname); + let arr = [$( searcher.$func().into_step(stringify!($func)) ),*]; + assert_eq!(&arr[..], &[$($result),*], $testname); } } @@ -17,26 +17,31 @@ enum Step { // be the same length for easy alignment Matches(usize, usize), Rejects(usize, usize), - InRange(usize, usize), Done, } -use self::Step::*; +use Step::*; -impl From for Step { - fn from(x: SearchStep) -> Self { - match x { - SearchStep::Match(a, b) => Matches(a, b), - SearchStep::Reject(a, b) => Rejects(a, b), +trait IntoStep { + fn into_step(self, method_name: &str) -> Step; +} + +impl IntoStep for SearchStep { + fn into_step(self, _name: &str) -> Step { + match self { + SearchStep::Match(s, e) => Matches(s, e), + SearchStep::Reject(s, e) => Rejects(s, e), SearchStep::Done => Done, } } } -impl From> for Step { - fn from(x: Option<(usize, usize)>) -> Self { - match x { - Some((a, b)) => InRange(a, b), +impl IntoStep for Option<(usize, usize)> { + fn into_step(self, method_name: &str) -> Step { + let is_reject = method_name.starts_with("next_reject"); + match self { + Some((s, e)) if is_reject => Rejects(s, e), + Some((s, e)) => Matches(s, e), None => Done, } } @@ -54,142 +59,134 @@ fn test_simple_iteration() { "abcdeabcd", 'a', "forward iteration for ASCII string", - // a b c d e a b c d EOF - [next, next, next, next, next, next, next, next, next, next], - [ - Matches(0, 1), - Rejects(1, 2), - Rejects(2, 3), - Rejects(3, 4), - Rejects(4, 5), - Matches(5, 6), - Rejects(6, 7), - Rejects(7, 8), - Rejects(8, 9), - Done - ] + next => Matches(0, 1), + next => Rejects(1, 2), + next => Rejects(2, 3), + next => Rejects(3, 4), + next => Rejects(4, 5), + next => Matches(5, 6), + next => Rejects(6, 7), + next => Rejects(7, 8), + next => Rejects(8, 9), + next => Done ); search_asserts!( "abcdeabcd", 'a', "reverse iteration for ASCII string", - // d c b a e d c b a EOF - [ - next_back, next_back, next_back, next_back, next_back, next_back, next_back, next_back, - next_back, next_back - ], - [ - Rejects(8, 9), - Rejects(7, 8), - Rejects(6, 7), - Matches(5, 6), - Rejects(4, 5), - Rejects(3, 4), - Rejects(2, 3), - Rejects(1, 2), - Matches(0, 1), - Done - ] + next_back => Rejects(8, 9), + next_back => Rejects(7, 8), + next_back => Rejects(6, 7), + next_back => Matches(5, 6), + next_back => Rejects(4, 5), + next_back => Rejects(3, 4), + next_back => Rejects(2, 3), + next_back => Rejects(1, 2), + next_back => Matches(0, 1), + next_back => Done ); search_asserts!( "我爱我的猫", '我', "forward iteration for Chinese string", - // 我 愛 我 的 貓 EOF - [next, next, next, next, next, next], - [Matches(0, 3), Rejects(3, 6), Matches(6, 9), Rejects(9, 12), Rejects(12, 15), Done] + next => Matches(0, 3), + next => Rejects(3, 6), + next => Matches(6, 9), + next => Rejects(9, 12), + next => Rejects(12, 15), + next => Done ); search_asserts!( "我的猫说meow", 'm', "forward iteration for mixed string", - // 我 的 猫 说 m e o w EOF - [next, next, next, next, next, next, next, next, next], - [ - Rejects(0, 3), - Rejects(3, 6), - Rejects(6, 9), - Rejects(9, 12), - Matches(12, 13), - Rejects(13, 14), - Rejects(14, 15), - Rejects(15, 16), - Done - ] + next => Rejects(0, 3), + next => Rejects(3, 6), + next => Rejects(6, 9), + next => Rejects(9, 12), + next => Matches(12, 13), + next => Rejects(13, 14), + next => Rejects(14, 15), + next => Rejects(15, 16), + next => Done ); search_asserts!( "我的猫说meow", '猫', "reverse iteration for mixed string", - // w o e m 说 猫 的 我 EOF - [ - next_back, next_back, next_back, next_back, next_back, next_back, next_back, next_back, - next_back - ], - [ - Rejects(15, 16), - Rejects(14, 15), - Rejects(13, 14), - Rejects(12, 13), - Rejects(9, 12), - Matches(6, 9), - Rejects(3, 6), - Rejects(0, 3), - Done - ] + next_back => Rejects(15, 16), + next_back => Rejects(14, 15), + next_back => Rejects(13, 14), + next_back => Rejects(12, 13), + next_back => Rejects(9, 12), + next_back => Matches(6, 9), + next_back => Rejects(3, 6), + next_back => Rejects(0, 3), + next_back => Done ); } +#[test] +fn backward_search_predicate() { + assert_eq!("abc".rfind(|c| c == 'a'), Some(0)); + assert_eq!("abcabc".rfind(|c| c == 'c'), Some(5)); + assert_eq!("éabc".rfind(['é']), Some(0)); + assert_eq!("éabc".rfind(|c| c == 'é'), Some(0)); + assert_eq!("éabcé".rfind(|c| c == 'é'), Some(5)); + assert_eq!("€abc".rfind(|c| c == '€'), Some(0)); + assert_eq!("😀abc".rfind(|c| c == '😀'), Some(0)); + + assert_eq!("abc".strip_suffix(|c| c == 'c'), Some("ab")); + assert_eq!("éabc".strip_suffix(|c| c == 'é'), None); +} + #[test] fn test_simple_search() { search_asserts!( "abcdeabcdeabcde", 'a', "next_match for ASCII string", - [next_match, next_match, next_match, next_match], - [InRange(0, 1), InRange(5, 6), InRange(10, 11), Done] + next_match => Matches(0, 1), + next_match => Matches(5, 6), + next_match => Matches(10, 11), + next_match => Done ); search_asserts!( "abcdeabcdeabcde", 'a', "next_match_back for ASCII string", - [next_match_back, next_match_back, next_match_back, next_match_back], - [InRange(10, 11), InRange(5, 6), InRange(0, 1), Done] + next_match_back => Matches(10, 11), + next_match_back => Matches(5, 6), + next_match_back => Matches(0, 1), + next_match_back => Done ); search_asserts!( "abcdeab", 'a', "next_reject for ASCII string", - [next_reject, next_reject, next_match, next_reject, next_reject], - [InRange(1, 2), InRange(2, 3), InRange(5, 6), InRange(6, 7), Done] + next_reject => Rejects(1, 2), + next_reject => Rejects(2, 3), + next_match => Matches(5, 6), + next_reject => Rejects(6, 7), + next_reject => Done ); search_asserts!( "abcdeabcdeabcde", 'a', "next_reject_back for ASCII string", - [ - next_reject_back, - next_reject_back, - next_match_back, - next_reject_back, - next_reject_back, - next_reject_back - ], - [ - InRange(14, 15), - InRange(13, 14), - InRange(10, 11), - InRange(9, 10), - InRange(8, 9), - InRange(7, 8) - ] + next_reject_back => Rejects(14, 15), + next_reject_back => Rejects(13, 14), + next_match_back => Matches(10, 11), + next_reject_back => Rejects(9, 10), + next_reject_back => Rejects(8, 9), + next_reject_back => Rejects(7, 8) ); } @@ -207,38 +204,58 @@ const STRESS: &str = "Áa🁀bÁꁁfg😁각กᘀ각aÁ각ꁁก😁a"; #[test] fn test_stress_indices() { // this isn't really a test, more of documentation on the indices of each character in the stresstest string + search_asserts!( + STRESS, + |_| true, + "Indices of characters in stress test", + next => Matches(0, 2), // Á + next => Matches(2, 3), // a + next => Matches(3, 7), // 🁀 + next => Matches(7, 8), // b + next => Matches(8, 10), // Á + next => Matches(10, 13), // ꁁ + next => Matches(13, 14), // f + next => Matches(14, 15), // g + next => Matches(15, 19), // 😀 + next => Matches(19, 22), // 각 + next => Matches(22, 25), // ก + next => Matches(25, 28), // ᘀ + next => Matches(28, 31), // 각 + next => Matches(31, 32), // a + next => Matches(32, 34), // Á + next => Matches(34, 37), // 각 + next => Matches(37, 40), // ꁁ + next => Matches(40, 43), // ก + next => Matches(43, 47), // 😀 + next => Matches(47, 48), // a + next => Done + ); search_asserts!( STRESS, 'x', "Indices of characters in stress test", - [ - next, next, next, next, next, next, next, next, next, next, next, next, next, next, - next, next, next, next, next, next, next - ], - [ - Rejects(0, 2), // Á - Rejects(2, 3), // a - Rejects(3, 7), // 🁀 - Rejects(7, 8), // b - Rejects(8, 10), // Á - Rejects(10, 13), // ꁁ - Rejects(13, 14), // f - Rejects(14, 15), // g - Rejects(15, 19), // 😀 - Rejects(19, 22), // 각 - Rejects(22, 25), // ก - Rejects(25, 28), // ᘀ - Rejects(28, 31), // 각 - Rejects(31, 32), // a - Rejects(32, 34), // Á - Rejects(34, 37), // 각 - Rejects(37, 40), // ꁁ - Rejects(40, 43), // ก - Rejects(43, 47), // 😀 - Rejects(47, 48), // a - Done - ] + next => Rejects(0, 2), // Á + next => Rejects(2, 3), // a + next => Rejects(3, 7), // 🁀 + next => Rejects(7, 8), // b + next => Rejects(8, 10), // Á + next => Rejects(10, 13), // ꁁ + next => Rejects(13, 14), // f + next => Rejects(14, 15), // g + next => Rejects(15, 19), // 😀 + next => Rejects(19, 22), // 각 + next => Rejects(22, 25), // ก + next => Rejects(25, 28), // ᘀ + next => Rejects(28, 31), // 각 + next => Rejects(31, 32), // a + next => Rejects(32, 34), // Á + next => Rejects(34, 37), // 각 + next => Rejects(37, 40), // ꁁ + next => Rejects(40, 43), // ก + next => Rejects(43, 47), // 😀 + next => Rejects(47, 48), // a + next => Done ); } @@ -248,96 +265,113 @@ fn test_forward_search_shared_bytes() { STRESS, 'Á', "Forward search for two-byte Latin character", - [next_match, next_match, next_match, next_match], - [InRange(0, 2), InRange(8, 10), InRange(32, 34), Done] + next_match => Matches(0, 2), + next_match => Matches(8, 10), + next_match => Matches(32, 34), + next_match => Done ); search_asserts!( STRESS, 'Á', "Forward search for two-byte Latin character; check if next() still works", - [next_match, next, next_match, next, next_match, next, next_match], - [ - InRange(0, 2), - Rejects(2, 3), - InRange(8, 10), - Rejects(10, 13), - InRange(32, 34), - Rejects(34, 37), - Done - ] + next_match => Matches(0, 2), + next => Rejects(2, 3), + next_match => Matches(8, 10), + next => Rejects(10, 13), + next_match => Matches(32, 34), + next => Rejects(34, 37), + next_match => Done ); search_asserts!( STRESS, '각', "Forward search for three-byte Hangul character", - [next_match, next, next_match, next_match, next_match], - [InRange(19, 22), Rejects(22, 25), InRange(28, 31), InRange(34, 37), Done] + next_match => Matches(19, 22), + next => Rejects(22, 25), + next_match => Matches(28, 31), + next_match => Matches(34, 37), + next_match => Done ); search_asserts!( STRESS, '각', "Forward search for three-byte Hangul character; check if next() still works", - [next_match, next, next_match, next, next_match, next, next_match], - [ - InRange(19, 22), - Rejects(22, 25), - InRange(28, 31), - Rejects(31, 32), - InRange(34, 37), - Rejects(37, 40), - Done - ] + next_match => Matches(19, 22), + next => Rejects(22, 25), + next_match => Matches(28, 31), + next => Rejects(31, 32), + next_match => Matches(34, 37), + next => Rejects(37, 40), + next_match => Done ); search_asserts!( STRESS, 'ก', "Forward search for three-byte Thai character", - [next_match, next, next_match, next, next_match], - [InRange(22, 25), Rejects(25, 28), InRange(40, 43), Rejects(43, 47), Done] + next_match => Matches(22, 25), + next => Rejects(25, 28), + next_match => Matches(40, 43), + next => Rejects(43, 47), + next_match => Done ); search_asserts!( STRESS, 'ก', "Forward search for three-byte Thai character; check if next() still works", - [next_match, next, next_match, next, next_match], - [InRange(22, 25), Rejects(25, 28), InRange(40, 43), Rejects(43, 47), Done] + next_match => Matches(22, 25), + next => Rejects(25, 28), + next_match => Matches(40, 43), + next => Rejects(43, 47), + next_match => Done ); search_asserts!( STRESS, '😁', "Forward search for four-byte emoji", - [next_match, next, next_match, next, next_match], - [InRange(15, 19), Rejects(19, 22), InRange(43, 47), Rejects(47, 48), Done] + next_match => Matches(15, 19), + next => Rejects(19, 22), + next_match => Matches(43, 47), + next => Rejects(47, 48), + next_match => Done ); search_asserts!( STRESS, '😁', "Forward search for four-byte emoji; check if next() still works", - [next_match, next, next_match, next, next_match], - [InRange(15, 19), Rejects(19, 22), InRange(43, 47), Rejects(47, 48), Done] + next_match => Matches(15, 19), + next => Rejects(19, 22), + next_match => Matches(43, 47), + next => Rejects(47, 48), + next_match => Done ); search_asserts!( STRESS, 'ꁁ', "Forward search for three-byte Yi character with repeated bytes", - [next_match, next, next_match, next, next_match], - [InRange(10, 13), Rejects(13, 14), InRange(37, 40), Rejects(40, 43), Done] + next_match => Matches(10, 13), + next => Rejects(13, 14), + next_match => Matches(37, 40), + next => Rejects(40, 43), + next_match => Done ); search_asserts!( STRESS, 'ꁁ', "Forward search for three-byte Yi character with repeated bytes; check if next() still works", - [next_match, next, next_match, next, next_match], - [InRange(10, 13), Rejects(13, 14), InRange(37, 40), Rejects(40, 43), Done] + next_match => Matches(10, 13), + next => Rejects(13, 14), + next_match => Matches(37, 40), + next => Rejects(40, 43), + next_match => Done ); } @@ -347,96 +381,112 @@ fn test_reverse_search_shared_bytes() { STRESS, 'Á', "Reverse search for two-byte Latin character", - [next_match_back, next_match_back, next_match_back, next_match_back], - [InRange(32, 34), InRange(8, 10), InRange(0, 2), Done] + next_match_back => Matches(32, 34), + next_match_back => Matches(8, 10), + next_match_back => Matches(0, 2), + next_match_back => Done ); search_asserts!( STRESS, 'Á', "Reverse search for two-byte Latin character; check if next_back() still works", - [next_match_back, next_back, next_match_back, next_back, next_match_back, next_back], - [InRange(32, 34), Rejects(31, 32), InRange(8, 10), Rejects(7, 8), InRange(0, 2), Done] + next_match_back => Matches(32, 34), + next_back => Rejects(31, 32), + next_match_back => Matches(8, 10), + next_back => Rejects(7, 8), + next_match_back => Matches(0, 2), + next_back => Done ); search_asserts!( STRESS, '각', "Reverse search for three-byte Hangul character", - [next_match_back, next_back, next_match_back, next_match_back, next_match_back], - [InRange(34, 37), Rejects(32, 34), InRange(28, 31), InRange(19, 22), Done] + next_match_back => Matches(34, 37), + next_back => Rejects(32, 34), + next_match_back => Matches(28, 31), + next_match_back => Matches(19, 22), + next_match_back => Done ); search_asserts!( STRESS, '각', "Reverse search for three-byte Hangul character; check if next_back() still works", - [ - next_match_back, - next_back, - next_match_back, - next_back, - next_match_back, - next_back, - next_match_back - ], - [ - InRange(34, 37), - Rejects(32, 34), - InRange(28, 31), - Rejects(25, 28), - InRange(19, 22), - Rejects(15, 19), - Done - ] + next_match_back => Matches(34, 37), + next_back => Rejects(32, 34), + next_match_back => Matches(28, 31), + next_back => Rejects(25, 28), + next_match_back => Matches(19, 22), + next_back => Rejects(15, 19), + next_match_back => Done ); search_asserts!( STRESS, 'ก', "Reverse search for three-byte Thai character", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(40, 43), Rejects(37, 40), InRange(22, 25), Rejects(19, 22), Done] + next_match_back => Matches(40, 43), + next_back => Rejects(37, 40), + next_match_back => Matches(22, 25), + next_back => Rejects(19, 22), + next_match_back => Done ); search_asserts!( STRESS, 'ก', "Reverse search for three-byte Thai character; check if next_back() still works", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(40, 43), Rejects(37, 40), InRange(22, 25), Rejects(19, 22), Done] + next_match_back => Matches(40, 43), + next_back => Rejects(37, 40), + next_match_back => Matches(22, 25), + next_back => Rejects(19, 22), + next_match_back => Done ); search_asserts!( STRESS, '😁', "Reverse search for four-byte emoji", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(43, 47), Rejects(40, 43), InRange(15, 19), Rejects(14, 15), Done] + next_match_back => Matches(43, 47), + next_back => Rejects(40, 43), + next_match_back => Matches(15, 19), + next_back => Rejects(14, 15), + next_match_back => Done ); search_asserts!( STRESS, '😁', "Reverse search for four-byte emoji; check if next_back() still works", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(43, 47), Rejects(40, 43), InRange(15, 19), Rejects(14, 15), Done] + next_match_back => Matches(43, 47), + next_back => Rejects(40, 43), + next_match_back => Matches(15, 19), + next_back => Rejects(14, 15), + next_match_back => Done ); search_asserts!( STRESS, 'ꁁ', "Reverse search for three-byte Yi character with repeated bytes", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(37, 40), Rejects(34, 37), InRange(10, 13), Rejects(8, 10), Done] + next_match_back => Matches(37, 40), + next_back => Rejects(34, 37), + next_match_back => Matches(10, 13), + next_back => Rejects(8, 10), + next_match_back => Done ); search_asserts!( STRESS, 'ꁁ', "Reverse search for three-byte Yi character with repeated bytes; check if next_back() still works", - [next_match_back, next_back, next_match_back, next_back, next_match_back], - [InRange(37, 40), Rejects(34, 37), InRange(10, 13), Rejects(8, 10), Done] + next_match_back => Matches(37, 40), + next_back => Rejects(34, 37), + next_match_back => Matches(10, 13), + next_back => Rejects(8, 10), + next_match_back => Done ); } @@ -448,56 +498,77 @@ fn double_ended_regression_test() { "abcdeabcdeabcde", 'a', "alternating double ended search", - [next_match, next_match_back, next_match, next_match_back], - [InRange(0, 1), InRange(10, 11), InRange(5, 6), Done] + next_match => Matches(0, 1), + next_match_back => Matches(10, 11), + next_match => Matches(5, 6), + next_match_back => Done ); search_asserts!( "abcdeabcdeabcde", 'a', "triple double ended search for a", - [next_match, next_match_back, next_match_back, next_match_back], - [InRange(0, 1), InRange(10, 11), InRange(5, 6), Done] + next_match => Matches(0, 1), + next_match_back => Matches(10, 11), + next_match_back => Matches(5, 6), + next_match_back => Done ); search_asserts!( "abcdeabcdeabcde", 'd', "triple double ended search for d", - [next_match, next_match_back, next_match_back, next_match_back], - [InRange(3, 4), InRange(13, 14), InRange(8, 9), Done] + next_match => Matches(3, 4), + next_match_back => Matches(13, 14), + next_match_back => Matches(8, 9), + next_match_back => Done ); search_asserts!( STRESS, 'Á', "Double ended search for two-byte Latin character", - [next_match, next_match_back, next_match, next_match_back], - [InRange(0, 2), InRange(32, 34), InRange(8, 10), Done] + next_match => Matches(0, 2), + next_match_back => Matches(32, 34), + next_match => Matches(8, 10), + next_match_back => Done ); search_asserts!( STRESS, '각', "Reverse double ended search for three-byte Hangul character", - [next_match_back, next_back, next_match, next, next_match_back, next_match], - [InRange(34, 37), Rejects(32, 34), InRange(19, 22), Rejects(22, 25), InRange(28, 31), Done] + next_match_back => Matches(34, 37), + next_back => Rejects(32, 34), + next_match => Matches(19, 22), + next => Rejects(22, 25), + next_match_back => Matches(28, 31), + next_match => Done ); search_asserts!( STRESS, 'ก', "Double ended search for three-byte Thai character", - [next_match, next_back, next, next_match_back, next_match], - [InRange(22, 25), Rejects(47, 48), Rejects(25, 28), InRange(40, 43), Done] + next_match => Matches(22, 25), + next_back => Rejects(47, 48), + next => Rejects(25, 28), + next_match_back => Matches(40, 43), + next_match => Done ); search_asserts!( STRESS, '😁', "Double ended search for four-byte emoji", - [next_match_back, next, next_match, next_back, next_match], - [InRange(43, 47), Rejects(0, 2), InRange(15, 19), Rejects(40, 43), Done] + next_match_back => Matches(43, 47), + next => Rejects(0, 2), + next_match => Matches(15, 19), + next_back => Rejects(40, 43), + next_match => Done ); search_asserts!( STRESS, 'ꁁ', "Double ended search for three-byte Yi character with repeated bytes", - [next_match, next, next_match_back, next_back, next_match], - [InRange(10, 13), Rejects(13, 14), InRange(37, 40), Rejects(34, 37), Done] + next_match => Matches(10, 13), + next => Rejects(13, 14), + next_match_back => Matches(37, 40), + next_back => Rejects(34, 37), + next_match => Done ); } diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 0702148957695..1e46ddb99e010 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -3590,7 +3590,7 @@ impl DirBuilder { fn create_dir_all(&self, path: &Path) -> io::Result<()> { // if path's parent is None, it is "/" path, which should // return Ok immediately - if path == Path::new("") || path.parent() == None { + if path.is_empty() || path.parent() == None { return Ok(()); } @@ -3601,7 +3601,7 @@ impl DirBuilder { // for relative paths like "foo/bar", the parent of // "foo" will be "" which there's no need to invoke // a mkdir syscall on - if ancestor == Path::new("") || ancestor.parent() == None { + if ancestor.is_empty() || ancestor.parent() == None { break; } diff --git a/library/std/src/sys/os_str/bytes.rs b/library/std/src/sys/os_str/bytes.rs index a57da01a5d85d..048e5def1369b 100644 --- a/library/std/src/sys/os_str/bytes.rs +++ b/library/std/src/sys/os_str/bytes.rs @@ -16,12 +16,12 @@ mod tests; #[derive(Hash)] #[repr(transparent)] -pub struct Buf { +pub(crate) struct Buf { pub inner: Vec, } #[repr(transparent)] -pub struct Slice { +pub(crate) struct Slice { pub inner: [u8], } diff --git a/library/std/src/sys/os_str/mod.rs b/library/std/src/sys/os_str/mod.rs index f7007cbf18b4c..dd37b558a096e 100644 --- a/library/std/src/sys/os_str/mod.rs +++ b/library/std/src/sys/os_str/mod.rs @@ -3,14 +3,14 @@ cfg_select! { any(target_os = "windows", target_os = "uefi") => { mod wtf8; - pub use wtf8::{Buf, Slice}; + pub(crate) use wtf8::{Buf, Slice}; } any(target_os = "motor") => { mod utf8; - pub use utf8::{Buf, Slice}; + pub(crate) use utf8::{Buf, Slice}; } _ => { mod bytes; - pub use bytes::{Buf, Slice}; + pub(crate) use bytes::{Buf, Slice}; } } diff --git a/library/std/src/sys/os_str/utf8.rs b/library/std/src/sys/os_str/utf8.rs index 289f58aa480f7..3648962da5eeb 100644 --- a/library/std/src/sys/os_str/utf8.rs +++ b/library/std/src/sys/os_str/utf8.rs @@ -11,12 +11,12 @@ use crate::{fmt, mem}; #[derive(Hash)] #[repr(transparent)] -pub struct Buf { +pub(crate) struct Buf { pub inner: String, } #[repr(transparent)] -pub struct Slice { +pub(crate) struct Slice { pub inner: str, } diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs index 9a32ab3f3ea12..5f9d64dc5d09c 100644 --- a/library/std/src/sys/os_str/wtf8.rs +++ b/library/std/src/sys/os_str/wtf8.rs @@ -13,12 +13,12 @@ use crate::{fmt, mem}; #[derive(Hash)] #[repr(transparent)] -pub struct Buf { +pub(crate) struct Buf { pub inner: Wtf8Buf, } #[repr(transparent)] -pub struct Slice { +pub(crate) struct Slice { pub inner: Wtf8, } diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 94c886649109f..e29e112b5ff39 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -285,7 +285,7 @@ fn try_download_ci_llvm(builder: &Builder<'_>, target: TargetSelection) -> Optio Some(DownloadedLlvm { output: LlvmOutput { - host_llvm_config: ci_llvm.join("bin").join("llvm-config"), + host_llvm_config: ci_llvm.join("bin").join(exe("llvm-config", builder.host_target)), link_shared, llvm_root_dir: ci_llvm, kind: LlvmKind::DownloadedFromCi, diff --git a/tests/codegen-llvm/complex-abi.rs b/tests/codegen-llvm/complex-abi.rs index bb1d6affd10c4..81d93b704ee1c 100644 --- a/tests/codegen-llvm/complex-abi.rs +++ b/tests/codegen-llvm/complex-abi.rs @@ -21,43 +21,47 @@ //@ [WIN32_GNU] compile-flags: --target i686-pc-windows-gnu //@ [WIN32_GNU] needs-llvm-components: x86 -// FIXME: the below revisions are deliberately disabled for now. +//@ revisions: AARCH64 AARCH64_DARWIN AARCH64_MSVC ARM64EC +//@ [AARCH64] compile-flags: --target aarch64-unknown-linux-gnu +//@ [AARCH64] needs-llvm-components: aarch64 +//@ [AARCH64_DARWIN] compile-flags: --target aarch64-apple-darwin +//@ [AARCH64_DARWIN] needs-llvm-components: aarch64 +//@ [AARCH64_MSVC] compile-flags: --target aarch64-pc-windows-msvc +//@ [AARCH64_MSVC] needs-llvm-components: aarch64 +//@ [ARM64EC] compile-flags: --target arm64ec-pc-windows-msvc +//@ [ARM64EC] needs-llvm-components: aarch64 + +//@ revisions: ARM +//@ [ARM] compile-flags: --target arm-unknown-linux-gnueabihf +//@ [ARM] needs-llvm-components: arm -// revisions: AARCH64 AARCH64_DARWIN AARCH64_MSVC ARM64EC -// [AARCH64] compile-flags: --target aarch64-unknown-linux-gnu -// [AARCH64] needs-llvm-components: aarch64 -// [AARCH64_DARWIN] compile-flags: --target aarch64-apple-darwin -// [AARCH64_DARWIN] needs-llvm-components: aarch64 -// [AARCH64_MSVC] compile-flags: --target aarch64-pc-windows-msvc -// [AARCH64_MSVC] needs-llvm-components: aarch64 -// [ARM64EC] compile-flags: --target arm64ec-pc-windows-msvc -// [ARM64EC] needs-llvm-components: aarch64 +//@ revisions: RISCV64 RISCV32 +//@ [RISCV64] compile-flags: --target riscv64gc-unknown-linux-gnu +//@ [RISCV64] needs-llvm-components: riscv +//@ [RISCV32] compile-flags: --target riscv32gc-unknown-linux-gnu +//@ [RISCV32] needs-llvm-components: riscv -// revisions: ARM -// [ARM] compile-flags: --target arm-unknown-linux-gnueabihf -// [ARM] needs-llvm-components: arm +//@ revisions: LOONGARCH64 LOONGARCH32 +//@ [LOONGARCH64] compile-flags: --target loongarch64-unknown-linux-gnu +//@ [LOONGARCH64] needs-llvm-components: loongarch +//@ [LOONGARCH32] compile-flags: --target loongarch32-unknown-none +//@ [LOONGARCH32] needs-llvm-components: loongarch -// revisions: RISCV64 RISCV32 -// [RISCV64] compile-flags: --target riscv64gc-unknown-linux-gnu -// [RISCV64] needs-llvm-components: riscv -// [RISCV32] compile-flags: --target riscv32gc-unknown-linux-gnu -// [RISCV32] needs-llvm-components: riscv +//@ revisions: S390X +//@ [S390X] compile-flags: --target s390x-unknown-linux-gnu +//@ [S390X] needs-llvm-components: systemz -// revisions: LOONGARCH64 LOONGARCH32 -// [LOONGARCH64] compile-flags: --target loongarch64-unknown-linux-gnu -// [LOONGARCH64] needs-llvm-components: loongarch -// [LOONGARCH32] compile-flags: --target loongarch32-unknown-none -// [LOONGARCH32] needs-llvm-components: loongarch +//@ revisions: WASM32 WASM64 +//@ [WASM32] compile-flags: --target wasm32-unknown-unknown +//@ [WASM32] needs-llvm-components: webassembly +//@ [WASM64] compile-flags: --target wasm64-unknown-unknown +//@ [WASM64] needs-llvm-components: webassembly -// revisions: SPARC64 SPARC -// [SPARC64] compile-flags: --target sparc64-unknown-linux-gnu -// [SPARC64] needs-llvm-components: sparc -// [SPARC] compile-flags: --target sparc-unknown-linux-gnu -// [SPARC] needs-llvm-components: sparc +//@ revisions: CSKY +//@ [CSKY] compile-flags: --target csky-unknown-linux-gnuabiv2 +//@ [CSKY] needs-llvm-components: csky -// revisions: S390X -// [S390X] compile-flags: --target s390x-unknown-linux-gnu -// [S390X] needs-llvm-components: systemz +// FIXME: the below revisions are deliberately disabled for now. // revisions: POWERPC POWERPC64LE POWERPC64 AIX // [POWERPC] compile-flags: --target powerpc-unknown-linux-gnu @@ -75,16 +79,6 @@ // [MIPS] compile-flags: --target mips-unknown-linux-gnu // [MIPS] needs-llvm-components: mips -// revisions: WASM32 WASM64 -// [WASM32] compile-flags: --target wasm32-unknown-unknown -// [WASM32] needs-llvm-components: webassembly -// [WASM64] compile-flags: --target wasm64-unknown-unknown -// [WASM64] needs-llvm-components: webassembly - -// revisions: CSKY -// [CSKY] compile-flags: --target csky-unknown-linux-gnuabiv2 -// [CSKY] needs-llvm-components: csky - // revisions: NVPTX // [NVPTX] compile-flags: --target nvptx64-nvidia-cuda // [NVPTX] needs-llvm-components: nvptx @@ -103,18 +97,18 @@ use minicore::num::Complex; #[no_mangle] pub extern "C" fn cplx_f16(x: Complex) -> Complex { - // AARCH64: define{{.*}} { half, half } @cplx_f16([2 x half] {{.*}}) - // AARCH64_DARWIN: define{{.*}} { half, half } @cplx_f16([2 x half] {{.*}}) - // AARCH64_MSVC: define{{.*}} { half, half } @cplx_f16([2 x half] {{.*}}) - // ARM64EC: define{{.*}} { half, half } @cplx_f16([2 x half] {{.*}}) - // ARM: define{{.*}} i32 @cplx_f16([1 x i32] {{.*}}) + // AARCH64: define{{.*}} [2 x half] @cplx_f16([2 x half] {{.*}}) + // AARCH64_DARWIN: define{{.*}} [2 x half] @cplx_f16([2 x half] {{.*}}) + // AARCH64_MSVC: define{{.*}} [2 x half] @cplx_f16([2 x half] {{.*}}) + // ARM64EC: define{{.*}} [2 x half] @cplx_f16([2 x half] {{.*}}) + // ARM: define{{.*}} [2 x half] @cplx_f16([2 x half] {{.*}}) // I686: define{{.*}} <2 x half> @cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} { half, half } @cplx_f16(half {{.*}}, half {{.*}}) - // LOONGARCH64: define{{.*}} { half, half } @cplx_f16(half {{.*}}, half {{.*}}) + // LOONGARCH32: define{{.*}} { half, half } @cplx_f16({ half, half } {{.*}}) + // LOONGARCH64: define{{.*}} { half, half } @cplx_f16({ half, half } {{.*}}) // NVPTX: define{{.*}} { half, half } @cplx_f16(ptr {{.*}} byval({ half, half }) {{.*}}) - // RISCV32: define{{.*}} { half, half } @cplx_f16(half {{.*}}, half {{.*}}) - // RISCV64: define{{.*}} { half, half } @cplx_f16(half {{.*}}, half {{.*}}) - // S390X: define{{.*}} void @cplx_f16(ptr {{.*}} sret({ half, half }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} { half, half } @cplx_f16({ half, half } {{.*}}) + // RISCV64: define{{.*}} { half, half } @cplx_f16({ half, half } {{.*}}) + // S390X: define{{.*}} void @cplx_f16(ptr {{.*}} sret([4 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} <2 x half> @cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} <2 x half> @cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i32 @cplx_f16(i32 {{.*}}) @@ -125,30 +119,30 @@ pub extern "C" fn cplx_f16(x: Complex) -> Complex { #[no_mangle] pub extern "C" fn cplx_f32(x: Complex) -> Complex { - // AARCH64: define{{.*}} { float, float } @cplx_f32([2 x float] {{.*}}) - // AARCH64_DARWIN: define{{.*}} { float, float } @cplx_f32([2 x float] {{.*}}) - // AARCH64_MSVC: define{{.*}} { float, float } @cplx_f32([2 x float] {{.*}}) + // AARCH64: define{{.*}} [2 x float] @cplx_f32([2 x float] {{.*}}) + // AARCH64_DARWIN: define{{.*}} [2 x float] @cplx_f32([2 x float] {{.*}}) + // AARCH64_MSVC: define{{.*}} [2 x float] @cplx_f32([2 x float] {{.*}}) // AIX: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) - // ARM64EC: define{{.*}} { float, float } @cplx_f32([2 x float] {{.*}}) - // ARM: define{{.*}} { float, float } @cplx_f32({ float, float } {{.*}}) + // ARM64EC: define{{.*}} [2 x float] @cplx_f32([2 x float] {{.*}}) + // ARM: define{{.*}} [2 x float] @cplx_f32([2 x float] {{.*}}) // BPF: define{{.*}} void @cplx_f32(ptr {{.*}} sret({ float, float }) {{.*}}, i64 {{.*}}) // CSKY: define{{.*}} [2 x i32] @cplx_f32([2 x i32] {{.*}}) // I686: define{{.*}} i64 @cplx_f32(ptr {{.*}} byval([8 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) - // LOONGARCH64: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) + // LOONGARCH32: define{{.*}} { float, float } @cplx_f32({ float, float } {{.*}}) + // LOONGARCH64: define{{.*}} { float, float } @cplx_f32({ float, float } {{.*}}) // MIPS64EL: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) - // MIPS: define{{.*}} { float, float } @cplx_f32(i32 {{.*}}, i32 {{.*}}) + // MIPS: define{{.*}} { float, float } @cplx_f32([2 x i32] {{.*}}) // NVPTX: define{{.*}} { float, float } @cplx_f32(ptr {{.*}} byval({ float, float }) {{.*}}) // POWERPC64: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) // POWERPC64LE: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) // POWERPC: define{{.*}} void @cplx_f32(ptr {{.*}} sret({ float, float }) {{.*}}, ptr {{.*}} byval({ float, float }) {{.*}}) - // RISCV32: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) - // RISCV64: define{{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) - // S390X: define{{.*}} void @cplx_f32(ptr {{.*}} sret({ float, float }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} { float, float } @cplx_f32({ float, float } {{.*}}) + // RISCV64: define{{.*}} { float, float } @cplx_f32({ float, float } {{.*}}) + // S390X: define{{.*}} void @cplx_f32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} {{.*}} { float, float } @cplx_f32(float {{.*}}, float {{.*}}) // SPARC: define{{.*}} { float, float } @cplx_f32(ptr {{.*}} byval({ float, float }) {{.*}}) - // WASM32: define{{.*}} void @cplx_f32(ptr {{.*}} sret({ float, float }) {{.*}}, ptr {{.*}} byval({ float, float }) {{.*}}) - // WASM64: define{{.*}} void @cplx_f32(ptr {{.*}} sret({ float, float }) {{.*}}, ptr {{.*}} byval({ float, float }) {{.*}}) + // WASM32: define{{.*}} void @cplx_f32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_f32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} i64 @cplx_f32(ptr {{.*}} byval([8 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} i64 @cplx_f32(ptr {{.*}} byval([8 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i64 @cplx_f32(i64 {{.*}}) @@ -159,30 +153,30 @@ pub extern "C" fn cplx_f32(x: Complex) -> Complex { #[no_mangle] pub extern "C" fn cplx_f64(x: Complex) -> Complex { - // AARCH64: define{{.*}} { double, double } @cplx_f64([2 x double] {{.*}}) - // AARCH64_DARWIN: define{{.*}} { double, double } @cplx_f64([2 x double] {{.*}}) - // AARCH64_MSVC: define{{.*}} { double, double } @cplx_f64([2 x double] {{.*}}) + // AARCH64: define{{.*}} [2 x double] @cplx_f64([2 x double] {{.*}}) + // AARCH64_DARWIN: define{{.*}} [2 x double] @cplx_f64([2 x double] {{.*}}) + // AARCH64_MSVC: define{{.*}} [2 x double] @cplx_f64([2 x double] {{.*}}) // AIX: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) - // ARM64EC: define{{.*}} { double, double } @cplx_f64([2 x double] {{.*}}) - // ARM: define{{.*}} { double, double } @cplx_f64({ double, double } {{.*}}) + // ARM64EC: define{{.*}} [2 x double] @cplx_f64([2 x double] {{.*}}) + // ARM: define{{.*}} [2 x double] @cplx_f64([2 x double] {{.*}}) // BPF: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, [2 x i64] {{.*}}) - // CSKY: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, [4 x i32] {{.*}}) + // CSKY: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, [4 x i32] {{.*}}) // I686: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) - // LOONGARCH64: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) + // LOONGARCH32: define{{.*}} { double, double } @cplx_f64({ double, double } {{.*}}) + // LOONGARCH64: define{{.*}} { double, double } @cplx_f64({ double, double } {{.*}}) // MIPS64EL: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) // MIPS: define{{.*}} { double, double } @cplx_f64(i32 {{.*}}, i32 {{.*}}, i32 {{.*}}, i32 {{.*}}) // NVPTX: define{{.*}} { double, double } @cplx_f64(ptr {{.*}} byval({ double, double }) {{.*}}) // POWERPC64: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) // POWERPC64LE: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) // POWERPC: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, ptr {{.*}} byval({ double, double }) {{.*}}) - // RISCV32: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) - // RISCV64: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) - // S390X: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} { double, double } @cplx_f64({ double, double } {{.*}}) + // RISCV64: define{{.*}} { double, double } @cplx_f64({ double, double } {{.*}}) + // S390X: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} { double, double } @cplx_f64(double {{.*}}, double {{.*}}) // SPARC: define{{.*}} { double, double } @cplx_f64(ptr {{.*}} byval({ double, double }) {{.*}}) - // WASM32: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, ptr {{.*}} byval({ double, double }) {{.*}}) - // WASM64: define{{.*}} void @cplx_f64(ptr {{.*}} sret({ double, double }) {{.*}}, ptr {{.*}} byval({ double, double }) {{.*}}) + // WASM32: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} void @cplx_f64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) @@ -193,41 +187,44 @@ pub extern "C" fn cplx_f64(x: Complex) -> Complex { #[no_mangle] pub extern "C" fn cplx_f128(x: Complex) -> Complex { + // AARCH64: define{{.*}} [2 x fp128] {{.*}}) // I686: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}} byval([32 x i8]) {{.*}}) - // WASM32: define{{.*}} void @cplx_f128(ptr {{.*}} sret({ fp128, fp128 }) {{.*}}, ptr {{.*}} byval({ fp128, fp128 }) {{.*}}) - // WASM64: define{{.*}} void @cplx_f128(ptr {{.*}} sret({ fp128, fp128 }) {{.*}}, ptr {{.*}} byval({ fp128, fp128 }) {{.*}}) + // WASM32: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}} byval([32 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}}) // X86_64: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}} byval([32 x i8]) {{.*}}) + // LOONGARCH64: define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}}) + // RISCV64 define{{.*}} void @cplx_f128(ptr {{.*}} sret([32 x i8]) {{.*}}, ptr {{.*}}) x } #[no_mangle] pub extern "C" fn cplx_i8(x: Complex) -> Complex { - // AARCH64: define{{.*}} i16 @cplx_i8(i64{{.*}}) - // AARCH64_DARWIN: define{{.*}} i16 @cplx_i8(i64{{.*}}) - // AARCH64_MSVC: define{{.*}} i16 @cplx_i8(i64{{.*}}) + // AARCH64: define{{.*}} i64 @cplx_i8(i64{{.*}}) + // AARCH64_DARWIN: define{{.*}} i64 @cplx_i8(i64{{.*}}) + // AARCH64_MSVC: define{{.*}} i64 @cplx_i8(i64{{.*}}) // AIX: define{{.*}} { i8, i8 } @cplx_i8(i8 {{.*}}, i8 {{.*}}) - // ARM64EC: define{{.*}} i16 @cplx_i8(i64{{.*}}) - // ARM: define{{.*}} i16 @cplx_i8([1 x i32]{{.*}}) + // ARM64EC: define{{.*}} i64 @cplx_i8(i64{{.*}}) + // ARM: define{{.*}} i32 @cplx_i8(i32{{.*}}) // BPF: define{{.*}} void @cplx_i8(ptr {{.*}} sret({ i8, i8 }) {{.*}}, i16 {{.*}}) - // CSKY: define{{.*}} {{.*}} i32 @cplx_i8(i32{{.*}}) + // CSKY: define{{.*}} i32 @cplx_i8(i32{{.*}}) // I686: define{{.*}} i16 @cplx_i8(ptr {{.*}} byval([2 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} {{.*}} i32 @cplx_i8(i32{{.*}}) - // LOONGARCH64: define{{.*}} {{.*}} i64 @cplx_i8(i64{{.*}}) + // LOONGARCH32: define{{.*}} i32 @cplx_i8(i32{{.*}}) + // LOONGARCH64: define{{.*}} i64 @cplx_i8(i64{{.*}}) // MIPS64EL: define{{.*}} { i8, i8 } @cplx_i8(i16 {{.*}}) // MIPS: define{{.*}} { i8, i8 } @cplx_i8(i16 {{.*}}) // NVPTX: define{{.*}} { i8, i8 } @cplx_i8(ptr {{.*}} byval({ i8, i8 }) {{.*}}) // POWERPC64: define{{.*}} { i8, i8 } @cplx_i8(i8 {{.*}}, i8 {{.*}}) // POWERPC64LE: define{{.*}} { i8, i8 } @cplx_i8(i8 {{.*}}, i8 {{.*}}) // POWERPC: define{{.*}} void @cplx_i8(ptr {{.*}} sret({ i8, i8 }) {{.*}}, ptr {{.*}} byval({ i8, i8 }) {{.*}}) - // RISCV32: define{{.*}} {{.*}} i32 @cplx_i8(i32{{.*}}) - // RISCV64: define{{.*}} {{.*}} i64 @cplx_i8(i64{{.*}}) - // S390X: define{{.*}} void @cplx_i8(ptr {{.*}} sret({ i8, i8 }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} i32 @cplx_i8(i32{{.*}}) + // RISCV64: define{{.*}} i64 @cplx_i8(i64{{.*}}) + // S390X: define{{.*}} void @cplx_i8(ptr {{.*}} sret([2 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} {{.*}} i64 @cplx_i8(i64{{.*}}) // SPARC: define{{.*}} { i8, i8 } @cplx_i8(ptr {{.*}} byval({ i8, i8 }) {{.*}}) - // WASM32: define{{.*}} void @cplx_i8(ptr {{.*}} sret({ i8, i8 }) {{.*}}, ptr {{.*}} byval({ i8, i8 }) {{.*}}) - // WASM64: define{{.*}} void @cplx_i8(ptr {{.*}} sret({ i8, i8 }) {{.*}}, ptr {{.*}} byval({ i8, i8 }) {{.*}}) + // WASM32: define{{.*}} void @cplx_i8(ptr {{.*}} sret([2 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_i8(ptr {{.*}} sret([2 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} i16 @cplx_i8(ptr {{.*}} byval([2 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} i16 @cplx_i8(ptr {{.*}} byval([2 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i16 @cplx_i8(i16 {{.*}}) @@ -238,17 +235,17 @@ pub extern "C" fn cplx_i8(x: Complex) -> Complex { #[no_mangle] pub extern "C" fn cplx_i16(x: Complex) -> Complex { - // AARCH64: define{{.*}} i32 @cplx_i16(i64{{.*}}) - // AARCH64_DARWIN: define{{.*}} i32 @cplx_i16(i64{{.*}}) - // AARCH64_MSVC: define{{.*}} i32 @cplx_i16(i64{{.*}}) + // AARCH64: define{{.*}} i64 @cplx_i16(i64{{.*}}) + // AARCH64_DARWIN: define{{.*}} i64 @cplx_i16(i64{{.*}}) + // AARCH64_MSVC: define{{.*}} i64 @cplx_i16(i64{{.*}}) // AIX: define{{.*}} { i16, i16 } @cplx_i16(i16 {{.*}}, i16 {{.*}}) - // ARM64EC: define{{.*}} i32 @cplx_i16(i64{{.*}}) - // ARM: define{{.*}} i32 @cplx_i16([1 x i32] {{.*}}) + // ARM64EC: define{{.*}} i64 @cplx_i16(i64{{.*}}) + // ARM: define{{.*}} i32 @cplx_i16(i32{{.*}}) // BPF: define{{.*}} void @cplx_i16(ptr {{.*}} sret({ i16, i16 }) {{.*}}, i32 {{.*}}) // CSKY: define{{.*}} i32 @cplx_i16(i32 {{.*}}) // I686: define{{.*}} i32 @cplx_i16(ptr {{.*}} byval([4 x i8]) {{.*}}) // LOONGARCH32: define{{.*}} i32 @cplx_i16(i32 {{.*}}) - // LOONGARCH64: define{{.*}} {{.*}} i64 @cplx_i16(i64{{.*}}) + // LOONGARCH64: define{{.*}} i64 @cplx_i16(i64{{.*}}) // MIPS64EL: define{{.*}} { i16, i16 } @cplx_i16(i32 {{.*}}) // MIPS: define{{.*}} { i16, i16 } @cplx_i16(i32 {{.*}}) // NVPTX: define{{.*}} { i16, i16 } @cplx_i16(ptr {{.*}} byval({ i16, i16 }) {{.*}}) @@ -256,12 +253,12 @@ pub extern "C" fn cplx_i16(x: Complex) -> Complex { // POWERPC64LE: define{{.*}} { i16, i16 } @cplx_i16(i16 {{.*}}, i16 {{.*}}) // POWERPC: define{{.*}} void @cplx_i16(ptr {{.*}} sret({ i16, i16 }) {{.*}}, ptr {{.*}} byval({ i16, i16 }) {{.*}}) // RISCV32: define{{.*}} i32 @cplx_i16(i32 {{.*}}) - // RISCV64: define{{.*}} {{.*}} i64 @cplx_i16(i64{{.*}}) - // S390X: define{{.*}} void @cplx_i16(ptr {{.*}} sret({ i16, i16 }) {{.*}}, ptr {{.*}}) + // RISCV64: define{{.*}} i64 @cplx_i16(i64{{.*}}) + // S390X: define{{.*}} void @cplx_i16(ptr {{.*}} sret([4 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} {{.*}} i64 @cplx_i16(i64{{.*}}) // SPARC: define{{.*}} { i16, i16 } @cplx_i16(ptr {{.*}} byval({ i16, i16 }) {{.*}}) - // WASM32: define{{.*}} void @cplx_i16(ptr {{.*}} sret({ i16, i16 }) {{.*}}, ptr {{.*}} byval({ i16, i16 }) {{.*}}) - // WASM64: define{{.*}} void @cplx_i16(ptr {{.*}} sret({ i16, i16 }) {{.*}}, ptr {{.*}} byval({ i16, i16 }) {{.*}}) + // WASM32: define{{.*}} void @cplx_i16(ptr {{.*}} sret([4 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_i16(ptr {{.*}} sret([4 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} i32 @cplx_i16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} i32 @cplx_i16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i32 @cplx_i16(i32 {{.*}}) @@ -277,7 +274,7 @@ pub extern "C" fn cplx_i32(x: Complex) -> Complex { // AARCH64_MSVC: define{{.*}} i64 @cplx_i32(i64 {{.*}}) // AIX: define{{.*}} { i32, i32 } @cplx_i32(i32 {{.*}}, i32 {{.*}}) // ARM64EC: define{{.*}} i64 @cplx_i32(i64 {{.*}}) - // ARM: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, [2 x i32] {{.*}}) + // ARM: define{{.*}} void @cplx_i32(ptr {{.*}} sret([8 x i8]) {{.*}}, [2 x i32] {{.*}}) // BPF: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, i64 {{.*}}) // CSKY: define{{.*}} [2 x i32] @cplx_i32([2 x i32] {{.*}}) // I686: define{{.*}} i64 @cplx_i32(ptr {{.*}} byval([8 x i8]) {{.*}}) @@ -291,11 +288,11 @@ pub extern "C" fn cplx_i32(x: Complex) -> Complex { // POWERPC: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, ptr {{.*}} byval({ i32, i32 }) {{.*}}) // RISCV32: define{{.*}} [2 x i32] @cplx_i32([2 x i32] {{.*}}) // RISCV64: define{{.*}} i64 @cplx_i32(i64 {{.*}}) - // S390X: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, ptr {{.*}}) + // S390X: define{{.*}} void @cplx_i32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} i64 @cplx_i32(i64 {{.*}}) // SPARC: define{{.*}} { i32, i32 } @cplx_i32(ptr {{.*}} byval({ i32, i32 }) {{.*}}) - // WASM32: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, ptr {{.*}} byval({ i32, i32 }) {{.*}}) - // WASM64: define{{.*}} void @cplx_i32(ptr {{.*}} sret({ i32, i32 }) {{.*}}, ptr {{.*}} byval({ i32, i32 }) {{.*}}) + // WASM32: define{{.*}} void @cplx_i32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_i32(ptr {{.*}} sret([8 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} i64 @cplx_i32(ptr {{.*}} byval([8 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} i64 @cplx_i32(ptr {{.*}} byval([8 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i64 @cplx_i32(i64 {{.*}}) @@ -311,11 +308,11 @@ pub extern "C" fn cplx_i64(x: Complex) -> Complex { // AARCH64_MSVC: define{{.*}} [2 x i64] @cplx_i64([2 x i64] {{.*}}) // AIX: define{{.*}} { i64, i64 } @cplx_i64(i64 {{.*}}, i64 {{.*}}) // ARM64EC: define{{.*}} [2 x i64] @cplx_i64([2 x i64] {{.*}}) - // ARM: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [2 x i64] {{.*}}) + // ARM: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, [2 x i64] {{.*}}) // BPF: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [2 x i64] {{.*}}) - // CSKY: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [4 x i32] {{.*}}) + // CSKY: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, [4 x i32] {{.*}}) // I686: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // LOONGARCH32: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // LOONGARCH64: define{{.*}} [2 x i64] @cplx_i64([2 x i64] {{.*}}) // MIPS64EL: define{{.*}} { i64, i64 } @cplx_i64(i64 {{.*}}, i64 {{.*}}) // MIPS: define{{.*}} { i64, i64 } @cplx_i64(i32 {{.*}}, i32 {{.*}}, i32 {{.*}}, i32 {{.*}}) @@ -323,13 +320,13 @@ pub extern "C" fn cplx_i64(x: Complex) -> Complex { // POWERPC64: define{{.*}} { i64, i64 } @cplx_i64(i64 {{.*}}, i64 {{.*}}) // POWERPC64LE: define{{.*}} { i64, i64 } @cplx_i64(i64 {{.*}}, i64 {{.*}}) // POWERPC: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // RISCV32: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // RISCV64: define{{.*}} [2 x i64] @cplx_i64([2 x i64] {{.*}}) - // S390X: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // S390X: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} { i64, i64 } @cplx_i64(i64 {{.*}}, i64 {{.*}}) // SPARC: define{{.*}} { i64, i64 } @cplx_i64(ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // WASM32: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // WASM64: define{{.*}} void @cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) + // WASM32: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} void @cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) @@ -350,11 +347,11 @@ pub extern "C" fn wrapper_cplx_i64( // AARCH64_MSVC: define{{.*}} [2 x i64] @wrapper_cplx_i64([2 x i64] {{.*}}) // AIX: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i64 {{.*}}, i64 {{.*}}) // ARM64EC: define{{.*}} [2 x i64] @wrapper_cplx_i64([2 x i64] {{.*}}) - // ARM: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [2 x i64] {{.*}}) + // ARM: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, [2 x i64] {{.*}}) // BPF: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [2 x i64] {{.*}}) - // CSKY: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, [4 x i32] {{.*}}) + // CSKY: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, [4 x i32] {{.*}}) // I686: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // LOONGARCH32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // LOONGARCH64: define{{.*}} [2 x i64] @wrapper_cplx_i64([2 x i64] {{.*}}) // MIPS64EL: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i64 {{.*}}, i64 {{.*}}) // MIPS: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i32 {{.*}}, i32 {{.*}}, i32 {{.*}}, i32 {{.*}}) @@ -362,13 +359,13 @@ pub extern "C" fn wrapper_cplx_i64( // POWERPC64: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i64 {{.*}}, i64 {{.*}}) // POWERPC64LE: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i64 {{.*}}, i64 {{.*}}) // POWERPC: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // RISCV32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // RISCV64: define{{.*}} [2 x i64] @wrapper_cplx_i64([2 x i64] {{.*}}) - // S390X: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}}) + // S390X: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // SPARC64: define{{.*}} { i64, i64 } @wrapper_cplx_i64(i64 {{.*}}, i64 {{.*}}) // SPARC: define{{.*}} { i64, i64 } @wrapper_cplx_i64(ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // WASM32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) - // WASM64: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret({ i64, i64 }) {{.*}}, ptr {{.*}} byval({ i64, i64 }) {{.*}}) + // WASM32: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) + // WASM64: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}} byval([16 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} void @wrapper_cplx_i64(ptr {{.*}} sret([16 x i8]) {{.*}}, ptr {{.*}}) @@ -381,18 +378,18 @@ pub extern "C" fn wrapper_cplx_i64( pub extern "C" fn wrapper_cplx_f16( x: Wrapper>>, ) -> Wrapper>> { - // AARCH64: define{{.*}} { half, half } @wrapper_cplx_f16([2 x half] {{.*}}) - // AARCH64_DARWIN: define{{.*}} { half, half } @wrapper_cplx_f16([2 x half] {{.*}}) - // AARCH64_MSVC: define{{.*}} { half, half } @wrapper_cplx_f16([2 x half] {{.*}}) - // ARM64EC: define{{.*}} { half, half } @wrapper_cplx_f16([2 x half] {{.*}}) - // ARM: define{{.*}} i32 @wrapper_cplx_f16([1 x i32] {{.*}}) + // AARCH64: define{{.*}} [2 x half] @wrapper_cplx_f16([2 x half] {{.*}}) + // AARCH64_DARWIN: define{{.*}} [2 x half] @wrapper_cplx_f16([2 x half] {{.*}}) + // AARCH64_MSVC: define{{.*}} [2 x half] @wrapper_cplx_f16([2 x half] {{.*}}) + // ARM64EC: define{{.*}} [2 x half] @wrapper_cplx_f16([2 x half] {{.*}}) + // ARM: define{{.*}} [2 x half] @wrapper_cplx_f16([2 x half] {{.*}}) // I686: define{{.*}} <2 x half> @wrapper_cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) - // LOONGARCH32: define{{.*}} { half, half } @wrapper_cplx_f16(half {{.*}}, half {{.*}}) - // LOONGARCH64: define{{.*}} { half, half } @wrapper_cplx_f16(half {{.*}}, half {{.*}}) + // LOONGARCH32: define{{.*}} { half, half } @wrapper_cplx_f16({ half, half } {{.*}}) + // LOONGARCH64: define{{.*}} { half, half } @wrapper_cplx_f16({ half, half } {{.*}}) // NVPTX: define{{.*}} { half, half } @wrapper_cplx_f16(ptr {{.*}} byval({ half, half }) {{.*}}) - // RISCV32: define{{.*}} { half, half } @wrapper_cplx_f16(half {{.*}}, half {{.*}}) - // RISCV64: define{{.*}} { half, half } @wrapper_cplx_f16(half {{.*}}, half {{.*}}) - // S390X: define{{.*}} void @wrapper_cplx_f16(ptr {{.*}} sret({ half, half }) {{.*}}, ptr {{.*}}) + // RISCV32: define{{.*}} { half, half } @wrapper_cplx_f16({ half, half } {{.*}}) + // RISCV64: define{{.*}} { half, half } @wrapper_cplx_f16({ half, half } {{.*}}) + // S390X: define{{.*}} void @wrapper_cplx_f16(ptr {{.*}} sret([4 x i8]) {{.*}}, ptr {{.*}}) // WIN32_GNU: define{{.*}} <2 x half> @wrapper_cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WIN32_MSVC: define{{.*}} <2 x half> @wrapper_cplx_f16(ptr {{.*}} byval([4 x i8]) {{.*}}) // WINDOWS_GNU: define{{.*}} i32 @wrapper_cplx_f16(i32 {{.*}}) diff --git a/tests/crashes/153005.rs b/tests/crashes/153005.rs new file mode 100644 index 0000000000000..44b4e029958cd --- /dev/null +++ b/tests/crashes/153005.rs @@ -0,0 +1,15 @@ +//@ known-bug: #153005 +#![feature(non_lifetime_binders)] +#![feature(derive_coerce_pointee)] + +#[derive(core::marker::CoercePointee)] +#[repr(transparent)] +struct _Ptr5<'a, #[pointee] T: ?Sized, X> +where + for V: Sized, +{ + data: &'a T, + x: core::marker::PhantomData, +} + +fn main() {} diff --git a/tests/crashes/153362.rs b/tests/crashes/153362.rs new file mode 100644 index 0000000000000..0a8e4ddae6283 --- /dev/null +++ b/tests/crashes/153362.rs @@ -0,0 +1,6 @@ +//@ known-bug: #153362 +struct ThinDst { + b: unsafe<> (), +} + +const C1: &ThinDst = unsafe { std::mem::transmute(b"d".as_ptr()) }; diff --git a/tests/crashes/153375.rs b/tests/crashes/153375.rs new file mode 100644 index 0000000000000..46ed4be3b829b --- /dev/null +++ b/tests/crashes/153375.rs @@ -0,0 +1,15 @@ +//@ known-bug: #153375 +//@ aux-build: aux153375.rs +extern crate aux153375; +use aux153375::Request; + +struct Bar<'ws>(&'ws ()); + +impl<'ws> Request for Bar<'ws> { + type A<'a> + = u8 + where + Self: 'a; + + fn f(_: Self::A<'_>) -> impl Sized {} +} diff --git a/tests/crashes/153947.rs b/tests/crashes/153947.rs new file mode 100644 index 0000000000000..39bc8c074cfc0 --- /dev/null +++ b/tests/crashes/153947.rs @@ -0,0 +1,10 @@ +//@ known-bug: #153947 +#![expect(drop_bounds)] +pub struct Thing(T) where [T]: Sized, Self: Drop; +impl Drop for Thing where [T]: Sized, Self: Drop { + fn drop(&mut self) {} +} +impl Drop for Thing where [T]: Sized, Self: Drop { + fn drop(&mut self) {} +} +fn main() {} diff --git a/tests/crashes/154296.rs b/tests/crashes/154296.rs new file mode 100644 index 0000000000000..d904a4d82e426 --- /dev/null +++ b/tests/crashes/154296.rs @@ -0,0 +1,12 @@ +//@ known-bug: #154296 +//@ edition: 2024 +mod m1 { + mod inner { + pub struct S; + } + pub use inner::*; + #[derive(Debug)] + pub struct S; +} +use m1::*; +use S; diff --git a/tests/crashes/154779.rs b/tests/crashes/154779.rs new file mode 100644 index 0000000000000..e6c03e88b0b90 --- /dev/null +++ b/tests/crashes/154779.rs @@ -0,0 +1,4 @@ +//@ known-bug: #154779 +struct Data([[&'static str]; 1]); +const _: &'static Data = &*(&[] as *const Data) ; +fn main() {} diff --git a/tests/crashes/154782.rs b/tests/crashes/154782.rs new file mode 100644 index 0000000000000..d5fdfb84b48ce --- /dev/null +++ b/tests/crashes/154782.rs @@ -0,0 +1,9 @@ +//@ known-bug: #154782 +//@ edition: 2024 +#![feature(pin_ergonomics)] +use core::pin::Pin; +fn test_idempotency(x: Pin<&mut T>) { + || { + x.poll(loop {}); + }; +} diff --git a/tests/crashes/154871.rs b/tests/crashes/154871.rs new file mode 100644 index 0000000000000..c106028623d75 --- /dev/null +++ b/tests/crashes/154871.rs @@ -0,0 +1,7 @@ +//@ known-bug: #154871 +struct Struct { + b: unsafe<> (), +} +fn main() { + std::ptr::null::; +} diff --git a/tests/crashes/auxiliary/aux132985.rs b/tests/crashes/auxiliary/aux132985.rs deleted file mode 100644 index 7ae5567bdc59d..0000000000000 --- a/tests/crashes/auxiliary/aux132985.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(adt_const_params)] - -use std::marker::ConstParamTy; - -#[derive(Eq, PartialEq, ConstParamTy)] -pub struct Foo; diff --git a/tests/crashes/auxiliary/aux153375.rs b/tests/crashes/auxiliary/aux153375.rs new file mode 100644 index 0000000000000..c5f09489181b6 --- /dev/null +++ b/tests/crashes/auxiliary/aux153375.rs @@ -0,0 +1,6 @@ +pub trait Request { + type A<'a> + where + Self: 'a; + fn f(_: Self::A<'_>) -> impl Sized; +} diff --git a/tests/crashes/auxiliary/overlapping_spans_helper.rs b/tests/crashes/auxiliary/overlapping_spans_helper.rs deleted file mode 100644 index e449fcd36c376..0000000000000 --- a/tests/crashes/auxiliary/overlapping_spans_helper.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Auxiliary lib for the issue 147973 regression test with ICEs due to overlapping spans. - -#[macro_export] -macro_rules! identity { - ($x:ident) => { - $x - }; -} - -#[macro_export] -macro_rules! do_loop { - ($x:ident) => { - for $crate::identity!($x) in $x {} - }; -} diff --git a/tests/debuginfo/pretty-std/lldb_input/windows_gnu.json b/tests/debuginfo/pretty-std/lldb_input/windows_gnu.json index 4b4ffabdc2c95..39ccd60fecfa4 100644 --- a/tests/debuginfo/pretty-std/lldb_input/windows_gnu.json +++ b/tests/debuginfo/pretty-std/lldb_input/windows_gnu.json @@ -91,7 +91,7 @@ "some": { "type": "core::option::Option", "pretty_print": "Some(8)", - "synthetic": "lldb_lookup.synthetic_lookup", + "synthetic": "lldb_lookup.ClangEncodedEnumProvider", "summary": "lldb_lookup.ClangEncodedEnumSummaryProvider", "children": [ { @@ -104,13 +104,12 @@ "none": { "type": "core::option::Option", "pretty_print": "None", - "synthetic": "lldb_lookup.synthetic_lookup", + "synthetic": "lldb_lookup.ClangEncodedEnumProvider", "summary": "lldb_lookup.ClangEncodedEnumSummaryProvider" }, "os_string": { "type": "std::ffi::os_str::OsString", "pretty_print": "\"IAMA OS string \ud83d\ude03\"", - "synthetic": "lldb_lookup.synthetic_lookup", "summary": "lldb_lookup.StdOsStringSummaryProvider", "children": [ { diff --git a/tests/debuginfo/pretty-std/lldb_input/windows_msvc.json b/tests/debuginfo/pretty-std/lldb_input/windows_msvc.json index 2a67d1cfb60b7..1b070b2ad5106 100644 --- a/tests/debuginfo/pretty-std/lldb_input/windows_msvc.json +++ b/tests/debuginfo/pretty-std/lldb_input/windows_msvc.json @@ -114,7 +114,6 @@ "os_string": { "type": "std::ffi::os_str::OsString", "pretty_print": "\"IAMA OS string \ud83d\ude03\"", - "synthetic": "lldb_lookup.synthetic_lookup", "summary": "lldb_lookup.StdOsStringSummaryProvider", "children": [ { diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml index 688c14c3ee078..7471f222739d6 100644 --- a/tests/rustdoc-gui/headers-color.goml +++ b/tests/rustdoc-gui/headers-color.goml @@ -24,15 +24,14 @@ define-function: ( move-cursor-to: "#impl-Foo" // Then we click on it. click: "a.anchor[href='#impl-Foo']" - assert-css: ( + wait-for-css: ( "#impl-Foo", {"color": |color|, "background-color": |focus_background_color|}, ) click: "a.fn[href='#method.must_use']" - assert-css: ( + wait-for-css: ( "#method\.must_use", {"color": |color|, "background-color": |focus_background_color|}, - ALL, ) go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-css: (".section-header a", {"color": |color|}, ALL) diff --git a/tests/rustdoc-gui/search-about-this-result.goml b/tests/rustdoc-gui/search-about-this-result.goml index ec1df737c8150..c3fea3ba9e5c4 100644 --- a/tests/rustdoc-gui/search-about-this-result.goml +++ b/tests/rustdoc-gui/search-about-this-result.goml @@ -1,13 +1,15 @@ // Check the "About this Result" popover. // Try a complex result. + +include: "utils.goml" + go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=scroll_traits::Iterator,(T->bool)->(Extend,Extend)" // These two commands are used to be sure the search will be run. focus: ".search-input" press-key: "Enter" -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-count: ("#search-tabs button", 1) assert-count: (".search-results > a", 1) @@ -32,8 +34,7 @@ go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=F->lib2::WhereWhitespac focus: ".search-input" press-key: "Enter" -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-text: ("//div[@class='type-signature']", "F -> WhereWhitespace") assert-count: ("#search-tabs button", 1) assert-count: (".search-results > a", 1) diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index 4d7c2263fd123..5d2ad41dc5615 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -8,7 +8,7 @@ define-function: ( [theme, error_background], block { call-function: ("switch-theme", {"theme": |theme|}) - wait-for-false: "#search-tabs .count.loading" + call-function: ("wait-for-search-results", {}) wait-for: "#search .error code" assert-css: ("#search .error code", {"background-color": |error_background|}) } diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index 7d0facfb7202b..86893b7867d2f 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -8,9 +8,7 @@ assert-text: ("#results .externcrate", "test_docs") wait-for: "#crate-search" // We now want to change the crate filter to "lib2". click: "#crate-search option[value='lib2']" -// Waiting for the search results to appear... -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-document-property: ({"URL": "&filter-crate="}, CONTAINS) // We check that there is no more "test_docs" appearing. assert-false: "#results .externcrate" @@ -30,9 +28,7 @@ assert-property: ("#crate-search", {"value": "lib2"}) // Selecting back "All crates" click: "#crate-search option[value='all crates']" -// Waiting for the search results to appear... -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-property: ("#crate-search", {"value": "all crates"}) // Checking that the URL parameter is taken into account for crate filtering. diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml index fdf0afb7e8f72..a1e44032bff70 100644 --- a/tests/rustdoc-gui/search-form-elements.goml +++ b/tests/rustdoc-gui/search-form-elements.goml @@ -1,8 +1,7 @@ // This test ensures that the elements in ".search-form" have the expected display. include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test" -wait-for: "#search-tabs" // Waiting for the search.js to load. -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) show-text: true define-function: ( @@ -120,11 +119,9 @@ call-function: ( // Check that search input correctly decodes form encoding. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a+b" -wait-for: "#search-tabs" // Waiting for the search.js to load. -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-property: (".search-input", { "value": "a b" }) // Check that literal + is not treated as space. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a%2Bb" -wait-for: "#search-tabs" // Waiting for the search.js to load. -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-property: (".search-input", { "value": "a+b" }) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index e5c11651bd27d..fa7b0658c0923 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -13,9 +13,7 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) - // Waiting for the search results to appear... - wait-for: "#search-tabs" - wait-for-false: "#search-tabs .count.loading" + call-function: ("wait-for-search-results", {}) assert-css: ( "#search-tabs > button > .count", {"color": |count_color|}, diff --git a/tests/rustdoc-gui/search-result-description.goml b/tests/rustdoc-gui/search-result-description.goml index 4ab250b472d0f..a3b07466c69a3 100644 --- a/tests/rustdoc-gui/search-result-description.goml +++ b/tests/rustdoc-gui/search-result-description.goml @@ -1,6 +1,5 @@ // This test is to ensure that the codeblocks are correctly rendered in the search results. +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" -// Waiting for the search results to appear... -wait-for: "#search-tabs" -wait-for-false: "#search-tabs .count.loading" +call-function: ("wait-for-search-results", {}) assert-text: (".search-results .desc code", "format!") diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml new file mode 100644 index 0000000000000..fa74a7452185c --- /dev/null +++ b/tests/rustdoc-gui/search-result-display.goml @@ -0,0 +1,112 @@ +// ignore-tidy-linelength +// Checks that the search results have the expected width. +include: "utils.goml" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (900, 1000) +call-function: ("perform-search", {"query": "test"}) +// The width is returned by "getComputedStyle" which returns the exact number instead of the +// CSS rule which is "50%"... +assert-size: (".search-results div.desc", {"width": 248}) +store-size: (".search-results .result-name .typename", {"width": width}) +set-window-size: (600, 100) +// As counter-intuitive as it may seem, in this width, the width is "100%", which is why +// when computed it's larger. +assert-size: (".search-results div.desc", {"width": 566}) + +// The result set is all on one line. +compare-elements-position-near: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"y": 2}, +) +compare-elements-position-near-false: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"x": 5}, +) +// The width of the "typename" isn't fixed anymore in this display mode. +store-size: (".search-results .result-name .typename", {"width": new_width}) +assert: |new_width| < |width| - 10 + +store-value: ( + value, + "SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName", +) +// Check that if the search is too long on mobile, it'll go under the "typename". +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=" + |value| +call-function: ("wait-for-search-results", {}) +compare-elements-position-near: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"y": 2, "x": 0}, +) +compare-elements-size-near: ( + ".search-results .result-name", + ".search-results .result-name .path", + {"width": 8, "height": 8}, +) + +// Check that the crate filter `