mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Auto merge of #108450 - matthiaskrgr:rollup-rqvfgu3, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #108354 (Update `fuchsia-test-runner.py` and docs) - #108404 (support `x fmt` for sub and outside of rust directories) - #108407 (docs: use intra-doc links for `Vec::get(_mut)`) - #108410 (rustdoc: avoid including `<li>` tags in item table short desc) - #108412 (Fix GUI test navigation bug) - #108433 (Wrap missing provider message correctly) - #108434 (Migrate `rustc_hir_analysis` to session diagnostic [Part One]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
31448badfd
@ -132,3 +132,26 @@ hir_analysis_where_clause_on_main = `main` function is not allowed to have a `wh
|
||||
|
||||
hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]`
|
||||
.label = `main` function is not allowed to be `#[track_caller]`
|
||||
|
||||
hir_analysis_start_not_track_caller = `start` is not allowed to be `#[track_caller]`
|
||||
.label = `start` is not allowed to be `#[track_caller]`
|
||||
|
||||
hir_analysis_start_not_async = `start` is not allowed to be `async`
|
||||
.label = `start` is not allowed to be `async`
|
||||
|
||||
hir_analysis_start_function_where = start function is not allowed to have a `where` clause
|
||||
.label = start function cannot have a `where` clause
|
||||
|
||||
hir_analysis_start_function_parameters = start function is not allowed to have type parameters
|
||||
.label = start function cannot have type parameters
|
||||
|
||||
hir_analysis_main_function_return_type_generic = `main` function return type is not allowed to have generic parameters
|
||||
|
||||
hir_analysis_main_function_async = `main` function is not allowed to be `async`
|
||||
.label = `main` function is not allowed to be `async`
|
||||
|
||||
hir_analysis_main_function_generic_parameters = `main` function is not allowed to have generic parameters
|
||||
.label = `main` cannot have generic parameters
|
||||
|
||||
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
|
||||
.label = C-variadic function must have a compatible calling convention
|
||||
|
@ -333,3 +333,70 @@ pub(crate) struct TrackCallerOnMain {
|
||||
#[label]
|
||||
pub annotated: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_not_track_caller)]
|
||||
pub(crate) struct StartTrackCaller {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label]
|
||||
pub start: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_not_async, code = "E0752")]
|
||||
pub(crate) struct StartAsync {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_function_where, code = "E0647")]
|
||||
pub(crate) struct StartFunctionWhere {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_function_parameters, code = "E0132")]
|
||||
pub(crate) struct StartFunctionParameters {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_return_type_generic, code = "E0131")]
|
||||
pub(crate) struct MainFunctionReturnTypeGeneric {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_async, code = "E0752")]
|
||||
pub(crate) struct MainFunctionAsync {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label]
|
||||
pub asyncness: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_generic_parameters, code = "E0131")]
|
||||
pub(crate) struct MainFunctionGenericParameters {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label]
|
||||
pub label_span: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_variadic_function_compatible_convention, code = "E0045")]
|
||||
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub conventions: &'a str,
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ mod outlives;
|
||||
pub mod structured_errors;
|
||||
mod variance;
|
||||
|
||||
use rustc_errors::{struct_span_err, ErrorGuaranteed};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
@ -123,7 +123,6 @@ use bounds::Bounds;
|
||||
fluent_messages! { "../locales/en-US.ftl" }
|
||||
|
||||
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
|
||||
const ERROR_HEAD: &str = "C-variadic function must have a compatible calling convention";
|
||||
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `win64`, `sysv64` or `efiapi`";
|
||||
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
|
||||
const UNSTABLE_EXPLAIN: &str =
|
||||
@ -155,8 +154,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi
|
||||
(true, false) => CONVENTIONS_UNSTABLE,
|
||||
};
|
||||
|
||||
let mut err = struct_span_err!(tcx.sess, span, E0045, "{}, like {}", ERROR_HEAD, conventions);
|
||||
err.span_label(span, ERROR_HEAD).emit();
|
||||
tcx.sess.emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions });
|
||||
}
|
||||
|
||||
fn require_same_types<'tcx>(
|
||||
@ -258,15 +256,10 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||
let main_fn_predicates = tcx.predicates_of(main_def_id);
|
||||
if main_fn_generics.count() != 0 || !main_fnsig.bound_vars().is_empty() {
|
||||
let generics_param_span = main_fn_generics_params_span(tcx, main_def_id);
|
||||
let msg = "`main` function is not allowed to have generic \
|
||||
parameters";
|
||||
let mut diag =
|
||||
struct_span_err!(tcx.sess, generics_param_span.unwrap_or(main_span), E0131, "{}", msg);
|
||||
if let Some(generics_param_span) = generics_param_span {
|
||||
let label = "`main` cannot have generic parameters";
|
||||
diag.span_label(generics_param_span, label);
|
||||
}
|
||||
diag.emit();
|
||||
tcx.sess.emit_err(errors::MainFunctionGenericParameters {
|
||||
span: generics_param_span.unwrap_or(main_span),
|
||||
label_span: generics_param_span,
|
||||
});
|
||||
error = true;
|
||||
} else if !main_fn_predicates.predicates.is_empty() {
|
||||
// generics may bring in implicit predicates, so we skip this check if generics is present.
|
||||
@ -280,17 +273,8 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||
|
||||
let main_asyncness = tcx.asyncness(main_def_id);
|
||||
if let hir::IsAsync::Async = main_asyncness {
|
||||
let mut diag = struct_span_err!(
|
||||
tcx.sess,
|
||||
main_span,
|
||||
E0752,
|
||||
"`main` function is not allowed to be `async`"
|
||||
);
|
||||
let asyncness_span = main_fn_asyncness_span(tcx, main_def_id);
|
||||
if let Some(asyncness_span) = asyncness_span {
|
||||
diag.span_label(asyncness_span, "`main` function is not allowed to be `async`");
|
||||
}
|
||||
diag.emit();
|
||||
tcx.sess.emit_err(errors::MainFunctionAsync { span: main_span, asyncness: asyncness_span });
|
||||
error = true;
|
||||
}
|
||||
|
||||
@ -308,9 +292,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||
let return_ty = main_fnsig.output();
|
||||
let return_ty_span = main_fn_return_type_span(tcx, main_def_id).unwrap_or(main_span);
|
||||
if !return_ty.bound_vars().is_empty() {
|
||||
let msg = "`main` function return type is not allowed to have generic \
|
||||
parameters";
|
||||
struct_span_err!(tcx.sess, return_ty_span, E0131, "{}", msg).emit();
|
||||
tcx.sess.emit_err(errors::MainFunctionReturnTypeGeneric { span: return_ty_span });
|
||||
error = true;
|
||||
}
|
||||
let return_ty = return_ty.skip_binder();
|
||||
@ -367,56 +349,28 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
|
||||
if let hir::ItemKind::Fn(sig, generics, _) = &it.kind {
|
||||
let mut error = false;
|
||||
if !generics.params.is_empty() {
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
generics.span,
|
||||
E0132,
|
||||
"start function is not allowed to have type parameters"
|
||||
)
|
||||
.span_label(generics.span, "start function cannot have type parameters")
|
||||
.emit();
|
||||
tcx.sess.emit_err(errors::StartFunctionParameters { span: generics.span });
|
||||
error = true;
|
||||
}
|
||||
if generics.has_where_clause_predicates {
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
generics.where_clause_span,
|
||||
E0647,
|
||||
"start function is not allowed to have a `where` clause"
|
||||
)
|
||||
.span_label(
|
||||
generics.where_clause_span,
|
||||
"start function cannot have a `where` clause",
|
||||
)
|
||||
.emit();
|
||||
tcx.sess.emit_err(errors::StartFunctionWhere {
|
||||
span: generics.where_clause_span,
|
||||
});
|
||||
error = true;
|
||||
}
|
||||
if let hir::IsAsync::Async = sig.header.asyncness {
|
||||
let span = tcx.def_span(it.owner_id);
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
span,
|
||||
E0752,
|
||||
"`start` is not allowed to be `async`"
|
||||
)
|
||||
.span_label(span, "`start` is not allowed to be `async`")
|
||||
.emit();
|
||||
tcx.sess.emit_err(errors::StartAsync { span: span });
|
||||
error = true;
|
||||
}
|
||||
|
||||
let attrs = tcx.hir().attrs(start_id);
|
||||
for attr in attrs {
|
||||
if attr.has_name(sym::track_caller) {
|
||||
tcx.sess
|
||||
.struct_span_err(
|
||||
attr.span,
|
||||
"`start` is not allowed to be `#[track_caller]`",
|
||||
)
|
||||
.span_label(
|
||||
start_span,
|
||||
"`start` is not allowed to be `#[track_caller]`",
|
||||
)
|
||||
.emit();
|
||||
tcx.sess.emit_err(errors::StartTrackCaller {
|
||||
span: attr.span,
|
||||
start: start_span,
|
||||
});
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -328,8 +328,9 @@ macro_rules! define_callbacks {
|
||||
|
||||
Providers {
|
||||
$($name: |_, key| bug!(
|
||||
"`tcx.{}({:?})` is not supported for {} crate;\n
|
||||
hint: Queries can be either made to the local crate, or the external crate. This error means you tried to use it for one that's not supported.\n
|
||||
"`tcx.{}({:?})` is not supported for {} crate;\n\
|
||||
hint: Queries can be either made to the local crate, or the external crate. \
|
||||
This error means you tried to use it for one that's not supported.\n\
|
||||
If that's not the case, {} was likely never assigned to a provider function.\n",
|
||||
stringify!($name),
|
||||
key,
|
||||
|
@ -378,8 +378,8 @@ mod spec_extend;
|
||||
/// Currently, `Vec` does not guarantee the order in which elements are dropped.
|
||||
/// The order has changed in the past and may change again.
|
||||
///
|
||||
/// [`get`]: ../../std/vec/struct.Vec.html#method.get
|
||||
/// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut
|
||||
/// [`get`]: slice::get
|
||||
/// [`get_mut`]: slice::get_mut
|
||||
/// [`String`]: crate::string::String
|
||||
/// [`&str`]: type@str
|
||||
/// [`shrink_to_fit`]: Vec::shrink_to_fit
|
||||
|
@ -218,7 +218,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
|
||||
WalkBuilder::new(first)
|
||||
}
|
||||
} else {
|
||||
WalkBuilder::new(first)
|
||||
WalkBuilder::new(src.join(first))
|
||||
};
|
||||
|
||||
for path in &paths[1..] {
|
||||
@ -229,7 +229,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
|
||||
walker.add(path);
|
||||
}
|
||||
} else {
|
||||
walker.add(path);
|
||||
walker.add(src.join(path));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
0.14.3
|
||||
0.14.4
|
@ -507,9 +507,8 @@ class TestEnvironment:
|
||||
bin/{exe_name}={bin_path}
|
||||
lib/{libstd_name}={rust_dir}/lib/rustlib/{rustlib_dir}/lib/{libstd_name}
|
||||
lib/{libtest_name}={rust_dir}/lib/rustlib/{rustlib_dir}/lib/{libtest_name}
|
||||
lib/ld.so.1={sdk_dir}/arch/{target_arch}/sysroot/lib/libc.so
|
||||
lib/libzircon.so={sdk_dir}/arch/{target_arch}/sysroot/lib/libzircon.so
|
||||
lib/libfdio.so={sdk_dir}/arch/{target_arch}/lib/libfdio.so
|
||||
lib/ld.so.1={sdk_dir}/arch/{target_arch}/sysroot/dist/lib/ld.so.1
|
||||
lib/libfdio.so={sdk_dir}/arch/{target_arch}/dist/libfdio.so
|
||||
"""
|
||||
|
||||
TEST_ENV_VARS: ClassVar[List[str]] = [
|
||||
@ -844,23 +843,34 @@ class TestEnvironment:
|
||||
"--",
|
||||
"--build-id-dir",
|
||||
os.path.join(self.sdk_dir, ".build-id"),
|
||||
"--build-id-dir",
|
||||
os.path.join(self.libs_dir(), ".build-id"),
|
||||
]
|
||||
|
||||
# Add rust source if it's available
|
||||
if args.rust_src is not None:
|
||||
libs_build_id_path = os.path.join(self.libs_dir(), ".build-id")
|
||||
if os.path.exists(libs_build_id_path):
|
||||
# Add .build-id symbols if installed libs have been stripped into a
|
||||
# .build-id directory
|
||||
command += [
|
||||
"--build-dir",
|
||||
args.rust_src,
|
||||
"--build-id-dir",
|
||||
libs_build_id_path,
|
||||
]
|
||||
else:
|
||||
# If no .build-id directory is detected, then assume that the shared
|
||||
# libs contain their debug symbols
|
||||
command += [
|
||||
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
|
||||
]
|
||||
|
||||
# Add rust source if it's available
|
||||
rust_src_map = None
|
||||
if args.rust_src is not None:
|
||||
# This matches the remapped prefix used by compiletest. There's no
|
||||
# clear way that we can determine this, so it's hard coded.
|
||||
rust_src_map = f"/rustc/FAKE_PREFIX={args.rust_src}"
|
||||
|
||||
# Add fuchsia source if it's available
|
||||
fuchsia_src_map = None
|
||||
if args.fuchsia_src is not None:
|
||||
command += [
|
||||
"--build-dir",
|
||||
os.path.join(args.fuchsia_src, "out", "default"),
|
||||
]
|
||||
fuchsia_src_map = f"./../..={args.fuchsia_src}"
|
||||
|
||||
# Load debug symbols for the test binary and automatically attach
|
||||
if args.test is not None:
|
||||
@ -883,7 +893,28 @@ class TestEnvironment:
|
||||
test_name,
|
||||
)
|
||||
|
||||
# The fake-test-src-base directory maps to the suite directory
|
||||
# e.g. tests/ui/foo.rs has a path of rust/fake-test-src-base/foo.rs
|
||||
fake_test_src_base = os.path.join(
|
||||
args.rust_src,
|
||||
"fake-test-src-base",
|
||||
)
|
||||
real_test_src_base = os.path.join(
|
||||
args.rust_src,
|
||||
"tests",
|
||||
args.test.split(os.path.sep)[0],
|
||||
)
|
||||
test_src_map = f"{fake_test_src_base}={real_test_src_base}"
|
||||
|
||||
with open(self.zxdb_script_path(), mode="w", encoding="utf-8") as f:
|
||||
print(f"set source-map += {test_src_map}", file=f)
|
||||
|
||||
if rust_src_map is not None:
|
||||
print(f"set source-map += {rust_src_map}", file=f)
|
||||
|
||||
if fuchsia_src_map is not None:
|
||||
print(f"set source-map += {fuchsia_src_map}", file=f)
|
||||
|
||||
print(f"attach {test_name[:31]}", file=f)
|
||||
|
||||
command += [
|
||||
@ -900,6 +931,20 @@ class TestEnvironment:
|
||||
# Connect to the running emulator with zxdb
|
||||
subprocess.run(command, env=self.ffx_cmd_env(), check=False)
|
||||
|
||||
def syslog(self, args):
|
||||
subprocess.run(
|
||||
[
|
||||
self.tool_path("ffx"),
|
||||
"--config",
|
||||
self.ffx_user_config_path(),
|
||||
"log",
|
||||
"--since",
|
||||
"now",
|
||||
],
|
||||
env=self.ffx_cmd_env(),
|
||||
check=False,
|
||||
)
|
||||
|
||||
|
||||
def start(args):
|
||||
test_env = TestEnvironment.from_args(args)
|
||||
@ -933,6 +978,12 @@ def debug(args):
|
||||
return 0
|
||||
|
||||
|
||||
def syslog(args):
|
||||
test_env = TestEnvironment.read_from_file()
|
||||
test_env.syslog(args)
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
@ -1028,6 +1079,11 @@ def main():
|
||||
)
|
||||
debug_parser.set_defaults(func=debug)
|
||||
|
||||
syslog_parser = subparsers.add_parser(
|
||||
"syslog", help="prints the device syslog"
|
||||
)
|
||||
syslog_parser.set_defaults(func=syslog)
|
||||
|
||||
args = parser.parse_args()
|
||||
return args.func(args)
|
||||
|
||||
|
@ -687,7 +687,9 @@ Rust compiler locally. See "[Targeting Fuchsia with a compiler built from source
|
||||
for the steps to build locally.
|
||||
|
||||
You'll also need to download a copy of the Fuchsia SDK. The current minimum
|
||||
supported SDK version is [9.20220726.1.1](https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core/linux-amd64/+/version:9.20220726.1.1).
|
||||
supported SDK version is [10.20221207.2.89][minimum_supported_sdk_version].
|
||||
|
||||
[minimum_supported_sdk_version]: https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core/linux-amd64/+/version:10.20221207.2.89
|
||||
|
||||
Fuchsia's test runner interacts with the Fuchsia emulator and is located at
|
||||
`src/ci/docker/scripts/fuchsia-test-runner.py`. We can use it to start our
|
||||
@ -697,7 +699,7 @@ test environment with:
|
||||
src/ci/docker/scripts/fuchsia-test-runner.py start
|
||||
--rust ${RUST_SRC_PATH}/install
|
||||
--sdk ${SDK_PATH}
|
||||
--target-triple {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia}
|
||||
--target {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia}
|
||||
```
|
||||
|
||||
Where `${RUST_SRC_PATH}/install` is the `prefix` set in `config.toml` and
|
||||
@ -717,17 +719,11 @@ run the full `tests/ui` test suite:
|
||||
--target x86_64-unknown-fuchsia \
|
||||
--run=always --jobs 1 \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -L \
|
||||
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args ${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
|
||||
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/lib \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -L \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args ${SDK_PATH}/arch/{x64|arm64}/lib \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Cpanic=abort \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Zpanic_abort_tests \
|
||||
--test-args -Clink-arg=--undefined-version \
|
||||
--test-args --remote-test-client \
|
||||
--test-args src/ci/docker/scripts/fuchsia-test-runner.py \
|
||||
)
|
||||
@ -736,7 +732,18 @@ run the full `tests/ui` test suite:
|
||||
*Note: The test suite cannot be run in parallel at the moment, so `x.py`
|
||||
must be run with `--jobs 1` to ensure only one test runs at a time.*
|
||||
|
||||
When finished, the test runner can be used to stop the test environment:
|
||||
By default, `x.py` compiles test binaries with `panic=unwind`. If you built your
|
||||
Rust toolchain with `-Cpanic=abort`, you need to tell `x.py` to compile test
|
||||
binaries with `panic=abort` as well:
|
||||
|
||||
```sh
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Cpanic=abort \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Zpanic_abort_tests \
|
||||
```
|
||||
|
||||
When finished testing, the test runner can be used to stop the test environment:
|
||||
|
||||
```sh
|
||||
src/ci/docker/scripts/fuchsia-test-runner.py stop
|
||||
@ -764,8 +771,9 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
|
||||
* `--symbol-path` gets required symbol paths, which are
|
||||
necessary for stepping through your program.
|
||||
|
||||
The "[displaying source code in `zxdb`](#displaying-source-code-in-zxdb)" section describes how you can
|
||||
display Rust and/or Fuchsia source code in your debugging session.
|
||||
The "[displaying source code in `zxdb`](#displaying-source-code-in-zxdb)"
|
||||
section describes how you can display Rust and/or Fuchsia source code in your
|
||||
debugging session.
|
||||
|
||||
### Using `zxdb`
|
||||
|
||||
@ -866,6 +874,64 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
|
||||
Linking to a Fuchsia checkout can help with debugging Fuchsia libraries,
|
||||
such as [fdio].
|
||||
|
||||
### Debugging the compiler test suite
|
||||
|
||||
Debugging the compiler test suite requires some special configuration:
|
||||
|
||||
First, we have to properly configure zxdb so it will be able to find debug
|
||||
symbols and source information for our test. The test runner can do this for us
|
||||
with:
|
||||
|
||||
```sh
|
||||
src/ci/docker/scripts/fuchsia-test-runner.py debug \
|
||||
--rust-src ${RUST_SRC_PATH} \
|
||||
--fuchsia-src ${FUCHSIA_SRC_PATH} \
|
||||
--test ${TEST}
|
||||
```
|
||||
|
||||
where `${TEST}` is relative to Rust's `tests` directory (e.g. `ui/abi/...`).
|
||||
|
||||
This will start a zxdb session that is properly configured for the specific test
|
||||
being run. All three arguments are optional, so you can omit `--fuchsia-src` if
|
||||
you don't have it downloaded. Now is a good time to set any desired breakpoints,
|
||||
like `b main`.
|
||||
|
||||
Next, we have to tell `x.py` not to optimize or strip debug symbols from our
|
||||
test suite binaries. We can do this by passing some new arguments to `rustc`
|
||||
through our `x.py` invocation. The full invocation is:
|
||||
|
||||
```sh
|
||||
( \
|
||||
source config-env.sh && \
|
||||
./x.py \
|
||||
--config config.toml \
|
||||
--stage=2 \
|
||||
test tests/${TEST} \
|
||||
--target x86_64-unknown-fuchsia \
|
||||
--run=always --jobs 1 \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/lib \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Clink-arg=--undefined-version \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Cdebuginfo=2 \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Copt-level=0 \
|
||||
--test-args --target-rustcflags \
|
||||
--test-args -Cstrip=none \
|
||||
--test-args --remote-test-client \
|
||||
--test-args src/ci/docker/scripts/fuchsia-test-runner.py \
|
||||
)
|
||||
```
|
||||
|
||||
*If you built your Rust toolchain with `panic=abort`, make sure to include the
|
||||
previous flags so your test binaries are also compiled with `panic=abort`.*
|
||||
|
||||
Upon running this command, the test suite binary will be run and zxdb will
|
||||
attach and load any relevant debug symbols.
|
||||
|
||||
[Fuchsia team]: https://team-api.infra.rust-lang.org/v1/teams/fuchsia.json
|
||||
[Fuchsia]: https://fuchsia.dev/
|
||||
[source tree]: https://fuchsia.dev/fuchsia-src/get-started/learn/build
|
||||
|
@ -552,10 +552,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> SummaryLine<'a, I> {
|
||||
}
|
||||
|
||||
fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
|
||||
matches!(
|
||||
t,
|
||||
Tag::Paragraph | Tag::Item | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote
|
||||
)
|
||||
matches!(t, Tag::Paragraph | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote)
|
||||
}
|
||||
|
||||
fn is_forbidden_tag(t: &Tag<'_>) -> bool {
|
||||
|
@ -68,5 +68,4 @@ size: (1000, 1000) // Popover only appears when the screen width is >700px.
|
||||
assert-false: "#help"
|
||||
click: "#help-button > a"
|
||||
click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']"
|
||||
wait-for: 2000
|
||||
assert-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}
|
||||
wait-for-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}
|
||||
|
1
tests/rustdoc/item-desc-list-at-start.item-table.html
Normal file
1
tests/rustdoc/item-desc-list-at-start.item-table.html
Normal file
@ -0,0 +1 @@
|
||||
<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul>
|
9
tests/rustdoc/item-desc-list-at-start.rs
Normal file
9
tests/rustdoc/item-desc-list-at-start.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// @has item_desc_list_at_start/index.html
|
||||
// @count - '//ul[@class="item-table"]/li/div/li' 0
|
||||
// @count - '//ul[@class="item-table"]/li' 1
|
||||
// @snapshot item-table - '//ul[@class="item-table"]'
|
||||
|
||||
// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16
|
||||
|
||||
/// * Groups: `SamplePatternSGIS`, `SamplePatternEXT`
|
||||
pub const MY_CONSTANT: usize = 0;
|
Loading…
Reference in New Issue
Block a user