Auto merge of #126788 - GuillaumeGomez:migrate-rustdoc-tests-syntax, r=fmease,oli-obk

Migrate rustdoc tests syntax to `//@` (for coherency)

Part of #125813.

cc `@jieyouxu`
r? `@fmease`

try-job: aarch64-apple
This commit is contained in:
bors 2024-06-24 11:29:33 +00:00
commit 06c072f158
631 changed files with 4700 additions and 4642 deletions

View file

@ -240,9 +240,37 @@ def concat_multi_lines(f):
print_err(lineno, line, 'Trailing backslash at the end of the file')
def get_known_directive_names():
def filter_line(line):
line = line.strip()
return line.startswith('"') and (line.endswith('",') or line.endswith('"'))
# Equivalent to `src/tools/compiletest/src/header.rs` constant of the same name.
with open(
os.path.join(
# We go back to `src`.
os.path.dirname(os.path.dirname(__file__)),
"tools/compiletest/src/command-list.rs",
),
"r",
encoding="utf8"
) as fd:
content = fd.read()
return [
line.strip().replace('",', '').replace('"', '')
for line in content.split('\n')
if filter_line(line)
]
# To prevent duplicating the list of commmands between `compiletest` and `htmldocck`, we put
# it into a common file which is included in rust code and parsed here.
# FIXME: This setup is temporary until we figure out how to improve this situation.
KNOWN_DIRECTIVE_NAMES = get_known_directive_names()
LINE_PATTERN = re.compile(r'''
(?<=(?<!\S))(?P<invalid>!?)@(?P<negated>!?)
(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
//@\s+
(?P<negated>!?)(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)
(?P<args>.*)$
''', re.X | re.UNICODE)
@ -254,17 +282,9 @@ def get_commands(template):
if not m:
continue
negated = (m.group('negated') == '!')
cmd = m.group('cmd')
if m.group('invalid') == '!':
print_err(
lineno,
line,
'Invalid command: `!@{0}{1}`, (help: try with `@!{1}`)'.format(
'!' if negated else '',
cmd,
),
)
negated = (m.group('negated') == '!')
if not negated and cmd in KNOWN_DIRECTIVE_NAMES:
continue
args = m.group('args')
if args and not args[:1].isspace():
@ -549,7 +569,7 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first):
def check_files_in_folder(c, cache, folder, files):
files = files.strip()
if not files.startswith('[') or not files.endswith(']'):
raise InvalidCheck("Expected list as second argument of @{} (ie '[]')".format(c.cmd))
raise InvalidCheck("Expected list as second argument of {} (ie '[]')".format(c.cmd))
folder = cache.get_absolute_path(folder)
@ -558,7 +578,7 @@ def check_files_in_folder(c, cache, folder, files):
files_set = set()
for file in files:
if file in files_set:
raise InvalidCheck("Duplicated file `{}` in @{}".format(file, c.cmd))
raise InvalidCheck("Duplicated file `{}` in {}".format(file, c.cmd))
files_set.add(file)
folder_set = set([f for f in os.listdir(folder) if f != "." and f != ".."])
@ -590,7 +610,7 @@ def check_command(c, cache):
if c.cmd in ['has', 'hasraw', 'matches', 'matchesraw']: # string test
regexp = c.cmd.startswith('matches')
# @has <path> = file existence
# has <path> = file existence
if len(c.args) == 1 and not regexp and 'raw' not in c.cmd:
try:
cache.get_file(c.args[0])
@ -598,40 +618,40 @@ def check_command(c, cache):
except FailedCheck as err:
cerr = str(err)
ret = False
# @hasraw/matchesraw <path> <pat> = string test
# hasraw/matchesraw <path> <pat> = 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)
# @has/matches <path> <pat> <match> = XML tree test
# has/matches <path> <pat> <match> = 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:
raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd))
raise InvalidCheck('Invalid number of {} arguments'.format(c.cmd))
elif c.cmd == 'files': # check files in given folder
if len(c.args) != 2: # @files <folder path> <file list>
raise InvalidCheck("Invalid number of @{} arguments".format(c.cmd))
if len(c.args) != 2: # files <folder path> <file list>
raise InvalidCheck("Invalid number of {} arguments".format(c.cmd))
elif c.negated:
raise InvalidCheck("@{} doesn't support negative check".format(c.cmd))
raise InvalidCheck("{} doesn't support negative check".format(c.cmd))
ret = check_files_in_folder(c, cache, c.args[0], c.args[1])
elif c.cmd == 'count': # count test
if len(c.args) == 3: # @count <path> <pat> <count> = count test
if len(c.args) == 3: # count <path> <pat> <count> = count test
expected = int(c.args[2])
found = get_tree_count(cache.get_tree(c.args[0]), c.args[1])
cerr = "Expected {} occurrences but found {}".format(expected, found)
ret = expected == found
elif len(c.args) == 4: # @count <path> <pat> <text> <count> = count test
elif len(c.args) == 4: # count <path> <pat> <text> <count> = count test
expected = int(c.args[3])
found = get_nb_matching_elements(cache, c, False, False)
cerr = "Expected {} occurrences but found {}".format(expected, found)
ret = found == expected
else:
raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd))
raise InvalidCheck('Invalid number of {} arguments'.format(c.cmd))
elif c.cmd == 'snapshot': # snapshot test
if len(c.args) == 3: # @snapshot <snapshot-name> <html-path> <xpath>
if len(c.args) == 3: # snapshot <snapshot-name> <html-path> <xpath>
[snapshot_name, html_path, pattern] = c.args
tree = cache.get_tree(html_path)
xpath = normalize_xpath(pattern)
@ -654,10 +674,10 @@ def check_command(c, cache):
else:
raise FailedCheck('Expected 1 match, but found {}'.format(len(subtrees)))
else:
raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd))
raise InvalidCheck('Invalid number of {} arguments'.format(c.cmd))
elif c.cmd == 'has-dir': # has-dir test
if len(c.args) == 1: # @has-dir <path> = has-dir test
if len(c.args) == 1: # has-dir <path> = has-dir test
try:
cache.get_dir(c.args[0])
ret = True
@ -665,22 +685,22 @@ def check_command(c, cache):
cerr = str(err)
ret = False
else:
raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd))
raise InvalidCheck('Invalid number of {} arguments'.format(c.cmd))
elif c.cmd == 'valid-html':
raise InvalidCheck('Unimplemented @valid-html')
raise InvalidCheck('Unimplemented valid-html')
elif c.cmd == 'valid-links':
raise InvalidCheck('Unimplemented @valid-links')
raise InvalidCheck('Unimplemented valid-links')
else:
raise InvalidCheck('Unrecognized @{}'.format(c.cmd))
raise InvalidCheck('Unrecognized {}'.format(c.cmd))
if ret == c.negated:
raise FailedCheck(cerr)
except FailedCheck as err:
message = '@{}{} check failed'.format('!' if c.negated else '', c.cmd)
message = '{}{} check failed'.format('!' if c.negated else '', c.cmd)
print_err(c.lineno, c.context, str(err), message)
except InvalidCheck as err:
print_err(c.lineno, c.context, str(err))

View file

@ -0,0 +1,230 @@
/// This was originally generated by collecting directives from ui tests and then extracting their
/// directive names. This is **not** an exhaustive list of all possible directives. Instead, this is
/// a best-effort approximation for diagnostics. Add new headers to this list when needed.
const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
// tidy-alphabetical-start
"assembly-output",
"aux-bin",
"aux-build",
"aux-codegen-backend",
"aux-crate",
"build-aux-docs",
"build-fail",
"build-pass",
"check-fail",
"check-pass",
"check-run-results",
"check-stdout",
"check-test-line-numbers-match",
"compare-output-lines-by-subset",
"compile-flags",
"dont-check-compiler-stderr",
"dont-check-compiler-stdout",
"dont-check-failure-status",
"edition",
"error-pattern",
"exec-env",
"failure-status",
"filecheck-flags",
"forbid-output",
"force-host",
"ignore-16bit",
"ignore-32bit",
"ignore-64bit",
"ignore-aarch64",
"ignore-aarch64-unknown-linux-gnu",
"ignore-android",
"ignore-apple",
"ignore-arm",
"ignore-avr",
"ignore-beta",
"ignore-cdb",
"ignore-compare-mode-next-solver",
"ignore-compare-mode-polonius",
"ignore-cross-compile",
"ignore-debug",
"ignore-eabi",
"ignore-emscripten",
"ignore-endian-big",
"ignore-freebsd",
"ignore-fuchsia",
"ignore-gdb",
"ignore-gdb-version",
"ignore-gnu",
"ignore-haiku",
"ignore-horizon",
"ignore-i686-pc-windows-msvc",
"ignore-illumos",
"ignore-ios",
"ignore-linux",
"ignore-lldb",
"ignore-llvm-version",
"ignore-loongarch64",
"ignore-macabi",
"ignore-macos",
"ignore-mode-assembly",
"ignore-mode-codegen",
"ignore-mode-codegen-units",
"ignore-mode-coverage-map",
"ignore-mode-coverage-run",
"ignore-mode-crashes",
"ignore-mode-debuginfo",
"ignore-mode-incremental",
"ignore-mode-js-doc-test",
"ignore-mode-mir-opt",
"ignore-mode-pretty",
"ignore-mode-run-make",
"ignore-mode-run-pass-valgrind",
"ignore-mode-rustdoc",
"ignore-mode-rustdoc-json",
"ignore-mode-ui",
"ignore-mode-ui-fulldeps",
"ignore-msp430",
"ignore-msvc",
"ignore-musl",
"ignore-netbsd",
"ignore-nightly",
"ignore-none",
"ignore-nto",
"ignore-nvptx64",
"ignore-nvptx64-nvidia-cuda",
"ignore-openbsd",
"ignore-pass",
"ignore-remote",
"ignore-riscv64",
"ignore-s390x",
"ignore-sgx",
"ignore-spirv",
"ignore-stable",
"ignore-stage1",
"ignore-stage2",
"ignore-test",
"ignore-thumb",
"ignore-thumbv8m.base-none-eabi",
"ignore-thumbv8m.main-none-eabi",
"ignore-tvos",
"ignore-unix",
"ignore-unknown",
"ignore-uwp",
"ignore-visionos",
"ignore-vxworks",
"ignore-wasi",
"ignore-wasm",
"ignore-wasm32",
"ignore-wasm32-bare",
"ignore-wasm64",
"ignore-watchos",
"ignore-windows",
"ignore-windows-gnu",
"ignore-x32",
"ignore-x86",
"ignore-x86_64",
"ignore-x86_64-apple-darwin",
"ignore-x86_64-unknown-linux-gnu",
"incremental",
"known-bug",
"llvm-cov-flags",
"min-cdb-version",
"min-gdb-version",
"min-lldb-version",
"min-llvm-version",
"min-system-llvm-version",
"needs-asm-support",
"needs-dlltool",
"needs-dynamic-linking",
"needs-force-clang-based-tests",
"needs-git-hash",
"needs-llvm-components",
"needs-profiler-support",
"needs-relocation-model-pic",
"needs-run-enabled",
"needs-rust-lld",
"needs-rust-lldb",
"needs-sanitizer-address",
"needs-sanitizer-cfi",
"needs-sanitizer-dataflow",
"needs-sanitizer-hwaddress",
"needs-sanitizer-kcfi",
"needs-sanitizer-leak",
"needs-sanitizer-memory",
"needs-sanitizer-memtag",
"needs-sanitizer-safestack",
"needs-sanitizer-shadow-call-stack",
"needs-sanitizer-support",
"needs-sanitizer-thread",
"needs-symlink",
"needs-threads",
"needs-unwind",
"needs-wasmtime",
"needs-xray",
"no-auto-check-cfg",
"no-prefer-dynamic",
"normalize-stderr-32bit",
"normalize-stderr-64bit",
"normalize-stderr-test",
"normalize-stdout-test",
"only-16bit",
"only-32bit",
"only-64bit",
"only-aarch64",
"only-apple",
"only-arm",
"only-avr",
"only-beta",
"only-bpf",
"only-cdb",
"only-gnu",
"only-i686-pc-windows-msvc",
"only-ios",
"only-linux",
"only-loongarch64",
"only-loongarch64-unknown-linux-gnu",
"only-macos",
"only-mips",
"only-mips64",
"only-msp430",
"only-msvc",
"only-nightly",
"only-nvptx64",
"only-riscv64",
"only-sparc",
"only-sparc64",
"only-stable",
"only-thumb",
"only-tvos",
"only-unix",
"only-visionos",
"only-wasm32",
"only-wasm32-bare",
"only-wasm32-wasip1",
"only-watchos",
"only-windows",
"only-x86",
"only-x86_64",
"only-x86_64-fortanix-unknown-sgx",
"only-x86_64-pc-windows-gnu",
"only-x86_64-pc-windows-msvc",
"only-x86_64-unknown-linux-gnu",
"pp-exact",
"pretty-compare-only",
"pretty-expanded",
"pretty-mode",
"regex-error-pattern",
"remap-src-base",
"revisions",
"run-fail",
"run-flags",
"run-pass",
"run-rustfix",
"rustc-env",
"rustfix-only-machine-applicable",
"should-fail",
"should-ice",
"stderr-per-bitwidth",
"test-mir-pass",
"unset-exec-env",
"unset-rustc-env",
// Used by the tidy check `unknown_revision`.
"unused-revision-names",
// tidy-alphabetical-end
];

View file

