From b5786dcae6c5a300f146fcbf6dab509d2cd48ec8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 11 Aug 2022 09:39:25 -0400 Subject: [PATCH 01/18] avoid some int2ptr casts in thread_local_key tests --- library/std/src/sys_common/thread_local_key/tests.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys_common/thread_local_key/tests.rs b/library/std/src/sys_common/thread_local_key/tests.rs index 968738a418080..6f32b858f0966 100644 --- a/library/std/src/sys_common/thread_local_key/tests.rs +++ b/library/std/src/sys_common/thread_local_key/tests.rs @@ -1,4 +1,5 @@ use super::{Key, StaticKey}; +use core::ptr; fn assert_sync() {} fn assert_send() {} @@ -12,8 +13,8 @@ fn smoke() { let k2 = Key::new(None); assert!(k1.get().is_null()); assert!(k2.get().is_null()); - k1.set(1 as *mut _); - k2.set(2 as *mut _); + k1.set(ptr::invalid_mut(1)); + k2.set(ptr::invalid_mut(2)); assert_eq!(k1.get() as usize, 1); assert_eq!(k2.get() as usize, 2); } @@ -26,8 +27,8 @@ fn statik() { unsafe { assert!(K1.get().is_null()); assert!(K2.get().is_null()); - K1.set(1 as *mut _); - K2.set(2 as *mut _); + K1.set(ptr::invalid_mut(1)); + K2.set(ptr::invalid_mut(2)); assert_eq!(K1.get() as usize, 1); assert_eq!(K2.get() as usize, 2); } From e182d12a8493b40a557394325a3a713b6528de60 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 12 Aug 2022 02:47:57 +0000 Subject: [PATCH 02/18] Fix HIR pretty printing of let else --- compiler/rustc_hir_pretty/src/lib.rs | 4 ++++ src/test/ui/unpretty/pretty-let-else.rs | 10 ++++++++++ src/test/ui/unpretty/pretty-let-else.stdout | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/test/ui/unpretty/pretty-let-else.rs create mode 100644 src/test/ui/unpretty/pretty-let-else.stdout diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index e0179bd3ed1e8..c7966b662de9f 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -911,6 +911,10 @@ impl<'a> State<'a> { if let Some(els) = els { self.nbsp(); self.word_space("else"); + // containing cbox, will be closed by print-block at `}` + self.cbox(0); + // head-box, will be closed by print-block after `{` + self.ibox(0); self.print_block(els); } diff --git a/src/test/ui/unpretty/pretty-let-else.rs b/src/test/ui/unpretty/pretty-let-else.rs new file mode 100644 index 0000000000000..5abfa2523b74e --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zunpretty=hir +// check-pass + +#![feature(let_else)] + +fn foo(x: Option) { + let Some(_) = x else { panic!() }; +} + +fn main() {} diff --git a/src/test/ui/unpretty/pretty-let-else.stdout b/src/test/ui/unpretty/pretty-let-else.stdout new file mode 100644 index 0000000000000..ffe1d1657aa15 --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.stdout @@ -0,0 +1,18 @@ +// compile-flags: -Zunpretty=hir +// check-pass + +#![feature(let_else)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn foo(x: + Option) { + let Some(_) = x else + { + + { ::std::rt::begin_panic("explicit panic") } + }; + } +fn main() { } From f94220f68eeef7fb0a4a36f7e95f599b56e2b161 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 12 Aug 2022 03:48:40 +0000 Subject: [PATCH 03/18] Erase regions better in promote_candidate --- .../src/transform/promote_consts.rs | 9 ++------- .../generic_const_exprs/issue-100360.rs | 13 +++++++++++++ .../generic_const_exprs/issue-89851.rs | 12 ++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-100360.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-89851.rs diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index ed4d8c95d1e61..161c89e3242b9 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -839,17 +839,12 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { let mut promoted_operand = |ty, span| { promoted.span = span; promoted.local_decls[RETURN_PLACE] = LocalDecl::new(ty, span); + let substs = tcx.erase_regions(InternalSubsts::identity_for_item(tcx, def.did)); let _const = tcx.mk_const(ty::ConstS { ty, kind: ty::ConstKind::Unevaluated(ty::Unevaluated { def, - substs: InternalSubsts::for_item(tcx, def.did, |param, _| { - if let ty::GenericParamDefKind::Lifetime = param.kind { - tcx.lifetimes.re_erased.into() - } else { - tcx.mk_param_from_def(param) - } - }), + substs, promoted: Some(promoted_id), }), }); diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs b/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs new file mode 100644 index 0000000000000..5572f1f88df4c --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs @@ -0,0 +1,13 @@ +// check-pass +// (this requires debug assertions) + +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +fn foo(arg: &'static bool) -> bool { + B == arg +} + +fn main() { + foo::<{ &true }>(&false); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs b/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs new file mode 100644 index 0000000000000..cde849d901788 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs @@ -0,0 +1,12 @@ +// check-pass +// (this requires debug assertions) + +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +pub const BAR: () = ice::<"">(); +pub const fn ice() { + &10; +} + +fn main() {} From 43eda18a6c615655941d989b80631ce99c937c1e Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Fri, 12 Aug 2022 08:57:18 +0000 Subject: [PATCH 04/18] adapt test for msan message change LLVM commit https://github.com/llvm/llvm-project/commit/057cabd997aeaef136e1e14f2ee645bd5bb197dd removed the function from the msan error message. This adapts our test accordingly. Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db --- src/test/ui/sanitize/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/sanitize/memory.rs b/src/test/ui/sanitize/memory.rs index b53f19a5b01aa..83f79679c6e67 100644 --- a/src/test/ui/sanitize/memory.rs +++ b/src/test/ui/sanitize/memory.rs @@ -6,7 +6,7 @@ // run-fail // error-pattern: MemorySanitizer: use-of-uninitialized-value // error-pattern: Uninitialized value was created by an allocation -// error-pattern: in the stack frame of function 'main' +// error-pattern: in the stack frame // // This test case intentionally limits the usage of the std, // since it will be linked with an uninstrumented version of it. From a65647a7f618d8b2d4367dbbfc197b17ebb00d80 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 12 Aug 2022 11:37:32 +0200 Subject: [PATCH 05/18] remove Clean trait implementation for hir::PathSegment --- src/librustdoc/clean/mod.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 6e24638548979..f447b2bfa7787 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1322,14 +1322,17 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type let trait_def = cx.tcx.associated_item(p.res.def_id()).container_id(cx.tcx); let trait_ = self::Path { res: Res::Def(DefKind::Trait, trait_def), - segments: trait_segments.iter().map(|x| x.clean(cx)).collect(), + segments: trait_segments.iter().map(|x| clean_path_segment(x, cx)).collect(), }; register_res(cx, trait_.res); let self_def_id = DefId::local(qself.hir_id.owner.local_def_index); let self_type = clean_ty(qself, cx); let should_show_cast = compute_should_show_cast(Some(self_def_id), &trait_, &self_type); Type::QPath { - assoc: Box::new(p.segments.last().expect("segments were empty").clean(cx)), + assoc: Box::new(clean_path_segment( + p.segments.last().expect("segments were empty"), + cx, + )), should_show_cast, self_type: Box::new(self_type), trait_, @@ -1349,7 +1352,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type let self_type = clean_ty(qself, cx); let should_show_cast = compute_should_show_cast(self_def_id, &trait_, &self_type); Type::QPath { - assoc: Box::new(segment.clean(cx)), + assoc: Box::new(clean_path_segment(segment, cx)), should_show_cast, self_type: Box::new(self_type), trait_, @@ -1823,7 +1826,10 @@ fn clean_variant_data<'tcx>( } fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path { - Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() } + Path { + res: path.res, + segments: path.segments.iter().map(|x| clean_path_segment(x, cx)).collect(), + } } fn clean_generic_args<'tcx>( @@ -1861,10 +1867,11 @@ fn clean_generic_args<'tcx>( } } -impl<'tcx> Clean<'tcx, PathSegment> for hir::PathSegment<'tcx> { - fn clean(&self, cx: &mut DocContext<'tcx>) -> PathSegment { - PathSegment { name: self.ident.name, args: clean_generic_args(self.args(), cx) } - } +fn clean_path_segment<'tcx>( + path: &hir::PathSegment<'tcx>, + cx: &mut DocContext<'tcx>, +) -> PathSegment { + PathSegment { name: path.ident.name, args: clean_generic_args(path.args(), cx) } } impl<'tcx> Clean<'tcx, BareFunctionDecl> for hir::BareFnTy<'tcx> { From 001cc12af78fd179622f6dbe0f7d61ceeebf4522 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 12 Aug 2022 11:40:39 +0200 Subject: [PATCH 06/18] remove Clean trait implementation for hir::BareFnTy --- src/librustdoc/clean/mod.rs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index f447b2bfa7787..addd6ffa11e28 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1510,7 +1510,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T if !lifetime.is_elided() { Some(clean_lifetime(*lifetime, cx)) } else { None }; DynTrait(bounds, lifetime) } - TyKind::BareFn(barefn) => BareFunction(Box::new(barefn.clean(cx))), + TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))), // Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s. TyKind::Infer | TyKind::Err => Infer, TyKind::Typeof(..) => panic!("unimplemented type {:?}", ty.kind), @@ -1874,22 +1874,23 @@ fn clean_path_segment<'tcx>( PathSegment { name: path.ident.name, args: clean_generic_args(path.args(), cx) } } -impl<'tcx> Clean<'tcx, BareFunctionDecl> for hir::BareFnTy<'tcx> { - fn clean(&self, cx: &mut DocContext<'tcx>) -> BareFunctionDecl { - let (generic_params, decl) = enter_impl_trait(cx, |cx| { - // NOTE: generics must be cleaned before args - let generic_params = self - .generic_params - .iter() - .filter(|p| !is_elided_lifetime(p)) - .map(|x| clean_generic_param(cx, None, x)) - .collect(); - let args = clean_args_from_types_and_names(cx, self.decl.inputs, self.param_names); - let decl = clean_fn_decl_with_args(cx, self.decl, args); - (generic_params, decl) - }); - BareFunctionDecl { unsafety: self.unsafety, abi: self.abi, decl, generic_params } - } +fn clean_bare_fn_ty<'tcx>( + bare_fn: &hir::BareFnTy<'tcx>, + cx: &mut DocContext<'tcx>, +) -> BareFunctionDecl { + let (generic_params, decl) = enter_impl_trait(cx, |cx| { + // NOTE: generics must be cleaned before args + let generic_params = bare_fn + .generic_params + .iter() + .filter(|p| !is_elided_lifetime(p)) + .map(|x| clean_generic_param(cx, None, x)) + .collect(); + let args = clean_args_from_types_and_names(cx, bare_fn.decl.inputs, bare_fn.param_names); + let decl = clean_fn_decl_with_args(cx, bare_fn.decl, args); + (generic_params, decl) + }); + BareFunctionDecl { unsafety: bare_fn.unsafety, abi: bare_fn.abi, decl, generic_params } } fn clean_maybe_renamed_item<'tcx>( From dcead65e48bb4957f9f20bdb037806dfa6c2db66 Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Fri, 12 Aug 2022 23:30:24 +0200 Subject: [PATCH 07/18] Make `[rust] use-lld=true` work on windows Before, it would fail with "error: ignoring unknown argument '-Wl,--icf=all'" --- src/bootstrap/compile.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index dd2b9d59366ea..c3aabb16a9b9a 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -658,7 +658,12 @@ impl Step for Rustc { // With LLD, we can use ICF (identical code folding) to reduce the executable size // of librustc_driver/rustc and to improve i-cache utilization. - if builder.config.use_lld { + // + // -Wl,[link options] doesn't work on MSVC. However, /OPT:ICF (technically /OPT:REF,ICF) + // is already on by default in MSVC optimized builds, which is interpreted as --icf=all: + // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746 + // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827 + if builder.config.use_lld && !compiler.host.contains("msvc") { cargo.rustflag("-Clink-args=-Wl,--icf=all"); } From 2787eb05d5018c6d8d3087a373d3ea758a9db9b9 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Tue, 9 Aug 2022 21:50:54 -0700 Subject: [PATCH 08/18] Use different name for arity-2 `@has` and `@matches` See #100354 for the rationale. --- src/etc/htmldocck.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index d02ac9d9c0ab7..1cc86c1a339e2 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -41,15 +41,15 @@ `PATH` is relative to the output directory. It can be given as `-` which repeats the most recently used `PATH`. -* `@has PATH PATTERN` and `@matches PATH PATTERN` checks for - the occurrence of the given pattern `PATTERN` in the specified file. +* `@has-literal PATH PATTERN` and `@matches-literal PATH PATTERN` checks + for the occurrence of the given pattern `PATTERN` in the specified file. Only one occurrence of the pattern is enough. - For `@has`, `PATTERN` is a whitespace-normalized (every consecutive + For `@has-literal`, `PATTERN` is a whitespace-normalized (every consecutive whitespace being replaced by one single space character) string. The entire file is also whitespace-normalized including newlines. - For `@matches`, `PATTERN` is a Python-supported regular expression. + For `@matches-literal`, `PATTERN` is a Python-supported regular expression. The file remains intact but the regexp is matched without the `MULTILINE` and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)` to override them, and `\A` and `\Z` for definitely matching @@ -542,19 +542,19 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first): def check_command(c, cache): try: cerr = "" - if c.cmd == 'has' or c.cmd == 'matches': # string test - regexp = (c.cmd == 'matches') - if len(c.args) == 1 and not regexp: # @has = file existence + if c.cmd in ['has', 'has-literal', 'matches', 'matches-literal']: # string test + regexp = c.cmd.startswith('matches') + if len(c.args) == 1 and not regexp and 'literal' not in c.cmd: # @has = file existence try: cache.get_file(c.args[0]) ret = True except FailedCheck as err: cerr = str(err) ret = False - elif len(c.args) == 2: # @has/matches = string test + elif len(c.args) == 2 and 'literal' in c.cmd: # @has-literal/matches-literal = string test cerr = "`PATTERN` did not match" ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp) - elif len(c.args) == 3: # @has/matches = XML tree test + elif len(c.args) == 3 and 'literal' not in c.cmd: # @has/matches = XML tree test cerr = "`XPATH PATTERN` did not match" ret = get_nb_matching_elements(cache, c, regexp, True) != 0 else: From 01408fc62762838b72dfb6ce090708d3e8303ed9 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Tue, 9 Aug 2022 21:52:04 -0700 Subject: [PATCH 09/18] Rename `@{has,matches}-literal` to `...text` Reasons: 1. It's shorter. 2. `@matches-literal` seems to contradict itself: a regex is intrinsically not a literal match, while it is still a textual match. --- src/etc/htmldocck.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 1cc86c1a339e2..48a83a66957f2 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -41,15 +41,15 @@ `PATH` is relative to the output directory. It can be given as `-` which repeats the most recently used `PATH`. -* `@has-literal PATH PATTERN` and `@matches-literal PATH PATTERN` checks +* `@hastext PATH PATTERN` and `@matchestext PATH PATTERN` checks for the occurrence of the given pattern `PATTERN` in the specified file. Only one occurrence of the pattern is enough. - For `@has-literal`, `PATTERN` is a whitespace-normalized (every consecutive + For `@hastext`, `PATTERN` is a whitespace-normalized (every consecutive whitespace being replaced by one single space character) string. The entire file is also whitespace-normalized including newlines. - For `@matches-literal`, `PATTERN` is a Python-supported regular expression. + For `@matchestext`, `PATTERN` is a Python-supported regular expression. The file remains intact but the regexp is matched without the `MULTILINE` and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)` to override them, and `\A` and `\Z` for definitely matching @@ -542,19 +542,19 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first): def check_command(c, cache): try: cerr = "" - if c.cmd in ['has', 'has-literal', 'matches', 'matches-literal']: # string test + if c.cmd in ['has', 'hastext', 'matches', 'matchestext']: # string test regexp = c.cmd.startswith('matches') - if len(c.args) == 1 and not regexp and 'literal' not in c.cmd: # @has = file existence + if len(c.args) == 1 and not regexp and 'text' not in c.cmd: # @has = file existence try: cache.get_file(c.args[0]) ret = True except FailedCheck as err: cerr = str(err) ret = False - elif len(c.args) == 2 and 'literal' in c.cmd: # @has-literal/matches-literal = string test + elif len(c.args) == 2 and 'text' in c.cmd: # @hastext/matchestext = string test cerr = "`PATTERN` did not match" ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp) - elif len(c.args) == 3 and 'literal' not in c.cmd: # @has/matches = XML tree test + elif len(c.args) == 3 and 'text' not in c.cmd: # @has/matches = XML tree test cerr = "`XPATH PATTERN` did not match" ret = get_nb_matching_elements(cache, c, regexp, True) != 0 else: From 37eed1d1ff3f433b4d6af02e65f6550d10b568f8 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 10 Aug 2022 13:10:04 -0700 Subject: [PATCH 10/18] Update tests: arity-2 `@{has,matches}` -> `...text` --- src/test/rustdoc/deprecated-impls.rs | 28 ++++----- src/test/rustdoc/elided-lifetime.rs | 12 ++-- src/test/rustdoc/empty-mod-private.rs | 6 +- src/test/rustdoc/empty-mod-public.rs | 6 +- .../generic-associated-types/issue-94683.rs | 4 +- src/test/rustdoc/hide-unstable-trait.rs | 4 +- src/test/rustdoc/impl-parts-crosscrate.rs | 8 +-- src/test/rustdoc/impl-trait-alias.rs | 4 +- src/test/rustdoc/inline_cross/add-docs.rs | 2 +- src/test/rustdoc/inline_cross/proc_macro.rs | 12 ++-- .../glob-extern-document-private-items.rs | 8 +-- src/test/rustdoc/inline_local/glob-extern.rs | 2 +- .../glob-private-document-private-items.rs | 16 ++--- src/test/rustdoc/inline_local/glob-private.rs | 4 +- .../rustdoc/inline_local/please_inline.rs | 2 +- src/test/rustdoc/intra-doc/extern-type.rs | 6 +- src/test/rustdoc/issue-16265-1.rs | 2 +- src/test/rustdoc/issue-16265-2.rs | 2 +- src/test/rustdoc/issue-23511.rs | 2 +- src/test/rustdoc/issue-23812.rs | 8 +-- src/test/rustdoc/issue-27104.rs | 2 +- src/test/rustdoc/issue-27759.rs | 4 +- src/test/rustdoc/issue-31899.rs | 2 +- src/test/rustdoc/issue-32374.rs | 2 +- src/test/rustdoc/issue-41783.rs | 10 ++-- src/test/rustdoc/issue-89852.rs | 2 +- src/test/rustdoc/link-title-escape.rs | 2 +- .../macro-document-private-duplicate.rs | 6 +- src/test/rustdoc/macro_rules-matchers.rs | 24 ++++---- src/test/rustdoc/markdown-summaries.rs | 6 +- src/test/rustdoc/nested-modules.rs | 4 +- src/test/rustdoc/search-index-summaries.rs | 2 +- src/test/rustdoc/search-index.rs | 4 +- src/test/rustdoc/show-const-contents.rs | 22 +++---- .../rustdoc/sort-modules-by-appearance.rs | 4 +- src/test/rustdoc/source-file.rs | 2 +- src/test/rustdoc/static-root-path.rs | 10 ++-- src/test/rustdoc/type-layout.rs | 58 +++++++++---------- src/test/rustdoc/typedef.rs | 2 +- src/test/rustdoc/universal-impl-trait.rs | 30 +++++----- 40 files changed, 168 insertions(+), 168 deletions(-) diff --git a/src/test/rustdoc/deprecated-impls.rs b/src/test/rustdoc/deprecated-impls.rs index efd250ce9f00f..75c65add85666 100644 --- a/src/test/rustdoc/deprecated-impls.rs +++ b/src/test/rustdoc/deprecated-impls.rs @@ -5,8 +5,8 @@ pub struct Foo0; impl Foo0 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc' - // @has - 'fn_with_doc short' - // @has - 'fn_with_doc full' + // @hastext - 'fn_with_doc short' + // @hastext - 'fn_with_doc full' /// fn_with_doc short /// /// fn_with_doc full @@ -52,8 +52,8 @@ pub struct Foo1; impl Bar for Foo1 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @has - 'fn_empty_with_doc_impl short' - // @has - 'fn_empty_with_doc_impl full' + // @hastext - 'fn_empty_with_doc_impl short' + // @hastext - 'fn_empty_with_doc_impl full' /// fn_empty_with_doc_impl short /// /// fn_empty_with_doc_impl full @@ -63,8 +63,8 @@ impl Bar for Foo1 { fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @has - 'fn_def_with_doc_impl short' - // @has - 'fn_def_with_doc_impl full' + // @hastext - 'fn_def_with_doc_impl short' + // @hastext - 'fn_def_with_doc_impl full' /// fn_def_with_doc_impl short /// /// fn_def_with_doc_impl full @@ -74,7 +74,7 @@ impl Bar for Foo1 { fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @has - 'fn_def_def_with_doc short' + // @hastext - 'fn_def_def_with_doc short' // @!has - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' @@ -85,33 +85,33 @@ pub struct Foo2; impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @has - 'fn_empty_with_doc short' + // @hastext - 'fn_empty_with_doc short' // @!has - 'fn_empty_with_doc full' fn fn_empty_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc' - // @has - 'fn_empty_without_doc_impl short' - // @has - 'fn_empty_without_doc_impl full' + // @hastext - 'fn_empty_without_doc_impl short' + // @hastext - 'fn_empty_without_doc_impl full' /// fn_empty_without_doc_impl short /// /// fn_empty_without_doc_impl full fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @has - 'fn_def_with_doc short' + // @hastext - 'fn_def_with_doc short' // @!has - 'fn_def_with_doc full' fn fn_def_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc' - // @has - 'fn_def_without_doc_impl short' - // @has - 'fn_def_without_doc_impl full' + // @hastext - 'fn_def_without_doc_impl short' + // @hastext - 'fn_def_without_doc_impl full' /// fn_def_without_doc_impl short /// /// fn_def_without_doc_impl full fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @has - 'fn_def_def_with_doc short' + // @hastext - 'fn_def_def_with_doc short' // @!has - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' diff --git a/src/test/rustdoc/elided-lifetime.rs b/src/test/rustdoc/elided-lifetime.rs index 5a32554f972b7..7ade072e4b1eb 100644 --- a/src/test/rustdoc/elided-lifetime.rs +++ b/src/test/rustdoc/elided-lifetime.rs @@ -11,33 +11,33 @@ pub struct Ref<'a>(&'a u32); type ARef<'a> = Ref<'a>; // @has foo/fn.test1.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" pub fn test1(a: &u32) -> Ref { Ref(a) } // @has foo/fn.test2.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" pub fn test2(a: &u32) -> Ref<'_> { Ref(a) } // @has foo/fn.test3.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" pub fn test3(a: &u32) -> ARef { Ref(a) } // @has foo/fn.test4.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" pub fn test4(a: &u32) -> ARef<'_> { Ref(a) } // Ensure external paths in inlined docs also display elided lifetime // @has foo/bar/fn.test5.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" // @has foo/bar/fn.test6.html -// @matches - "Ref<'_>" +// @matchestext - "Ref<'_>" #[doc(inline)] pub extern crate bar; diff --git a/src/test/rustdoc/empty-mod-private.rs b/src/test/rustdoc/empty-mod-private.rs index c2a98049a48cb..68c7649a50fb0 100644 --- a/src/test/rustdoc/empty-mod-private.rs +++ b/src/test/rustdoc/empty-mod-private.rs @@ -1,16 +1,16 @@ // compile-flags: --document-private-items // @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo' -// @has 'empty_mod_private/sidebar-items.js' 'foo' +// @hastext 'empty_mod_private/sidebar-items.js' 'foo' // @matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo' mod foo {} // @has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar' -// @has 'empty_mod_private/sidebar-items.js' 'bar' +// @hastext 'empty_mod_private/sidebar-items.js' 'bar' // @matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar' mod bar { // @has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @has 'empty_mod_private/bar/sidebar-items.js' 'baz' + // @hastext 'empty_mod_private/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz' mod baz {} } diff --git a/src/test/rustdoc/empty-mod-public.rs b/src/test/rustdoc/empty-mod-public.rs index d097fcf839cba..1e797d9513aa0 100644 --- a/src/test/rustdoc/empty-mod-public.rs +++ b/src/test/rustdoc/empty-mod-public.rs @@ -1,14 +1,14 @@ // @has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo' -// @has 'empty_mod_public/sidebar-items.js' 'foo' +// @hastext 'empty_mod_public/sidebar-items.js' 'foo' // @matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo' pub mod foo {} // @has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar' -// @has 'empty_mod_public/sidebar-items.js' 'bar' +// @hastext 'empty_mod_public/sidebar-items.js' 'bar' // @matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar' pub mod bar { // @has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @has 'empty_mod_public/bar/sidebar-items.js' 'baz' + // @hastext 'empty_mod_public/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz' pub mod baz {} } diff --git a/src/test/rustdoc/generic-associated-types/issue-94683.rs b/src/test/rustdoc/generic-associated-types/issue-94683.rs index 38ecf5283108f..324a6461f4292 100644 --- a/src/test/rustdoc/generic-associated-types/issue-94683.rs +++ b/src/test/rustdoc/generic-associated-types/issue-94683.rs @@ -8,6 +8,6 @@ pub trait Trait { // Make sure that the elided lifetime shows up // @has foo/type.T.html -// @has - "pub type T = " -// @has - "<'_>" +// @hastext - "pub type T = " +// @hastext - "<'_>" pub type T = fn(&<() as Trait>::Gat<'_>); diff --git a/src/test/rustdoc/hide-unstable-trait.rs b/src/test/rustdoc/hide-unstable-trait.rs index c30d6ed7b5220..0bdacf74ed284 100644 --- a/src/test/rustdoc/hide-unstable-trait.rs +++ b/src/test/rustdoc/hide-unstable-trait.rs @@ -5,7 +5,7 @@ extern crate unstable_trait; -// @has foo/struct.Foo.html 'bar' -// @has foo/struct.Foo.html 'bar2' +// @hastext foo/struct.Foo.html 'bar' +// @hastext foo/struct.Foo.html 'bar2' #[doc(inline)] pub use unstable_trait::Foo; diff --git a/src/test/rustdoc/impl-parts-crosscrate.rs b/src/test/rustdoc/impl-parts-crosscrate.rs index 6c5e79d5aa323..8fb8971ca7175 100644 --- a/src/test/rustdoc/impl-parts-crosscrate.rs +++ b/src/test/rustdoc/impl-parts-crosscrate.rs @@ -12,9 +12,9 @@ pub struct Bar { t: T } // full impl string. Instead, just make sure something from each part // is mentioned. -// @has implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar -// @has - Send -// @has - !AnAutoTrait -// @has - Copy +// @hastext implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar +// @hastext - Send +// @hastext - !AnAutoTrait +// @hastext - Copy impl !rustdoc_impl_parts_crosscrate::AnAutoTrait for Bar where T: Copy {} diff --git a/src/test/rustdoc/impl-trait-alias.rs b/src/test/rustdoc/impl-trait-alias.rs index 54c3f856ddb3c..1e913af587eb8 100644 --- a/src/test/rustdoc/impl-trait-alias.rs +++ b/src/test/rustdoc/impl-trait-alias.rs @@ -3,11 +3,11 @@ trait MyTrait {} impl MyTrait for i32 {} -// @has impl_trait_alias/type.Foo.html 'Foo' +// @hastext impl_trait_alias/type.Foo.html 'Foo' /// debug type pub type Foo = impl MyTrait; -// @has impl_trait_alias/fn.foo.html 'foo' +// @hastext impl_trait_alias/fn.foo.html 'foo' /// debug function pub fn foo() -> Foo { 1 diff --git a/src/test/rustdoc/inline_cross/add-docs.rs b/src/test/rustdoc/inline_cross/add-docs.rs index 8f0c4e5e64184..83764835546ee 100644 --- a/src/test/rustdoc/inline_cross/add-docs.rs +++ b/src/test/rustdoc/inline_cross/add-docs.rs @@ -4,6 +4,6 @@ extern crate inner; // @has add_docs/struct.MyStruct.html -// @has add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition" +// @hastext add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition" /// Doc comment from 'pub use', pub use inner::MyStruct; diff --git a/src/test/rustdoc/inline_cross/proc_macro.rs b/src/test/rustdoc/inline_cross/proc_macro.rs index 532a295c0f3f7..f32d7f383d967 100644 --- a/src/test/rustdoc/inline_cross/proc_macro.rs +++ b/src/test/rustdoc/inline_cross/proc_macro.rs @@ -12,25 +12,25 @@ extern crate some_macros; // @has proc_macro/derive.SomeDerive.html // @has proc_macro/macro.some_proc_macro.html -// @has - 'a proc-macro that swallows its input and does nothing.' +// @hastext - 'a proc-macro that swallows its input and does nothing.' pub use some_macros::some_proc_macro; // @has proc_macro/macro.reexported_macro.html -// @has - 'Doc comment from the original crate' +// @hastext - 'Doc comment from the original crate' pub use some_macros::reexported_macro; // @has proc_macro/attr.some_proc_attr.html -// @has - 'a proc-macro attribute that passes its item through verbatim.' +// @hastext - 'a proc-macro attribute that passes its item through verbatim.' pub use some_macros::some_proc_attr; // @has proc_macro/derive.SomeDerive.html -// @has - 'a derive attribute that adds nothing to its input.' +// @hastext - 'a derive attribute that adds nothing to its input.' pub use some_macros::SomeDerive; // @has proc_macro/attr.first_attr.html -// @has - 'Generated doc comment' +// @hastext - 'Generated doc comment' pub use some_macros::first_attr; // @has proc_macro/attr.second_attr.html -// @has - 'Generated doc comment' +// @hastext - 'Generated doc comment' pub use some_macros::second_attr; diff --git a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs index a2f0d65efce4c..5c95f7ca77645 100644 --- a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs @@ -12,14 +12,14 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @has - "mod1" -// @has - "public_fn" +// @hastext - "mod1" +// @hastext - "public_fn" // @!has - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html // @has foo/mod1/index.html -// @has - "public_fn" -// @has - "private_fn" +// @hastext - "public_fn" +// @hastext - "private_fn" // @has foo/mod1/fn.public_fn.html // @has foo/mod1/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs index 686e55de39264..48614ccb79156 100644 --- a/src/test/rustdoc/inline_local/glob-extern.rs +++ b/src/test/rustdoc/inline_local/glob-extern.rs @@ -11,7 +11,7 @@ pub use mod1::*; // @has foo/index.html // @!has - "mod1" -// @has - "public_fn" +// @hastext - "public_fn" // @!has - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs index f16d21ecdb139..82c5cff9d69dd 100644 --- a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs @@ -15,11 +15,11 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @has - "mod1" -// @has - "Mod1Public" +// @hastext - "mod1" +// @hastext - "Mod1Public" // @!has - "Mod1Private" // @!has - "mod2" -// @has - "Mod2Public" +// @hastext - "Mod2Public" // @!has - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html @@ -27,9 +27,9 @@ pub use mod1::*; // @!has foo/struct.Mod2Private.html // @has foo/mod1/index.html -// @has - "mod2" -// @has - "Mod1Public" -// @has - "Mod1Private" +// @hastext - "mod2" +// @hastext - "Mod1Public" +// @hastext - "Mod1Private" // @!has - "Mod2Public" // @!has - "Mod2Private" // @has foo/mod1/struct.Mod1Public.html @@ -38,8 +38,8 @@ pub use mod1::*; // @!has foo/mod1/struct.Mod2Private.html // @has foo/mod1/mod2/index.html -// @has - "Mod2Public" -// @has - "Mod2Private" +// @hastext - "Mod2Public" +// @hastext - "Mod2Private" // @has foo/mod1/mod2/struct.Mod2Public.html // @has foo/mod1/mod2/struct.Mod2Private.html diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs index d294d590e1b62..a1f2771a7ba6c 100644 --- a/src/test/rustdoc/inline_local/glob-private.rs +++ b/src/test/rustdoc/inline_local/glob-private.rs @@ -14,10 +14,10 @@ pub use mod1::*; // @has foo/index.html // @!has - "mod1" -// @has - "Mod1Public" +// @hastext - "Mod1Public" // @!has - "Mod1Private" // @!has - "mod2" -// @has - "Mod2Public" +// @hastext - "Mod2Public" // @!has - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs index 48539361fbfb5..1bd47752388c7 100644 --- a/src/test/rustdoc/inline_local/please_inline.rs +++ b/src/test/rustdoc/inline_local/please_inline.rs @@ -12,7 +12,7 @@ pub mod a { // @has please_inline/b/index.html pub mod b { - // @has - 'pub use foo::' + // @hastext - 'pub use foo::' // @!has please_inline/b/struct.Foo.html #[feature(inline)] pub use foo::Foo; diff --git a/src/test/rustdoc/intra-doc/extern-type.rs b/src/test/rustdoc/intra-doc/extern-type.rs index ab088ab789d43..f1c19b8e685d4 100644 --- a/src/test/rustdoc/intra-doc/extern-type.rs +++ b/src/test/rustdoc/intra-doc/extern-type.rs @@ -25,11 +25,11 @@ impl G for ExternType { } // @has 'extern_type/foreigntype.ExternType.html' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hastext 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.f"' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hastext 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.test"' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hastext 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.g"' /// See also [ExternType::f] /// See also [ExternType::test] diff --git a/src/test/rustdoc/issue-16265-1.rs b/src/test/rustdoc/issue-16265-1.rs index ec007e36b726c..052b5d6cc23d8 100644 --- a/src/test/rustdoc/issue-16265-1.rs +++ b/src/test/rustdoc/issue-16265-1.rs @@ -1,6 +1,6 @@ pub struct Foo; -// @has issue_16265_1/traits/index.html 'source' +// @hastext issue_16265_1/traits/index.html 'source' pub mod traits { impl PartialEq for super::Foo { fn eq(&self, _: &super::Foo) -> bool { diff --git a/src/test/rustdoc/issue-16265-2.rs b/src/test/rustdoc/issue-16265-2.rs index d5cd18d9daf9d..2df79bdd106e3 100644 --- a/src/test/rustdoc/issue-16265-2.rs +++ b/src/test/rustdoc/issue-16265-2.rs @@ -1,4 +1,4 @@ -// @has issue_16265_2/index.html 'source' +// @hastext issue_16265_2/index.html 'source' trait Y {} impl Y for Option {} diff --git a/src/test/rustdoc/issue-23511.rs b/src/test/rustdoc/issue-23511.rs index 2d2a7908fb187..3f4755003cb96 100644 --- a/src/test/rustdoc/issue-23511.rs +++ b/src/test/rustdoc/issue-23511.rs @@ -6,7 +6,7 @@ pub mod str { #![doc(primitive = "str")] impl str { - // @has search-index.js foo + // @hastext search-index.js foo #[rustc_allow_incoherent_impl] pub fn foo(&self) {} } diff --git a/src/test/rustdoc/issue-23812.rs b/src/test/rustdoc/issue-23812.rs index 5dac8d87b089c..7526d6ef83c65 100644 --- a/src/test/rustdoc/issue-23812.rs +++ b/src/test/rustdoc/issue-23812.rs @@ -16,9 +16,9 @@ doc! { } // @has issue_23812/Foo/index.html -// @has - 'Outer comment' +// @hastext - 'Outer comment' // @!has - '/// Outer comment' -// @has - 'Inner comment' +// @hastext - 'Inner comment' // @!has - '//! Inner comment' @@ -30,7 +30,7 @@ doc! { } // @has issue_23812/Bar/index.html -// @has - 'Outer block comment' +// @hastext - 'Outer block comment' // @!has - '/** Outer block comment */' -// @has - 'Inner block comment' +// @hastext - 'Inner block comment' // @!has - '/*! Inner block comment */' diff --git a/src/test/rustdoc/issue-27104.rs b/src/test/rustdoc/issue-27104.rs index b74c3eb78ace4..05a8457ff6a1c 100644 --- a/src/test/rustdoc/issue-27104.rs +++ b/src/test/rustdoc/issue-27104.rs @@ -6,5 +6,5 @@ // @!has - 'extern crate std' // @!has - 'use std::prelude::' -// @has - 'pub extern crate empty' +// @hastext - 'pub extern crate empty' pub extern crate empty; diff --git a/src/test/rustdoc/issue-27759.rs b/src/test/rustdoc/issue-27759.rs index f3739dafdf2f1..a12c0dac54a4a 100644 --- a/src/test/rustdoc/issue-27759.rs +++ b/src/test/rustdoc/issue-27759.rs @@ -4,11 +4,11 @@ #![unstable(feature="test", issue="27759")] // @has issue_27759/unstable/index.html -// @has - 'test #27759' +// @hastext - 'test #27759' #[unstable(feature="test", issue="27759")] pub mod unstable { // @has issue_27759/unstable/fn.issue.html - // @has - 'test_function #12345' + // @hastext - 'test_function #12345' #[unstable(feature="test_function", issue="12345")] pub fn issue() {} } diff --git a/src/test/rustdoc/issue-31899.rs b/src/test/rustdoc/issue-31899.rs index e7a8ee239e2f9..da8f596b3a010 100644 --- a/src/test/rustdoc/issue-31899.rs +++ b/src/test/rustdoc/issue-31899.rs @@ -1,5 +1,5 @@ // @has issue_31899/index.html -// @has - 'Make this line a bit longer.' +// @hastext - 'Make this line a bit longer.' // @!has - 'rust rust-example-rendered' // @!has - 'use ndarray::arr2' // @!has - 'prohibited' diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index 01f95538196f0..cf4575d635531 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -10,7 +10,7 @@ // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ // '👎 Deprecated since 1.0.0: text' -// @has - 'test #32374' +// @hastext - 'test #32374' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ // '🔬 This is a nightly-only experimental API. \(test\s#32374\)$' /// Docs diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index cb9b9b1538951..c509db43c9b09 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,11 +1,11 @@ // @has issue_41783/struct.Foo.html // @!has - 'space' // @!has - 'comment' -// @has - '# single' -// @has - '## double' -// @has - '### triple' -// @has - '#[outer]' -// @has - '#![inner]' +// @hastext - '# single' +// @hastext - '## double' +// @hastext - '### triple' +// @hastext - '#[outer]' +// @hastext - '#![inner]' /// ```no_run /// # # space diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs index 45544dbeea6a0..10c5199cadbb2 100644 --- a/src/test/rustdoc/issue-89852.rs +++ b/src/test/rustdoc/issue-89852.rs @@ -3,7 +3,7 @@ #![no_core] #![feature(no_core)] -// @matches 'issue_89852/sidebar-items.js' '"repro"' +// @matchestext 'issue_89852/sidebar-items.js' '"repro"' // @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' #[macro_export] diff --git a/src/test/rustdoc/link-title-escape.rs b/src/test/rustdoc/link-title-escape.rs index 01aa8d00b707b..ba143312b01fb 100644 --- a/src/test/rustdoc/link-title-escape.rs +++ b/src/test/rustdoc/link-title-escape.rs @@ -6,4 +6,4 @@ //! //! [foo]: url 'title & & "things"' -// @has 'foo/index.html' 'title & <stuff> & "things"' +// @hastext 'foo/index.html' 'title & <stuff> & "things"' diff --git a/src/test/rustdoc/macro-document-private-duplicate.rs b/src/test/rustdoc/macro-document-private-duplicate.rs index 7576c1326b8e4..2638c288120f3 100644 --- a/src/test/rustdoc/macro-document-private-duplicate.rs +++ b/src/test/rustdoc/macro-document-private-duplicate.rs @@ -10,14 +10,14 @@ // // compile-flags: --document-private-items -// @has macro_document_private_duplicate/index.html 'Doc 1.' -// @has macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' +// @hastext macro_document_private_duplicate/index.html 'Doc 1.' +// @hastext macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' /// Doc 1. macro_rules! a_macro { () => () } -// @has macro_document_private_duplicate/index.html 'Doc 2.' +// @hastext macro_document_private_duplicate/index.html 'Doc 2.' // @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' /// Doc 2. macro_rules! a_macro { diff --git a/src/test/rustdoc/macro_rules-matchers.rs b/src/test/rustdoc/macro_rules-matchers.rs index 131c53ec24bc4..28ef367de9dd2 100644 --- a/src/test/rustdoc/macro_rules-matchers.rs +++ b/src/test/rustdoc/macro_rules-matchers.rs @@ -7,27 +7,27 @@ // @has - '//span[@class="macro"]' 'macro_rules!' // @has - '//span[@class="ident"]' 'todo' -// @has - '{ () => { ... }; ($(' +// @hastext - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' -// @has - ':' +// @hastext - ':' // @has - '//span[@class="ident"]' 'tt' -// @has - ')+' -// @has - ') => { ... }; }' +// @hastext - ')+' +// @hastext - ') => { ... }; }' pub use std::todo; mod mod1 { // @has 'foo/macro.macro1.html' - // @has - 'macro_rules!' - // @has - 'macro1' - // @has - '{ () => { ... }; ($(' + // @hastext - 'macro_rules!' + // @hastext - 'macro1' + // @hastext - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' - // @has - ':' - // @has - 'expr' - // @has - '),' - // @has - '+' - // @has - ') => { ... }; }' + // @hastext - ':' + // @hastext - 'expr' + // @hastext - '),' + // @hastext - '+' + // @hastext - ') => { ... }; }' #[macro_export] macro_rules! macro1 { () => {}; diff --git a/src/test/rustdoc/markdown-summaries.rs b/src/test/rustdoc/markdown-summaries.rs index b843e28e7b0d3..f30e8cad8d1fe 100644 --- a/src/test/rustdoc/markdown-summaries.rs +++ b/src/test/rustdoc/markdown-summaries.rs @@ -7,7 +7,7 @@ //! //! [link]: https://example.com -// @has search-index.js 'This summary has a link and code.' +// @hastext search-index.js 'This summary has a link and code.' // @!has - 'second paragraph' /// This `code` will be rendered in a code tag. @@ -15,8 +15,8 @@ /// This text should not be rendered. pub struct Sidebar; -// @has search-index.js 'This code will be rendered in a code tag.' -// @has summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' +// @hastext search-index.js 'This code will be rendered in a code tag.' +// @hastext summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' // @!has - 'text should not be rendered' /// ```text diff --git a/src/test/rustdoc/nested-modules.rs b/src/test/rustdoc/nested-modules.rs index 1596f46740e8f..260f941e07a67 100644 --- a/src/test/rustdoc/nested-modules.rs +++ b/src/test/rustdoc/nested-modules.rs @@ -7,11 +7,11 @@ mod a_module { pub mod a_nested_module { // @has aCrate/a_nested_module/index.html '//a[@href="fn.a_nested_public_function.html"]' 'a_nested_public_function' - // @has aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' + // @hastext aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' pub fn a_nested_public_function() {} // @has aCrate/a_nested_module/index.html '//a[@href="fn.another_nested_public_function.html"]' 'another_nested_public_function' - // @has aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' + // @hastext aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' pub use a_nested_module::a_nested_public_function as another_nested_public_function; } diff --git a/src/test/rustdoc/search-index-summaries.rs b/src/test/rustdoc/search-index-summaries.rs index dd9c1a0b47dfc..63be1a64a9dac 100644 --- a/src/test/rustdoc/search-index-summaries.rs +++ b/src/test/rustdoc/search-index-summaries.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @has 'search-index.js' 'Foo short link.' +// @hastext 'search-index.js' 'Foo short link.' // @!has - 'www.example.com' // @!has - 'More Foo.' diff --git a/src/test/rustdoc/search-index.rs b/src/test/rustdoc/search-index.rs index f1b78f17277d1..ab2e6e0574021 100644 --- a/src/test/rustdoc/search-index.rs +++ b/src/test/rustdoc/search-index.rs @@ -2,13 +2,13 @@ use std::ops::Deref; -// @has search-index.js Foo +// @hastext search-index.js Foo pub use private::Foo; mod private { pub struct Foo; impl Foo { - pub fn test_method() {} // @has - test_method + pub fn test_method() {} // @hastext - test_method fn priv_method() {} // @!has - priv_method } diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs index 48b60885974af..875d79d928be8 100644 --- a/src/test/rustdoc/show-const-contents.rs +++ b/src/test/rustdoc/show-const-contents.rs @@ -1,34 +1,34 @@ // Test that the contents of constants are displayed as part of the // documentation. -// @has show_const_contents/constant.CONST_S.html 'show this' +// @hastext show_const_contents/constant.CONST_S.html 'show this' // @!has show_const_contents/constant.CONST_S.html '; //' pub const CONST_S: &'static str = "show this"; -// @has show_const_contents/constant.CONST_I32.html '= 42;' +// @hastext show_const_contents/constant.CONST_I32.html '= 42;' // @!has show_const_contents/constant.CONST_I32.html '; //' pub const CONST_I32: i32 = 42; -// @has show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' +// @hastext show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' // @!has show_const_contents/constant.CONST_I32_HEX.html '; //' pub const CONST_I32_HEX: i32 = 0x42; -// @has show_const_contents/constant.CONST_NEG_I32.html '= -42;' +// @hastext show_const_contents/constant.CONST_NEG_I32.html '= -42;' // @!has show_const_contents/constant.CONST_NEG_I32.html '; //' pub const CONST_NEG_I32: i32 = -42; -// @has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' +// @hastext show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' // @!has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' pub const CONST_EQ_TO_VALUE_I32: i32 = 42i32; -// @has show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' +// @hastext show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' pub const CONST_CALC_I32: i32 = 42 + 1; // @!has show_const_contents/constant.CONST_REF_I32.html '= &42;' // @!has show_const_contents/constant.CONST_REF_I32.html '; //' pub const CONST_REF_I32: &'static i32 = &42; -// @has show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hastext show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' pub const CONST_I32_MAX: i32 = i32::MAX; // @!has show_const_contents/constant.UNIT.html '= ();' @@ -47,11 +47,11 @@ pub struct MyTypeWithStr(&'static str); // @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); -// @has show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' -// @has show_const_contents/constant.PI.html '; // 3.14159274f32' +// @hastext show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' +// @hastext show_const_contents/constant.PI.html '; // 3.14159274f32' pub use std::f32::consts::PI; -// @has show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hastext show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' #[allow(deprecated, deprecated_in_future)] pub use std::i32::MAX; @@ -61,7 +61,7 @@ macro_rules! int_module { ) } -// @has show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' +// @hastext show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' int_module!(i16); // @has show_const_contents/constant.ESCAPE.html //pre '= r#""#;' diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs index 5be6b98264a10..ec7d1093abf31 100644 --- a/src/test/rustdoc/sort-modules-by-appearance.rs +++ b/src/test/rustdoc/sort-modules-by-appearance.rs @@ -9,5 +9,5 @@ pub mod module_c {} pub mod module_a {} -// @matches 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' -// @matches 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' +// @matchestext 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' +// @matchestext 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' diff --git a/src/test/rustdoc/source-file.rs b/src/test/rustdoc/source-file.rs index 968899dab8852..0177211ddb85e 100644 --- a/src/test/rustdoc/source-file.rs +++ b/src/test/rustdoc/source-file.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @has source-files.js source-file.rs +// @hastext source-files.js source-file.rs pub struct Foo; diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs index f1d49b9fcb20a..e33601243f73b 100644 --- a/src/test/rustdoc/static-root-path.rs +++ b/src/test/rustdoc/static-root-path.rs @@ -1,18 +1,18 @@ // compile-flags:-Z unstable-options --static-root-path /cache/ // @has static_root_path/struct.SomeStruct.html -// @matches - '"/cache/main\.js"' +// @matchestext - '"/cache/main\.js"' // @!matches - '"\.\./main\.js"' -// @matches - 'data-root-path="\.\./"' +// @matchestext - 'data-root-path="\.\./"' // @!matches - '"/cache/search-index\.js"' pub struct SomeStruct; // @has src/static_root_path/static-root-path.rs.html -// @matches - '"/cache/source-script\.js"' +// @matchestext - '"/cache/source-script\.js"' // @!matches - '"\.\./\.\./source-script\.js"' -// @matches - '"\.\./\.\./source-files.js"' +// @matchestext - '"\.\./\.\./source-files.js"' // @!matches - '"/cache/source-files\.js"' // @has settings.html -// @matches - '/cache/settings\.js' +// @matchestext - '/cache/settings\.js' // @!matches - '\./settings\.js' diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs index e5c6e9dc3f9ed..7d1b82b051a18 100644 --- a/src/test/rustdoc/type-layout.rs +++ b/src/test/rustdoc/type-layout.rs @@ -1,84 +1,84 @@ // compile-flags: --show-type-layout -Z unstable-options -// @has type_layout/struct.Foo.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/struct.Foo.html 'Size: ' +// @hastext - ' bytes' // @has - '//*[@id="layout"]/a[@href="#layout"]' '' pub struct Foo { pub a: usize, b: Vec, } -// @has type_layout/enum.Bar.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/enum.Bar.html 'Size: ' +// @hastext - ' bytes' pub enum Bar<'a> { A(String), B(&'a str, (std::collections::HashMap, Foo)), } -// @has type_layout/union.Baz.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/union.Baz.html 'Size: ' +// @hastext - ' bytes' pub union Baz { a: &'static str, b: usize, c: &'static [u8], } -// @has type_layout/struct.X.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/struct.X.html 'Size: ' +// @hastext - ' bytes' pub struct X(usize); -// @has type_layout/struct.Y.html 'Size: ' -// @has - '1 byte' +// @hastext type_layout/struct.Y.html 'Size: ' +// @hastext - '1 byte' // @!has - ' bytes' pub struct Y(u8); -// @has type_layout/struct.Z.html 'Size: ' -// @has - '0 bytes' +// @hastext type_layout/struct.Z.html 'Size: ' +// @hastext - '0 bytes' pub struct Z; // We can't compute layout for generic types. -// @has type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' +// @hastext type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' // @!has - 'Size: ' pub struct Generic(T); // We *can*, however, compute layout for types that are only generic over lifetimes, // because lifetimes are a type-system construct. -// @has type_layout/struct.GenericLifetimes.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/struct.GenericLifetimes.html 'Size: ' +// @hastext - ' bytes' pub struct GenericLifetimes<'a>(&'a str); -// @has type_layout/struct.Unsized.html 'Size: ' -// @has - '(unsized)' +// @hastext type_layout/struct.Unsized.html 'Size: ' +// @hastext - '(unsized)' pub struct Unsized([u8]); -// @has type_layout/type.TypeAlias.html 'Size: ' -// @has - ' bytes' +// @hastext type_layout/type.TypeAlias.html 'Size: ' +// @hastext - ' bytes' pub type TypeAlias = X; -// @has type_layout/type.GenericTypeAlias.html 'Size: ' -// @has - '8 bytes' +// @hastext type_layout/type.GenericTypeAlias.html 'Size: ' +// @hastext - '8 bytes' pub type GenericTypeAlias = (Generic<(u32, ())>, Generic); // Regression test for the rustdoc equivalent of #85103. -// @has type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' +// @hastext type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>; // @!has type_layout/trait.MyTrait.html 'Size: ' pub trait MyTrait {} -// @has type_layout/enum.Variants.html 'Size: ' -// @has - '2 bytes' -// @has - 'A: 0 bytes' -// @has - 'B: 1 byte' +// @hastext type_layout/enum.Variants.html 'Size: ' +// @hastext - '2 bytes' +// @hastext - 'A: 0 bytes' +// @hastext - 'B: 1 byte' pub enum Variants { A, B(u8), } -// @has type_layout/enum.WithNiche.html 'Size: ' +// @hastext type_layout/enum.WithNiche.html 'Size: ' // @has - //p '4 bytes' -// @has - 'None: 0 bytes' -// @has - 'Some: 4 bytes' +// @hastext - 'None: 0 bytes' +// @hastext - 'Some: 4 bytes' pub enum WithNiche { None, Some(std::num::NonZeroU32), diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 4ecd62cded22e..0384575a5dfd2 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -11,7 +11,7 @@ impl MyStruct { // @has typedef/type.MyAlias.html // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyAlias' // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyTrait for MyAlias' -// @has - 'Alias docstring' +// @hastext - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' // @has - '//*[@class="sidebar"]//a[@href="#trait-implementations"]' 'Trait Implementations' diff --git a/src/test/rustdoc/universal-impl-trait.rs b/src/test/rustdoc/universal-impl-trait.rs index b10b1b8658db9..201ec3818e9ae 100644 --- a/src/test/rustdoc/universal-impl-trait.rs +++ b/src/test/rustdoc/universal-impl-trait.rs @@ -5,15 +5,15 @@ use std::borrow::Borrow; // @has foo/fn.foo.html // @has - //pre 'foo(' -// @matches - '_x: impl (' - // @matches - '_x: impl (' + // @matchestext - '_x: impl (T); impl S { // @has foo/struct.S.html - // @has - 'bar(' - // @matches - '_bar: impl (' + // @matchestext - '_bar: impl (' - // @matches - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' + // @hastext - 'baz(' + // @matchestext - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' pub fn baz(_baz: S) { } - // @has - 'qux(' - // @matches - 'trait\.Read\.html' + // @hastext - 'qux(' + // @matchestext - 'trait\.Read\.html' pub fn qux(_qux: impl IntoIterator>) { } } -// @has - 'method(' -// @matches - '_x: impl (' +// @matchestext - '_x: impl Trait for S {} // @has foo/fn.much_universe.html -// @matches - 'T:.+Borrow.+impl .+trait\.Trait\.html' -// @matches - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' -// @matches - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' +// @matchestext - 'T:.+Borrow.+impl .+trait\.Trait\.html' +// @matchestext - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' +// @matchestext - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' pub fn much_universe< T: Borrow, U: IntoIterator>, From 13d53273f81142cbea70e63730f0adc199723153 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 10 Aug 2022 13:13:18 -0700 Subject: [PATCH 11/18] Rename `@hastext` to `@hasraw` (same for `matches`) I think `@hasraw` is slightly clearer than `@hastext` since it is actually matching against the raw HTML, not the text nodes. --- src/etc/htmldocck.py | 14 ++--- src/test/rustdoc/deprecated-impls.rs | 28 ++++----- src/test/rustdoc/elided-lifetime.rs | 12 ++-- src/test/rustdoc/empty-mod-private.rs | 6 +- src/test/rustdoc/empty-mod-public.rs | 6 +- .../generic-associated-types/issue-94683.rs | 4 +- src/test/rustdoc/hide-unstable-trait.rs | 4 +- src/test/rustdoc/impl-parts-crosscrate.rs | 8 +-- src/test/rustdoc/impl-trait-alias.rs | 4 +- src/test/rustdoc/inline_cross/add-docs.rs | 2 +- src/test/rustdoc/inline_cross/proc_macro.rs | 12 ++-- .../glob-extern-document-private-items.rs | 8 +-- src/test/rustdoc/inline_local/glob-extern.rs | 2 +- .../glob-private-document-private-items.rs | 16 ++--- src/test/rustdoc/inline_local/glob-private.rs | 4 +- .../rustdoc/inline_local/please_inline.rs | 2 +- src/test/rustdoc/intra-doc/extern-type.rs | 6 +- src/test/rustdoc/issue-16265-1.rs | 2 +- src/test/rustdoc/issue-16265-2.rs | 2 +- src/test/rustdoc/issue-23511.rs | 2 +- src/test/rustdoc/issue-23812.rs | 8 +-- src/test/rustdoc/issue-27104.rs | 2 +- src/test/rustdoc/issue-27759.rs | 4 +- src/test/rustdoc/issue-31899.rs | 2 +- src/test/rustdoc/issue-32374.rs | 2 +- src/test/rustdoc/issue-41783.rs | 10 ++-- src/test/rustdoc/issue-89852.rs | 2 +- src/test/rustdoc/link-title-escape.rs | 2 +- .../macro-document-private-duplicate.rs | 6 +- src/test/rustdoc/macro_rules-matchers.rs | 24 ++++---- src/test/rustdoc/markdown-summaries.rs | 6 +- src/test/rustdoc/nested-modules.rs | 4 +- src/test/rustdoc/search-index-summaries.rs | 2 +- src/test/rustdoc/search-index.rs | 4 +- src/test/rustdoc/show-const-contents.rs | 22 +++---- .../rustdoc/sort-modules-by-appearance.rs | 4 +- src/test/rustdoc/source-file.rs | 2 +- src/test/rustdoc/static-root-path.rs | 10 ++-- src/test/rustdoc/type-layout.rs | 58 +++++++++---------- src/test/rustdoc/typedef.rs | 2 +- src/test/rustdoc/universal-impl-trait.rs | 30 +++++----- 41 files changed, 175 insertions(+), 175 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 48a83a66957f2..e0cd089ac5e87 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -41,15 +41,15 @@ `PATH` is relative to the output directory. It can be given as `-` which repeats the most recently used `PATH`. -* `@hastext PATH PATTERN` and `@matchestext PATH PATTERN` checks +* `@hasraw PATH PATTERN` and `@matchesraw PATH PATTERN` checks for the occurrence of the given pattern `PATTERN` in the specified file. Only one occurrence of the pattern is enough. - For `@hastext`, `PATTERN` is a whitespace-normalized (every consecutive + For `@hasraw`, `PATTERN` is a whitespace-normalized (every consecutive whitespace being replaced by one single space character) string. The entire file is also whitespace-normalized including newlines. - For `@matchestext`, `PATTERN` is a Python-supported regular expression. + For `@matchesraw`, `PATTERN` is a Python-supported regular expression. The file remains intact but the regexp is matched without the `MULTILINE` and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)` to override them, and `\A` and `\Z` for definitely matching @@ -542,19 +542,19 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first): def check_command(c, cache): try: cerr = "" - if c.cmd in ['has', 'hastext', 'matches', 'matchestext']: # string test + if c.cmd in ['has', 'hasraw', 'matches', 'matchesraw']: # string test regexp = c.cmd.startswith('matches') - if len(c.args) == 1 and not regexp and 'text' not in c.cmd: # @has = file existence + if len(c.args) == 1 and not regexp and 'raw' not in c.cmd: # @has = file existence try: cache.get_file(c.args[0]) ret = True except FailedCheck as err: cerr = str(err) ret = False - elif len(c.args) == 2 and 'text' in c.cmd: # @hastext/matchestext = string test + elif len(c.args) == 2 and 'raw' in c.cmd: # @hasraw/matchesraw = string test cerr = "`PATTERN` did not match" ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp) - elif len(c.args) == 3 and 'text' not in c.cmd: # @has/matches = XML tree test + elif len(c.args) == 3 and 'raw' not in c.cmd: # @has/matches = XML tree test cerr = "`XPATH PATTERN` did not match" ret = get_nb_matching_elements(cache, c, regexp, True) != 0 else: diff --git a/src/test/rustdoc/deprecated-impls.rs b/src/test/rustdoc/deprecated-impls.rs index 75c65add85666..76c1e880ae79d 100644 --- a/src/test/rustdoc/deprecated-impls.rs +++ b/src/test/rustdoc/deprecated-impls.rs @@ -5,8 +5,8 @@ pub struct Foo0; impl Foo0 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc' - // @hastext - 'fn_with_doc short' - // @hastext - 'fn_with_doc full' + // @hasraw - 'fn_with_doc short' + // @hasraw - 'fn_with_doc full' /// fn_with_doc short /// /// fn_with_doc full @@ -52,8 +52,8 @@ pub struct Foo1; impl Bar for Foo1 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @hastext - 'fn_empty_with_doc_impl short' - // @hastext - 'fn_empty_with_doc_impl full' + // @hasraw - 'fn_empty_with_doc_impl short' + // @hasraw - 'fn_empty_with_doc_impl full' /// fn_empty_with_doc_impl short /// /// fn_empty_with_doc_impl full @@ -63,8 +63,8 @@ impl Bar for Foo1 { fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @hastext - 'fn_def_with_doc_impl short' - // @hastext - 'fn_def_with_doc_impl full' + // @hasraw - 'fn_def_with_doc_impl short' + // @hasraw - 'fn_def_with_doc_impl full' /// fn_def_with_doc_impl short /// /// fn_def_with_doc_impl full @@ -74,7 +74,7 @@ impl Bar for Foo1 { fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @hastext - 'fn_def_def_with_doc short' + // @hasraw - 'fn_def_def_with_doc short' // @!has - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' @@ -85,33 +85,33 @@ pub struct Foo2; impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @hastext - 'fn_empty_with_doc short' + // @hasraw - 'fn_empty_with_doc short' // @!has - 'fn_empty_with_doc full' fn fn_empty_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc' - // @hastext - 'fn_empty_without_doc_impl short' - // @hastext - 'fn_empty_without_doc_impl full' + // @hasraw - 'fn_empty_without_doc_impl short' + // @hasraw - 'fn_empty_without_doc_impl full' /// fn_empty_without_doc_impl short /// /// fn_empty_without_doc_impl full fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @hastext - 'fn_def_with_doc short' + // @hasraw - 'fn_def_with_doc short' // @!has - 'fn_def_with_doc full' fn fn_def_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc' - // @hastext - 'fn_def_without_doc_impl short' - // @hastext - 'fn_def_without_doc_impl full' + // @hasraw - 'fn_def_without_doc_impl short' + // @hasraw - 'fn_def_without_doc_impl full' /// fn_def_without_doc_impl short /// /// fn_def_without_doc_impl full fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @hastext - 'fn_def_def_with_doc short' + // @hasraw - 'fn_def_def_with_doc short' // @!has - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' diff --git a/src/test/rustdoc/elided-lifetime.rs b/src/test/rustdoc/elided-lifetime.rs index 7ade072e4b1eb..9b4ceb4f9cd86 100644 --- a/src/test/rustdoc/elided-lifetime.rs +++ b/src/test/rustdoc/elided-lifetime.rs @@ -11,33 +11,33 @@ pub struct Ref<'a>(&'a u32); type ARef<'a> = Ref<'a>; // @has foo/fn.test1.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" pub fn test1(a: &u32) -> Ref { Ref(a) } // @has foo/fn.test2.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" pub fn test2(a: &u32) -> Ref<'_> { Ref(a) } // @has foo/fn.test3.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" pub fn test3(a: &u32) -> ARef { Ref(a) } // @has foo/fn.test4.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" pub fn test4(a: &u32) -> ARef<'_> { Ref(a) } // Ensure external paths in inlined docs also display elided lifetime // @has foo/bar/fn.test5.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" // @has foo/bar/fn.test6.html -// @matchestext - "Ref<'_>" +// @matchesraw - "Ref<'_>" #[doc(inline)] pub extern crate bar; diff --git a/src/test/rustdoc/empty-mod-private.rs b/src/test/rustdoc/empty-mod-private.rs index 68c7649a50fb0..147e11e5882e0 100644 --- a/src/test/rustdoc/empty-mod-private.rs +++ b/src/test/rustdoc/empty-mod-private.rs @@ -1,16 +1,16 @@ // compile-flags: --document-private-items // @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo' -// @hastext 'empty_mod_private/sidebar-items.js' 'foo' +// @hasraw 'empty_mod_private/sidebar-items.js' 'foo' // @matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo' mod foo {} // @has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar' -// @hastext 'empty_mod_private/sidebar-items.js' 'bar' +// @hasraw 'empty_mod_private/sidebar-items.js' 'bar' // @matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar' mod bar { // @has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @hastext 'empty_mod_private/bar/sidebar-items.js' 'baz' + // @hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz' mod baz {} } diff --git a/src/test/rustdoc/empty-mod-public.rs b/src/test/rustdoc/empty-mod-public.rs index 1e797d9513aa0..c0bac40212c90 100644 --- a/src/test/rustdoc/empty-mod-public.rs +++ b/src/test/rustdoc/empty-mod-public.rs @@ -1,14 +1,14 @@ // @has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo' -// @hastext 'empty_mod_public/sidebar-items.js' 'foo' +// @hasraw 'empty_mod_public/sidebar-items.js' 'foo' // @matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo' pub mod foo {} // @has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar' -// @hastext 'empty_mod_public/sidebar-items.js' 'bar' +// @hasraw 'empty_mod_public/sidebar-items.js' 'bar' // @matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar' pub mod bar { // @has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @hastext 'empty_mod_public/bar/sidebar-items.js' 'baz' + // @hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz' pub mod baz {} } diff --git a/src/test/rustdoc/generic-associated-types/issue-94683.rs b/src/test/rustdoc/generic-associated-types/issue-94683.rs index 324a6461f4292..91499100ec687 100644 --- a/src/test/rustdoc/generic-associated-types/issue-94683.rs +++ b/src/test/rustdoc/generic-associated-types/issue-94683.rs @@ -8,6 +8,6 @@ pub trait Trait { // Make sure that the elided lifetime shows up // @has foo/type.T.html -// @hastext - "pub type T = " -// @hastext - "<'_>" +// @hasraw - "pub type T = " +// @hasraw - "<'_>" pub type T = fn(&<() as Trait>::Gat<'_>); diff --git a/src/test/rustdoc/hide-unstable-trait.rs b/src/test/rustdoc/hide-unstable-trait.rs index 0bdacf74ed284..0bf7cabc43b24 100644 --- a/src/test/rustdoc/hide-unstable-trait.rs +++ b/src/test/rustdoc/hide-unstable-trait.rs @@ -5,7 +5,7 @@ extern crate unstable_trait; -// @hastext foo/struct.Foo.html 'bar' -// @hastext foo/struct.Foo.html 'bar2' +// @hasraw foo/struct.Foo.html 'bar' +// @hasraw foo/struct.Foo.html 'bar2' #[doc(inline)] pub use unstable_trait::Foo; diff --git a/src/test/rustdoc/impl-parts-crosscrate.rs b/src/test/rustdoc/impl-parts-crosscrate.rs index 8fb8971ca7175..34733f1f8ccb8 100644 --- a/src/test/rustdoc/impl-parts-crosscrate.rs +++ b/src/test/rustdoc/impl-parts-crosscrate.rs @@ -12,9 +12,9 @@ pub struct Bar { t: T } // full impl string. Instead, just make sure something from each part // is mentioned. -// @hastext implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar -// @hastext - Send -// @hastext - !AnAutoTrait -// @hastext - Copy +// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar +// @hasraw - Send +// @hasraw - !AnAutoTrait +// @hasraw - Copy impl !rustdoc_impl_parts_crosscrate::AnAutoTrait for Bar where T: Copy {} diff --git a/src/test/rustdoc/impl-trait-alias.rs b/src/test/rustdoc/impl-trait-alias.rs index 1e913af587eb8..4f681c78ee117 100644 --- a/src/test/rustdoc/impl-trait-alias.rs +++ b/src/test/rustdoc/impl-trait-alias.rs @@ -3,11 +3,11 @@ trait MyTrait {} impl MyTrait for i32 {} -// @hastext impl_trait_alias/type.Foo.html 'Foo' +// @hasraw impl_trait_alias/type.Foo.html 'Foo' /// debug type pub type Foo = impl MyTrait; -// @hastext impl_trait_alias/fn.foo.html 'foo' +// @hasraw impl_trait_alias/fn.foo.html 'foo' /// debug function pub fn foo() -> Foo { 1 diff --git a/src/test/rustdoc/inline_cross/add-docs.rs b/src/test/rustdoc/inline_cross/add-docs.rs index 83764835546ee..a1124d2094c0f 100644 --- a/src/test/rustdoc/inline_cross/add-docs.rs +++ b/src/test/rustdoc/inline_cross/add-docs.rs @@ -4,6 +4,6 @@ extern crate inner; // @has add_docs/struct.MyStruct.html -// @hastext add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition" +// @hasraw add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition" /// Doc comment from 'pub use', pub use inner::MyStruct; diff --git a/src/test/rustdoc/inline_cross/proc_macro.rs b/src/test/rustdoc/inline_cross/proc_macro.rs index f32d7f383d967..a46550865c8b1 100644 --- a/src/test/rustdoc/inline_cross/proc_macro.rs +++ b/src/test/rustdoc/inline_cross/proc_macro.rs @@ -12,25 +12,25 @@ extern crate some_macros; // @has proc_macro/derive.SomeDerive.html // @has proc_macro/macro.some_proc_macro.html -// @hastext - 'a proc-macro that swallows its input and does nothing.' +// @hasraw - 'a proc-macro that swallows its input and does nothing.' pub use some_macros::some_proc_macro; // @has proc_macro/macro.reexported_macro.html -// @hastext - 'Doc comment from the original crate' +// @hasraw - 'Doc comment from the original crate' pub use some_macros::reexported_macro; // @has proc_macro/attr.some_proc_attr.html -// @hastext - 'a proc-macro attribute that passes its item through verbatim.' +// @hasraw - 'a proc-macro attribute that passes its item through verbatim.' pub use some_macros::some_proc_attr; // @has proc_macro/derive.SomeDerive.html -// @hastext - 'a derive attribute that adds nothing to its input.' +// @hasraw - 'a derive attribute that adds nothing to its input.' pub use some_macros::SomeDerive; // @has proc_macro/attr.first_attr.html -// @hastext - 'Generated doc comment' +// @hasraw - 'Generated doc comment' pub use some_macros::first_attr; // @has proc_macro/attr.second_attr.html -// @hastext - 'Generated doc comment' +// @hasraw - 'Generated doc comment' pub use some_macros::second_attr; diff --git a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs index 5c95f7ca77645..8526cbde7df36 100644 --- a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs @@ -12,14 +12,14 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @hastext - "mod1" -// @hastext - "public_fn" +// @hasraw - "mod1" +// @hasraw - "public_fn" // @!has - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html // @has foo/mod1/index.html -// @hastext - "public_fn" -// @hastext - "private_fn" +// @hasraw - "public_fn" +// @hasraw - "private_fn" // @has foo/mod1/fn.public_fn.html // @has foo/mod1/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs index 48614ccb79156..c465fcf35cac6 100644 --- a/src/test/rustdoc/inline_local/glob-extern.rs +++ b/src/test/rustdoc/inline_local/glob-extern.rs @@ -11,7 +11,7 @@ pub use mod1::*; // @has foo/index.html // @!has - "mod1" -// @hastext - "public_fn" +// @hasraw - "public_fn" // @!has - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs index 82c5cff9d69dd..adbd53f912e49 100644 --- a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs @@ -15,11 +15,11 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @hastext - "mod1" -// @hastext - "Mod1Public" +// @hasraw - "mod1" +// @hasraw - "Mod1Public" // @!has - "Mod1Private" // @!has - "mod2" -// @hastext - "Mod2Public" +// @hasraw - "Mod2Public" // @!has - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html @@ -27,9 +27,9 @@ pub use mod1::*; // @!has foo/struct.Mod2Private.html // @has foo/mod1/index.html -// @hastext - "mod2" -// @hastext - "Mod1Public" -// @hastext - "Mod1Private" +// @hasraw - "mod2" +// @hasraw - "Mod1Public" +// @hasraw - "Mod1Private" // @!has - "Mod2Public" // @!has - "Mod2Private" // @has foo/mod1/struct.Mod1Public.html @@ -38,8 +38,8 @@ pub use mod1::*; // @!has foo/mod1/struct.Mod2Private.html // @has foo/mod1/mod2/index.html -// @hastext - "Mod2Public" -// @hastext - "Mod2Private" +// @hasraw - "Mod2Public" +// @hasraw - "Mod2Private" // @has foo/mod1/mod2/struct.Mod2Public.html // @has foo/mod1/mod2/struct.Mod2Private.html diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs index a1f2771a7ba6c..d1d15ae2b0eaa 100644 --- a/src/test/rustdoc/inline_local/glob-private.rs +++ b/src/test/rustdoc/inline_local/glob-private.rs @@ -14,10 +14,10 @@ pub use mod1::*; // @has foo/index.html // @!has - "mod1" -// @hastext - "Mod1Public" +// @hasraw - "Mod1Public" // @!has - "Mod1Private" // @!has - "mod2" -// @hastext - "Mod2Public" +// @hasraw - "Mod2Public" // @!has - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs index 1bd47752388c7..03db2386d9d7e 100644 --- a/src/test/rustdoc/inline_local/please_inline.rs +++ b/src/test/rustdoc/inline_local/please_inline.rs @@ -12,7 +12,7 @@ pub mod a { // @has please_inline/b/index.html pub mod b { - // @hastext - 'pub use foo::' + // @hasraw - 'pub use foo::' // @!has please_inline/b/struct.Foo.html #[feature(inline)] pub use foo::Foo; diff --git a/src/test/rustdoc/intra-doc/extern-type.rs b/src/test/rustdoc/intra-doc/extern-type.rs index f1c19b8e685d4..5440f582dff7e 100644 --- a/src/test/rustdoc/intra-doc/extern-type.rs +++ b/src/test/rustdoc/intra-doc/extern-type.rs @@ -25,11 +25,11 @@ impl G for ExternType { } // @has 'extern_type/foreigntype.ExternType.html' -// @hastext 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.f"' -// @hastext 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.test"' -// @hastext 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.g"' /// See also [ExternType::f] /// See also [ExternType::test] diff --git a/src/test/rustdoc/issue-16265-1.rs b/src/test/rustdoc/issue-16265-1.rs index 052b5d6cc23d8..2fda637a64131 100644 --- a/src/test/rustdoc/issue-16265-1.rs +++ b/src/test/rustdoc/issue-16265-1.rs @@ -1,6 +1,6 @@ pub struct Foo; -// @hastext issue_16265_1/traits/index.html 'source' +// @hasraw issue_16265_1/traits/index.html 'source' pub mod traits { impl PartialEq for super::Foo { fn eq(&self, _: &super::Foo) -> bool { diff --git a/src/test/rustdoc/issue-16265-2.rs b/src/test/rustdoc/issue-16265-2.rs index 2df79bdd106e3..c3eb356171e85 100644 --- a/src/test/rustdoc/issue-16265-2.rs +++ b/src/test/rustdoc/issue-16265-2.rs @@ -1,4 +1,4 @@ -// @hastext issue_16265_2/index.html 'source' +// @hasraw issue_16265_2/index.html 'source' trait Y {} impl Y for Option {} diff --git a/src/test/rustdoc/issue-23511.rs b/src/test/rustdoc/issue-23511.rs index 3f4755003cb96..7576ebb0305aa 100644 --- a/src/test/rustdoc/issue-23511.rs +++ b/src/test/rustdoc/issue-23511.rs @@ -6,7 +6,7 @@ pub mod str { #![doc(primitive = "str")] impl str { - // @hastext search-index.js foo + // @hasraw search-index.js foo #[rustc_allow_incoherent_impl] pub fn foo(&self) {} } diff --git a/src/test/rustdoc/issue-23812.rs b/src/test/rustdoc/issue-23812.rs index 7526d6ef83c65..a52a4f56a4c63 100644 --- a/src/test/rustdoc/issue-23812.rs +++ b/src/test/rustdoc/issue-23812.rs @@ -16,9 +16,9 @@ doc! { } // @has issue_23812/Foo/index.html -// @hastext - 'Outer comment' +// @hasraw - 'Outer comment' // @!has - '/// Outer comment' -// @hastext - 'Inner comment' +// @hasraw - 'Inner comment' // @!has - '//! Inner comment' @@ -30,7 +30,7 @@ doc! { } // @has issue_23812/Bar/index.html -// @hastext - 'Outer block comment' +// @hasraw - 'Outer block comment' // @!has - '/** Outer block comment */' -// @hastext - 'Inner block comment' +// @hasraw - 'Inner block comment' // @!has - '/*! Inner block comment */' diff --git a/src/test/rustdoc/issue-27104.rs b/src/test/rustdoc/issue-27104.rs index 05a8457ff6a1c..a5b0441ac7669 100644 --- a/src/test/rustdoc/issue-27104.rs +++ b/src/test/rustdoc/issue-27104.rs @@ -6,5 +6,5 @@ // @!has - 'extern crate std' // @!has - 'use std::prelude::' -// @hastext - 'pub extern crate empty' +// @hasraw - 'pub extern crate empty' pub extern crate empty; diff --git a/src/test/rustdoc/issue-27759.rs b/src/test/rustdoc/issue-27759.rs index a12c0dac54a4a..65e0f7cb87b0c 100644 --- a/src/test/rustdoc/issue-27759.rs +++ b/src/test/rustdoc/issue-27759.rs @@ -4,11 +4,11 @@ #![unstable(feature="test", issue="27759")] // @has issue_27759/unstable/index.html -// @hastext - 'test #27759' +// @hasraw - 'test #27759' #[unstable(feature="test", issue="27759")] pub mod unstable { // @has issue_27759/unstable/fn.issue.html - // @hastext - 'test_function #12345' + // @hasraw - 'test_function #12345' #[unstable(feature="test_function", issue="12345")] pub fn issue() {} } diff --git a/src/test/rustdoc/issue-31899.rs b/src/test/rustdoc/issue-31899.rs index da8f596b3a010..09fe77d89260a 100644 --- a/src/test/rustdoc/issue-31899.rs +++ b/src/test/rustdoc/issue-31899.rs @@ -1,5 +1,5 @@ // @has issue_31899/index.html -// @hastext - 'Make this line a bit longer.' +// @hasraw - 'Make this line a bit longer.' // @!has - 'rust rust-example-rendered' // @!has - 'use ndarray::arr2' // @!has - 'prohibited' diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index cf4575d635531..9c585497d354f 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -10,7 +10,7 @@ // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ // '👎 Deprecated since 1.0.0: text' -// @hastext - 'test #32374' +// @hasraw - 'test #32374' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ // '🔬 This is a nightly-only experimental API. \(test\s#32374\)$' /// Docs diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index c509db43c9b09..ebdfe0488a166 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,11 +1,11 @@ // @has issue_41783/struct.Foo.html // @!has - 'space' // @!has - 'comment' -// @hastext - '# single' -// @hastext - '## double' -// @hastext - '### triple' -// @hastext - '#[outer]' -// @hastext - '#![inner]' +// @hasraw - '# single' +// @hasraw - '## double' +// @hasraw - '### triple' +// @hasraw - '#[outer]' +// @hasraw - '#![inner]' /// ```no_run /// # # space diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs index 10c5199cadbb2..0cd397dc463a5 100644 --- a/src/test/rustdoc/issue-89852.rs +++ b/src/test/rustdoc/issue-89852.rs @@ -3,7 +3,7 @@ #![no_core] #![feature(no_core)] -// @matchestext 'issue_89852/sidebar-items.js' '"repro"' +// @matchesraw 'issue_89852/sidebar-items.js' '"repro"' // @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' #[macro_export] diff --git a/src/test/rustdoc/link-title-escape.rs b/src/test/rustdoc/link-title-escape.rs index ba143312b01fb..7a322ea6d3414 100644 --- a/src/test/rustdoc/link-title-escape.rs +++ b/src/test/rustdoc/link-title-escape.rs @@ -6,4 +6,4 @@ //! //! [foo]: url 'title & & "things"' -// @hastext 'foo/index.html' 'title & <stuff> & "things"' +// @hasraw 'foo/index.html' 'title & <stuff> & "things"' diff --git a/src/test/rustdoc/macro-document-private-duplicate.rs b/src/test/rustdoc/macro-document-private-duplicate.rs index 2638c288120f3..21a2ed9b3449e 100644 --- a/src/test/rustdoc/macro-document-private-duplicate.rs +++ b/src/test/rustdoc/macro-document-private-duplicate.rs @@ -10,14 +10,14 @@ // // compile-flags: --document-private-items -// @hastext macro_document_private_duplicate/index.html 'Doc 1.' -// @hastext macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' +// @hasraw macro_document_private_duplicate/index.html 'Doc 1.' +// @hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' /// Doc 1. macro_rules! a_macro { () => () } -// @hastext macro_document_private_duplicate/index.html 'Doc 2.' +// @hasraw macro_document_private_duplicate/index.html 'Doc 2.' // @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' /// Doc 2. macro_rules! a_macro { diff --git a/src/test/rustdoc/macro_rules-matchers.rs b/src/test/rustdoc/macro_rules-matchers.rs index 28ef367de9dd2..98026663e5a7a 100644 --- a/src/test/rustdoc/macro_rules-matchers.rs +++ b/src/test/rustdoc/macro_rules-matchers.rs @@ -7,27 +7,27 @@ // @has - '//span[@class="macro"]' 'macro_rules!' // @has - '//span[@class="ident"]' 'todo' -// @hastext - '{ () => { ... }; ($(' +// @hasraw - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' -// @hastext - ':' +// @hasraw - ':' // @has - '//span[@class="ident"]' 'tt' -// @hastext - ')+' -// @hastext - ') => { ... }; }' +// @hasraw - ')+' +// @hasraw - ') => { ... }; }' pub use std::todo; mod mod1 { // @has 'foo/macro.macro1.html' - // @hastext - 'macro_rules!' - // @hastext - 'macro1' - // @hastext - '{ () => { ... }; ($(' + // @hasraw - 'macro_rules!' + // @hasraw - 'macro1' + // @hasraw - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' - // @hastext - ':' - // @hastext - 'expr' - // @hastext - '),' - // @hastext - '+' - // @hastext - ') => { ... }; }' + // @hasraw - ':' + // @hasraw - 'expr' + // @hasraw - '),' + // @hasraw - '+' + // @hasraw - ') => { ... }; }' #[macro_export] macro_rules! macro1 { () => {}; diff --git a/src/test/rustdoc/markdown-summaries.rs b/src/test/rustdoc/markdown-summaries.rs index f30e8cad8d1fe..8f54953ed6640 100644 --- a/src/test/rustdoc/markdown-summaries.rs +++ b/src/test/rustdoc/markdown-summaries.rs @@ -7,7 +7,7 @@ //! //! [link]: https://example.com -// @hastext search-index.js 'This summary has a link and code.' +// @hasraw search-index.js 'This summary has a link and code.' // @!has - 'second paragraph' /// This `code` will be rendered in a code tag. @@ -15,8 +15,8 @@ /// This text should not be rendered. pub struct Sidebar; -// @hastext search-index.js 'This code will be rendered in a code tag.' -// @hastext summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' +// @hasraw search-index.js 'This code will be rendered in a code tag.' +// @hasraw summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' // @!has - 'text should not be rendered' /// ```text diff --git a/src/test/rustdoc/nested-modules.rs b/src/test/rustdoc/nested-modules.rs index 260f941e07a67..29f317d054611 100644 --- a/src/test/rustdoc/nested-modules.rs +++ b/src/test/rustdoc/nested-modules.rs @@ -7,11 +7,11 @@ mod a_module { pub mod a_nested_module { // @has aCrate/a_nested_module/index.html '//a[@href="fn.a_nested_public_function.html"]' 'a_nested_public_function' - // @hastext aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' + // @hasraw aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' pub fn a_nested_public_function() {} // @has aCrate/a_nested_module/index.html '//a[@href="fn.another_nested_public_function.html"]' 'another_nested_public_function' - // @hastext aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' + // @hasraw aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' pub use a_nested_module::a_nested_public_function as another_nested_public_function; } diff --git a/src/test/rustdoc/search-index-summaries.rs b/src/test/rustdoc/search-index-summaries.rs index 63be1a64a9dac..09b3683054d60 100644 --- a/src/test/rustdoc/search-index-summaries.rs +++ b/src/test/rustdoc/search-index-summaries.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @hastext 'search-index.js' 'Foo short link.' +// @hasraw 'search-index.js' 'Foo short link.' // @!has - 'www.example.com' // @!has - 'More Foo.' diff --git a/src/test/rustdoc/search-index.rs b/src/test/rustdoc/search-index.rs index ab2e6e0574021..db625f7a31fd9 100644 --- a/src/test/rustdoc/search-index.rs +++ b/src/test/rustdoc/search-index.rs @@ -2,13 +2,13 @@ use std::ops::Deref; -// @hastext search-index.js Foo +// @hasraw search-index.js Foo pub use private::Foo; mod private { pub struct Foo; impl Foo { - pub fn test_method() {} // @hastext - test_method + pub fn test_method() {} // @hasraw - test_method fn priv_method() {} // @!has - priv_method } diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs index 875d79d928be8..d70827ec29010 100644 --- a/src/test/rustdoc/show-const-contents.rs +++ b/src/test/rustdoc/show-const-contents.rs @@ -1,34 +1,34 @@ // Test that the contents of constants are displayed as part of the // documentation. -// @hastext show_const_contents/constant.CONST_S.html 'show this' +// @hasraw show_const_contents/constant.CONST_S.html 'show this' // @!has show_const_contents/constant.CONST_S.html '; //' pub const CONST_S: &'static str = "show this"; -// @hastext show_const_contents/constant.CONST_I32.html '= 42;' +// @hasraw show_const_contents/constant.CONST_I32.html '= 42;' // @!has show_const_contents/constant.CONST_I32.html '; //' pub const CONST_I32: i32 = 42; -// @hastext show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' +// @hasraw show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' // @!has show_const_contents/constant.CONST_I32_HEX.html '; //' pub const CONST_I32_HEX: i32 = 0x42; -// @hastext show_const_contents/constant.CONST_NEG_I32.html '= -42;' +// @hasraw show_const_contents/constant.CONST_NEG_I32.html '= -42;' // @!has show_const_contents/constant.CONST_NEG_I32.html '; //' pub const CONST_NEG_I32: i32 = -42; -// @hastext show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' +// @hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' // @!has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' pub const CONST_EQ_TO_VALUE_I32: i32 = 42i32; -// @hastext show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' +// @hasraw show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' pub const CONST_CALC_I32: i32 = 42 + 1; // @!has show_const_contents/constant.CONST_REF_I32.html '= &42;' // @!has show_const_contents/constant.CONST_REF_I32.html '; //' pub const CONST_REF_I32: &'static i32 = &42; -// @hastext show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hasraw show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' pub const CONST_I32_MAX: i32 = i32::MAX; // @!has show_const_contents/constant.UNIT.html '= ();' @@ -47,11 +47,11 @@ pub struct MyTypeWithStr(&'static str); // @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); -// @hastext show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' -// @hastext show_const_contents/constant.PI.html '; // 3.14159274f32' +// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' +// @hasraw show_const_contents/constant.PI.html '; // 3.14159274f32' pub use std::f32::consts::PI; -// @hastext show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hasraw show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' #[allow(deprecated, deprecated_in_future)] pub use std::i32::MAX; @@ -61,7 +61,7 @@ macro_rules! int_module { ) } -// @hastext show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' +// @hasraw show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' int_module!(i16); // @has show_const_contents/constant.ESCAPE.html //pre '= r#""#;' diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs index ec7d1093abf31..b5cc8bc8304e8 100644 --- a/src/test/rustdoc/sort-modules-by-appearance.rs +++ b/src/test/rustdoc/sort-modules-by-appearance.rs @@ -9,5 +9,5 @@ pub mod module_c {} pub mod module_a {} -// @matchestext 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' -// @matchestext 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' +// @matchesraw 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' +// @matchesraw 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' diff --git a/src/test/rustdoc/source-file.rs b/src/test/rustdoc/source-file.rs index 0177211ddb85e..4e166479063cc 100644 --- a/src/test/rustdoc/source-file.rs +++ b/src/test/rustdoc/source-file.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @hastext source-files.js source-file.rs +// @hasraw source-files.js source-file.rs pub struct Foo; diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs index e33601243f73b..ac11445d459aa 100644 --- a/src/test/rustdoc/static-root-path.rs +++ b/src/test/rustdoc/static-root-path.rs @@ -1,18 +1,18 @@ // compile-flags:-Z unstable-options --static-root-path /cache/ // @has static_root_path/struct.SomeStruct.html -// @matchestext - '"/cache/main\.js"' +// @matchesraw - '"/cache/main\.js"' // @!matches - '"\.\./main\.js"' -// @matchestext - 'data-root-path="\.\./"' +// @matchesraw - 'data-root-path="\.\./"' // @!matches - '"/cache/search-index\.js"' pub struct SomeStruct; // @has src/static_root_path/static-root-path.rs.html -// @matchestext - '"/cache/source-script\.js"' +// @matchesraw - '"/cache/source-script\.js"' // @!matches - '"\.\./\.\./source-script\.js"' -// @matchestext - '"\.\./\.\./source-files.js"' +// @matchesraw - '"\.\./\.\./source-files.js"' // @!matches - '"/cache/source-files\.js"' // @has settings.html -// @matchestext - '/cache/settings\.js' +// @matchesraw - '/cache/settings\.js' // @!matches - '\./settings\.js' diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs index 7d1b82b051a18..bfcdfec69f259 100644 --- a/src/test/rustdoc/type-layout.rs +++ b/src/test/rustdoc/type-layout.rs @@ -1,84 +1,84 @@ // compile-flags: --show-type-layout -Z unstable-options -// @hastext type_layout/struct.Foo.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/struct.Foo.html 'Size: ' +// @hasraw - ' bytes' // @has - '//*[@id="layout"]/a[@href="#layout"]' '' pub struct Foo { pub a: usize, b: Vec, } -// @hastext type_layout/enum.Bar.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/enum.Bar.html 'Size: ' +// @hasraw - ' bytes' pub enum Bar<'a> { A(String), B(&'a str, (std::collections::HashMap, Foo)), } -// @hastext type_layout/union.Baz.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/union.Baz.html 'Size: ' +// @hasraw - ' bytes' pub union Baz { a: &'static str, b: usize, c: &'static [u8], } -// @hastext type_layout/struct.X.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/struct.X.html 'Size: ' +// @hasraw - ' bytes' pub struct X(usize); -// @hastext type_layout/struct.Y.html 'Size: ' -// @hastext - '1 byte' +// @hasraw type_layout/struct.Y.html 'Size: ' +// @hasraw - '1 byte' // @!has - ' bytes' pub struct Y(u8); -// @hastext type_layout/struct.Z.html 'Size: ' -// @hastext - '0 bytes' +// @hasraw type_layout/struct.Z.html 'Size: ' +// @hasraw - '0 bytes' pub struct Z; // We can't compute layout for generic types. -// @hastext type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' +// @hasraw type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' // @!has - 'Size: ' pub struct Generic(T); // We *can*, however, compute layout for types that are only generic over lifetimes, // because lifetimes are a type-system construct. -// @hastext type_layout/struct.GenericLifetimes.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/struct.GenericLifetimes.html 'Size: ' +// @hasraw - ' bytes' pub struct GenericLifetimes<'a>(&'a str); -// @hastext type_layout/struct.Unsized.html 'Size: ' -// @hastext - '(unsized)' +// @hasraw type_layout/struct.Unsized.html 'Size: ' +// @hasraw - '(unsized)' pub struct Unsized([u8]); -// @hastext type_layout/type.TypeAlias.html 'Size: ' -// @hastext - ' bytes' +// @hasraw type_layout/type.TypeAlias.html 'Size: ' +// @hasraw - ' bytes' pub type TypeAlias = X; -// @hastext type_layout/type.GenericTypeAlias.html 'Size: ' -// @hastext - '8 bytes' +// @hasraw type_layout/type.GenericTypeAlias.html 'Size: ' +// @hasraw - '8 bytes' pub type GenericTypeAlias = (Generic<(u32, ())>, Generic); // Regression test for the rustdoc equivalent of #85103. -// @hastext type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' +// @hasraw type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>; // @!has type_layout/trait.MyTrait.html 'Size: ' pub trait MyTrait {} -// @hastext type_layout/enum.Variants.html 'Size: ' -// @hastext - '2 bytes' -// @hastext - 'A: 0 bytes' -// @hastext - 'B: 1 byte' +// @hasraw type_layout/enum.Variants.html 'Size: ' +// @hasraw - '2 bytes' +// @hasraw - 'A: 0 bytes' +// @hasraw - 'B: 1 byte' pub enum Variants { A, B(u8), } -// @hastext type_layout/enum.WithNiche.html 'Size: ' +// @hasraw type_layout/enum.WithNiche.html 'Size: ' // @has - //p '4 bytes' -// @hastext - 'None: 0 bytes' -// @hastext - 'Some: 4 bytes' +// @hasraw - 'None: 0 bytes' +// @hasraw - 'Some: 4 bytes' pub enum WithNiche { None, Some(std::num::NonZeroU32), diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 0384575a5dfd2..b68ec4557ad55 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -11,7 +11,7 @@ impl MyStruct { // @has typedef/type.MyAlias.html // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyAlias' // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyTrait for MyAlias' -// @hastext - 'Alias docstring' +// @hasraw - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' // @has - '//*[@class="sidebar"]//a[@href="#trait-implementations"]' 'Trait Implementations' diff --git a/src/test/rustdoc/universal-impl-trait.rs b/src/test/rustdoc/universal-impl-trait.rs index 201ec3818e9ae..f5eabda59b782 100644 --- a/src/test/rustdoc/universal-impl-trait.rs +++ b/src/test/rustdoc/universal-impl-trait.rs @@ -5,15 +5,15 @@ use std::borrow::Borrow; // @has foo/fn.foo.html // @has - //pre 'foo(' -// @matchestext - '_x: impl (' - // @matchestext - '_x: impl (' + // @matchesraw - '_x: impl (T); impl S { // @has foo/struct.S.html - // @hastext - 'bar(' - // @matchestext - '_bar: impl (' + // @matchesraw - '_bar: impl (' - // @matchestext - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' + // @hasraw - 'baz(' + // @matchesraw - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' pub fn baz(_baz: S) { } - // @hastext - 'qux(' - // @matchestext - 'trait\.Read\.html' + // @hasraw - 'qux(' + // @matchesraw - 'trait\.Read\.html' pub fn qux(_qux: impl IntoIterator>) { } } -// @hastext - 'method(' -// @matchestext - '_x: impl (' +// @matchesraw - '_x: impl Trait for S {} // @has foo/fn.much_universe.html -// @matchestext - 'T:.+Borrow.+impl .+trait\.Trait\.html' -// @matchestext - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' -// @matchestext - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' +// @matchesraw - 'T:.+Borrow.+impl .+trait\.Trait\.html' +// @matchesraw - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' +// @matchesraw - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' pub fn much_universe< T: Borrow, U: IntoIterator>, From 9db6061d64fbec7470f4e4419d16c47fe9aeb322 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Thu, 11 Aug 2022 11:09:48 -0400 Subject: [PATCH 12/18] Fix line lengths --- src/etc/htmldocck.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index e0cd089ac5e87..baf95627c7028 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -544,17 +544,21 @@ def check_command(c, cache): cerr = "" if c.cmd in ['has', 'hasraw', 'matches', 'matchesraw']: # string test regexp = c.cmd.startswith('matches') - if len(c.args) == 1 and not regexp and 'raw' not in c.cmd: # @has = file existence + + # @has = file existence + if len(c.args) == 1 and not regexp and 'raw' not in c.cmd: try: cache.get_file(c.args[0]) ret = True except FailedCheck as err: cerr = str(err) ret = False - elif len(c.args) == 2 and 'raw' in c.cmd: # @hasraw/matchesraw = string test + # @hasraw/matchesraw = string test + elif len(c.args) == 2 and 'raw' in c.cmd: cerr = "`PATTERN` did not match" ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp) - elif len(c.args) == 3 and 'raw' not in c.cmd: # @has/matches = XML tree test + # @has/matches = XML tree test + elif len(c.args) == 3 and 'raw' not in c.cmd: cerr = "`XPATH PATTERN` did not match" ret = get_nb_matching_elements(cache, c, regexp, True) != 0 else: From 52a15180d2bc193aceea7302dd175f2c872df340 Mon Sep 17 00:00:00 2001 From: yukang Date: Sat, 13 Aug 2022 12:50:53 +0800 Subject: [PATCH 13/18] give a helpful diagnostic even when the next struct field has an attribute --- compiler/rustc_parse/src/parser/item.rs | 8 ++++++-- .../ui/parser/struct-filed-with-attr.fixed | 18 ++++++++++++++++++ src/test/ui/parser/struct-filed-with-attr.rs | 18 ++++++++++++++++++ .../ui/parser/struct-filed-with-attr.stderr | 8 ++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/parser/struct-filed-with-attr.fixed create mode 100644 src/test/ui/parser/struct-filed-with-attr.rs create mode 100644 src/test/ui/parser/struct-filed-with-attr.stderr diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 72c23776d3399..e8c097d0d56de 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1539,8 +1539,12 @@ impl<'a> Parser<'a> { } } - if self.token.is_ident() { - // This is likely another field; emit the diagnostic and keep going + if self.token.is_ident() + || (self.token.kind == TokenKind::Pound + && (self.look_ahead(1, |t| t == &token::OpenDelim(Delimiter::Bracket)))) + { + // This is likely another field, TokenKind::Pound is used for `#[..]` attribute for next field, + // emit the diagnostic and keep going err.span_suggestion( sp, "try adding a comma", diff --git a/src/test/ui/parser/struct-filed-with-attr.fixed b/src/test/ui/parser/struct-filed-with-attr.fixed new file mode 100644 index 0000000000000..a799ec8ca2ea5 --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.fixed @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool, + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.rs b/src/test/ui/parser/struct-filed-with-attr.rs new file mode 100644 index 0000000000000..bfc78e15b5b09 --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.rs @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.stderr b/src/test/ui/parser/struct-filed-with-attr.stderr new file mode 100644 index 0000000000000..c2cd7e82ead41 --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.stderr @@ -0,0 +1,8 @@ +error: expected `,`, or `}`, found `#` + --> $DIR/struct-filed-with-attr.rs:5:14 + | +LL | owo: bool + | ^ help: try adding a comma: `,` + +error: aborting due to previous error + From b34e2404fd375e1bc18c1191639e4e67bdbc7d19 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Fri, 12 Aug 2022 00:44:07 -0400 Subject: [PATCH 14/18] Update `@!has` name in tests --- src/test/rustdoc/all.rs | 2 +- src/test/rustdoc/assoc-consts.rs | 8 +++--- src/test/rustdoc/const-display.rs | 6 ++--- src/test/rustdoc/deprecated-impls.rs | 8 +++--- src/test/rustdoc/empty-section.rs | 2 +- src/test/rustdoc/hidden-impls.rs | 4 +-- src/test/rustdoc/hidden-line.rs | 2 +- src/test/rustdoc/hidden-methods.rs | 8 +++--- src/test/rustdoc/inline_cross/assoc-items.rs | 4 +-- src/test/rustdoc/inline_cross/hidden-use.rs | 4 +-- .../glob-extern-document-private-items.rs | 2 +- src/test/rustdoc/inline_local/glob-extern.rs | 4 +-- .../glob-private-document-private-items.rs | 10 +++---- src/test/rustdoc/inline_local/glob-private.rs | 8 +++--- src/test/rustdoc/inline_local/hidden-use.rs | 4 +-- .../rustdoc/inline_local/macro_by_example.rs | 2 +- .../rustdoc/inline_local/please_inline.rs | 2 +- src/test/rustdoc/internal.rs | 8 +++--- src/test/rustdoc/issue-23812.rs | 8 +++--- src/test/rustdoc/issue-27104.rs | 4 +-- src/test/rustdoc/issue-29584.rs | 2 +- src/test/rustdoc/issue-31899.rs | 6 ++--- src/test/rustdoc/issue-32395.rs | 12 ++++----- src/test/rustdoc/issue-34473.rs | 2 +- src/test/rustdoc/issue-41783.rs | 4 +-- src/test/rustdoc/issue-53689.rs | 2 +- src/test/rustdoc/issue-61592.rs | 4 +-- src/test/rustdoc/issue-89852.rs | 2 +- .../macro-document-private-duplicate.rs | 2 +- .../rustdoc/macro-private-not-documented.rs | 4 +-- src/test/rustdoc/markdown-summaries.rs | 6 ++--- src/test/rustdoc/masked.rs | 14 +++++----- src/test/rustdoc/module-impls.rs | 2 +- src/test/rustdoc/nested-modules.rs | 10 +++---- src/test/rustdoc/no-crate-filter.rs | 2 +- src/test/rustdoc/recursive-deref.rs | 8 +++--- src/test/rustdoc/remove-url-from-headings.rs | 2 +- src/test/rustdoc/search-index-summaries.rs | 4 +-- src/test/rustdoc/search-index.rs | 6 ++--- src/test/rustdoc/show-const-contents.rs | 26 +++++++++---------- src/test/rustdoc/sized_trait.rs | 4 +-- src/test/rustdoc/static-root-path.rs | 10 +++---- src/test/rustdoc/table-in-docblock.rs | 2 +- src/test/rustdoc/toggle-item-contents.rs | 4 +-- .../trait-impl-items-links-and-anchors.rs | 2 +- src/test/rustdoc/trait-impl.rs | 2 +- src/test/rustdoc/tuple-struct-fields-doc.rs | 2 +- src/test/rustdoc/type-layout-flag-required.rs | 2 +- src/test/rustdoc/type-layout.rs | 6 ++--- 49 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/test/rustdoc/all.rs b/src/test/rustdoc/all.rs index a95d6c4620697..4c8d023109559 100644 --- a/src/test/rustdoc/all.rs +++ b/src/test/rustdoc/all.rs @@ -24,5 +24,5 @@ mod private_module { } // @has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct' -// @!has foo/all.html 'private_module' +// @!hasraw foo/all.html 'private_module' pub use private_module::ReexportedStruct; diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index a79e93145ba7d..97b7739b4c975 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -5,7 +5,7 @@ pub trait Foo { const FOO: usize = 12 + 1; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' const FOO_NO_DEFAULT: bool; - // @!has - FOO_HIDDEN + // @!hasraw - FOO_HIDDEN #[doc(hidden)] const FOO_HIDDEN: u8 = 0; } @@ -18,7 +18,7 @@ impl Foo for Bar { const FOO: usize = 12; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' const FOO_NO_DEFAULT: bool = false; - // @!has - FOO_HIDDEN + // @!hasraw - FOO_HIDDEN #[doc(hidden)] const FOO_HIDDEN: u8 = 0; } @@ -50,9 +50,9 @@ impl Bar { } impl Bar { - // @!has assoc_consts/struct.Bar.html 'BAR_PRIVATE' + // @!hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE' const BAR_PRIVATE: char = 'a'; - // @!has assoc_consts/struct.Bar.html 'BAR_HIDDEN' + // @!hasraw assoc_consts/struct.Bar.html 'BAR_HIDDEN' #[doc(hidden)] pub const BAR_HIDDEN: &'static str = "a"; } diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index 8455dd9ef95f4..594501b22b142 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -20,7 +20,7 @@ pub const fn foo() -> u32 { 42 } pub const unsafe fn foo_unsafe() -> u32 { 42 } // @has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' #[unstable(feature = "humans", issue = "none")] pub const fn foo2() -> u32 { 42 } @@ -32,7 +32,7 @@ pub const fn bar2() -> u32 { 42 } // @has 'foo/fn.foo2_gated.html' '//pre' 'pub const unsafe fn foo2_gated() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' #[unstable(feature = "foo2", issue = "none")] pub const unsafe fn foo2_gated() -> u32 { 42 } @@ -43,7 +43,7 @@ pub const unsafe fn foo2_gated() -> u32 { 42 } pub const unsafe fn bar2_gated() -> u32 { 42 } // @has 'foo/fn.bar_not_gated.html' '//pre' 'pub const unsafe fn bar_not_gated() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' pub const unsafe fn bar_not_gated() -> u32 { 42 } pub struct Foo; diff --git a/src/test/rustdoc/deprecated-impls.rs b/src/test/rustdoc/deprecated-impls.rs index 76c1e880ae79d..e419d2631f684 100644 --- a/src/test/rustdoc/deprecated-impls.rs +++ b/src/test/rustdoc/deprecated-impls.rs @@ -75,7 +75,7 @@ impl Bar for Foo1 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' // @hasraw - 'fn_def_def_with_doc short' - // @!has - 'fn_def_def_with_doc full' + // @!hasraw - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' } @@ -86,7 +86,7 @@ pub struct Foo2; impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' // @hasraw - 'fn_empty_with_doc short' - // @!has - 'fn_empty_with_doc full' + // @!hasraw - 'fn_empty_with_doc full' fn fn_empty_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc' @@ -99,7 +99,7 @@ impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' // @hasraw - 'fn_def_with_doc short' - // @!has - 'fn_def_with_doc full' + // @!hasraw - 'fn_def_with_doc full' fn fn_def_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc' @@ -112,7 +112,7 @@ impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' // @hasraw - 'fn_def_def_with_doc short' - // @!has - 'fn_def_def_with_doc full' + // @!hasraw - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' } diff --git a/src/test/rustdoc/empty-section.rs b/src/test/rustdoc/empty-section.rs index 665aa38b11eba..d8241ab96f6dd 100644 --- a/src/test/rustdoc/empty-section.rs +++ b/src/test/rustdoc/empty-section.rs @@ -5,7 +5,7 @@ pub struct Foo; // @has foo/struct.Foo.html -// @!has - 'Auto Trait Implementations' +// @!hasraw - 'Auto Trait Implementations' impl !Send for Foo {} impl !Sync for Foo {} impl !std::marker::Unpin for Foo {} diff --git a/src/test/rustdoc/hidden-impls.rs b/src/test/rustdoc/hidden-impls.rs index 8f33a6604c219..26e2e0e066008 100644 --- a/src/test/rustdoc/hidden-impls.rs +++ b/src/test/rustdoc/hidden-impls.rs @@ -11,7 +11,7 @@ pub mod __hidden { } // @has foo/trait.Clone.html -// @!has - 'Foo' +// @!hasraw - 'Foo' // @has implementors/core/clone/trait.Clone.js -// @!has - 'Foo' +// @!hasraw - 'Foo' pub use std::clone::Clone; diff --git a/src/test/rustdoc/hidden-line.rs b/src/test/rustdoc/hidden-line.rs index f2f6173d26db9..00a05a7c26f0e 100644 --- a/src/test/rustdoc/hidden-line.rs +++ b/src/test/rustdoc/hidden-line.rs @@ -15,5 +15,5 @@ /// ``` pub fn foo() {} -// @!has hidden_line/fn.foo.html invisible +// @!hasraw hidden_line/fn.foo.html invisible // @matches - //pre "#\[derive\(PartialEq\)\] // Bar" diff --git a/src/test/rustdoc/hidden-methods.rs b/src/test/rustdoc/hidden-methods.rs index 27181d489f59d..543d8f768a61c 100644 --- a/src/test/rustdoc/hidden-methods.rs +++ b/src/test/rustdoc/hidden-methods.rs @@ -17,13 +17,13 @@ pub mod hidden { } // @has foo/struct.Foo.html -// @!has - 'Methods' +// @!hasraw - 'Methods' // @!has - '//code' 'impl Foo' -// @!has - 'this_should_be_hidden' +// @!hasraw - 'this_should_be_hidden' pub use hidden::Foo; // @has foo/struct.Bar.html -// @!has - 'Methods' +// @!hasraw - 'Methods' // @!has - '//code' 'impl Bar' -// @!has - 'this_should_be_hidden' +// @!hasraw - 'this_should_be_hidden' pub use hidden::Bar; diff --git a/src/test/rustdoc/inline_cross/assoc-items.rs b/src/test/rustdoc/inline_cross/assoc-items.rs index 231805a52b90e..811827a17feeb 100644 --- a/src/test/rustdoc/inline_cross/assoc-items.rs +++ b/src/test/rustdoc/inline_cross/assoc-items.rs @@ -7,10 +7,10 @@ extern crate assoc_items; // @has foo/struct.MyStruct.html -// @!has - 'PrivateConst' +// @!hasraw - 'PrivateConst' // @has - '//*[@id="associatedconstant.PublicConst"]' 'pub const PublicConst: u8' // @has - '//*[@class="docblock"]' 'docs for PublicConst' -// @!has - 'private_method' +// @!hasraw - 'private_method' // @has - '//*[@id="method.public_method"]' 'pub fn public_method()' // @has - '//*[@class="docblock"]' 'docs for public_method' // @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16' diff --git a/src/test/rustdoc/inline_cross/hidden-use.rs b/src/test/rustdoc/inline_cross/hidden-use.rs index 97715737fd90d..28a4f4bac1a4a 100644 --- a/src/test/rustdoc/inline_cross/hidden-use.rs +++ b/src/test/rustdoc/inline_cross/hidden-use.rs @@ -5,8 +5,8 @@ extern crate rustdoc_hidden; // @has hidden_use/index.html -// @!has - 'rustdoc_hidden' -// @!has - 'Bar' +// @!hasraw - 'rustdoc_hidden' +// @!hasraw - 'Bar' // @!has hidden_use/struct.Bar.html #[doc(hidden)] pub use rustdoc_hidden::Bar; diff --git a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs index 8526cbde7df36..8e1089d60ec51 100644 --- a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs @@ -14,7 +14,7 @@ pub use mod1::*; // @has foo/index.html // @hasraw - "mod1" // @hasraw - "public_fn" -// @!has - "private_fn" +// @!hasraw - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs index c465fcf35cac6..c592a4db19d98 100644 --- a/src/test/rustdoc/inline_local/glob-extern.rs +++ b/src/test/rustdoc/inline_local/glob-extern.rs @@ -10,9 +10,9 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @!has - "mod1" +// @!hasraw - "mod1" // @hasraw - "public_fn" -// @!has - "private_fn" +// @!hasraw - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs index adbd53f912e49..d8cbd42343b9d 100644 --- a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs @@ -17,10 +17,10 @@ pub use mod1::*; // @has foo/index.html // @hasraw - "mod1" // @hasraw - "Mod1Public" -// @!has - "Mod1Private" -// @!has - "mod2" +// @!hasraw - "Mod1Private" +// @!hasraw - "mod2" // @hasraw - "Mod2Public" -// @!has - "Mod2Private" +// @!hasraw - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html // @has foo/struct.Mod2Public.html @@ -30,8 +30,8 @@ pub use mod1::*; // @hasraw - "mod2" // @hasraw - "Mod1Public" // @hasraw - "Mod1Private" -// @!has - "Mod2Public" -// @!has - "Mod2Private" +// @!hasraw - "Mod2Public" +// @!hasraw - "Mod2Private" // @has foo/mod1/struct.Mod1Public.html // @has foo/mod1/struct.Mod1Private.html // @!has foo/mod1/struct.Mod2Public.html diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs index d1d15ae2b0eaa..303f1d6104889 100644 --- a/src/test/rustdoc/inline_local/glob-private.rs +++ b/src/test/rustdoc/inline_local/glob-private.rs @@ -13,12 +13,12 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @!has - "mod1" +// @!hasraw - "mod1" // @hasraw - "Mod1Public" -// @!has - "Mod1Private" -// @!has - "mod2" +// @!hasraw - "Mod1Private" +// @!hasraw - "mod2" // @hasraw - "Mod2Public" -// @!has - "Mod2Private" +// @!hasraw - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html // @has foo/struct.Mod2Public.html diff --git a/src/test/rustdoc/inline_local/hidden-use.rs b/src/test/rustdoc/inline_local/hidden-use.rs index a972d376aab33..de512fb26e6ef 100644 --- a/src/test/rustdoc/inline_local/hidden-use.rs +++ b/src/test/rustdoc/inline_local/hidden-use.rs @@ -3,8 +3,8 @@ mod private { } // @has hidden_use/index.html -// @!has - 'private' -// @!has - 'Foo' +// @!hasraw - 'private' +// @!hasraw - 'Foo' // @!has hidden_use/struct.Foo.html #[doc(hidden)] pub use private::Foo; diff --git a/src/test/rustdoc/inline_local/macro_by_example.rs b/src/test/rustdoc/inline_local/macro_by_example.rs index dacc7cfb3cb76..5c33c0037e48e 100644 --- a/src/test/rustdoc/inline_local/macro_by_example.rs +++ b/src/test/rustdoc/inline_local/macro_by_example.rs @@ -7,7 +7,7 @@ macro_rules! foo { // @has macro_by_example/macros/index.html pub mod macros { - // @!has - 'pub use foo as bar;' + // @!hasraw - 'pub use foo as bar;' // @has macro_by_example/macros/macro.bar.html // @has - '//*[@class="docblock"]' 'docs for foo' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text' diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs index 03db2386d9d7e..e4429ef33a928 100644 --- a/src/test/rustdoc/inline_local/please_inline.rs +++ b/src/test/rustdoc/inline_local/please_inline.rs @@ -4,7 +4,7 @@ pub mod foo { // @has please_inline/a/index.html pub mod a { - // @!has - 'pub use foo::' + // @!hasraw - 'pub use foo::' // @has please_inline/a/struct.Foo.html #[doc(inline)] pub use foo::Foo; diff --git a/src/test/rustdoc/internal.rs b/src/test/rustdoc/internal.rs index f316eb24a4851..572ec0e1d93d2 100644 --- a/src/test/rustdoc/internal.rs +++ b/src/test/rustdoc/internal.rs @@ -2,14 +2,14 @@ // Check that the unstable marker is not added for "rustc_private". -// @!matches internal/index.html \ +// @!matchesraw internal/index.html \ // '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' -// @!matches internal/index.html \ +// @!matchesraw internal/index.html \ // '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' // @matches - '//*[@class="item-right docblock-short"]' 'Docs' -// @!has internal/struct.S.html '//*[@class="stab unstable"]' -// @!has internal/struct.S.html '//*[@class="stab internal"]' +// @!hasraw internal/struct.S.html '//*[@class="stab unstable"]' +// @!hasraw internal/struct.S.html '//*[@class="stab internal"]' /// Docs pub struct S; diff --git a/src/test/rustdoc/issue-23812.rs b/src/test/rustdoc/issue-23812.rs index a52a4f56a4c63..08fd1833bcef3 100644 --- a/src/test/rustdoc/issue-23812.rs +++ b/src/test/rustdoc/issue-23812.rs @@ -17,9 +17,9 @@ doc! { // @has issue_23812/Foo/index.html // @hasraw - 'Outer comment' -// @!has - '/// Outer comment' +// @!hasraw - '/// Outer comment' // @hasraw - 'Inner comment' -// @!has - '//! Inner comment' +// @!hasraw - '//! Inner comment' doc! { @@ -31,6 +31,6 @@ doc! { // @has issue_23812/Bar/index.html // @hasraw - 'Outer block comment' -// @!has - '/** Outer block comment */' +// @!hasraw - '/** Outer block comment */' // @hasraw - 'Inner block comment' -// @!has - '/*! Inner block comment */' +// @!hasraw - '/*! Inner block comment */' diff --git a/src/test/rustdoc/issue-27104.rs b/src/test/rustdoc/issue-27104.rs index a5b0441ac7669..9f2fd9071144f 100644 --- a/src/test/rustdoc/issue-27104.rs +++ b/src/test/rustdoc/issue-27104.rs @@ -3,8 +3,8 @@ // ignore-cross-compile // @has issue_27104/index.html -// @!has - 'extern crate std' -// @!has - 'use std::prelude::' +// @!hasraw - 'extern crate std' +// @!hasraw - 'use std::prelude::' // @hasraw - 'pub extern crate empty' pub extern crate empty; diff --git a/src/test/rustdoc/issue-29584.rs b/src/test/rustdoc/issue-29584.rs index 28e1efec608dc..4364a9649b57b 100644 --- a/src/test/rustdoc/issue-29584.rs +++ b/src/test/rustdoc/issue-29584.rs @@ -4,5 +4,5 @@ extern crate issue_29584; // @has issue_29584/struct.Foo.html -// @!has - 'impl Bar for' +// @!hasraw - 'impl Bar for' pub use issue_29584::Foo; diff --git a/src/test/rustdoc/issue-31899.rs b/src/test/rustdoc/issue-31899.rs index 09fe77d89260a..3eee374465d2b 100644 --- a/src/test/rustdoc/issue-31899.rs +++ b/src/test/rustdoc/issue-31899.rs @@ -1,8 +1,8 @@ // @has issue_31899/index.html // @hasraw - 'Make this line a bit longer.' -// @!has - 'rust rust-example-rendered' -// @!has - 'use ndarray::arr2' -// @!has - 'prohibited' +// @!hasraw - 'rust rust-example-rendered' +// @!hasraw - 'use ndarray::arr2' +// @!hasraw - 'prohibited' /// A tuple or fixed size array that can be used to index an array. /// Make this line a bit longer. diff --git a/src/test/rustdoc/issue-32395.rs b/src/test/rustdoc/issue-32395.rs index 13468c153132e..5552300f9fe89 100644 --- a/src/test/rustdoc/issue-32395.rs +++ b/src/test/rustdoc/issue-32395.rs @@ -3,13 +3,13 @@ // ignore-cross-compile // @has variant_struct/enum.Foo.html -// @!has - 'pub qux' -// @!has - 'pub(crate) qux' -// @!has - 'pub Bar' +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' extern crate variant_struct; // @has issue_32395/enum.Foo.html -// @!has - 'pub qux' -// @!has - 'pub(crate) qux' -// @!has - 'pub Bar' +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' pub use variant_struct::Foo; diff --git a/src/test/rustdoc/issue-34473.rs b/src/test/rustdoc/issue-34473.rs index d96301f3ae736..37da3dd199975 100644 --- a/src/test/rustdoc/issue-34473.rs +++ b/src/test/rustdoc/issue-34473.rs @@ -5,7 +5,7 @@ mod second { } // @has foo/index.html -// @!has - SomeTypeWithLongName +// @!hasraw - SomeTypeWithLongName // @has foo/struct.SomeType.html // @!has foo/struct.SomeTypeWithLongName.html pub use second::{SomeTypeWithLongName as SomeType}; diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index ebdfe0488a166..58a55a73815d0 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,6 +1,6 @@ // @has issue_41783/struct.Foo.html -// @!has - 'space' -// @!has - 'comment' +// @!hasraw - 'space' +// @!hasraw - 'comment' // @hasraw - '# single' // @hasraw - '## double' // @hasraw - '### triple' diff --git a/src/test/rustdoc/issue-53689.rs b/src/test/rustdoc/issue-53689.rs index 52ce4159d823e..832140e061b51 100644 --- a/src/test/rustdoc/issue-53689.rs +++ b/src/test/rustdoc/issue-53689.rs @@ -5,7 +5,7 @@ extern crate issue_53689; // @has foo/trait.MyTrait.html -// @!has - 'MyStruct' +// @!hasraw - 'MyStruct' // @count - '//*[h3="impl MyTrait for T"]' 1 pub trait MyTrait {} diff --git a/src/test/rustdoc/issue-61592.rs b/src/test/rustdoc/issue-61592.rs index aef038c07d891..3adeb751d33cb 100644 --- a/src/test/rustdoc/issue-61592.rs +++ b/src/test/rustdoc/issue-61592.rs @@ -5,11 +5,11 @@ extern crate foo; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooTrait as _;' -// @!has - '//a[@href="trait._.html"]' +// @!hasraw - '//a[@href="trait._.html"]' pub use foo::FooTrait as _; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooStruct as _;' -// @!has - '//a[@href="struct._.html"]' +// @!hasraw - '//a[@href="struct._.html"]' pub use foo::FooStruct as _; diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs index 0cd397dc463a5..4f2da5e07bee1 100644 --- a/src/test/rustdoc/issue-89852.rs +++ b/src/test/rustdoc/issue-89852.rs @@ -4,7 +4,7 @@ #![feature(no_core)] // @matchesraw 'issue_89852/sidebar-items.js' '"repro"' -// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' +// @!matchesraw 'issue_89852/sidebar-items.js' '"repro".*"repro"' #[macro_export] macro_rules! repro { diff --git a/src/test/rustdoc/macro-document-private-duplicate.rs b/src/test/rustdoc/macro-document-private-duplicate.rs index 21a2ed9b3449e..ee3010514417a 100644 --- a/src/test/rustdoc/macro-document-private-duplicate.rs +++ b/src/test/rustdoc/macro-document-private-duplicate.rs @@ -18,7 +18,7 @@ macro_rules! a_macro { } // @hasraw macro_document_private_duplicate/index.html 'Doc 2.' -// @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' +// @!hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' /// Doc 2. macro_rules! a_macro { () => () diff --git a/src/test/rustdoc/macro-private-not-documented.rs b/src/test/rustdoc/macro-private-not-documented.rs index ae8b0e7229f91..f135a3a9ca662 100644 --- a/src/test/rustdoc/macro-private-not-documented.rs +++ b/src/test/rustdoc/macro-private-not-documented.rs @@ -6,13 +6,13 @@ // This is a regression text for issue #88453. #![feature(decl_macro)] -// @!has macro_private_not_documented/index.html 'a_macro' +// @!hasraw macro_private_not_documented/index.html 'a_macro' // @!has macro_private_not_documented/macro.a_macro.html macro_rules! a_macro { () => () } -// @!has macro_private_not_documented/index.html 'another_macro' +// @!hasraw macro_private_not_documented/index.html 'another_macro' // @!has macro_private_not_documented/macro.another_macro.html macro another_macro { () => () diff --git a/src/test/rustdoc/markdown-summaries.rs b/src/test/rustdoc/markdown-summaries.rs index 8f54953ed6640..31e7072b5ce9b 100644 --- a/src/test/rustdoc/markdown-summaries.rs +++ b/src/test/rustdoc/markdown-summaries.rs @@ -8,7 +8,7 @@ //! [link]: https://example.com // @hasraw search-index.js 'This summary has a link and code.' -// @!has - 'second paragraph' +// @!hasraw - 'second paragraph' /// This `code` will be rendered in a code tag. /// @@ -17,11 +17,11 @@ pub struct Sidebar; // @hasraw search-index.js 'This code will be rendered in a code tag.' // @hasraw summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' -// @!has - 'text should not be rendered' +// @!hasraw - 'text should not be rendered' /// ```text /// this block should not be rendered /// ``` pub struct Sidebar2; -// @!has summaries/sidebar-items.js 'block should not be rendered' +// @!hasraw summaries/sidebar-items.js 'block should not be rendered' diff --git a/src/test/rustdoc/masked.rs b/src/test/rustdoc/masked.rs index c7ad690d66e3e..80d5b99c0b035 100644 --- a/src/test/rustdoc/masked.rs +++ b/src/test/rustdoc/masked.rs @@ -7,24 +7,24 @@ #[doc(masked)] extern crate masked; -// @!has 'search-index.js' 'masked_method' +// @!hasraw 'search-index.js' 'masked_method' -// @!has 'foo/struct.String.html' 'MaskedTrait' -// @!has 'foo/struct.String.html' 'masked_method' +// @!hasraw 'foo/struct.String.html' 'MaskedTrait' +// @!hasraw 'foo/struct.String.html' 'masked_method' pub use std::string::String; -// @!has 'foo/trait.Clone.html' 'MaskedStruct' +// @!hasraw 'foo/trait.Clone.html' 'MaskedStruct' pub use std::clone::Clone; -// @!has 'foo/struct.MyStruct.html' 'MaskedTrait' -// @!has 'foo/struct.MyStruct.html' 'masked_method' +// @!hasraw 'foo/struct.MyStruct.html' 'MaskedTrait' +// @!hasraw 'foo/struct.MyStruct.html' 'masked_method' pub struct MyStruct; impl masked::MaskedTrait for MyStruct { fn masked_method() {} } -// @!has 'foo/trait.MyTrait.html' 'MaskedStruct' +// @!hasraw 'foo/trait.MyTrait.html' 'MaskedStruct' pub trait MyTrait {} impl MyTrait for masked::MaskedStruct {} diff --git a/src/test/rustdoc/module-impls.rs b/src/test/rustdoc/module-impls.rs index 198b3446c61b7..852f444e99b65 100644 --- a/src/test/rustdoc/module-impls.rs +++ b/src/test/rustdoc/module-impls.rs @@ -2,4 +2,4 @@ pub use std::marker::Send; -// @!has foo/index.html 'Implementations' +// @!hasraw foo/index.html 'Implementations' diff --git a/src/test/rustdoc/nested-modules.rs b/src/test/rustdoc/nested-modules.rs index 29f317d054611..12234d2cf7ef5 100644 --- a/src/test/rustdoc/nested-modules.rs +++ b/src/test/rustdoc/nested-modules.rs @@ -15,14 +15,14 @@ mod a_module { pub use a_nested_module::a_nested_public_function as another_nested_public_function; } - // @!has aCrate/a_nested_module/index.html 'yet_another_nested_public_function' + // @!hasraw aCrate/a_nested_module/index.html 'yet_another_nested_public_function' pub use a_nested_module::a_nested_public_function as yet_another_nested_public_function; - // @!has aCrate/a_nested_module/index.html 'one_last_nested_public_function' + // @!hasraw aCrate/a_nested_module/index.html 'one_last_nested_public_function' pub use a_nested_module::another_nested_public_function as one_last_nested_public_function; } -// @!has aCrate/index.html 'a_module' +// @!hasraw aCrate/index.html 'a_module' // @has aCrate/index.html '//a[@href="a_nested_module/index.html"]' 'a_nested_module' pub use a_module::a_nested_module; @@ -36,7 +36,7 @@ pub use a_module::{ }; // @has aCrate/index.html '//a[@href="fn.private_function.html"]' 'private_function' -// @!has aCrate/fn.private_function.html 'a_module' +// @!hasraw aCrate/fn.private_function.html 'a_module' // @has aCrate/index.html '//a[@href="fn.other_private_function.html"]' 'other_private_function' -// @!has aCrate/fn.other_private_function.html 'a_module' +// @!hasraw aCrate/fn.other_private_function.html 'a_module' pub use a_module::{other_private_function, private_function}; diff --git a/src/test/rustdoc/no-crate-filter.rs b/src/test/rustdoc/no-crate-filter.rs index c694d1456ef34..d11c66b54ead1 100644 --- a/src/test/rustdoc/no-crate-filter.rs +++ b/src/test/rustdoc/no-crate-filter.rs @@ -2,5 +2,5 @@ // compile-flags: -Z unstable-options --disable-per-crate-search -// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' +// @!hasraw 'foo/struct.Foo.html' '//*[id="crate-search"]' pub struct Foo; diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index a7504fbccfb50..8c899447e8acf 100644 --- a/src/test/rustdoc/recursive-deref.rs +++ b/src/test/rustdoc/recursive-deref.rs @@ -51,7 +51,7 @@ impl G { // @has recursive_deref/struct.D.html '//h3[@class="code-header in-band"]' 'impl Deref for D' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!hasraw '-' '//*[@id="deref-methods-G"]' impl Deref for D { type Target = E; @@ -62,7 +62,7 @@ impl Deref for D { // @has recursive_deref/struct.E.html '//h3[@class="code-header in-band"]' 'impl Deref for E' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!hasraw '-' '//*[@id="deref-methods-G"]' impl Deref for E { type Target = F; @@ -73,7 +73,7 @@ impl Deref for E { // @has recursive_deref/struct.F.html '//h3[@class="code-header in-band"]' 'impl Deref for F' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!hasraw '-' '//*[@id="deref-methods-G"]' impl Deref for F { type Target = G; @@ -101,7 +101,7 @@ impl I { } // @has recursive_deref/struct.H.html '//h3[@class="code-header in-band"]' 'impl Deref for H' -// @!has '-' '//*[@id="deref-methods-I"]' +// @!hasraw '-' '//*[@id="deref-methods-I"]' impl Deref for H { type Target = I; diff --git a/src/test/rustdoc/remove-url-from-headings.rs b/src/test/rustdoc/remove-url-from-headings.rs index e2b232a6efb93..8fb38cc8bf3fb 100644 --- a/src/test/rustdoc/remove-url-from-headings.rs +++ b/src/test/rustdoc/remove-url-from-headings.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @!has - '//a[@href="http://a.a"]' +// @!hasraw - '//a[@href="http://a.a"]' // @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere' // @has - '//a[@href="#another-one-urg"]' 'Another one urg' diff --git a/src/test/rustdoc/search-index-summaries.rs b/src/test/rustdoc/search-index-summaries.rs index 09b3683054d60..efd366405bfeb 100644 --- a/src/test/rustdoc/search-index-summaries.rs +++ b/src/test/rustdoc/search-index-summaries.rs @@ -1,8 +1,8 @@ #![crate_name = "foo"] // @hasraw 'search-index.js' 'Foo short link.' -// @!has - 'www.example.com' -// @!has - 'More Foo.' +// @!hasraw - 'www.example.com' +// @!hasraw - 'More Foo.' /// Foo short [link](https://www.example.com/). /// diff --git a/src/test/rustdoc/search-index.rs b/src/test/rustdoc/search-index.rs index db625f7a31fd9..d1d05eb886b00 100644 --- a/src/test/rustdoc/search-index.rs +++ b/src/test/rustdoc/search-index.rs @@ -9,18 +9,18 @@ mod private { pub struct Foo; impl Foo { pub fn test_method() {} // @hasraw - test_method - fn priv_method() {} // @!has - priv_method + fn priv_method() {} // @!hasraw - priv_method } pub trait PrivateTrait { - fn trait_method(&self) {} // @!has - priv_method + fn trait_method(&self) {} // @!hasraw - priv_method } } pub struct Bar; impl Deref for Bar { - // @!has search-index.js Target + // @!hasraw search-index.js Target type Target = Bar; fn deref(&self) -> &Bar { self } } diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs index d70827ec29010..69e742ee74739 100644 --- a/src/test/rustdoc/show-const-contents.rs +++ b/src/test/rustdoc/show-const-contents.rs @@ -2,49 +2,49 @@ // documentation. // @hasraw show_const_contents/constant.CONST_S.html 'show this' -// @!has show_const_contents/constant.CONST_S.html '; //' +// @!hasraw show_const_contents/constant.CONST_S.html '; //' pub const CONST_S: &'static str = "show this"; // @hasraw show_const_contents/constant.CONST_I32.html '= 42;' -// @!has show_const_contents/constant.CONST_I32.html '; //' +// @!hasraw show_const_contents/constant.CONST_I32.html '; //' pub const CONST_I32: i32 = 42; // @hasraw show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' -// @!has show_const_contents/constant.CONST_I32_HEX.html '; //' +// @!hasraw show_const_contents/constant.CONST_I32_HEX.html '; //' pub const CONST_I32_HEX: i32 = 0x42; // @hasraw show_const_contents/constant.CONST_NEG_I32.html '= -42;' -// @!has show_const_contents/constant.CONST_NEG_I32.html '; //' +// @!hasraw show_const_contents/constant.CONST_NEG_I32.html '; //' pub const CONST_NEG_I32: i32 = -42; // @hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' -// @!has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' +// @!hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' pub const CONST_EQ_TO_VALUE_I32: i32 = 42i32; // @hasraw show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' pub const CONST_CALC_I32: i32 = 42 + 1; -// @!has show_const_contents/constant.CONST_REF_I32.html '= &42;' -// @!has show_const_contents/constant.CONST_REF_I32.html '; //' +// @!hasraw show_const_contents/constant.CONST_REF_I32.html '= &42;' +// @!hasraw show_const_contents/constant.CONST_REF_I32.html '; //' pub const CONST_REF_I32: &'static i32 = &42; // @hasraw show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' pub const CONST_I32_MAX: i32 = i32::MAX; -// @!has show_const_contents/constant.UNIT.html '= ();' -// @!has show_const_contents/constant.UNIT.html '; //' +// @!hasraw show_const_contents/constant.UNIT.html '= ();' +// @!hasraw show_const_contents/constant.UNIT.html '; //' pub const UNIT: () = (); pub struct MyType(i32); -// @!has show_const_contents/constant.MY_TYPE.html '= MyType(42);' -// @!has show_const_contents/constant.MY_TYPE.html '; //' +// @!hasraw show_const_contents/constant.MY_TYPE.html '= MyType(42);' +// @!hasraw show_const_contents/constant.MY_TYPE.html '; //' pub const MY_TYPE: MyType = MyType(42); pub struct MyTypeWithStr(&'static str); -// @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '= MyTypeWithStr("show this");' -// @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' +// @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '= MyTypeWithStr("show this");' +// @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); // @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' diff --git a/src/test/rustdoc/sized_trait.rs b/src/test/rustdoc/sized_trait.rs index 9d2c1967757f1..77aa13294d8e8 100644 --- a/src/test/rustdoc/sized_trait.rs +++ b/src/test/rustdoc/sized_trait.rs @@ -1,13 +1,13 @@ #![crate_name = "foo"] // @has foo/struct.Bar.html -// @!has - '//*[@id="impl-Sized"]' +// @!hasraw - '//*[@id="impl-Sized"]' pub struct Bar { a: u16, } // @has foo/struct.Foo.html -// @!has - '//*[@id="impl-Sized"]' +// @!hasraw - '//*[@id="impl-Sized"]' pub struct Foo(T); // @has foo/struct.Unsized.html diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs index ac11445d459aa..08c055c5b8dbb 100644 --- a/src/test/rustdoc/static-root-path.rs +++ b/src/test/rustdoc/static-root-path.rs @@ -2,17 +2,17 @@ // @has static_root_path/struct.SomeStruct.html // @matchesraw - '"/cache/main\.js"' -// @!matches - '"\.\./main\.js"' +// @!matchesraw - '"\.\./main\.js"' // @matchesraw - 'data-root-path="\.\./"' -// @!matches - '"/cache/search-index\.js"' +// @!matchesraw - '"/cache/search-index\.js"' pub struct SomeStruct; // @has src/static_root_path/static-root-path.rs.html // @matchesraw - '"/cache/source-script\.js"' -// @!matches - '"\.\./\.\./source-script\.js"' +// @!matchesraw - '"\.\./\.\./source-script\.js"' // @matchesraw - '"\.\./\.\./source-files.js"' -// @!matches - '"/cache/source-files\.js"' +// @!matchesraw - '"/cache/source-files\.js"' // @has settings.html // @matchesraw - '/cache/settings\.js' -// @!matches - '\./settings\.js' +// @!matchesraw - '\./settings\.js' diff --git a/src/test/rustdoc/table-in-docblock.rs b/src/test/rustdoc/table-in-docblock.rs index 858b589196e72..1463a2764273b 100644 --- a/src/test/rustdoc/table-in-docblock.rs +++ b/src/test/rustdoc/table-in-docblock.rs @@ -2,7 +2,7 @@ // @has foo/struct.Foo.html // @count - '//*[@class="docblock"]/div/table' 2 -// @!has - '//*[@class="docblock"]/table' +// @!hasraw - '//*[@class="docblock"]/table' /// | hello | hello2 | /// | ----- | ------ | /// | data | data2 | diff --git a/src/test/rustdoc/toggle-item-contents.rs b/src/test/rustdoc/toggle-item-contents.rs index c1df4613e3562..37e51741a1c43 100644 --- a/src/test/rustdoc/toggle-item-contents.rs +++ b/src/test/rustdoc/toggle-item-contents.rs @@ -62,7 +62,7 @@ pub struct PrivStruct { } // @has 'toggle_item_contents/enum.Enum.html' -// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!hasraw - '//details[@class="rustdoc-toggle type-contents-toggle"]' pub enum Enum { A, B, C, D { @@ -72,7 +72,7 @@ pub enum Enum { } // @has 'toggle_item_contents/enum.EnumStructVariant.html' -// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!hasraw - '//details[@class="rustdoc-toggle type-contents-toggle"]' pub enum EnumStructVariant { A, B, C, D { diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index b5a97c610daea..c303a1052de11 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -59,7 +59,7 @@ pub struct MyStruct; // We check that associated items with default values aren't generated in the implementors list. impl MyTrait for (u8, u8) { - // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' + // @!hasraw trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' type Assoc = bool; fn trait_function(&self) {} } diff --git a/src/test/rustdoc/trait-impl.rs b/src/test/rustdoc/trait-impl.rs index 4f7e2dfe3b9a5..abfa93b757cc1 100644 --- a/src/test/rustdoc/trait-impl.rs +++ b/src/test/rustdoc/trait-impl.rs @@ -40,7 +40,7 @@ impl Trait for Struct { fn c() {} // @has - '//*[@id="method.d"]/../../div[@class="docblock"]/p' 'Escaped formatting a*b*c* works' - // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' + // @!hasraw - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' fn d() {} // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html' diff --git a/src/test/rustdoc/tuple-struct-fields-doc.rs b/src/test/rustdoc/tuple-struct-fields-doc.rs index 31426131bc2c1..b5a9004339530 100644 --- a/src/test/rustdoc/tuple-struct-fields-doc.rs +++ b/src/test/rustdoc/tuple-struct-fields-doc.rs @@ -5,7 +5,7 @@ // @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' // @has - '//*[@id="structfield.0"]' '0: u32' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'hello' -// @!has - '//*[@id="structfield.1"]' +// @!hasraw - '//*[@id="structfield.1"]' // @has - '//*[@id="structfield.2"]' '2: char' // @has - '//*[@id="structfield.3"]' '3: i8' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'not hello' diff --git a/src/test/rustdoc/type-layout-flag-required.rs b/src/test/rustdoc/type-layout-flag-required.rs index a01fbd229508b..6bb5e10f88137 100644 --- a/src/test/rustdoc/type-layout-flag-required.rs +++ b/src/test/rustdoc/type-layout-flag-required.rs @@ -1,4 +1,4 @@ // Tests that `--show-type-layout` is required in order to show layout info. -// @!has type_layout_flag_required/struct.Foo.html 'Size: ' +// @!hasraw type_layout_flag_required/struct.Foo.html 'Size: ' pub struct Foo(usize); diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs index bfcdfec69f259..5e0a0411a62b6 100644 --- a/src/test/rustdoc/type-layout.rs +++ b/src/test/rustdoc/type-layout.rs @@ -29,7 +29,7 @@ pub struct X(usize); // @hasraw type_layout/struct.Y.html 'Size: ' // @hasraw - '1 byte' -// @!has - ' bytes' +// @!hasraw - ' bytes' pub struct Y(u8); // @hasraw type_layout/struct.Z.html 'Size: ' @@ -38,7 +38,7 @@ pub struct Z; // We can't compute layout for generic types. // @hasraw type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' -// @!has - 'Size: ' +// @!hasraw - 'Size: ' pub struct Generic(T); // We *can*, however, compute layout for types that are only generic over lifetimes, @@ -63,7 +63,7 @@ pub type GenericTypeAlias = (Generic<(u32, ())>, Generic); // @hasraw type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>; -// @!has type_layout/trait.MyTrait.html 'Size: ' +// @!hasraw type_layout/trait.MyTrait.html 'Size: ' pub trait MyTrait {} // @hasraw type_layout/enum.Variants.html 'Size: ' From 0d588e928e7db77f9a810b1b5de02521dbf5ee5e Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 13 Aug 2022 00:56:16 -0400 Subject: [PATCH 15/18] rustdoc: Fix incorrect usage of `@!has` and `@!matches` `@!has` (and `@!matches`) with two arguments used to treat the second argument as a literal string of HTML code. Now, that feature has been renamed into `@!hasraw` (and `@!matchesraw`), and the arity-2 `@!has` version is an error. These uses thought the second argument was being treated as an XPath, as with the arity-3 version, but in fact was being treated as literal HTML. Because these were checking for the *absence* of the string, the tests silently did nothing -- an XPath string won't ever be showing up in the test's generated HTML! --- src/test/rustdoc/internal.rs | 14 ++++++++------ src/test/rustdoc/issue-61592.rs | 4 ++-- src/test/rustdoc/no-crate-filter.rs | 2 +- src/test/rustdoc/recursive-deref.rs | 8 ++++---- src/test/rustdoc/remove-url-from-headings.rs | 2 +- src/test/rustdoc/sized_trait.rs | 4 ++-- src/test/rustdoc/table-in-docblock.rs | 2 +- src/test/rustdoc/toggle-item-contents.rs | 4 ++-- .../rustdoc/trait-impl-items-links-and-anchors.rs | 2 +- src/test/rustdoc/trait-impl.rs | 2 +- src/test/rustdoc/tuple-struct-fields-doc.rs | 2 +- 11 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/test/rustdoc/internal.rs b/src/test/rustdoc/internal.rs index 572ec0e1d93d2..caad43a087c4e 100644 --- a/src/test/rustdoc/internal.rs +++ b/src/test/rustdoc/internal.rs @@ -2,14 +2,16 @@ // Check that the unstable marker is not added for "rustc_private". -// @!matchesraw internal/index.html \ -// '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' -// @!matchesraw internal/index.html \ -// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' +// @!matches internal/index.html \ +// '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' \ +// '' +// @!matches internal/index.html \ +// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' \ +// '' // @matches - '//*[@class="item-right docblock-short"]' 'Docs' -// @!hasraw internal/struct.S.html '//*[@class="stab unstable"]' -// @!hasraw internal/struct.S.html '//*[@class="stab internal"]' +// @!has internal/struct.S.html '//*[@class="stab unstable"]' '' +// @!has internal/struct.S.html '//*[@class="stab internal"]' '' /// Docs pub struct S; diff --git a/src/test/rustdoc/issue-61592.rs b/src/test/rustdoc/issue-61592.rs index 3adeb751d33cb..4b6c37b94aa71 100644 --- a/src/test/rustdoc/issue-61592.rs +++ b/src/test/rustdoc/issue-61592.rs @@ -5,11 +5,11 @@ extern crate foo; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooTrait as _;' -// @!hasraw - '//a[@href="trait._.html"]' +// @!has - '//a[@href="trait._.html"]' '' pub use foo::FooTrait as _; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooStruct as _;' -// @!hasraw - '//a[@href="struct._.html"]' +// @!has - '//a[@href="struct._.html"]' '' pub use foo::FooStruct as _; diff --git a/src/test/rustdoc/no-crate-filter.rs b/src/test/rustdoc/no-crate-filter.rs index d11c66b54ead1..b2f89906480d6 100644 --- a/src/test/rustdoc/no-crate-filter.rs +++ b/src/test/rustdoc/no-crate-filter.rs @@ -2,5 +2,5 @@ // compile-flags: -Z unstable-options --disable-per-crate-search -// @!hasraw 'foo/struct.Foo.html' '//*[id="crate-search"]' +// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' '' pub struct Foo; diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index 8c899447e8acf..2ab9d44be6dac 100644 --- a/src/test/rustdoc/recursive-deref.rs +++ b/src/test/rustdoc/recursive-deref.rs @@ -51,7 +51,7 @@ impl G { // @has recursive_deref/struct.D.html '//h3[@class="code-header in-band"]' 'impl Deref for D' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!hasraw '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for D { type Target = E; @@ -62,7 +62,7 @@ impl Deref for D { // @has recursive_deref/struct.E.html '//h3[@class="code-header in-band"]' 'impl Deref for E' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!hasraw '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for E { type Target = F; @@ -73,7 +73,7 @@ impl Deref for E { // @has recursive_deref/struct.F.html '//h3[@class="code-header in-band"]' 'impl Deref for F' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!hasraw '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for F { type Target = G; @@ -101,7 +101,7 @@ impl I { } // @has recursive_deref/struct.H.html '//h3[@class="code-header in-band"]' 'impl Deref for H' -// @!hasraw '-' '//*[@id="deref-methods-I"]' +// @!has '-' '//*[@id="deref-methods-I"]' '' impl Deref for H { type Target = I; diff --git a/src/test/rustdoc/remove-url-from-headings.rs b/src/test/rustdoc/remove-url-from-headings.rs index 8fb38cc8bf3fb..599c429a6e1de 100644 --- a/src/test/rustdoc/remove-url-from-headings.rs +++ b/src/test/rustdoc/remove-url-from-headings.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @!hasraw - '//a[@href="http://a.a"]' +// @!has - '//a[@href="http://a.a"]' '' // @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere' // @has - '//a[@href="#another-one-urg"]' 'Another one urg' diff --git a/src/test/rustdoc/sized_trait.rs b/src/test/rustdoc/sized_trait.rs index 77aa13294d8e8..36718ebe1a630 100644 --- a/src/test/rustdoc/sized_trait.rs +++ b/src/test/rustdoc/sized_trait.rs @@ -1,13 +1,13 @@ #![crate_name = "foo"] // @has foo/struct.Bar.html -// @!hasraw - '//*[@id="impl-Sized"]' +// @!has - '//*[@id="impl-Sized"]' '' pub struct Bar { a: u16, } // @has foo/struct.Foo.html -// @!hasraw - '//*[@id="impl-Sized"]' +// @!has - '//*[@id="impl-Sized"]' '' pub struct Foo(T); // @has foo/struct.Unsized.html diff --git a/src/test/rustdoc/table-in-docblock.rs b/src/test/rustdoc/table-in-docblock.rs index 1463a2764273b..194f49f16d007 100644 --- a/src/test/rustdoc/table-in-docblock.rs +++ b/src/test/rustdoc/table-in-docblock.rs @@ -2,7 +2,7 @@ // @has foo/struct.Foo.html // @count - '//*[@class="docblock"]/div/table' 2 -// @!hasraw - '//*[@class="docblock"]/table' +// @!has - '//*[@class="docblock"]/table' '' /// | hello | hello2 | /// | ----- | ------ | /// | data | data2 | diff --git a/src/test/rustdoc/toggle-item-contents.rs b/src/test/rustdoc/toggle-item-contents.rs index 37e51741a1c43..dbaf195e1a963 100644 --- a/src/test/rustdoc/toggle-item-contents.rs +++ b/src/test/rustdoc/toggle-item-contents.rs @@ -62,7 +62,7 @@ pub struct PrivStruct { } // @has 'toggle_item_contents/enum.Enum.html' -// @!hasraw - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' '' pub enum Enum { A, B, C, D { @@ -72,7 +72,7 @@ pub enum Enum { } // @has 'toggle_item_contents/enum.EnumStructVariant.html' -// @!hasraw - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' '' pub enum EnumStructVariant { A, B, C, D { diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index c303a1052de11..fba594c38273c 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -59,7 +59,7 @@ pub struct MyStruct; // We check that associated items with default values aren't generated in the implementors list. impl MyTrait for (u8, u8) { - // @!hasraw trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' + // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' '' type Assoc = bool; fn trait_function(&self) {} } diff --git a/src/test/rustdoc/trait-impl.rs b/src/test/rustdoc/trait-impl.rs index abfa93b757cc1..4d5173f6024c7 100644 --- a/src/test/rustdoc/trait-impl.rs +++ b/src/test/rustdoc/trait-impl.rs @@ -40,7 +40,7 @@ impl Trait for Struct { fn c() {} // @has - '//*[@id="method.d"]/../../div[@class="docblock"]/p' 'Escaped formatting a*b*c* works' - // @!hasraw - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' + // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' '' fn d() {} // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html' diff --git a/src/test/rustdoc/tuple-struct-fields-doc.rs b/src/test/rustdoc/tuple-struct-fields-doc.rs index b5a9004339530..66bb409325c99 100644 --- a/src/test/rustdoc/tuple-struct-fields-doc.rs +++ b/src/test/rustdoc/tuple-struct-fields-doc.rs @@ -5,7 +5,7 @@ // @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' // @has - '//*[@id="structfield.0"]' '0: u32' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'hello' -// @!hasraw - '//*[@id="structfield.1"]' +// @!has - '//*[@id="structfield.1"]' '' // @has - '//*[@id="structfield.2"]' '2: char' // @has - '//*[@id="structfield.3"]' '3: i8' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'not hello' From 2dc9bf0fa01e156476017f94b713749bc8653e62 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 13 Aug 2022 12:55:43 -0400 Subject: [PATCH 16/18] nicer Miri backtraces for from_exposed_addr --- library/core/src/ptr/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 57adcd6bb3405..203531f66aa36 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -603,6 +603,7 @@ pub const fn invalid_mut(addr: usize) -> *mut T { #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] +#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn from_exposed_addr(addr: usize) -> *const T where T: Sized, @@ -639,6 +640,7 @@ where #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] +#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn from_exposed_addr_mut(addr: usize) -> *mut T where T: Sized, From 40b1f612c995006bef17e03e865fc2e6fe4d74ec Mon Sep 17 00:00:00 2001 From: Ellen Date: Sat, 13 Aug 2022 19:42:25 +0100 Subject: [PATCH 17/18] move --- src/test/ui/{hrtb => higher-rank-trait-bounds}/complex.rs | 0 .../ui/{hrtb => higher-rank-trait-bounds}/due-to-where-clause.rs | 0 .../{hrtb => higher-rank-trait-bounds}/due-to-where-clause.stderr | 0 .../{hrtb => higher-rank-trait-bounds}/hrtb-cache-issue-54302.rs | 0 .../hrtb-cache-issue-54302.stderr | 0 .../{hrtb => higher-rank-trait-bounds}/hrtb-conflate-regions.rs | 0 .../hrtb-conflate-regions.stderr | 0 .../hrtb-debruijn-in-receiver.rs | 0 .../hrtb-debruijn-in-receiver.stderr | 0 .../{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-fn.rs | 0 .../hrtb-exists-forall-fn.stderr | 0 .../hrtb-exists-forall-trait-contravariant.rs | 0 .../hrtb-exists-forall-trait-contravariant.stderr | 0 .../hrtb-exists-forall-trait-covariant.rs | 0 .../hrtb-exists-forall-trait-invariant.rs | 0 .../hrtb-exists-forall-trait-invariant.stderr | 0 .../hrtb-higher-ranker-supertraits-transitive.rs | 0 .../hrtb-higher-ranker-supertraits-transitive.stderr | 0 .../hrtb-higher-ranker-supertraits.rs | 0 .../hrtb-higher-ranker-supertraits.stderr | 0 .../hrtb-identity-fn-borrows.rs | 0 .../hrtb-identity-fn-borrows.stderr | 0 .../ui/{hrtb => higher-rank-trait-bounds}/hrtb-just-for-static.rs | 0 .../hrtb-just-for-static.stderr | 0 .../hrtb-perfect-forwarding.polonius.stderr | 0 .../{hrtb => higher-rank-trait-bounds}/hrtb-perfect-forwarding.rs | 0 .../hrtb-perfect-forwarding.stderr | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-30786.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-30786.stderr | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-46989.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-46989.stderr | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-57639.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-58451.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-58451.stderr | 0 .../ui/{hrtb => higher-rank-trait-bounds}/issue-62203-hrtb-ice.rs | 0 .../issue-62203-hrtb-ice.stderr | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-88446.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-90177.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95034.rs | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95034.stderr | 0 src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95230.rs | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/complex.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/due-to-where-clause.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/due-to-where-clause.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-cache-issue-54302.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-cache-issue-54302.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-conflate-regions.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-conflate-regions.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-debruijn-in-receiver.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-debruijn-in-receiver.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-fn.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-fn.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-trait-contravariant.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-trait-contravariant.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-trait-covariant.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-trait-invariant.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-exists-forall-trait-invariant.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-higher-ranker-supertraits-transitive.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-higher-ranker-supertraits-transitive.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-higher-ranker-supertraits.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-higher-ranker-supertraits.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-identity-fn-borrows.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-identity-fn-borrows.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-just-for-static.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-just-for-static.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-perfect-forwarding.polonius.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-perfect-forwarding.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/hrtb-perfect-forwarding.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-30786.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-30786.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-46989.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-46989.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-57639.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-58451.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-58451.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-62203-hrtb-ice.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-62203-hrtb-ice.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-88446.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-90177.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95034.rs (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95034.stderr (100%) rename src/test/ui/{hrtb => higher-rank-trait-bounds}/issue-95230.rs (100%) diff --git a/src/test/ui/hrtb/complex.rs b/src/test/ui/higher-rank-trait-bounds/complex.rs similarity index 100% rename from src/test/ui/hrtb/complex.rs rename to src/test/ui/higher-rank-trait-bounds/complex.rs diff --git a/src/test/ui/hrtb/due-to-where-clause.rs b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs similarity index 100% rename from src/test/ui/hrtb/due-to-where-clause.rs rename to src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs diff --git a/src/test/ui/hrtb/due-to-where-clause.stderr b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr similarity index 100% rename from src/test/ui/hrtb/due-to-where-clause.stderr rename to src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-cache-issue-54302.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-cache-issue-54302.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-conflate-regions.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-conflate-regions.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-fn.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-fn.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-identity-fn-borrows.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr diff --git a/src/test/ui/hrtb/hrtb-just-for-static.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-just-for-static.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-just-for-static.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs similarity index 100% rename from src/test/ui/hrtb/hrtb-perfect-forwarding.rs rename to src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr similarity index 100% rename from src/test/ui/hrtb/hrtb-perfect-forwarding.stderr rename to src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr diff --git a/src/test/ui/hrtb/issue-30786.rs b/src/test/ui/higher-rank-trait-bounds/issue-30786.rs similarity index 100% rename from src/test/ui/hrtb/issue-30786.rs rename to src/test/ui/higher-rank-trait-bounds/issue-30786.rs diff --git a/src/test/ui/hrtb/issue-30786.stderr b/src/test/ui/higher-rank-trait-bounds/issue-30786.stderr similarity index 100% rename from src/test/ui/hrtb/issue-30786.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-30786.stderr diff --git a/src/test/ui/hrtb/issue-46989.rs b/src/test/ui/higher-rank-trait-bounds/issue-46989.rs similarity index 100% rename from src/test/ui/hrtb/issue-46989.rs rename to src/test/ui/higher-rank-trait-bounds/issue-46989.rs diff --git a/src/test/ui/hrtb/issue-46989.stderr b/src/test/ui/higher-rank-trait-bounds/issue-46989.stderr similarity index 100% rename from src/test/ui/hrtb/issue-46989.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-46989.stderr diff --git a/src/test/ui/hrtb/issue-57639.rs b/src/test/ui/higher-rank-trait-bounds/issue-57639.rs similarity index 100% rename from src/test/ui/hrtb/issue-57639.rs rename to src/test/ui/higher-rank-trait-bounds/issue-57639.rs diff --git a/src/test/ui/hrtb/issue-58451.rs b/src/test/ui/higher-rank-trait-bounds/issue-58451.rs similarity index 100% rename from src/test/ui/hrtb/issue-58451.rs rename to src/test/ui/higher-rank-trait-bounds/issue-58451.rs diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/higher-rank-trait-bounds/issue-58451.stderr similarity index 100% rename from src/test/ui/hrtb/issue-58451.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-58451.stderr diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.rs b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs similarity index 100% rename from src/test/ui/hrtb/issue-62203-hrtb-ice.rs rename to src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr similarity index 100% rename from src/test/ui/hrtb/issue-62203-hrtb-ice.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr diff --git a/src/test/ui/hrtb/issue-88446.rs b/src/test/ui/higher-rank-trait-bounds/issue-88446.rs similarity index 100% rename from src/test/ui/hrtb/issue-88446.rs rename to src/test/ui/higher-rank-trait-bounds/issue-88446.rs diff --git a/src/test/ui/hrtb/issue-90177.rs b/src/test/ui/higher-rank-trait-bounds/issue-90177.rs similarity index 100% rename from src/test/ui/hrtb/issue-90177.rs rename to src/test/ui/higher-rank-trait-bounds/issue-90177.rs diff --git a/src/test/ui/hrtb/issue-95034.rs b/src/test/ui/higher-rank-trait-bounds/issue-95034.rs similarity index 100% rename from src/test/ui/hrtb/issue-95034.rs rename to src/test/ui/higher-rank-trait-bounds/issue-95034.rs diff --git a/src/test/ui/hrtb/issue-95034.stderr b/src/test/ui/higher-rank-trait-bounds/issue-95034.stderr similarity index 100% rename from src/test/ui/hrtb/issue-95034.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-95034.stderr diff --git a/src/test/ui/hrtb/issue-95230.rs b/src/test/ui/higher-rank-trait-bounds/issue-95230.rs similarity index 100% rename from src/test/ui/hrtb/issue-95230.rs rename to src/test/ui/higher-rank-trait-bounds/issue-95230.rs From 1ec2b9bce8caf6d132b0fc42affe51b8cac8f458 Mon Sep 17 00:00:00 2001 From: lcnr Date: Sat, 13 Aug 2022 13:49:11 +0200 Subject: [PATCH 18/18] wf correctly shallow_resolve consts --- compiler/rustc_trait_selection/src/traits/wf.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 414857f0acc80..7a5e67ff74b32 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -31,9 +31,9 @@ pub fn obligations<'a, 'tcx>( if resolved_ty == ty { // No progress, bail out to prevent "livelock". return None; + } else { + resolved_ty } - - resolved_ty } _ => ty, } @@ -41,16 +41,14 @@ pub fn obligations<'a, 'tcx>( } GenericArgKind::Const(ct) => { match ct.kind() { - ty::ConstKind::Infer(infer) => { - let resolved = infcx.shallow_resolve(infer); - if resolved == infer { + ty::ConstKind::Infer(_) => { + let resolved = infcx.shallow_resolve(ct); + if resolved == ct { // No progress. return None; + } else { + resolved } - - infcx - .tcx - .mk_const(ty::ConstS { kind: ty::ConstKind::Infer(resolved), ty: ct.ty() }) } _ => ct, }