@ -723,235 +723,28 @@ pub fn line_directive<'line>(
}
}
/// This was originally generated by collecting directives from ui tests and then extracting their
/// directive names. This is **not** an exhaustive list of all possible directives. Instead, this is
/// a best-effort approximation for diagnostics. Add new headers to this list when needed.
const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
// tidy-alphabetical-start
"assembly-output",
"aux-bin",
"aux-build",
"aux-codegen-backend",
"aux-crate",
"build-aux-docs",
"build-fail",
"build-pass",
"check-fail",
"check-pass",
"check-run-results",
"check-stdout",
"check-test-line-numbers-match",
"compare-output-lines-by-subset",
"compile-flags",
"dont-check-compiler-stderr",
"dont-check-compiler-stdout",
"dont-check-failure-status",
"edition",
"error-pattern",
"exec-env",
"failure-status",
"filecheck-flags",
"forbid-output",
"force-host",
"ignore-16bit",
"ignore-32bit",
"ignore-64bit",
"ignore-aarch64",
"ignore-aarch64-unknown-linux-gnu",
"ignore-android",
"ignore-apple",
"ignore-arm",
"ignore-avr",
"ignore-beta",
"ignore-cdb",
"ignore-compare-mode-next-solver",
"ignore-compare-mode-polonius",
"ignore-cross-compile",
"ignore-debug",
"ignore-eabi",
"ignore-emscripten",
"ignore-endian-big",
"ignore-freebsd",
"ignore-fuchsia",
"ignore-gdb",
"ignore-gdb-version",
"ignore-gnu",
"ignore-haiku",
"ignore-horizon",
"ignore-i686-pc-windows-msvc",
"ignore-illumos",
"ignore-ios",
"ignore-linux",
"ignore-lldb",
"ignore-llvm-version",
"ignore-loongarch64",
"ignore-macabi",
"ignore-macos",
"ignore-mode-assembly",
"ignore-mode-codegen",
"ignore-mode-codegen-units",
"ignore-mode-coverage-map",
"ignore-mode-coverage-run",
"ignore-mode-crashes",
"ignore-mode-debuginfo",
"ignore-mode-incremental",
"ignore-mode-js-doc-test",
"ignore-mode-mir-opt",
"ignore-mode-pretty",
"ignore-mode-run-make",
"ignore-mode-run-pass-valgrind",
"ignore-mode-rustdoc",
"ignore-mode-rustdoc-json",
"ignore-mode-ui",
"ignore-mode-ui-fulldeps",
"ignore-msp430",
"ignore-msvc",
"ignore-musl",
"ignore-netbsd",
"ignore-nightly",
"ignore-none",
"ignore-nto",
"ignore-nvptx64",
"ignore-nvptx64-nvidia-cuda",
"ignore-openbsd",
"ignore-pass",
"ignore-remote",
"ignore-riscv64",
"ignore-s390x",
"ignore-sgx",
"ignore-spirv",
"ignore-stable",
"ignore-stage1",
"ignore-stage2",
"ignore-test",
"ignore-thumb",
"ignore-thumbv8m.base-none-eabi",
"ignore-thumbv8m.main-none-eabi",
"ignore-tvos",
"ignore-unix",
"ignore-unknown",
"ignore-uwp",
"ignore-visionos",
"ignore-vxworks",
"ignore-wasi",
"ignore-wasm",
"ignore-wasm32",
"ignore-wasm32-bare",
"ignore-wasm64",
"ignore-watchos",
"ignore-windows",
"ignore-windows-gnu",
"ignore-x32",
"ignore-x86",
"ignore-x86_64",
"ignore-x86_64-apple-darwin",
"ignore-x86_64-unknown-linux-gnu",
"incremental",
"known-bug",
"llvm-cov-flags",
"min-cdb-version",
"min-gdb-version",
"min-lldb-version",
"min-llvm-version",
"min-system-llvm-version",
"needs-asm-support",
"needs-dlltool",
"needs-dynamic-linking",
"needs-force-clang-based-tests",
"needs-git-hash",
"needs-llvm-components",
"needs-profiler-support",
"needs-relocation-model-pic",
"needs-run-enabled",
"needs-rust-lld",
"needs-rust-lldb",
"needs-sanitizer-address",
"needs-sanitizer-cfi",
"needs-sanitizer-dataflow",
"needs-sanitizer-hwaddress",
"needs-sanitizer-kcfi",
"needs-sanitizer-leak",
"needs-sanitizer-memory",
"needs-sanitizer-memtag",
"needs-sanitizer-safestack",
"needs-sanitizer-shadow-call-stack",
"needs-sanitizer-support",
"needs-sanitizer-thread",
"needs-symlink",
"needs-threads",
"needs-unwind",
"needs-wasmtime",
"needs-xray",
"no-auto-check-cfg",
"no-prefer-dynamic",
"normalize-stderr-32bit",
"normalize-stderr-64bit",
"normalize-stderr-test",
"normalize-stdout-test",
"only-16bit",
"only-32bit",
"only-64bit",
"only-aarch64",
"only-apple",
"only-arm",
"only-avr",
"only-beta",
"only-bpf",
"only-cdb",
"only-gnu",
"only-i686-pc-windows-msvc",
"only-ios",
"only-linux",
"only-loongarch64",
"only-loongarch64-unknown-linux-gnu",
"only-macos",
"only-mips",
"only-mips64",
"only-msp430",
"only-msvc",
"only-nightly",
"only-nvptx64",
"only-riscv64",
"only-sparc",
"only-sparc64",
"only-stable",
"only-thumb",
"only-tvos",
"only-unix",
"only-visionos",
"only-wasm32",
"only-wasm32-bare",
"only-wasm32-wasip1",
"only-watchos",
"only-windows",
"only-x86",
"only-x86_64",
"only-x86_64-fortanix-unknown-sgx",
"only-x86_64-pc-windows-gnu",
"only-x86_64-pc-windows-msvc",
"only-x86_64-unknown-linux-gnu",
"pp-exact",
"pretty-compare-only",
"pretty-expanded",
"pretty-mode",
"regex-error-pattern",
"remap-src-base",
"revisions",
"run-fail",
"run-flags",
"run-pass",
"run-rustfix",
"rustc-env",
"rustfix-only-machine-applicable",
"should-fail",
"should-ice",
"stderr-per-bitwidth",
"test-mir-pass",
"unset-exec-env",
"unset-rustc-env",
// Used by the tidy check `unknown_revision`.
"unused-revision-names",
// tidy-alphabetical-end
// To prevent duplicating the list of commmands between `compiletest` and `htmldocck`, we put
// it into a common file which is included in rust code and parsed here.
// FIXME: This setup is temporary until we figure out how to improve this situation.
include!("command-list.rs");
const KNOWN_RUSTDOC_DIRECTIVE_NAMES: &[&str] = &[
"count",
"!count",
"files",
"!files",
"has",
"!has",
"has-dir",
"!has-dir",
"hasraw",
"!hasraw",
"matches",
"!matches",
"matchesraw",
"!matchesraw",
"snapshot",
"!snapshot",
];
/// The broken-down contents of a line containing a test header directive,
@ -988,20 +781,30 @@ pub(crate) struct CheckDirectiveResult<'ln> {
trailing_directive: Option<&'ln str>,
}
pub(crate) fn check_directive(directive_ln: &str) -> CheckDirectiveResult<'_> {
pub(crate) fn check_directive<'a>(
directive_ln: &'a str,
is_rustdoc: bool,
original_line: &str,
) -> CheckDirectiveResult<'a> {
let (directive_name, post) = directive_ln.split_once([':', ' ']).unwrap_or((directive_ln, ""));
let trailing = post.trim().split_once(' ').map(|(pre, _)| pre).unwrap_or(post);
let is_known = |s: &str| {
KNOWN_DIRECTIVE_NAMES.contains(&s)
|| (is_rustdoc
&& original_line.starts_with("//@")
&& KNOWN_RUSTDOC_DIRECTIVE_NAMES.contains(&s))
};
let trailing_directive = {
// 1. is the directive name followed by a space? (to exclude `:`)
matches!(directive_ln.get(directive_name.len()..), Some(s) if s.starts_with(' '))
// 2. is what is after that directive also a directive (ex: "only-x86 only-arm")
&& KNOWN_DIRECTIVE_NAMES.contains(&trailing)
&& is_known(trailing)
}
.then_some(trailing);
CheckDirectiveResult {
is_known_directive: KNOWN_DIRECTIVE_NAMES.contains(&directive_name),
is_known_directive: is_known(&directive_name),
directive_name: directive_ln,
trailing_directive,
}
@ -1072,7 +875,7 @@ fn iter_header(
let directive_ln = non_revisioned_directive_line.trim();
let CheckDirectiveResult { is_known_directive, trailing_directive, .. } =
check_directive(directive_ln);
check_directive(directive_ln, mode == Mode::Rustdoc, ln);
if !is_known_directive {
*poisoned = true;
@ -1125,7 +928,7 @@ fn iter_header(
let rest = rest.trim_start();
let CheckDirectiveResult { is_known_directive, directive_name, .. } =
check_directive(rest);
check_directive(rest, mode == Mode::Rustdoc, ln);
if is_known_directive {
*poisoned = true;

View file

@ -186,6 +186,11 @@ fn should_ignore(line: &str) -> bool {
// - `//@[rev] normalize-stderr-test`
|| static_regex!("\\s*//@(\\[.*\\]) (compile-flags|normalize-stderr-test|error-pattern).*")
.is_match(line)
// Matching for rustdoc tests commands.
// It allows to prevent them emitting warnings like `line longer than 100 chars`.
|| static_regex!(
"\\s*//@ \\!?(count|files|has|has-dir|hasraw|matches|matchesraw|snapshot)\\s.*"
).is_match(line)
}
/// Returns `true` if `line` is allowed to be longer than the normal limit.

View file

@ -7,11 +7,11 @@
extern crate alias_reexport2;
// @has 'foo/reexport/fn.foo.html'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
// @has 'foo/reexport/fn.foo2.html'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
// @has 'foo/reexport/type.Reexported.html'
// @has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
//@ has 'foo/reexport/fn.foo.html'
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
//@ has 'foo/reexport/fn.foo2.html'
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
//@ has 'foo/reexport/type.Reexported.html'
//@ has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
#[doc(inline)]
pub use alias_reexport2 as reexport;

View file

@ -9,9 +9,9 @@
use alias_reexport::Reexported;
// @has 'foo/fn.foo.html'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
//@ has 'foo/fn.foo.html'
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
pub fn foo() -> Reexported { 0 }
// @has 'foo/fn.foo2.html'
// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
//@ has 'foo/fn.foo2.html'
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
pub fn foo2() -> Result<Reexported, ()> { Ok(0) }

View file

@ -1,11 +1,11 @@
#![crate_name = "foo"]
// @has foo/all.html '//a[@href="struct.Struct.html"]' 'Struct'
// @has foo/all.html '//a[@href="enum.Enum.html"]' 'Enum'
// @has foo/all.html '//a[@href="union.Union.html"]' 'Union'
// @has foo/all.html '//a[@href="constant.CONST.html"]' 'CONST'
// @has foo/all.html '//a[@href="static.STATIC.html"]' 'STATIC'
// @has foo/all.html '//a[@href="fn.function.html"]' 'function'
//@ has foo/all.html '//a[@href="struct.Struct.html"]' 'Struct'
//@ has foo/all.html '//a[@href="enum.Enum.html"]' 'Enum'
//@ has foo/all.html '//a[@href="union.Union.html"]' 'Union'
//@ has foo/all.html '//a[@href="constant.CONST.html"]' 'CONST'
//@ has foo/all.html '//a[@href="static.STATIC.html"]' 'STATIC'
//@ has foo/all.html '//a[@href="fn.function.html"]' 'function'
pub struct Struct;
pub enum Enum {
@ -23,6 +23,6 @@ mod private_module {
pub struct ReexportedStruct;
}
// @has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct'
// @!hasraw foo/all.html 'private_module'
//@ has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct'
//@ !hasraw foo/all.html 'private_module'
pub use private_module::ReexportedStruct;

View file

@ -1,7 +1,7 @@
// https://github.com/rust-lang/rust/issues/25001
#![crate_name="issue_25001"]
// @has issue_25001/struct.Foo.html
//@ has issue_25001/struct.Foo.html
pub struct Foo<T>(T);
pub trait Bar {
@ -11,36 +11,36 @@ pub trait Bar {
}
impl Foo<u8> {
// @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()'
//@ has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()'
pub fn pass() {}
}
impl Foo<u16> {
// @has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize'
//@ has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize'
pub fn pass() -> usize { 42 }
}
impl Foo<u32> {
// @has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize'
//@ has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize'
pub fn pass() -> isize { 42 }
}
impl<T> Bar for Foo<T> {
// @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' 'type Item = T'
//@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' 'type Item = T'
type Item=T;
// @has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a Foo<T> {
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T"
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T"
type Item=&'a T;
// @has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a mut Foo<T> {
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T"
//@ has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T"
type Item=&'a mut T;
// @has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)'
//@ has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)'
fn quux(self) {}
}

View file

@ -1,4 +1,4 @@
// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
//@ has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
// https://github.com/rust-lang/rust/issues/15169
#![crate_name="issue_15169"]

View file

@ -3,32 +3,32 @@
#![feature(associated_type_defaults)]
// @has issue_28478/trait.Bar.html
//@ has issue_28478/trait.Bar.html
pub trait Bar {
// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
// @has - '//*[@href="#associatedtype.Bar"]' 'Bar'
//@ has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
//@ has - '//*[@href="#associatedtype.Bar"]' 'Bar'
type Bar = ();
// @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
// @has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
//@ has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
//@ has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
const Baz: usize = 7;
// @has - '//*[@id="tymethod.bar"]' 'fn bar'
//@ has - '//*[@id="tymethod.bar"]' 'fn bar'
fn bar();
// @has - '//*[@id="method.baz"]' 'fn baz'
//@ has - '//*[@id="method.baz"]' 'fn baz'
fn baz() { }
}
// @has issue_28478/struct.Foo.html
//@ has issue_28478/struct.Foo.html
pub struct Foo;
impl Foo {
// @has - '//*[@href="#method.foo"]' 'foo'
//@ has - '//*[@href="#method.foo"]' 'foo'
pub fn foo() {}
}
impl Bar for Foo {
// @has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar'
// @has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz'
// @has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar'
//@ has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar'
//@ has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz'
//@ has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar'
fn bar() {}
// @has - '//*[@href="trait.Bar.html#method.baz"]' 'baz'
//@ has - '//*[@href="trait.Bar.html#method.baz"]' 'baz'
}

View file

@ -6,44 +6,44 @@
pub struct Foo;
// @has 'foo/trait.Bar.html'
//@ has 'foo/trait.Bar.html'
pub trait Bar {
// There should be no anchors here.
// @snapshot no_type_anchor - '//*[@id="associatedtype.T"]'
//@ snapshot no_type_anchor - '//*[@id="associatedtype.T"]'
type T;
// There should be no anchors here.
// @snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]'
//@ snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]'
const YOLO: u32;
// There should be no anchors here.
// @snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]'
//@ snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]'
fn foo();
// There should be no anchors here.
// @snapshot no_trait_method_anchor - '//*[@id="method.bar"]'
//@ snapshot no_trait_method_anchor - '//*[@id="method.bar"]'
fn bar() {}
}
// @has 'foo/struct.Foo.html'
//@ has 'foo/struct.Foo.html'
impl Bar for Foo {
// @has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' ''
//@ has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' ''
type T = u32;
// @has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' ''
//@ has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' ''
const YOLO: u32 = 0;
// @has - '//*[@id="method.foo"]/a[@class="anchor"]' ''
//@ has - '//*[@id="method.foo"]/a[@class="anchor"]' ''
fn foo() {}
// Same check for provided "bar" method.
// @has - '//*[@id="method.bar"]/a[@class="anchor"]' ''
//@ has - '//*[@id="method.bar"]/a[@class="anchor"]' ''
}
impl Foo {
// @snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]'
//@ snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]'
// There should be no anchors here.
pub const X: i32 = 0;
// @snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]'
//@ snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]'
// There should be no anchors here.
pub type Y = u32;
// @snapshot no_method_anchor - '//*[@id="method.new"]'
//@ snapshot no_method_anchor - '//*[@id="method.new"]'
// There should be no anchors here.
pub fn new() -> Self { Self }
}

View file

@ -11,8 +11,8 @@ pub trait Stream {
fn size_hint(&self) -> (usize, Option<usize>);
}
// @has 'foo/trait.Stream.html'
// @has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S'
//@ has 'foo/trait.Stream.html'
//@ has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S'
impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
type Item = S::Item;

View file

@ -2,16 +2,16 @@
// This test ensures we don't display anonymous (non-inline) re-exports of public items.
// @has 'foo/index.html'
// @has - '//*[@id="main-content"]' ''
//@ has 'foo/index.html'
//@ has - '//*[@id="main-content"]' ''
// We check that the only "h2" present are "Structs" (for "Bla") and "Re-exports".
// @count - '//*[@id="main-content"]/h2' 2
// @has - '//*[@id="main-content"]/h2' 'Structs'
// @has - '//*[@id="main-content"]/h2' 'Re-exports'
//@ count - '//*[@id="main-content"]/h2' 2
//@ has - '//*[@id="main-content"]/h2' 'Structs'
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
// The 3 re-exports.
// @count - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 3
//@ count - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 3
// The public struct.
// @count - '//*[@id="main-content"]//a[@class="struct"]' 1
//@ count - '//*[@id="main-content"]//a[@class="struct"]' 1
mod ext {
pub trait Foo {}

View file

@ -3,26 +3,26 @@
pub struct MyBox<T: ?Sized>(*const T);
// @has 'foo/fn.alpha.html'
// @snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code'
//@ has 'foo/fn.alpha.html'
//@ snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code'
pub fn alpha() -> &'static [u32; 1] {
loop {}
}
// @has 'foo/fn.beta.html'
// @snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code'
//@ has 'foo/fn.beta.html'
//@ snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code'
pub fn beta<T>() -> &'static [T; 1] {
loop {}
}
// @has 'foo/fn.gamma.html'
// @snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code'
//@ has 'foo/fn.gamma.html'
//@ snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code'
pub fn gamma() -> MyBox<[u32; 1]> {
loop {}
}
// @has 'foo/fn.delta.html'
// @snapshot link_box_generic - '//pre[@class="rust item-decl"]/code'
//@ has 'foo/fn.delta.html'
//@ snapshot link_box_generic - '//pre[@class="rust item-decl"]/code'
pub fn delta<T>() -> MyBox<[T; 1]> {
loop {}
}

View file

@ -2,7 +2,7 @@
use std::arch::asm;
// @has asm_foreign/fn.aarch64.html
//@ has asm_foreign/fn.aarch64.html
pub unsafe fn aarch64(a: f64, b: f64) -> f64 {
let c;
asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") {
@ -12,7 +12,7 @@ pub unsafe fn aarch64(a: f64, b: f64) -> f64 {
c
}
// @has asm_foreign/fn.x86.html
//@ has asm_foreign/fn.x86.html
pub unsafe fn x86(a: f64, b: f64) -> f64 {
let c;
asm!("addsd {}, {}, xmm0", out(xmm_reg) c, in(xmm_reg) a, in("xmm0") b);

View file

@ -3,7 +3,7 @@
use std::arch::asm;
// @has asm_foreign2/fn.x86.html
//@ has asm_foreign2/fn.x86.html
pub unsafe fn x86(x: i64) -> i64 {
let y;
asm!("movq {}, {}", in(reg) x, out(reg) y, options(att_syntax));

View file

@ -4,14 +4,14 @@
use std::convert::AsRef;
pub struct Local;
// @has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
//@ has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
impl AsRef<str> for Local {
fn as_ref(&self) -> &str {
todo!()
}
}
// @has - '//h3[@class="code-header"]' 'impl AsRef<Local> for str'
//@ has - '//h3[@class="code-header"]' 'impl AsRef<Local> for str'
impl AsRef<Local> for str {
fn as_ref(&self) -> &Local {
todo!()

View file

@ -8,7 +8,7 @@
pub struct SomeStruct;
impl SomeStruct {
// @has 'foo/struct.SomeStruct.html' \
//@ has 'foo/struct.SomeStruct.html' \
// '//*[@id="associatedconstant.SOME_CONST"]//span[@class="since"]' '1.1.2'
#[stable(since="1.1.2", feature="rust2")]
pub const SOME_CONST: usize = 0;

View file

@ -1,11 +1,11 @@
pub trait Foo {
// @has assoc_consts/trait.Foo.html '//pre[@class="rust item-decl"]' \
//@ has assoc_consts/trait.Foo.html '//pre[@class="rust item-decl"]' \
// 'const FOO: usize = 13usize;'
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
//@ has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
const FOO: usize = 12 + 1;
// @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
//@ has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
const FOO_NO_DEFAULT: bool;
// @!hasraw - FOO_HIDDEN
//@ !hasraw - FOO_HIDDEN
#[doc(hidden)]
const FOO_HIDDEN: u8 = 0;
}
@ -13,22 +13,22 @@ pub trait Foo {
pub struct Bar;
impl Foo for Bar {
// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Foo for Bar'
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
//@ has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Foo for Bar'
//@ has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
const FOO: usize = 12;
// @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
//@ has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
const FOO_NO_DEFAULT: bool = false;
// @!hasraw - FOO_HIDDEN
//@ !hasraw - FOO_HIDDEN
#[doc(hidden)]
const FOO_HIDDEN: u8 = 0;
}
impl Bar {
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
//@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
// 'const BAR: usize'
pub const BAR: usize = 3;
// @has - '//*[@id="associatedconstant.BAR_ESCAPED"]' \
//@ has - '//*[@id="associatedconstant.BAR_ESCAPED"]' \
// "const BAR_ESCAPED: &'static str = \"<em>markup</em>\""
pub const BAR_ESCAPED: &'static str = "<em>markup</em>";
}
@ -36,7 +36,7 @@ impl Bar {
pub struct Baz<'a, U: 'a, T>(T, &'a [U]);
impl Bar {
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAZ"]' \
//@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAZ"]' \
// "const BAZ: Baz<'static, u8, u32>"
pub const BAZ: Baz<'static, u8, u32> = Baz(321, &[1, 2, 3]);
}
@ -44,60 +44,60 @@ impl Bar {
pub fn f(_: &(ToString + 'static)) {}
impl Bar {
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \
//@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \
// "const F: fn(_: &(dyn ToString + 'static))"
pub const F: fn(_: &(ToString + 'static)) = f;
}
impl Bar {
// @!hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE'
//@ !hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE'
const BAR_PRIVATE: char = 'a';
// @!hasraw assoc_consts/struct.Bar.html 'BAR_HIDDEN'
//@ !hasraw assoc_consts/struct.Bar.html 'BAR_HIDDEN'
#[doc(hidden)]
pub const BAR_HIDDEN: &'static str = "a";
}
// @has assoc_consts/trait.Qux.html
//@ has assoc_consts/trait.Qux.html
pub trait Qux {
// @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
// @has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
//@ has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
//@ has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
/// Docs for QUX0 in trait.
const QUX0: u8;
// @has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
// @has - '//*[@class="docblock"]' "Docs for QUX1 in trait."
//@ has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
//@ has - '//*[@class="docblock"]' "Docs for QUX1 in trait."
/// Docs for QUX1 in trait.
const QUX1: i8;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
/// Docs for QUX_DEFAULT12 in trait.
const QUX_DEFAULT0: u16 = 1;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in trait."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in trait."
/// Docs for QUX_DEFAULT1 in trait.
const QUX_DEFAULT1: i16 = 2;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
/// Docs for QUX_DEFAULT2 in trait.
const QUX_DEFAULT2: u32 = 3;
}
// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar'
//@ has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar'
impl Qux for Bar {
// @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
// @has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
//@ has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
//@ has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
/// Docs for QUX0 in trait.
const QUX0: u8 = 4;
// @has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
// @has - '//*[@class="docblock"]' "Docs for QUX1 in impl."
//@ has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
//@ has - '//*[@class="docblock"]' "Docs for QUX1 in impl."
/// Docs for QUX1 in impl.
const QUX1: i8 = 5;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
//@ has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
const QUX_DEFAULT0: u16 = 6;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in impl."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in impl."
/// Docs for QUX_DEFAULT1 in impl.
const QUX_DEFAULT1: i16 = 7;
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
//@ has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
}

View file

@ -9,6 +9,6 @@ pub trait AsExpression<T> {
fn as_expression(self) -> Self::Expression;
}
// @has foo/type.AsExprOf.html
// @has - '//pre[@class="rust item-decl"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
//@ has foo/type.AsExprOf.html
//@ has - '//pre[@class="rust item-decl"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;

View file

@ -7,22 +7,22 @@
extern crate issue_20646;
// @has issue_20646/trait.Trait.html \
//@ has issue_20646/trait.Trait.html \
// '//*[@id="associatedtype.Output"]' \
// 'type Output'
pub trait Trait {
type Output;
}
// @has issue_20646/fn.fun.html \
//@ has issue_20646/fn.fun.html \
// '//pre[@class="rust item-decl"]' 'where T: Trait<Output = i32>'
pub fn fun<T>(_: T) where T: Trait<Output=i32> {}
pub mod reexport {
// @has issue_20646/reexport/trait.Trait.html \
//@ has issue_20646/reexport/trait.Trait.html \
// '//*[@id="associatedtype.Output"]' \
// 'type Output'
// @has issue_20646/reexport/fn.fun.html \
//@ has issue_20646/reexport/fn.fun.html \
// '//pre[@class="rust item-decl"]' 'where T: Trait<Output = i32>'
pub use issue_20646::{Trait, fun};
}

View file

@ -1,19 +1,19 @@
#![crate_type="lib"]
// @has assoc_types/trait.Index.html
//@ has assoc_types/trait.Index.html
pub trait Index<I: ?Sized> {
// @has - '//*[@id="associatedtype.Output"]//h4[@class="code-header"]' 'type Output: ?Sized'
//@ has - '//*[@id="associatedtype.Output"]//h4[@class="code-header"]' 'type Output: ?Sized'
type Output: ?Sized;
// @has - '//*[@id="tymethod.index"]//h4[@class="code-header"]' \
//@ has - '//*[@id="tymethod.index"]//h4[@class="code-header"]' \
// "fn index<'a>(&'a self, index: I) -> &'a Self::Output"
// @has - '//*[@id="tymethod.index"]//h4[@class="code-header"]//a[@href="trait.Index.html#associatedtype.Output"]' \
//@ has - '//*[@id="tymethod.index"]//h4[@class="code-header"]//a[@href="trait.Index.html#associatedtype.Output"]' \
// "Output"
fn index<'a>(&'a self, index: I) -> &'a Self::Output;
}
// @has assoc_types/fn.use_output.html
// @has - '//pre[@class="rust item-decl"]' '-> &T::Output'
// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output'
//@ has assoc_types/fn.use_output.html
//@ has - '//pre[@class="rust item-decl"]' '-> &T::Output'
//@ has - '//pre[@class="rust item-decl"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output'
pub fn use_output<T: Index<usize>>(obj: &T, index: usize) -> &T::Output {
obj.index(index)
}
@ -22,14 +22,14 @@ pub trait Feed {
type Input;
}
// @has assoc_types/fn.use_input.html
// @has - '//pre[@class="rust item-decl"]' 'T::Input'
// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input'
//@ has assoc_types/fn.use_input.html
//@ has - '//pre[@class="rust item-decl"]' 'T::Input'
//@ has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input'
pub fn use_input<T: Feed>(_feed: &T, _element: T::Input) { }
// @has assoc_types/fn.cmp_input.html
// @has - '//pre[@class="rust item-decl"]' 'where T::Input: PartialEq<U::Input>'
// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input'
//@ has assoc_types/fn.cmp_input.html
//@ has - '//pre[@class="rust item-decl"]' 'where T::Input: PartialEq<U::Input>'
//@ has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input'
pub fn cmp_input<T: Feed, U: Feed>(a: &T::Input, b: &U::Input) -> bool
where T::Input: PartialEq<U::Input>
{

View file

@ -8,9 +8,9 @@ pub trait Trait {
pub struct Bar;
// @has 'foo/struct.Bar.html'
// @!has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
// @!has - '//div[@class="sidebar-elems"]//a' 'FOO'
//@ has 'foo/struct.Bar.html'
//@ !has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
//@ !has - '//div[@class="sidebar-elems"]//a' 'FOO'
impl Trait for Bar {
const FOO: u32 = 1;
@ -21,9 +21,9 @@ pub enum Foo {
A,
}
// @has 'foo/enum.Foo.html'
// @!has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
// @!has - '//div[@class="sidebar-elems"]//a' 'FOO'
//@ has 'foo/enum.Foo.html'
//@ !has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
//@ !has - '//div[@class="sidebar-elems"]//a' 'FOO'
impl Trait for Foo {
const FOO: u32 = 1;
@ -32,9 +32,9 @@ fn foo() {}
pub struct Baz;
// @has 'foo/struct.Baz.html'
// @has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
// @has - '//div[@class="sidebar-elems"]//a' 'FOO'
//@ has 'foo/struct.Baz.html'
//@ has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
//@ has - '//div[@class="sidebar-elems"]//a' 'FOO'
impl Baz {
pub const FOO: u32 = 42;
}
@ -43,9 +43,9 @@ pub enum Quux {
B,
}
// @has 'foo/enum.Quux.html'
// @has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
// @has - '//div[@class="sidebar-elems"]//a' 'FOO'
//@ has 'foo/enum.Quux.html'
//@ has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants'
//@ has - '//div[@class="sidebar-elems"]//a' 'FOO'
impl Quux {
pub const FOO: u32 = 42;
}

View file

@ -5,11 +5,11 @@
// that comes from an async fn desugaring.
// Check that we don't document an unnamed opaque type
// @!has async_fn_opaque_item/opaque..html
//@ !has async_fn_opaque_item/opaque..html
// Checking there is only a "Functions" header and no "Opaque types".
// @has async_fn_opaque_item/index.html
// @count - '//*[@class="section-header"]' 1
// @has - '//*[@class="section-header"]' 'Functions'
//@ has async_fn_opaque_item/index.html
//@ count - '//*[@class="section-header"]' 1
//@ has - '//*[@class="section-header"]' 'Functions'
pub async fn test() {}

View file

@ -1,43 +1,43 @@
//@ edition:2018
// @has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option<Foo>'
//@ has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option<Foo>'
pub async fn foo() -> Option<Foo> {
None
}
// @has async_fn/fn.bar.html '//pre[@class="rust item-decl"]' 'pub async fn bar(a: i32, b: i32) -> i32'
//@ has async_fn/fn.bar.html '//pre[@class="rust item-decl"]' 'pub async fn bar(a: i32, b: i32) -> i32'
pub async fn bar(a: i32, b: i32) -> i32 {
0
}
// @has async_fn/fn.baz.html '//pre[@class="rust item-decl"]' 'pub async fn baz<T>(a: T) -> T'
//@ has async_fn/fn.baz.html '//pre[@class="rust item-decl"]' 'pub async fn baz<T>(a: T) -> T'
pub async fn baz<T>(a: T) -> T {
a
}
// @has async_fn/fn.qux.html '//pre[@class="rust item-decl"]' 'pub async unsafe fn qux() -> char'
//@ has async_fn/fn.qux.html '//pre[@class="rust item-decl"]' 'pub async unsafe fn qux() -> char'
pub async unsafe fn qux() -> char {
'⚠'
}
// @has async_fn/fn.mut_args.html '//pre[@class="rust item-decl"]' 'pub async fn mut_args(a: usize)'
//@ has async_fn/fn.mut_args.html '//pre[@class="rust item-decl"]' 'pub async fn mut_args(a: usize)'
pub async fn mut_args(mut a: usize) {}
// @has async_fn/fn.mut_ref.html '//pre[@class="rust item-decl"]' 'pub async fn mut_ref(x: i32)'
//@ has async_fn/fn.mut_ref.html '//pre[@class="rust item-decl"]' 'pub async fn mut_ref(x: i32)'
pub async fn mut_ref(ref mut x: i32) {}
trait Bar {}
impl Bar for () {}
// @has async_fn/fn.quux.html '//pre[@class="rust item-decl"]' 'pub async fn quux() -> impl Bar'
//@ has async_fn/fn.quux.html '//pre[@class="rust item-decl"]' 'pub async fn quux() -> impl Bar'
pub async fn quux() -> impl Bar {
()
}
// @has async_fn/struct.Foo.html
// @matches - '//h4[@class="code-header"]' 'pub async fn f\(\)$'
// @matches - '//h4[@class="code-header"]' 'pub async unsafe fn g\(\)$'
// @matches - '//h4[@class="code-header"]' 'pub async fn mut_self\(self, first: usize\)$'
//@ has async_fn/struct.Foo.html
//@ matches - '//h4[@class="code-header"]' 'pub async fn f\(\)$'
//@ matches - '//h4[@class="code-header"]' 'pub async unsafe fn g\(\)$'
//@ matches - '//h4[@class="code-header"]' 'pub async fn mut_self\(self, first: usize\)$'
pub struct Foo;
impl Foo {
@ -51,49 +51,49 @@ pub trait Pattern<'a> {}
impl Pattern<'_> for () {}
pub trait Trait<const N: usize> {}
// @has async_fn/fn.const_generics.html
// @has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
//@ has async_fn/fn.const_generics.html
//@ has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
pub async fn const_generics<const N: usize>(_: impl Trait<N>) {}
// test that elided lifetimes are properly elided and not displayed as `'_`
// regression test for #63037
// @has async_fn/fn.elided.html
// @has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str'
//@ has async_fn/fn.elided.html
//@ has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str'
pub async fn elided(foo: &str) -> &str { "" }
// This should really be shown as written, but for implementation reasons it's difficult.
// See `impl Clean for TyKind::Ref`.
// @has async_fn/fn.user_elided.html
// @has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str'
//@ has async_fn/fn.user_elided.html
//@ has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str'
pub async fn user_elided(foo: &'_ str) -> &str { "" }
// @has async_fn/fn.static_trait.html
// @has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>'
//@ has async_fn/fn.static_trait.html
//@ has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>'
pub async fn static_trait(foo: &str) -> Box<dyn Bar> { Box::new(()) }
// @has async_fn/fn.lifetime_for_trait.html
// @has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>"
//@ has async_fn/fn.lifetime_for_trait.html
//@ has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>"
pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_> { Box::new(()) }
// @has async_fn/fn.elided_in_input_trait.html
// @has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)"
//@ has async_fn/fn.elided_in_input_trait.html
//@ has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)"
pub async fn elided_in_input_trait(t: impl Pattern<'_>) {}
struct AsyncFdReadyGuard<'a, T> { x: &'a T }
impl Foo {
// @has async_fn/struct.Foo.html
// @has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar, ) -> impl Iterator<Item = &usize>'
//@ has async_fn/struct.Foo.html
//@ has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar, ) -> impl Iterator<Item = &usize>'
pub async fn complicated_lifetimes(&self, context: &impl Bar) -> impl Iterator<Item = &usize> {
[0].iter()
}
// taken from `tokio` as an example of a method that was particularly bad before
// @has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>"
//@ has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>"
pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()> { Err(()) }
// @has - '//*[@class="method"]' "pub async fn mut_self(&mut self)"
//@ has - '//*[@class="method"]' "pub async fn mut_self(&mut self)"
pub async fn mut_self(&mut self) {}
}
// test named lifetimes, just in case
// @has async_fn/fn.named.html
// @has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str"
//@ has async_fn/fn.named.html
//@ has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str"
pub async fn named<'a, 'b>(foo: &'a str) -> &'b str { "" }
// @has async_fn/fn.named_trait.html
// @has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>"
//@ has async_fn/fn.named_trait.html
//@ has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>"
pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b> {}

View file

@ -3,10 +3,10 @@
#![allow(incomplete_features)]
pub trait Foo {
// @has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn bar() -> i32"
//@ has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn bar() -> i32"
async fn bar() -> i32;
// @has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn baz() -> i32"
//@ has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn baz() -> i32"
async fn baz() -> i32 {
1
}

View file

@ -7,7 +7,7 @@
pub struct Oink {}
// @has 'async_trait/struct.Oink.html' '//h4[@class="code-header"]' "async fn woof()"
//@ has 'async_trait/struct.Oink.html' '//h4[@class="code-header"]' "async fn woof()"
impl async_trait_dep::Meow for Oink {
async fn woof() {
todo!()

View file

@ -1,7 +1,7 @@
#![crate_name = "foo"]
// @has 'foo/fn.f.html'
// @has - //*[@'class="rust item-decl"]' '#[export_name = "f"] pub fn f()'
//@ has 'foo/fn.f.html'
//@ has - //*[@'class="rust item-decl"]' '#[export_name = "f"] pub fn f()'
#[export_name = "\
f"]
pub fn f() {}

View file

@ -1,13 +1,13 @@
#![crate_name = "foo"]
// @has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[no_mangle]'
//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[no_mangle]'
#[no_mangle]
pub extern "C" fn f() {}
// @has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[export_name = "bar"]'
//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[export_name = "bar"]'
#[export_name = "bar"]
pub extern "C" fn g() {}
// @has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]'
//@ has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]'
#[repr(C, align(8))]
pub struct Repr;

View file

@ -4,7 +4,7 @@
pub use std::fs::File;
// @has 'foo/primitive.i16.html' '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementation'
//@ has 'foo/primitive.i16.html' '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementation'
#[rustc_doc_primitive = "i16"]
/// I love poneys!
mod prim {}

View file

@ -16,11 +16,11 @@ impl<B, C> Signal2 for B
type Item2 = C;
}
// @has foo/struct.Switch.html
// @has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
// @has - '//h3[@class="code-header"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 6
//@ has foo/struct.Switch.html
//@ has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
//@ has - '//h3[@class="code-header"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
//@ count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 6
pub struct Switch<B: Signal> {
pub inner: <B as Signal2>::Item2,
}

View file

@ -3,11 +3,11 @@
pub trait ScopeHandle<'scope> {}
// @has foo/struct.ScopeFutureContents.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has foo/struct.ScopeFutureContents.html
//@ has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync"
//
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<'scope, S> Sync for ScopeFutureContents<'scope, S>where S: Sync"
pub struct ScopeFutureContents<'scope, S>
where S: ScopeHandle<'scope>,

View file

@ -9,8 +9,8 @@ pub trait Owned<'a> {
}
}
// @has foo/struct.Owned.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has foo/struct.Owned.html
//@ has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<T> Send for Owned<T>where <T as Owned<'static>>::Reader: Send"
pub struct Owned<T> where T: for<'a> ::traits::Owned<'a> {
marker: PhantomData<<T as ::traits::Owned<'static>>::Reader>,

View file

@ -3,19 +3,19 @@
#![feature(negative_impls)]
// @has foo/struct.A.html
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has foo/struct.A.html
//@ has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl !Send for A"
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl !Sync for A"
pub struct A();
impl !Send for A {}
impl !Sync for A {}
// @has foo/struct.B.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has foo/struct.B.html
//@ has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<T> !Send for B<T>"
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
//@ has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \
// "impl<T> !Sync for B<T>"
pub struct B<T: ?Sized>(A, Box<T>);

View file

@ -1,8 +1,8 @@
#![crate_name = "foo"]
// @has 'foo/struct.Foo.html'
// @has - '//*[@id="impl-Send-for-Foo"]' 'impl !Send for Foo'
// @has - '//*[@id="impl-Sync-for-Foo"]' 'impl !Sync for Foo'
//@ has 'foo/struct.Foo.html'
//@ has - '//*[@id="impl-Send-for-Foo"]' 'impl !Send for Foo'
//@ has - '//*[@id="impl-Sync-for-Foo"]' 'impl !Sync for Foo'
pub struct Foo(*const i8);
pub trait Whatever: Send {}
impl<T: Send + ?Sized> Whatever for T {}

View file

@ -6,8 +6,8 @@
extern crate auto_traits;
// @has 'foo/trait.Foo.html' '//pre' 'pub unsafe auto trait Foo'
//@ has 'foo/trait.Foo.html' '//pre' 'pub unsafe auto trait Foo'
pub unsafe auto trait Foo {}
// @has 'foo/trait.Bar.html' '//pre' 'pub unsafe auto trait Bar'
//@ has 'foo/trait.Bar.html' '//pre' 'pub unsafe auto trait Bar'
pub use auto_traits::Bar;

View file

@ -1,6 +1,6 @@
#![feature(auto_traits)]
// @has auto_aliases/trait.Bar.html '//*[@data-aliases="auto_aliases::Foo"]' 'impl Bar for Foo'
//@ has auto_aliases/trait.Bar.html '//*[@data-aliases="auto_aliases::Foo"]' 'impl Bar for Foo'
pub struct Foo;
pub auto trait Bar {}

View file

@ -4,9 +4,9 @@
pub use alias_reexport::Reexported;
// @has 'foo/fn.foo.html'
// @has - '//*[@class="docblock item-decl"]' 'pub fn foo() -> Reexported'
//@ has 'foo/fn.foo.html'
//@ has - '//*[@class="docblock item-decl"]' 'pub fn foo() -> Reexported'
pub fn foo() -> Reexported { 0 }
// @has 'foo/fn.foo2.html'
// @has - '//*[@class="docblock item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
//@ has 'foo/fn.foo2.html'
//@ has - '//*[@class="docblock item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
pub fn foo2() -> Result<Reexported, ()> { Ok(0) }

View file

@ -1,6 +1,6 @@
#![crate_type="lib"]
extern "C" {
// @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
//@ has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
pub fn foreigner(cold_as_ice: u32);
}

View file

@ -1,43 +1,43 @@
#![allow(rustdoc::invalid_rust_codeblocks)]
// @has bad_codeblock_syntax/fn.foo.html
// @has - '//*[@class="docblock"]' '\_'
//@ has bad_codeblock_syntax/fn.foo.html
//@ has - '//*[@class="docblock"]' '\_'
/// ```
/// \_
/// ```
pub fn foo() {}
// @has bad_codeblock_syntax/fn.bar.html
// @has - '//*[@class="docblock"]' '`baz::foobar`'
//@ has bad_codeblock_syntax/fn.bar.html
//@ has - '//*[@class="docblock"]' '`baz::foobar`'
/// ```
/// `baz::foobar`
/// ```
pub fn bar() {}
// @has bad_codeblock_syntax/fn.quux.html
// @has - '//*[@class="docblock"]' '\_'
//@ has bad_codeblock_syntax/fn.quux.html
//@ has - '//*[@class="docblock"]' '\_'
/// ```rust
/// \_
/// ```
pub fn quux() {}
// @has bad_codeblock_syntax/fn.ok.html
// @has - '//*[@class="docblock"]' '\_'
//@ has bad_codeblock_syntax/fn.ok.html
//@ has - '//*[@class="docblock"]' '\_'
/// ```text
/// \_
/// ```
pub fn ok() {}
// @has bad_codeblock_syntax/fn.escape.html
// @has - '//*[@class="docblock"]' '\_ <script>alert("not valid Rust");</script>'
//@ has bad_codeblock_syntax/fn.escape.html
//@ has - '//*[@class="docblock"]' '\_ <script>alert("not valid Rust");</script>'
/// ```
/// \_
/// <script>alert("not valid Rust");</script>
/// ```
pub fn escape() {}
// @has bad_codeblock_syntax/fn.unterminated.html
// @has - '//*[@class="docblock"]' '"unterminated'
//@ has bad_codeblock_syntax/fn.unterminated.html
//@ has - '//*[@class="docblock"]' '"unterminated'
/// ```
/// "unterminated
/// ```

View file

@ -1,7 +1,7 @@
// https://github.com/rust-lang/rust/issues/47197
#![crate_name="foo"]
// @has foo/fn.whose_woods_these_are_i_think_i_know.html
//@ has foo/fn.whose_woods_these_are_i_think_i_know.html
/**
* snow

View file

@ -3,12 +3,12 @@
use std::fmt;
// @has issue_29503/trait.MyTrait.html
//@ has issue_29503/trait.MyTrait.html
pub trait MyTrait {
fn my_string(&self) -> String;
}
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl<T> MyTrait for Twhere T: Debug"
//@ has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl<T> MyTrait for Twhere T: Debug"
impl<T> MyTrait for T
where
T: fmt::Debug,

View file

@ -7,18 +7,18 @@ pub trait AnAmazingTrait {}
impl<T: Something> AnAmazingTrait for T {}
// @has 'issue_78673/struct.MyStruct.html'
// @has - '//*[@class="impl"]' 'AnAmazingTrait for MyStruct'
// @!has - '//*[@class="impl"]' 'AnAmazingTrait for T'
//@ has 'issue_78673/struct.MyStruct.html'
//@ has - '//*[@class="impl"]' 'AnAmazingTrait for MyStruct'
//@ !has - '//*[@class="impl"]' 'AnAmazingTrait for T'
pub struct MyStruct;
impl AnAmazingTrait for MyStruct {}
// generic structs may have _both_ specific and blanket impls that apply
// @has 'issue_78673/struct.AnotherStruct.html'
// @has - '//*[@class="impl"]' 'AnAmazingTrait for AnotherStruct<()>'
// @has - '//*[@class="impl"]' 'AnAmazingTrait for T'
//@ has 'issue_78673/struct.AnotherStruct.html'
//@ has - '//*[@class="impl"]' 'AnAmazingTrait for AnotherStruct<()>'
//@ has - '//*[@class="impl"]' 'AnAmazingTrait for T'
pub struct AnotherStruct<T>(T);
impl<T: Something> Something for AnotherStruct<T> {}

View file

@ -1,6 +1,6 @@
#![crate_name = "foo"]
// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-T"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T'
//@ has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-T"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T'
pub struct S2 {}
mod m {
pub struct S {}

View file

@ -4,16 +4,16 @@ pub trait Eq {}
pub trait Eq2 {}
// Checking that "where predicates" and "generics params" are merged.
// @has 'foo/trait.T.html'
// @has - "//*[@id='tymethod.f']/h4" "fn f<'a, 'b, 'c, T>()where Self: Eq, T: Eq + 'a, 'c: 'b + 'a,"
//@ has 'foo/trait.T.html'
//@ has - "//*[@id='tymethod.f']/h4" "fn f<'a, 'b, 'c, T>()where Self: Eq, T: Eq + 'a, 'c: 'b + 'a,"
pub trait T {
fn f<'a, 'b, 'c: 'a, T: Eq + 'a>()
where Self: Eq, Self: Eq, T: Eq, 'c: 'b;
}
// Checking that a duplicated "where predicate" is removed.
// @has 'foo/trait.T2.html'
// @has - "//*[@id='tymethod.f']/h4" "fn f<T>()where Self: Eq + Eq2, T: Eq2 + Eq,"
//@ has 'foo/trait.T2.html'
//@ has - "//*[@id='tymethod.f']/h4" "fn f<T>()where Self: Eq + Eq2, T: Eq2 + Eq,"
pub trait T2 {
fn f<T: Eq>()
where Self: Eq, Self: Eq2, T: Eq2;
@ -23,8 +23,8 @@ fn f<T: Eq>()
// Note that we don't want to hide them since they have a semantic effect.
// For outlives-bounds, they force the lifetime param to be early-bound instead of late-bound.
// For trait bounds, it can affect well-formedness (see `ClauseKind::WellFormed`).
// @has 'foo/fn.empty.html'
// @has - '//pre[@class="rust item-decl"]' "empty<'a, T>()where T:, 'a:,"
//@ has 'foo/fn.empty.html'
//@ has - '//pre[@class="rust item-decl"]' "empty<'a, T>()where T:, 'a:,"
pub fn empty<'a, T>()
where
T:,

View file

@ -3,7 +3,7 @@
// therefore should not concern itself with the lints.
#[deny(warnings)]
// @has cap_lints/struct.Foo.html //* 'Foo'
//@ has cap_lints/struct.Foo.html //* 'Foo'
pub struct Foo {
field: i32,
}

View file

@ -1,5 +1,5 @@
// @!has cfg_doctest/struct.SomeStruct.html
// @!has cfg_doctest/index.html '//a/@href' 'struct.SomeStruct.html'
//@ !has cfg_doctest/struct.SomeStruct.html
//@ !has cfg_doctest/index.html '//a/@href' 'struct.SomeStruct.html'
/// Sneaky, this isn't actually part of docs.
#[cfg(doctest)]

View file

@ -4,14 +4,14 @@
#![crate_name = "foo"]
#![no_core]
// @has 'foo/index.html'
// @has - '//*[@class="item-name"]/*[@class="stab portability"]' 'foobar'
// @has - '//*[@class="item-name"]/*[@class="stab portability"]' 'bar'
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]/*[@class="stab portability"]' 'foobar'
//@ has - '//*[@class="item-name"]/*[@class="stab portability"]' 'bar'
#[doc(cfg(feature = "foobar"))]
mod imp_priv {
// @has 'foo/struct.BarPriv.html'
// @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
//@ has 'foo/struct.BarPriv.html'
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on crate feature foobar only.'
pub struct BarPriv {}
impl BarPriv {
@ -22,8 +22,8 @@ pub fn test() {}
pub use crate::imp_priv::*;
pub mod bar {
// @has 'foo/bar/struct.Bar.html'
// @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
//@ has 'foo/bar/struct.Bar.html'
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on crate feature bar only.'
#[doc(cfg(feature = "bar"))]
pub struct Bar;

View file

@ -2,14 +2,14 @@
#![crate_name = "foo"]
// @has 'src/foo/check-source-code-urls-to-def-std.rs.html'
//@ has 'src/foo/check-source-code-urls-to-def-std.rs.html'
fn babar() {}
// @has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32'
// @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str'
// @has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool'
// @has - '//a[@href="#7"]' 'babar'
//@ has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32'
//@ has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str'
//@ has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool'
//@ has - '//a[@href="#7"]' 'babar'
pub fn foo(a: u32, b: &str, c: String) {
let x = 12;
let y: bool = true;
@ -31,12 +31,12 @@ macro_rules! data {
pub fn another_foo() {
// This is known limitation: if the macro doesn't generate anything, the visitor
// can't find any item or anything that could tell us that it comes from expansion.
// @!has - '//a[@href="#19"]' 'yolo!'
//@ !has - '//a[@href="#19"]' 'yolo!'
yolo!();
// @has - '//a[@href="{{channel}}/std/macro.eprintln.html"]' 'eprintln!'
//@ has - '//a[@href="{{channel}}/std/macro.eprintln.html"]' 'eprintln!'
eprintln!();
// @has - '//a[@href="#27-29"]' 'data!'
//@ has - '//a[@href="#27-29"]' 'data!'
let x = data!(4);
// @has - '//a[@href="#23-25"]' 'bar!'
//@ has - '//a[@href="#23-25"]' 'bar!'
bar!(x);
}

View file

@ -8,16 +8,16 @@
extern crate source_code;
// @has 'src/foo/check-source-code-urls-to-def.rs.html'
//@ has 'src/foo/check-source-code-urls-to-def.rs.html'
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#1-17"]' 'bar'
//@ has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#1-17"]' 'bar'
#[path = "auxiliary/source-code-bar.rs"]
pub mod bar;
// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5-7"]' 4
//@ count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5-7"]' 4
use bar::Bar;
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13-17"]' 'self'
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
//@ has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13-17"]' 'self'
//@ has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
use bar::sub::{self, Trait};
pub struct Foo;
@ -28,30 +28,30 @@ fn hello(&self) {}
fn babar() {}
// @has - '//pre[@class="rust"]//a/@href' '/struct.String.html'
// @has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html'
// @has - '//pre[@class="rust"]//a/@href' '/primitive.str.html'
// @count - '//pre[@class="rust"]//a[@href="#23"]' 5
// @has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' \
//@ has - '//pre[@class="rust"]//a/@href' '/struct.String.html'
//@ has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html'
//@ has - '//pre[@class="rust"]//a/@href' '/primitive.str.html'
//@ count - '//pre[@class="rust"]//a[@href="#23"]' 5
//@ has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' \
// 'source_code::SourceCode'
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
let x = 12;
let y: Foo = Foo;
let z: Bar = bar::Bar { field: Foo };
babar();
// @has - '//pre[@class="rust"]//a[@href="#26"]' 'hello'
//@ has - '//pre[@class="rust"]//a[@href="#26"]' 'hello'
y.hello();
}
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
//@ has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
//@ has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {}
pub trait AnotherTrait {}
pub trait WhyNot {}
// @has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait'
// @has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot'
//@ has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait'
//@ has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot'
pub fn foo3<T, V>(t: &T, v: &V)
where
T: AnotherTrait,
@ -60,11 +60,11 @@ pub fn foo3<T, V>(t: &T, v: &V)
pub trait AnotherTrait2 {}
// @has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2'
//@ has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2'
pub fn foo4() {
let x: Vec<&dyn AnotherTrait2> = Vec::new();
}
// @has - '//pre[@class="rust"]//a[@href="../../foo/primitive.bool.html"]' 'bool'
//@ has - '//pre[@class="rust"]//a[@href="../../foo/primitive.bool.html"]' 'bool'
#[rustc_doc_primitive = "bool"]
mod whatever {}

View file

@ -2,7 +2,7 @@
pub struct Foo;
// @has foo/struct.Bar.html '//a[@href="struct.Foo.html"]' 'Foo'
//@ has foo/struct.Bar.html '//a[@href="struct.Foo.html"]' 'Foo'
/// Code-styled reference to [`Foo`].
pub struct Bar;

View file

@ -1,5 +1,5 @@
//@ compile-flags: -Z unstable-options --check
// @!has check/fn.foo.html
// @!has check/index.html
//@ !has check/fn.foo.html
//@ !has check/index.html
pub fn foo() {}

View file

@ -1,9 +1,9 @@
#![crate_name = "foo"]
// @has foo/fn.bar.html '//*[@class="example-wrap compile_fail"]/*[@class="tooltip"]' "ⓘ"
// @has foo/fn.bar.html '//*[@class="example-wrap ignore"]/*[@class="tooltip"]' "ⓘ"
// @has foo/fn.bar.html '//*[@class="example-wrap should_panic"]/*[@class="tooltip"]' "ⓘ"
// @has foo/fn.bar.html '//*[@title="This example runs with edition 2018"]' "ⓘ"
//@ has foo/fn.bar.html '//*[@class="example-wrap compile_fail"]/*[@class="tooltip"]' "ⓘ"
//@ has foo/fn.bar.html '//*[@class="example-wrap ignore"]/*[@class="tooltip"]' "ⓘ"
//@ has foo/fn.bar.html '//*[@class="example-wrap should_panic"]/*[@class="tooltip"]' "ⓘ"
//@ has foo/fn.bar.html '//*[@title="This example runs with edition 2018"]' "ⓘ"
/// foo
///

View file

@ -2,14 +2,14 @@
#![crate_name = "foo"]
// @has 'foo/index.html'
//@ has 'foo/index.html'
// Each compiler builtin proc-macro has a trait equivalent so we should have
// a trait section as well.
// @count - '//*[@id="main-content"]//*[@class="section-header"]' 2
// @has - '//*[@id="main-content"]//*[@class="section-header"]' 'Traits'
// @has - '//*[@id="main-content"]//*[@class="section-header"]' 'Derive Macros'
//@ count - '//*[@id="main-content"]//*[@class="section-header"]' 2
//@ has - '//*[@id="main-content"]//*[@class="section-header"]' 'Traits'
//@ has - '//*[@id="main-content"]//*[@class="section-header"]' 'Derive Macros'
// Now checking the correct file is generated as well.
// @has 'foo/derive.Clone.html'
// @!has 'foo/macro.Clone.html'
//@ has 'foo/derive.Clone.html'
//@ !has 'foo/macro.Clone.html'
pub use std::clone::Clone;

View file

@ -7,68 +7,68 @@
#![feature(foo, foo2)]
#![feature(staged_api)]
// @has 'foo/fn.foo.html' '//pre' 'pub fn foo() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has 'foo/fn.foo.html' '//pre' 'pub fn foo() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const fn foo() -> u32 { 42 }
// @has 'foo/fn.foo_unsafe.html' '//pre' 'pub unsafe fn foo_unsafe() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has 'foo/fn.foo_unsafe.html' '//pre' 'pub unsafe fn foo_unsafe() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const unsafe fn foo_unsafe() -> u32 { 42 }
// @has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32'
// @!hasraw - '//span[@class="since"]'
//@ has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32'
//@ !hasraw - '//span[@class="since"]'
#[unstable(feature = "humans", issue = "none")]
pub const fn foo2() -> u32 { 42 }
// @has 'foo/fn.foo3.html' '//pre' 'pub const fn foo3() -> u32'
// @!hasraw - '//span[@class="since"]'
//@ has 'foo/fn.foo3.html' '//pre' 'pub const fn foo3() -> u32'
//@ !hasraw - '//span[@class="since"]'
#[unstable(feature = "humans", issue = "none")]
#[rustc_const_unstable(feature = "humans", issue = "none")]
pub const fn foo3() -> u32 { 42 }
// @has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32'
// @has - //span '1.0.0 (const: 1.0.0)'
//@ has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32'
//@ has - //span '1.0.0 (const: 1.0.0)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
pub const fn bar2() -> u32 { 42 }
// @has 'foo/fn.foo2_gated.html' '//pre' 'pub const unsafe fn foo2_gated() -> u32'
// @!hasraw - '//span[@class="since"]'
//@ has 'foo/fn.foo2_gated.html' '//pre' 'pub const unsafe fn foo2_gated() -> u32'
//@ !hasraw - '//span[@class="since"]'
#[unstable(feature = "foo2", issue = "none")]
pub const unsafe fn foo2_gated() -> u32 { 42 }
// @has 'foo/fn.bar2_gated.html' '//pre' 'pub const unsafe fn bar2_gated() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: 1.0.0)'
//@ has 'foo/fn.bar2_gated.html' '//pre' 'pub const unsafe fn bar2_gated() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: 1.0.0)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
pub const unsafe fn bar2_gated() -> u32 { 42 }
// @has 'foo/fn.bar_not_gated.html' '//pre' 'pub const unsafe fn bar_not_gated() -> u32'
// @!hasraw - '//span[@class="since"]'
//@ has 'foo/fn.bar_not_gated.html' '//pre' 'pub const unsafe fn bar_not_gated() -> u32'
//@ !hasraw - '//span[@class="since"]'
pub const unsafe fn bar_not_gated() -> u32 { 42 }
pub struct Foo;
impl Foo {
// @has 'foo/struct.Foo.html' '//*[@id="method.gated"]/h4[@class="code-header"]' 'pub fn gated() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has 'foo/struct.Foo.html' '//*[@id="method.gated"]/h4[@class="code-header"]' 'pub fn gated() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const fn gated() -> u32 { 42 }
// @has 'foo/struct.Foo.html' '//*[@id="method.gated_unsafe"]/h4[@class="code-header"]' 'pub unsafe fn gated_unsafe() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has 'foo/struct.Foo.html' '//*[@id="method.gated_unsafe"]/h4[@class="code-header"]' 'pub unsafe fn gated_unsafe() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const unsafe fn gated_unsafe() -> u32 { 42 }
// @has 'foo/struct.Foo.html' '//*[@id="method.stable_impl"]/h4[@class="code-header"]' 'pub const fn stable_impl() -> u32'
// @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
//@ has 'foo/struct.Foo.html' '//*[@id="method.stable_impl"]/h4[@class="code-header"]' 'pub const fn stable_impl() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const2", since = "1.2.0")]
pub const fn stable_impl() -> u32 { 42 }
@ -79,13 +79,13 @@ pub const fn stable_impl() -> u32 { 42 }
impl Bar {
// Show non-const stabilities that are the same as the enclosing item.
// @has 'foo/struct.Bar.html' '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
//@ has 'foo/struct.Bar.html' '//span[@class="since"]' '1.0.0 (const: 1.2.0)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const2", since = "1.2.0")]
pub const fn stable_impl() -> u32 { 42 }
// Show const-stability even for unstable functions.
// @matches 'foo/struct.Bar.html' '//span[@class="since"]' '^const: 1.3.0$'
//@ matches 'foo/struct.Bar.html' '//span[@class="since"]' '^const: 1.3.0$'
#[unstable(feature = "foo2", issue = "none")]
#[rustc_const_stable(feature = "const3", since = "1.3.0")]
pub const fn const_stable_unstable() -> u32 { 42 }

View file

@ -11,8 +11,8 @@ pub struct ContentType {
}
impl ContentType {
// @has const_doc/struct.ContentType.html
// @has - '//*[@id="associatedconstant.Any"]' 'const Any: ContentType'
//@ has const_doc/struct.ContentType.html
//@ has - '//*[@id="associatedconstant.Any"]' 'const Any: ContentType'
pub const Any: ContentType = ContentType { ttype: Foo { f: PhantomData, },
subtype: Foo { f: PhantomData, },
params: None, };

View file

@ -9,7 +9,7 @@ pub trait Tr {
fn f();
}
// @has foo/fn.g.html
// @has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr>()'
//@ has foo/fn.g.html
//@ has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr>()'
/// foo
pub const fn g<T: ~const Tr>() {}

View file

@ -1,7 +1,7 @@
// https://github.com/rust-lang/rust/issues/76501
#![crate_name="foo"]
// @has 'foo/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32'
//@ has 'foo/fn.bloop.html' '//pre' 'pub const fn bloop() -> i32'
/// A useless function that always returns 1.
pub const fn bloop() -> i32 {
1
@ -11,7 +11,7 @@ pub const fn bloop() -> i32 {
pub struct Struct {}
impl Struct {
// @has 'foo/struct.Struct.html' '//*[@class="method"]' \
//@ has 'foo/struct.Struct.html' '//*[@class="method"]' \
// 'pub const fn blurp() -> i32'
/// A useless function that always returns 1.
pub const fn blurp() -> i32 {

View file

@ -2,15 +2,15 @@
#![feature(effects)]
#![allow(incomplete_features)]
// @has foo/fn.bar.html
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
//@ has foo/fn.bar.html
//@ has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
/// foo
pub const fn bar() -> usize {
2
}
// @has foo/struct.Foo.html
// @has - '//*[@class="method"]' 'const fn new()'
//@ has foo/struct.Foo.html
//@ has - '//*[@class="method"]' 'const fn new()'
pub struct Foo(usize);
impl Foo {

View file

@ -1,14 +1,14 @@
#![crate_name = "foo"]
// @has foo/fn.bar.html
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
//@ has foo/fn.bar.html
//@ has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
/// foo
pub const fn bar() -> usize {
2
}
// @has foo/struct.Foo.html
// @has - '//*[@class="method"]' 'const fn new()'
//@ has foo/struct.Foo.html
//@ has - '//*[@class="method"]' 'const fn new()'
pub struct Foo(usize);
impl Foo {

View file

@ -2,12 +2,12 @@
use std::ops::Add;
// @has foo/struct.Simd.html '//pre[@class="rust item-decl"]' 'pub struct Simd<T, const WIDTH: usize>'
//@ has foo/struct.Simd.html '//pre[@class="rust item-decl"]' 'pub struct Simd<T, const WIDTH: usize>'
pub struct Simd<T, const WIDTH: usize> {
inner: T,
}
// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add for Simd<u8, 16>'
//@ has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add for Simd<u8, 16>'
impl Add for Simd<u8, 16> {
type Output = Self;

View file

@ -1,5 +1,5 @@
#![crate_name = "foo"]
// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
//@ has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
// 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>('
pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T);

View file

@ -4,8 +4,8 @@ pub trait Array {
type Item;
}
// @has foo/trait.Array.html
// @has - '//*[@class="impl"]' 'impl<T, const N: usize> Array for [T; N]'
//@ has foo/trait.Array.html
//@ has - '//*[@class="impl"]' 'impl<T, const N: usize> Array for [T; N]'
impl<T, const N: usize> Array for [T; N] {
type Item = T;
}

View file

@ -3,26 +3,26 @@
#![crate_name = "foo"]
extern crate extern_crate;
// @has foo/fn.extern_fn.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.extern_fn.html '//pre[@class="rust item-decl"]' \
// 'pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]>'
pub use extern_crate::extern_fn;
// @has foo/struct.ExternTy.html '//pre[@class="rust item-decl"]' \
//@ has foo/struct.ExternTy.html '//pre[@class="rust item-decl"]' \
// 'pub struct ExternTy<const N: usize> {'
pub use extern_crate::ExternTy;
// @has foo/type.TyAlias.html '//pre[@class="rust item-decl"]' \
//@ has foo/type.TyAlias.html '//pre[@class="rust item-decl"]' \
// 'type TyAlias<const N: usize> = ExternTy<N>;'
pub use extern_crate::TyAlias;
// @has foo/trait.WTrait.html '//pre[@class="rust item-decl"]' \
//@ has foo/trait.WTrait.html '//pre[@class="rust item-decl"]' \
// 'pub trait WTrait<const N: usize, const M: usize>'
// @has - '//pre[@class="rust item-decl"]' 'fn hey<const P: usize>() -> usize'
//@ has - '//pre[@class="rust item-decl"]' 'fn hey<const P: usize>() -> usize'
pub use extern_crate::WTrait;
// @has foo/trait.Trait.html '//pre[@class="rust item-decl"]' \
//@ has foo/trait.Trait.html '//pre[@class="rust item-decl"]' \
// 'pub trait Trait<const N: usize>'
// @has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<1> for u8'
// @has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<2> for u8'
// @has - '//*[@id="impl-Trait%3C%7B1+%2B+2%7D%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<{1 + 2}> for u8'
// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8;+N%5D"]//h3[@class="code-header"]' \
//@ has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<1> for u8'
//@ has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<2> for u8'
//@ has - '//*[@id="impl-Trait%3C%7B1+%2B+2%7D%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<{1 + 2}> for u8'
//@ has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8;+N%5D"]//h3[@class="code-header"]' \
// 'impl<const N: usize> Trait<N> for [u8; N]'
pub trait Trait<const N: usize> {}
impl Trait<1> for u8 {}
@ -30,58 +30,58 @@ impl Trait<2> for u8 {}
impl Trait<{1 + 2}> for u8 {}
impl<const N: usize> Trait<N> for [u8; N] {}
// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
//@ has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
// 'pub struct Foo<const N: usize> where u8: Trait<N>'
pub struct Foo<const N: usize> where u8: Trait<N>;
// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar<T, const N: usize>('
//@ has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar<T, const N: usize>('
pub struct Bar<T, const N: usize>([T; N]);
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>'
//@ has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>'
impl<const M: usize> Foo<M> where u8: Trait<M> {
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
//@ has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
pub const FOO_ASSOC: usize = M + 13;
// @has - '//*[@id="method.hey"]' 'pub fn hey<const N: usize>(&self) -> Bar<u8, N>'
//@ has - '//*[@id="method.hey"]' 'pub fn hey<const N: usize>(&self) -> Bar<u8, N>'
pub fn hey<const N: usize>(&self) -> Bar<u8, N> {
Bar([0; N])
}
}
// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8,+M%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Bar<u8, M>'
//@ has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8,+M%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Bar<u8, M>'
impl<const M: usize> Bar<u8, M> {
// @has - '//*[@id="method.hey"]' \
//@ has - '//*[@id="method.hey"]' \
// 'pub fn hey<const N: usize>(&self) -> Foo<N>where u8: Trait<N>'
pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N> {
Foo
}
}
// @has foo/fn.test.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.test.html '//pre[@class="rust item-decl"]' \
// 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>'
pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
2u8
}
// @has foo/fn.a_sink.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.a_sink.html '//pre[@class="rust item-decl"]' \
// 'pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N>'
pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> {
v
}
// @has foo/fn.b_sink.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.b_sink.html '//pre[@class="rust item-decl"]' \
// 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)'
pub async fn b_sink<const N: usize>(_: impl Trait<N>) {}
// @has foo/fn.concrete.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.concrete.html '//pre[@class="rust item-decl"]' \
// 'pub fn concrete() -> [u8; 22]'
pub fn concrete() -> [u8; 3 + std::mem::size_of::<u64>() << 1] {
Default::default()
}
// @has foo/type.Faz.html '//pre[@class="rust item-decl"]' \
//@ has foo/type.Faz.html '//pre[@class="rust item-decl"]' \
// 'type Faz<const N: usize> = [u8; N];'
pub type Faz<const N: usize> = [u8; N];
// @has foo/type.Fiz.html '//pre[@class="rust item-decl"]' \
//@ has foo/type.Fiz.html '//pre[@class="rust item-decl"]' \
// 'type Fiz<const N: usize> = [[u8; N]; 48];'
pub type Fiz<const N: usize> = [[u8; N]; 3 << 4];
@ -91,7 +91,7 @@ macro_rules! define_me {
}
}
// @has foo/struct.Foz.html '//pre[@class="rust item-decl"]' \
//@ has foo/struct.Foz.html '//pre[@class="rust item-decl"]' \
// 'pub struct Foz<const N: usize>(/* private fields */);'
define_me!(Foz<N>);
@ -103,26 +103,26 @@ trait Q {
const ASSOC: usize = N;
}
// @has foo/fn.q_user.html '//pre[@class="rust item-decl"]' \
//@ has foo/fn.q_user.html '//pre[@class="rust item-decl"]' \
// 'pub fn q_user() -> [u8; 13]'
pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {
[0; <[u8; 13] as Q>::ASSOC]
}
// @has foo/union.Union.html '//pre[@class="rust item-decl"]' \
//@ has foo/union.Union.html '//pre[@class="rust item-decl"]' \
// 'pub union Union<const N: usize>'
pub union Union<const N: usize> {
// @has - //pre "pub arr: [u8; N]"
//@ has - //pre "pub arr: [u8; N]"
pub arr: [u8; N],
// @has - //pre "pub another_arr: [(); N]"
//@ has - //pre "pub another_arr: [(); N]"
pub another_arr: [(); N],
}
// @has foo/enum.Enum.html '//pre[@class="rust item-decl"]' \
//@ has foo/enum.Enum.html '//pre[@class="rust item-decl"]' \
// 'pub enum Enum<const N: usize>'
pub enum Enum<const N: usize> {
// @has - //pre "Variant([u8; N])"
//@ has - //pre "Variant([u8; N])"
Variant([u8; N]),
// @has - //pre "EmptyVariant"
//@ has - //pre "EmptyVariant"
EmptyVariant,
}

View file

@ -10,21 +10,21 @@ pub enum Order {
Unsorted,
}
// @has foo/struct.VSet.html '//pre[@class="rust item-decl"]' 'pub struct VSet<T, const ORDER: Order>'
// @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT,+ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
// @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT,+ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
//@ has foo/struct.VSet.html '//pre[@class="rust item-decl"]' 'pub struct VSet<T, const ORDER: Order>'
//@ has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT,+ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
//@ has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT,+ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
pub struct VSet<T, const ORDER: Order> {
inner: Vec<T>,
}
// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Sorted+%7D%3E"]/h3[@class="code-header"]' 'impl<T> VSet<T, { Order::Sorted }>'
//@ has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Sorted+%7D%3E"]/h3[@class="code-header"]' 'impl<T> VSet<T, { Order::Sorted }>'
impl<T> VSet<T, { Order::Sorted }> {
pub fn new() -> Self {
Self { inner: Vec::new() }
}
}
// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Unsorted+%7D%3E"]/h3[@class="code-header"]' 'impl<T> VSet<T, { Order::Unsorted }>'
//@ has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Unsorted+%7D%3E"]/h3[@class="code-header"]' 'impl<T> VSet<T, { Order::Unsorted }>'
impl<T> VSet<T, { Order::Unsorted }> {
pub fn new() -> Self {
Self { inner: Vec::new() }
@ -33,7 +33,7 @@ pub fn new() -> Self {
pub struct Escape<const S: &'static str>;
// @has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
//@ has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
impl Escape<r#"<script>alert("Escape");</script>"#> {
pub fn f() {}
}

View file

@ -2,6 +2,6 @@
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
// make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647
// @has foo/struct.Ice.html '//pre[@class="rust item-decl"]' \
//@ has foo/struct.Ice.html '//pre[@class="rust item-decl"]' \
// 'pub struct Ice<const N: usize> where [(); { _ }]:;'
pub struct Ice<const N: usize> where [(); N + 1]:;

View file

@ -11,8 +11,8 @@ pub struct Hasher<T> {
unsafe impl<T: Default> Send for Hasher<T> {}
// @has foo/struct.Foo.html
// @has - '//h3[@class="code-header"]' 'impl Send for Foo'
//@ has foo/struct.Foo.html
//@ has - '//h3[@class="code-header"]' 'impl Send for Foo'
pub struct Foo {
hasher: Hasher<[u8; 3]>,
}

View file

@ -1,4 +1,4 @@
#![crate_name = "foo"]
// @has foo/type.CellIndex.html '//pre[@class="rust item-decl"]' 'type CellIndex<const D: usize> = [i64; D];'
//@ has foo/type.CellIndex.html '//pre[@class="rust item-decl"]' 'type CellIndex<const D: usize> = [i64; D];'
pub type CellIndex<const D: usize> = [i64; D];

View file

@ -5,21 +5,21 @@
#![stable(since="1.0.0", feature="rust1")]
extern "rust-intrinsic" {
// @has 'foo/fn.transmute.html'
// @has - '//pre[@class="rust item-decl"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U'
//@ has 'foo/fn.transmute.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U'
#[stable(since="1.0.0", feature="rust1")]
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
pub fn transmute<T, U>(_: T) -> U;
// @has 'foo/fn.unreachable.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !'
//@ has 'foo/fn.unreachable.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !'
#[stable(since="1.0.0", feature="rust1")]
pub fn unreachable() -> !;
}
extern "C" {
// @has 'foo/fn.needs_drop.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn needs_drop() -> !'
//@ has 'foo/fn.needs_drop.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn needs_drop() -> !'
#[stable(since="1.0.0", feature="rust1")]
pub fn needs_drop() -> !;
}

View file

@ -8,42 +8,42 @@ macro_rules! make {
($n:expr) => {
pub struct S;
// @has issue_33302/constant.CST.html \
//@ has issue_33302/constant.CST.html \
// '//pre[@class="rust item-decl"]' 'pub const CST: i32'
pub const CST: i32 = ($n * $n);
// @has issue_33302/static.ST.html \
//@ has issue_33302/static.ST.html \
// '//pre[@class="rust item-decl"]' 'pub static ST: i32'
pub static ST: i32 = ($n * $n);
pub trait T<X> {
fn ignore(_: &X) {}
const C: X;
// @has issue_33302/trait.T.html \
//@ has issue_33302/trait.T.html \
// '//pre[@class="rust item-decl"]' 'const D: i32'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
//@ has - '//*[@id="associatedconstant.D"]' 'const D: i32'
const D: i32 = ($n * $n);
}
// @has issue_33302/struct.S.html \
//@ has issue_33302/struct.S.html \
// '//*[@class="impl"]' 'impl T<[i32; 16]> for S'
// @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
//@ has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
//@ has - '//*[@id="associatedconstant.D"]' 'const D: i32'
impl T<[i32; ($n * $n)]> for S {
const C: [i32; ($n * $n)] = [0; ($n * $n)];
}
// @has issue_33302/struct.S.html \
//@ has issue_33302/struct.S.html \
// '//*[@class="impl"]' 'impl T<[i32; 16]> for S'
// @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)'
// @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32'
//@ has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)'
//@ has - '//*[@id="associatedconstant.D-1"]' 'const D: i32'
impl T<(i32,)> for S {
const C: (i32,) = ($n,);
}
// @has issue_33302/struct.S.html \
//@ has issue_33302/struct.S.html \
// '//*[@class="impl"]' 'impl T<(i32, i32)> for S'
// @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
// @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
//@ has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
//@ has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
impl T<(i32, i32)> for S {
const C: (i32, i32) = ($n, $n);
const D: i32 = ($n / $n);

View file

@ -1,6 +1,6 @@
//@ compile-flags: --document-private-items
// @!has const_underscore/constant._.html
//@ !has const_underscore/constant._.html
const _: () = {
#[no_mangle]
extern "C" fn implementation_detail() {}

View file

@ -1,9 +1,9 @@
#![crate_name = "foo"]
// @has 'foo/constant.HOUR_IN_SECONDS.html'
// @has - '//*[@class="rust item-decl"]//code' 'pub const HOUR_IN_SECONDS: u64 = _; // 3_600u64'
//@ has 'foo/constant.HOUR_IN_SECONDS.html'
//@ has - '//*[@class="rust item-decl"]//code' 'pub const HOUR_IN_SECONDS: u64 = _; // 3_600u64'
pub const HOUR_IN_SECONDS: u64 = 60 * 60;
// @has 'foo/constant.NEGATIVE.html'
// @has - '//*[@class="rust item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64'
//@ has 'foo/constant.NEGATIVE.html'
//@ has - '//*[@class="rust item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64'
pub const NEGATIVE: i64 = -60 * 60;

View file

@ -3,7 +3,7 @@
pub struct Foo;
impl Foo {
// @has const/struct.Foo.html '//*[@id="method.new"]//h4[@class="code-header"]' 'const unsafe fn new'
//@ has const/struct.Foo.html '//*[@id="method.new"]//h4[@class="code-header"]' 'const unsafe fn new'
pub const unsafe fn new() -> Foo {
Foo
}

View file

@ -7,9 +7,9 @@ pub enum Bar {
}
}
// @count 'foo/index.html' '//*[code="pub use a::Foo;"]' 1
//@ count 'foo/index.html' '//*[code="pub use a::Foo;"]' 1
#[doc(no_inline)]
pub use a::Foo;
// @count 'foo/index.html' '//*[code="pub use a::Bar::Baz;"]' 1
//@ count 'foo/index.html' '//*[code="pub use a::Bar::Baz;"]' 1
#[doc(no_inline)]
pub use a::Bar::Baz;

View file

@ -2,4 +2,4 @@
#![crate_name = "foo"]
// @has 'foo/index.html' '//*[@class="version"]' '<script>alert("hi")</script>'
//@ has 'foo/index.html' '//*[@class="version"]' '<script>alert("hi")</script>'

View file

@ -3,5 +3,5 @@
#![crate_name="foo"]
// main version next to logo, extra version data below it
// @has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly'
// @has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)'
//@ has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly'
//@ has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)'

View file

@ -1,3 +1,3 @@
//@ compile-flags: --crate-version=1.3.37
// @has 'crate_version/index.html' '//*[@class="version"]' '1.3.37'
//@ has 'crate_version/index.html' '//*[@class="version"]' '1.3.37'

View file

@ -10,14 +10,14 @@
// visible items instead and assert that there are *exactly two* associated items
// (by counting the number of `section`s). This is more robust and future-proof.
// @has dependent/struct.Ty.html
// @has - '//*[@id="associatedtype.VisibleAssoc"]' 'type VisibleAssoc = ()'
// @has - '//*[@id="associatedconstant.VISIBLE_ASSOC"]' 'const VISIBLE_ASSOC: ()'
// @count - '//*[@class="impl-items"]/section' 2
//@ has dependent/struct.Ty.html
//@ has - '//*[@id="associatedtype.VisibleAssoc"]' 'type VisibleAssoc = ()'
//@ has - '//*[@id="associatedconstant.VISIBLE_ASSOC"]' 'const VISIBLE_ASSOC: ()'
//@ count - '//*[@class="impl-items"]/section' 2
// @has dependent/trait.Tr.html
// @has - '//*[@id="associatedtype.VisibleAssoc-1"]' 'type VisibleAssoc = ()'
// @has - '//*[@id="associatedconstant.VISIBLE_ASSOC-1"]' 'const VISIBLE_ASSOC: ()'
// @count - '//*[@class="impl-items"]/section' 2
//@ has dependent/trait.Tr.html
//@ has - '//*[@id="associatedtype.VisibleAssoc-1"]' 'type VisibleAssoc = ()'
//@ has - '//*[@id="associatedconstant.VISIBLE_ASSOC-1"]' 'const VISIBLE_ASSOC: ()'
//@ count - '//*[@class="impl-items"]/section' 2
pub use dependency::{Tr, Ty};

View file

@ -8,7 +8,7 @@
pub enum MyLibType {}
// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CHiddenType%3E"]' 'impl From<HiddenType> for MyLibType'
//@ !has foo/enum.MyLibType.html '//*[@id="impl-From%3CHiddenType%3E"]' 'impl From<HiddenType> for MyLibType'
impl From<HiddenType> for MyLibType {
fn from(it: HiddenType) -> MyLibType {
match it {}
@ -17,17 +17,17 @@ fn from(it: HiddenType) -> MyLibType {
pub struct T<T>(T);
// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CT%3CT%3CT%3CT%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<T<T<T<T<HiddenType>>>>> for MyLibType'
//@ !has foo/enum.MyLibType.html '//*[@id="impl-From%3CT%3CT%3CT%3CT%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<T<T<T<T<HiddenType>>>>> for MyLibType'
impl From<T<T<T<T<HiddenType>>>>> for MyLibType {
fn from(it: T<T<T<T<HiddenType>>>>) -> MyLibType {
todo!()
}
}
// @!has foo/enum.MyLibType.html '//*[@id="impl-HiddenTrait"]' 'impl HiddenTrait for MyLibType'
//@ !has foo/enum.MyLibType.html '//*[@id="impl-HiddenTrait"]' 'impl HiddenTrait for MyLibType'
impl HiddenTrait for MyLibType {}
// @!has foo/struct.T.html '//*[@id="impl-From%3CMyLibType%3E"]' 'impl From<MyLibType> for T<T<T<T<HiddenType>>>>'
//@ !has foo/struct.T.html '//*[@id="impl-From%3CMyLibType%3E"]' 'impl From<MyLibType> for T<T<T<T<HiddenType>>>>'
impl From<MyLibType> for T<T<T<T<HiddenType>>>> {
fn from(it: MyLibType) -> T<T<T<T<HiddenType>>>> {
match it {}

View file

@ -6,54 +6,54 @@
#[macro_use]
extern crate all_item_types;
// @has 'foo/index.html' '//a[@href="../all_item_types/foo_mod/index.html"]' 'foo_mod'
//@ has 'foo/index.html' '//a[@href="../all_item_types/foo_mod/index.html"]' 'foo_mod'
#[doc(no_inline)]
pub use all_item_types::foo_mod;
// @has 'foo/index.html' '//a[@href="../all_item_types/fn.foo_ffn.html"]' 'foo_ffn'
//@ has 'foo/index.html' '//a[@href="../all_item_types/fn.foo_ffn.html"]' 'foo_ffn'
#[doc(no_inline)]
pub use all_item_types::foo_ffn;
// @has 'foo/index.html' '//a[@href="../all_item_types/static.FOO_FSTATIC.html"]' 'FOO_FSTATIC'
//@ has 'foo/index.html' '//a[@href="../all_item_types/static.FOO_FSTATIC.html"]' 'FOO_FSTATIC'
#[doc(no_inline)]
pub use all_item_types::FOO_FSTATIC;
// @has 'foo/index.html' '//a[@href="../all_item_types/foreigntype.FooFType.html"]' 'FooFType'
//@ has 'foo/index.html' '//a[@href="../all_item_types/foreigntype.FooFType.html"]' 'FooFType'
#[doc(no_inline)]
pub use all_item_types::FooFType;
// @has 'foo/index.html' '//a[@href="../all_item_types/fn.foo_fn.html"]' 'foo_fn'
//@ has 'foo/index.html' '//a[@href="../all_item_types/fn.foo_fn.html"]' 'foo_fn'
#[doc(no_inline)]
pub use all_item_types::foo_fn;
// @has 'foo/index.html' '//a[@href="../all_item_types/trait.FooTrait.html"]' 'FooTrait'
//@ has 'foo/index.html' '//a[@href="../all_item_types/trait.FooTrait.html"]' 'FooTrait'
#[doc(no_inline)]
pub use all_item_types::FooTrait;
// @has 'foo/index.html' '//a[@href="../all_item_types/struct.FooStruct.html"]' 'FooStruct'
//@ has 'foo/index.html' '//a[@href="../all_item_types/struct.FooStruct.html"]' 'FooStruct'
#[doc(no_inline)]
pub use all_item_types::FooStruct;
// @has 'foo/index.html' '//a[@href="../all_item_types/enum.FooEnum.html"]' 'FooEnum'
//@ has 'foo/index.html' '//a[@href="../all_item_types/enum.FooEnum.html"]' 'FooEnum'
#[doc(no_inline)]
pub use all_item_types::FooEnum;
// @has 'foo/index.html' '//a[@href="../all_item_types/union.FooUnion.html"]' 'FooUnion'
//@ has 'foo/index.html' '//a[@href="../all_item_types/union.FooUnion.html"]' 'FooUnion'
#[doc(no_inline)]
pub use all_item_types::FooUnion;
// @has 'foo/index.html' '//a[@href="../all_item_types/type.FooType.html"]' 'FooType'
//@ has 'foo/index.html' '//a[@href="../all_item_types/type.FooType.html"]' 'FooType'
#[doc(no_inline)]
pub use all_item_types::FooType;
// @has 'foo/index.html' '//a[@href="../all_item_types/static.FOO_STATIC.html"]' 'FOO_STATIC'
//@ has 'foo/index.html' '//a[@href="../all_item_types/static.FOO_STATIC.html"]' 'FOO_STATIC'
#[doc(no_inline)]
pub use all_item_types::FOO_STATIC;
// @has 'foo/index.html' '//a[@href="../all_item_types/constant.FOO_CONSTANT.html"]' 'FOO_CONSTANT'
//@ has 'foo/index.html' '//a[@href="../all_item_types/constant.FOO_CONSTANT.html"]' 'FOO_CONSTANT'
#[doc(no_inline)]
pub use all_item_types::FOO_CONSTANT;
// @has 'foo/index.html' '//a[@href="../all_item_types/macro.foo_macro.html"]' 'foo_macro'
//@ has 'foo/index.html' '//a[@href="../all_item_types/macro.foo_macro.html"]' 'foo_macro'
#[doc(no_inline)]
pub use all_item_types::foo_macro;

View file

@ -7,7 +7,7 @@
extern crate primitive_doc;
// @has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'usize'
// @has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'link'
//@ has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'usize'
//@ has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'link'
/// [link](usize)
pub fn foo() -> usize { 0 }

View file

@ -4,10 +4,10 @@
#![feature(no_core)]
#![no_core]
// @has 'foo/struct.Bar.html'
// @has - '//*[@id="main-content"]//pre[@class="language-whatever hoho-c"]' 'main;'
// @has - '//*[@id="main-content"]//pre[@class="language-whatever2 haha-c"]' 'main;'
// @has - '//*[@id="main-content"]//pre[@class="language-whatever4 huhu-c"]' 'main;'
//@ has 'foo/struct.Bar.html'
//@ has - '//*[@id="main-content"]//pre[@class="language-whatever hoho-c"]' 'main;'
//@ has - '//*[@id="main-content"]//pre[@class="language-whatever2 haha-c"]' 'main;'
//@ has - '//*[@id="main-content"]//pre[@class="language-whatever4 huhu-c"]' 'main;'
/// ```{class=hoho-c},whatever
/// main;

View file

@ -5,8 +5,8 @@
pub struct Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000;
// @has 'decl_line_wrapping_empty_arg_list/fn.create.html'
// @snapshot decl - '//pre[@class="rust item-decl"]'
//@ has 'decl_line_wrapping_empty_arg_list/fn.create.html'
//@ snapshot decl - '//pre[@class="rust item-decl"]'
pub fn create() -> Padding00000000000000000000000000000000000000000000000000000000000000000000000000000000 {
loop {}
}

View file

@ -4,10 +4,10 @@
pub struct Error;
// @has 'foo/trait.Write.html'
//@ has 'foo/trait.Write.html'
pub trait Write {
// @snapshot 'declaration' - '//*[@class="rust item-decl"]//code'
//@ snapshot 'declaration' - '//*[@class="rust item-decl"]//code'
fn poll_write(
self,
cx: &mut Option<String>,

View file

@ -2,25 +2,25 @@
#![feature(decl_macro)]
// @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
// @has - //pre '...'
// @has - //pre '}'
//@ has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
//@ has - //pre '...'
//@ has - //pre '}'
pub macro my_macro() {
}
// @has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
// @has - //pre '...'
// @has - //pre '}'
//@ has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
//@ has - //pre '...'
//@ has - //pre '}'
pub macro my_macro_2($($tok:tt)*) {
}
// @has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {'
// @has - //pre '(_) => { ... },'
// @has - //pre '($foo:ident . $bar:expr) => { ... },'
// @has - //pre '($($foo:literal),+) => { ... },'
// @has - //pre '}'
//@ has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {'
//@ has - //pre '(_) => { ... },'
//@ has - //pre '($foo:ident . $bar:expr) => { ... },'
//@ has - //pre '($($foo:literal),+) => { ... },'
//@ has - //pre '}'
pub macro my_macro_multi {
(_) => {
@ -33,21 +33,21 @@
}
}
// @has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {'
// @has - //pre '...'
// @has - //pre '}'
//@ has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {'
//@ has - //pre '...'
//@ has - //pre '}'
pub macro by_example_single {
($foo:expr) => {}
}
mod a {
mod b {
// @has decl_macro/a/b/macro.by_example_vis.html //pre 'pub(super) macro by_example_vis($foo:expr) {'
//@ has decl_macro/a/b/macro.by_example_vis.html //pre 'pub(super) macro by_example_vis($foo:expr) {'
pub(in super) macro by_example_vis {
($foo:expr) => {}
}
mod c {
// @has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {'
//@ has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {'
pub(in a) macro by_example_vis_named {
($foo:expr) => {}
}

View file

@ -2,13 +2,13 @@
#![feature(decl_macro)]
// @has decl_macro_priv/macro.crate_macro.html //pre 'pub(crate) macro crate_macro() {'
// @has - //pre '...'
// @has - //pre '}'
//@ has decl_macro_priv/macro.crate_macro.html //pre 'pub(crate) macro crate_macro() {'
//@ has - //pre '...'
//@ has - //pre '}'
pub(crate) macro crate_macro() {}
// @has decl_macro_priv/macro.priv_macro.html //pre 'macro priv_macro() {'
// @!has - //pre 'pub macro priv_macro() {'
// @has - //pre '...'
// @has - //pre '}'
//@ has decl_macro_priv/macro.priv_macro.html //pre 'macro priv_macro() {'
//@ !has - //pre 'pub macro priv_macro() {'
//@ has - //pre '...'
//@ has - //pre '}'
macro priv_macro() {}

View file

@ -9,6 +9,6 @@ impl super::Blah for super::What { }
pub trait Blah { }
// @count issue_21474/struct.What.html \
//@ count issue_21474/struct.What.html \
// '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1
pub struct What;

View file

@ -1,7 +1,7 @@
//@ compile-flags: --default-theme ayu
// @has default_theme/index.html
// @has - '//script[@id="default-settings"]/@data-theme' 'ayu'
// @has - '//script[@id="default-settings"]/@data-use_system_theme' 'false'
//@ has default_theme/index.html
//@ has - '//script[@id="default-settings"]/@data-theme' 'ayu'
//@ has - '//script[@id="default-settings"]/@data-use_system_theme' 'false'
pub fn whatever() {}

View file

@ -1,7 +1,7 @@
#![crate_name = "foo"]
// @has foo/trait.Foo.html '//a[@href="trait.Foo.html#tymethod.req"]' 'req'
// @has foo/trait.Foo.html '//a[@href="trait.Foo.html#method.prov"]' 'prov'
//@ has foo/trait.Foo.html '//a[@href="trait.Foo.html#tymethod.req"]' 'req'
//@ has foo/trait.Foo.html '//a[@href="trait.Foo.html#method.prov"]' 'prov'
/// Always make sure to implement [`req`], but you don't have to implement [`prov`].
///

View file

@ -1,45 +1,45 @@
#![feature(min_specialization)]
// @has default_trait_method/trait.Item.html
//@ has default_trait_method/trait.Item.html
pub trait Item {
// @has - '//*[@id="tymethod.foo"]' 'fn foo()'
// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
//@ has - '//*[@id="tymethod.foo"]' 'fn foo()'
//@ !has - '//*[@id="tymethod.foo"]' 'default fn foo()'
fn foo();
// @has - '//*[@id="tymethod.bar"]' 'fn bar()'
// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
//@ has - '//*[@id="tymethod.bar"]' 'fn bar()'
//@ !has - '//*[@id="tymethod.bar"]' 'default fn bar()'
fn bar();
// @has - '//*[@id="tymethod.baz"]' 'unsafe fn baz()'
// @!has - '//*[@id="tymethod.baz"]' 'default unsafe fn baz()'
//@ has - '//*[@id="tymethod.baz"]' 'unsafe fn baz()'
//@ !has - '//*[@id="tymethod.baz"]' 'default unsafe fn baz()'
unsafe fn baz();
// @has - '//*[@id="tymethod.quux"]' 'unsafe fn quux()'
// @!has - '//*[@id="tymethod.quux"]' 'default unsafe fn quux()'
//@ has - '//*[@id="tymethod.quux"]' 'unsafe fn quux()'
//@ !has - '//*[@id="tymethod.quux"]' 'default unsafe fn quux()'
unsafe fn quux();
// @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
// @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
//@ has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
//@ !has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
fn xyzzy() {}
}
// @has default_trait_method/struct.Foo.html
//@ has default_trait_method/struct.Foo.html
pub struct Foo;
impl Item for Foo {
// @has - '//*[@id="method.foo"]' 'default fn foo()'
//@ has - '//*[@id="method.foo"]' 'default fn foo()'
default fn foo() {}
// @has - '//*[@id="method.bar"]' 'fn bar()'
// @!has - '//*[@id="method.bar"]' 'default fn bar()'
//@ has - '//*[@id="method.bar"]' 'fn bar()'
//@ !has - '//*[@id="method.bar"]' 'default fn bar()'
fn bar() {}
// @has - '//*[@id="method.baz"]' 'default unsafe fn baz()'
//@ has - '//*[@id="method.baz"]' 'default unsafe fn baz()'
default unsafe fn baz() {}
// @has - '//*[@id="method.quux"]' 'unsafe fn quux()'
// @!has - '//*[@id="method.quux"]' 'default unsafe fn quux()'
//@ has - '//*[@id="method.quux"]' 'unsafe fn quux()'
//@ !has - '//*[@id="method.quux"]' 'default unsafe fn quux()'
unsafe fn quux() {}
// @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
// @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
//@ has - '//*[@id="method.xyzzy"]' 'fn xyzzy()'
//@ !has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()'
}

View file

@ -1,17 +1,17 @@
#![feature(staged_api)]
#![stable(feature = "deprecated_future_staged_api", since = "1.0.0")]
// @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
// 'Deprecation planned'
// @has deprecated_future_staged_api/struct.S1.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future_staged_api/struct.S1.html '//*[@class="stab deprecated"]' \
// 'Deprecating in 99.99.99: effectively never'
#[deprecated(since = "99.99.99", note = "effectively never")]
#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")]
pub struct S1;
// @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
// 'Deprecation planned'
// @has deprecated_future_staged_api/struct.S2.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future_staged_api/struct.S2.html '//*[@class="stab deprecated"]' \
// 'Deprecating in a future version: literally never'
#[deprecated(since = "TBD", note = "literally never")]
#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")]

View file

@ -1,6 +1,6 @@
// @has deprecated_future/index.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future/index.html '//*[@class="stab deprecated"]' \
// 'Deprecated'
// @has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
//@ has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
// 'Deprecated since 99.99.99: effectively never'
#[deprecated(since = "99.99.99", note = "effectively never")]
pub struct S;

View file

@ -1,19 +1,19 @@
#![crate_name = "foo"]
// @has foo/struct.Foo0.html
//@ has foo/struct.Foo0.html
pub struct Foo0;
impl Foo0 {
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc'
// @hasraw - 'fn_with_doc short'
// @hasraw - 'fn_with_doc full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc'
//@ hasraw - 'fn_with_doc short'
//@ hasraw - 'fn_with_doc full'
/// fn_with_doc short
///
/// fn_with_doc full
#[deprecated(since = "1.0.1", note = "fn_with_doc")]
pub fn fn_with_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.2: fn_without_doc'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.2: fn_without_doc'
#[deprecated(since = "1.0.2", note = "fn_without_doc")]
pub fn fn_without_doc() {}
}
@ -47,72 +47,72 @@ fn fn_def_def_with_doc() {}
fn fn_def_def_without_doc() {}
}
// @has foo/struct.Foo1.html
//@ has foo/struct.Foo1.html
pub struct Foo1;
impl Bar for Foo1 {
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc'
// @hasraw - 'fn_empty_with_doc_impl short'
// @hasraw - 'fn_empty_with_doc_impl full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc'
//@ 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
fn fn_empty_with_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc'
fn fn_empty_without_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
// @hasraw - 'fn_def_with_doc_impl short'
// @hasraw - 'fn_def_with_doc_impl full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
//@ 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
fn fn_def_with_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
fn fn_def_without_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc'
// @hasraw - 'fn_def_def_with_doc short'
// @!hasraw - 'fn_def_def_with_doc full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc'
//@ hasraw - 'fn_def_def_with_doc short'
//@ !hasraw - 'fn_def_def_with_doc full'
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'
}
// @has foo/struct.Foo2.html
//@ has foo/struct.Foo2.html
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'
// @!hasraw - 'fn_empty_with_doc full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc'
//@ hasraw - 'fn_empty_with_doc short'
//@ !hasraw - 'fn_empty_with_doc full'
fn fn_empty_with_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc'
// @hasraw - 'fn_empty_without_doc_impl short'
// @hasraw - 'fn_empty_without_doc_impl full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc'
//@ 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'
// @hasraw - 'fn_def_with_doc short'
// @!hasraw - 'fn_def_with_doc full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
//@ hasraw - 'fn_def_with_doc short'
//@ !hasraw - 'fn_def_with_doc full'
fn fn_def_with_doc() {}
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
// @hasraw - 'fn_def_without_doc_impl short'
// @hasraw - 'fn_def_without_doc_impl full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
//@ 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'
// @hasraw - 'fn_def_def_with_doc short'
// @!hasraw - 'fn_def_def_with_doc full'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc'
//@ hasraw - 'fn_def_def_with_doc short'
//@ !hasraw - 'fn_def_def_with_doc full'
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'
//@ has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'
}

View file

@ -1,33 +1,33 @@
// @has deprecated/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
//@ has deprecated/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
// 'Deprecated'
// @has - '//*[@class="desc docblock-short"]' 'Deprecated docs'
//@ has - '//*[@class="desc docblock-short"]' 'Deprecated docs'
// @has deprecated/struct.S.html '//*[@class="stab deprecated"]' \
//@ has deprecated/struct.S.html '//*[@class="stab deprecated"]' \
// 'Deprecated since 1.0.0: text'
/// Deprecated docs
#[deprecated(since = "1.0.0", note = "text")]
pub struct S;
// @matches deprecated/index.html '//*[@class="desc docblock-short"]' '^Docs'
//@ matches deprecated/index.html '//*[@class="desc docblock-short"]' '^Docs'
/// Docs
pub struct T;
// @matches deprecated/struct.U.html '//*[@class="stab deprecated"]' \
//@ matches deprecated/struct.U.html '//*[@class="stab deprecated"]' \
// 'Deprecated since 1.0.0$'
#[deprecated(since = "1.0.0")]
pub struct U;
// @matches deprecated/struct.V.html '//*[@class="stab deprecated"]' \
//@ matches deprecated/struct.V.html '//*[@class="stab deprecated"]' \
// 'Deprecated: text$'
#[deprecated(note = "text")]
pub struct V;
// @matches deprecated/struct.W.html '//*[@class="stab deprecated"]' \
//@ matches deprecated/struct.W.html '//*[@class="stab deprecated"]' \
// 'Deprecated$'
#[deprecated]
pub struct W;
// @matches deprecated/struct.X.html '//*[@class="stab deprecated"]' \
//@ matches deprecated/struct.X.html '//*[@class="stab deprecated"]' \
// 'Deprecated: shorthand reason: code$'
#[deprecated = "shorthand reason: `code`"]
pub struct X;

View file

@ -11,6 +11,6 @@ impl Deref for Bar {
fn deref(&self) -> &String { loop {} }
}
// @has issue_19190_2/struct.Bar.html
// @!has - '//*[@id="method.new"]' 'fn new() -> String'
// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str'
//@ has issue_19190_2/struct.Bar.html
//@ !has - '//*[@id="method.new"]' 'fn new() -> String'
//@ has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str'

View file

@ -9,19 +9,19 @@
use std::ops::Deref;
use issue_19190_3::Baz;
// @has issue_19190_3/struct.Foo.html
// @has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str'
// @!has - '//*[@id="method.new"]' 'fn new() -> String'
//@ has issue_19190_3/struct.Foo.html
//@ has - '//*[@id="method.as_str"]' 'fn as_str(&self) -> &str'
//@ !has - '//*[@id="method.new"]' 'fn new() -> String'
pub use issue_19190_3::Foo;
// @has issue_19190_3/struct.Bar.html
// @has - '//*[@id="method.baz"]' 'fn baz(&self)'
// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()'
//@ has issue_19190_3/struct.Bar.html
//@ has - '//*[@id="method.baz"]' 'fn baz(&self)'
//@ !has - '//*[@id="method.static_baz"]' 'fn static_baz()'
pub use issue_19190_3::Bar;
// @has issue_19190_3/struct.MyBar.html
// @has - '//*[@id="method.baz"]' 'fn baz(&self)'
// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()'
//@ has issue_19190_3/struct.MyBar.html
//@ has - '//*[@id="method.baz"]' 'fn baz(&self)'
//@ !has - '//*[@id="method.static_baz"]' 'fn static_baz()'
pub struct MyBar;
impl Deref for MyBar {

View file

@ -16,8 +16,8 @@ impl Deref for Bar {
fn deref(&self) -> &Foo { loop {} }
}
// @has issue_19190/struct.Bar.html
// @has - '//*[@id="method.foo"]//h4[@class="code-header"]' 'fn foo(&self)'
// @has - '//*[@id="method.foo"]' 'fn foo(&self)'
// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
//@ has issue_19190/struct.Bar.html
//@ has - '//*[@id="method.foo"]//h4[@class="code-header"]' 'fn foo(&self)'
//@ has - '//*[@id="method.foo"]' 'fn foo(&self)'
//@ !has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
//@ !has - '//*[@id="method.static_foo"]' 'fn static_foo()'

View file

@ -26,18 +26,18 @@ impl DerefMut for Bar {
fn deref_mut(&mut self) -> &mut Foo { loop {} }
}
// @has foo/struct.Bar.html
// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
// @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
// @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
// @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
//@ has foo/struct.Bar.html
//@ has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
//@ has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
//@ has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
//@ has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
//@ has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
//@ has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
//@ has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
//@ has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
//@ !has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
//@ !has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
//@ !has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
//@ !has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
//@ !has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
//@ !has - '//*[@id="method.static_foo"]' 'fn static_foo()'

View file

@ -21,18 +21,18 @@ impl Deref for Bar {
fn deref(&self) -> &Foo { loop {} }
}
// @has foo/struct.Bar.html
// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
// @!has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
//@ has foo/struct.Bar.html
//@ has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
//@ has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
//@ has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
//@ has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
//@ !has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
//@ !has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
//@ !has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
//@ !has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
//@ !has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
//@ !has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
//@ !has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
//@ !has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
//@ !has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
//@ !has - '//*[@id="method.static_foo"]' 'fn static_foo()'

View file

@ -7,13 +7,13 @@
#![stable(feature = "rust1", since = "1.0.0")]
// @has 'foo/struct.Bar.html'
//@ has 'foo/struct.Bar.html'
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Bar;
impl Bar {
// @has - '//*[@id="method.len"]' 'pub const fn len(&self) -> usize'
// @has - '//*[@id="method.len"]//span[@class="since"]' 'const: 1.0.0'
//@ has - '//*[@id="method.len"]' 'pub const fn len(&self) -> usize'
//@ has - '//*[@id="method.len"]//span[@class="since"]' 'const: 1.0.0'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
pub const fn len(&self) -> usize { 0 }
@ -24,10 +24,10 @@ pub struct Foo {
value: Bar,
}
// @has 'foo/struct.Foo.html'
// @has - '//*[@id="method.len"]' 'pub fn len(&self) -> usize'
// @has - '//*[@id="method.len"]//span[@class="since"]' '1.0.0'
// @!has - '//*[@id="method.len"]//span[@class="since"]' '(const: 1.0.0)'
//@ has 'foo/struct.Foo.html'
//@ has - '//*[@id="method.len"]' 'pub fn len(&self) -> usize'
//@ has - '//*[@id="method.len"]//span[@class="since"]' '1.0.0'
//@ !has - '//*[@id="method.len"]//span[@class="since"]' '(const: 1.0.0)'
#[stable(feature = "rust1", since = "1.0.0")]
impl std::ops::Deref for Foo {
type Target = Bar;

Some files were not shown because too many files have changed in this diff Show more