Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 31448ba

Browse files
committedFeb 25, 2023
Auto merge of rust-lang#108450 - matthiaskrgr:rollup-rqvfgu3, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#108354 (Update `fuchsia-test-runner.py` and docs) - rust-lang#108404 (support `x fmt` for sub and outside of rust directories) - rust-lang#108407 (docs: use intra-doc links for `Vec::get(_mut)`) - rust-lang#108410 (rustdoc: avoid including `<li>` tags in item table short desc) - rust-lang#108412 (Fix GUI test navigation bug) - rust-lang#108433 (Wrap missing provider message correctly) - rust-lang#108434 (Migrate `rustc_hir_analysis` to session diagnostic [Part One]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents dcca6a3 + 2aad179 commit 31448ba

File tree

13 files changed

+276
-103
lines changed

13 files changed

+276
-103
lines changed
 

‎compiler/rustc_hir_analysis/locales/en-US.ftl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,26 @@ hir_analysis_where_clause_on_main = `main` function is not allowed to have a `wh
132132
133133
hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]`
134134
.label = `main` function is not allowed to be `#[track_caller]`
135+
136+
hir_analysis_start_not_track_caller = `start` is not allowed to be `#[track_caller]`
137+
.label = `start` is not allowed to be `#[track_caller]`
138+
139+
hir_analysis_start_not_async = `start` is not allowed to be `async`
140+
.label = `start` is not allowed to be `async`
141+
142+
hir_analysis_start_function_where = start function is not allowed to have a `where` clause
143+
.label = start function cannot have a `where` clause
144+
145+
hir_analysis_start_function_parameters = start function is not allowed to have type parameters
146+
.label = start function cannot have type parameters
147+
148+
hir_analysis_main_function_return_type_generic = `main` function return type is not allowed to have generic parameters
149+
150+
hir_analysis_main_function_async = `main` function is not allowed to be `async`
151+
.label = `main` function is not allowed to be `async`
152+
153+
hir_analysis_main_function_generic_parameters = `main` function is not allowed to have generic parameters
154+
.label = `main` cannot have generic parameters
155+
156+
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
157+
.label = C-variadic function must have a compatible calling convention

‎compiler/rustc_hir_analysis/src/errors.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,70 @@ pub(crate) struct TrackCallerOnMain {
333333
#[label]
334334
pub annotated: Span,
335335
}
336+
337+
#[derive(Diagnostic)]
338+
#[diag(hir_analysis_start_not_track_caller)]
339+
pub(crate) struct StartTrackCaller {
340+
#[primary_span]
341+
pub span: Span,
342+
#[label]
343+
pub start: Span,
344+
}
345+
346+
#[derive(Diagnostic)]
347+
#[diag(hir_analysis_start_not_async, code = "E0752")]
348+
pub(crate) struct StartAsync {
349+
#[primary_span]
350+
#[label]
351+
pub span: Span,
352+
}
353+
354+
#[derive(Diagnostic)]
355+
#[diag(hir_analysis_start_function_where, code = "E0647")]
356+
pub(crate) struct StartFunctionWhere {
357+
#[primary_span]
358+
#[label]
359+
pub span: Span,
360+
}
361+
362+
#[derive(Diagnostic)]
363+
#[diag(hir_analysis_start_function_parameters, code = "E0132")]
364+
pub(crate) struct StartFunctionParameters {
365+
#[primary_span]
366+
#[label]
367+
pub span: Span,
368+
}
369+
370+
#[derive(Diagnostic)]
371+
#[diag(hir_analysis_main_function_return_type_generic, code = "E0131")]
372+
pub(crate) struct MainFunctionReturnTypeGeneric {
373+
#[primary_span]
374+
pub span: Span,
375+
}
376+
377+
#[derive(Diagnostic)]
378+
#[diag(hir_analysis_main_function_async, code = "E0752")]
379+
pub(crate) struct MainFunctionAsync {
380+
#[primary_span]
381+
pub span: Span,
382+
#[label]
383+
pub asyncness: Option<Span>,
384+
}
385+
386+
#[derive(Diagnostic)]
387+
#[diag(hir_analysis_main_function_generic_parameters, code = "E0131")]
388+
pub(crate) struct MainFunctionGenericParameters {
389+
#[primary_span]
390+
pub span: Span,
391+
#[label]
392+
pub label_span: Option<Span>,
393+
}
394+
395+
#[derive(Diagnostic)]
396+
#[diag(hir_analysis_variadic_function_compatible_convention, code = "E0045")]
397+
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
398+
#[primary_span]
399+
#[label]
400+
pub span: Span,
401+
pub conventions: &'a str,
402+
}

‎compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 17 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod outlives;
9898
pub mod structured_errors;
9999
mod variance;
100100

101-
use rustc_errors::{struct_span_err, ErrorGuaranteed};
101+
use rustc_errors::ErrorGuaranteed;
102102
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
103103
use rustc_hir as hir;
104104
use rustc_hir::Node;
@@ -123,7 +123,6 @@ use bounds::Bounds;
123123
fluent_messages! { "../locales/en-US.ftl" }
124124

125125
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
126-
const ERROR_HEAD: &str = "C-variadic function must have a compatible calling convention";
127126
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `win64`, `sysv64` or `efiapi`";
128127
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
129128
const UNSTABLE_EXPLAIN: &str =
@@ -155,8 +154,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi
155154
(true, false) => CONVENTIONS_UNSTABLE,
156155
};
157156

158-
let mut err = struct_span_err!(tcx.sess, span, E0045, "{}, like {}", ERROR_HEAD, conventions);
159-
err.span_label(span, ERROR_HEAD).emit();
157+
tcx.sess.emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions });
160158
}
161159

162160
fn require_same_types<'tcx>(
@@ -258,15 +256,10 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
258256
let main_fn_predicates = tcx.predicates_of(main_def_id);
259257
if main_fn_generics.count() != 0 || !main_fnsig.bound_vars().is_empty() {
260258
let generics_param_span = main_fn_generics_params_span(tcx, main_def_id);
261-
let msg = "`main` function is not allowed to have generic \
262-
parameters";
263-
let mut diag =
264-
struct_span_err!(tcx.sess, generics_param_span.unwrap_or(main_span), E0131, "{}", msg);
265-
if let Some(generics_param_span) = generics_param_span {
266-
let label = "`main` cannot have generic parameters";
267-
diag.span_label(generics_param_span, label);
268-
}
269-
diag.emit();
259+
tcx.sess.emit_err(errors::MainFunctionGenericParameters {
260+
span: generics_param_span.unwrap_or(main_span),
261+
label_span: generics_param_span,
262+
});
270263
error = true;
271264
} else if !main_fn_predicates.predicates.is_empty() {
272265
// 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) {
280273

281274
let main_asyncness = tcx.asyncness(main_def_id);
282275
if let hir::IsAsync::Async = main_asyncness {
283-
let mut diag = struct_span_err!(
284-
tcx.sess,
285-
main_span,
286-
E0752,
287-
"`main` function is not allowed to be `async`"
288-
);
289276
let asyncness_span = main_fn_asyncness_span(tcx, main_def_id);
290-
if let Some(asyncness_span) = asyncness_span {
291-
diag.span_label(asyncness_span, "`main` function is not allowed to be `async`");
292-
}
293-
diag.emit();
277+
tcx.sess.emit_err(errors::MainFunctionAsync { span: main_span, asyncness: asyncness_span });
294278
error = true;
295279
}
296280

@@ -308,9 +292,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
308292
let return_ty = main_fnsig.output();
309293
let return_ty_span = main_fn_return_type_span(tcx, main_def_id).unwrap_or(main_span);
310294
if !return_ty.bound_vars().is_empty() {
311-
let msg = "`main` function return type is not allowed to have generic \
312-
parameters";
313-
struct_span_err!(tcx.sess, return_ty_span, E0131, "{}", msg).emit();
295+
tcx.sess.emit_err(errors::MainFunctionReturnTypeGeneric { span: return_ty_span });
314296
error = true;
315297
}
316298
let return_ty = return_ty.skip_binder();
@@ -367,56 +349,28 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
367349
if let hir::ItemKind::Fn(sig, generics, _) = &it.kind {
368350
let mut error = false;
369351
if !generics.params.is_empty() {
370-
struct_span_err!(
371-
tcx.sess,
372-
generics.span,
373-
E0132,
374-
"start function is not allowed to have type parameters"
375-
)
376-
.span_label(generics.span, "start function cannot have type parameters")
377-
.emit();
352+
tcx.sess.emit_err(errors::StartFunctionParameters { span: generics.span });
378353
error = true;
379354
}
380355
if generics.has_where_clause_predicates {
381-
struct_span_err!(
382-
tcx.sess,
383-
generics.where_clause_span,
384-
E0647,
385-
"start function is not allowed to have a `where` clause"
386-
)
387-
.span_label(
388-
generics.where_clause_span,
389-
"start function cannot have a `where` clause",
390-
)
391-
.emit();
356+
tcx.sess.emit_err(errors::StartFunctionWhere {
357+
span: generics.where_clause_span,
358+
});
392359
error = true;
393360
}
394361
if let hir::IsAsync::Async = sig.header.asyncness {
395362
let span = tcx.def_span(it.owner_id);
396-
struct_span_err!(
397-
tcx.sess,
398-
span,
399-
E0752,
400-
"`start` is not allowed to be `async`"
401-
)
402-
.span_label(span, "`start` is not allowed to be `async`")
403-
.emit();
363+
tcx.sess.emit_err(errors::StartAsync { span: span });
404364
error = true;
405365
}
406366

407367
let attrs = tcx.hir().attrs(start_id);
408368
for attr in attrs {
409369
if attr.has_name(sym::track_caller) {
410-
tcx.sess
411-
.struct_span_err(
412-
attr.span,
413-
"`start` is not allowed to be `#[track_caller]`",
414-
)
415-
.span_label(
416-
start_span,
417-
"`start` is not allowed to be `#[track_caller]`",
418-
)
419-
.emit();
370+
tcx.sess.emit_err(errors::StartTrackCaller {
371+
span: attr.span,
372+
start: start_span,
373+
});
420374
error = true;
421375
}
422376
}

‎compiler/rustc_middle/src/ty/query.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ macro_rules! define_callbacks {
328328

329329
Providers {
330330
$($name: |_, key| bug!(
331-
"`tcx.{}({:?})` is not supported for {} crate;\n
332-
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
331+
"`tcx.{}({:?})` is not supported for {} crate;\n\
332+
hint: Queries can be either made to the local crate, or the external crate. \
333+
This error means you tried to use it for one that's not supported.\n\
333334
If that's not the case, {} was likely never assigned to a provider function.\n",
334335
stringify!($name),
335336
key,

‎library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ mod spec_extend;
378378
/// Currently, `Vec` does not guarantee the order in which elements are dropped.
379379
/// The order has changed in the past and may change again.
380380
///
381-
/// [`get`]: ../../std/vec/struct.Vec.html#method.get
382-
/// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut
381+
/// [`get`]: slice::get
382+
/// [`get_mut`]: slice::get_mut
383383
/// [`String`]: crate::string::String
384384
/// [`&str`]: type@str
385385
/// [`shrink_to_fit`]: Vec::shrink_to_fit

‎src/bootstrap/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
218218
WalkBuilder::new(first)
219219
}
220220
} else {
221-
WalkBuilder::new(first)
221+
WalkBuilder::new(src.join(first))
222222
};
223223

224224
for path in &paths[1..] {
@@ -229,7 +229,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
229229
walker.add(path);
230230
}
231231
} else {
232-
walker.add(path);
232+
walker.add(src.join(path));
233233
}
234234
}
235235

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.14.3
1+
0.14.4

‎src/ci/docker/scripts/fuchsia-test-runner.py

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,8 @@ def start(self):
507507
bin/{exe_name}={bin_path}
508508
lib/{libstd_name}={rust_dir}/lib/rustlib/{rustlib_dir}/lib/{libstd_name}
509509
lib/{libtest_name}={rust_dir}/lib/rustlib/{rustlib_dir}/lib/{libtest_name}
510-
lib/ld.so.1={sdk_dir}/arch/{target_arch}/sysroot/lib/libc.so
511-
lib/libzircon.so={sdk_dir}/arch/{target_arch}/sysroot/lib/libzircon.so
512-
lib/libfdio.so={sdk_dir}/arch/{target_arch}/lib/libfdio.so
510+
lib/ld.so.1={sdk_dir}/arch/{target_arch}/sysroot/dist/lib/ld.so.1
511+
lib/libfdio.so={sdk_dir}/arch/{target_arch}/dist/libfdio.so
513512
"""
514513

515514
TEST_ENV_VARS: ClassVar[List[str]] = [
@@ -844,23 +843,34 @@ def debug(self, args):
844843
"--",
845844
"--build-id-dir",
846845
os.path.join(self.sdk_dir, ".build-id"),
847-
"--build-id-dir",
848-
os.path.join(self.libs_dir(), ".build-id"),
849846
]
850847

851-
# Add rust source if it's available
852-
if args.rust_src is not None:
848+
libs_build_id_path = os.path.join(self.libs_dir(), ".build-id")
849+
if os.path.exists(libs_build_id_path):
850+
# Add .build-id symbols if installed libs have been stripped into a
851+
# .build-id directory
853852
command += [
854-
"--build-dir",
855-
args.rust_src,
853+
"--build-id-dir",
854+
libs_build_id_path,
855+
]
856+
else:
857+
# If no .build-id directory is detected, then assume that the shared
858+
# libs contain their debug symbols
859+
command += [
860+
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
856861
]
857862

863+
# Add rust source if it's available
864+
rust_src_map = None
865+
if args.rust_src is not None:
866+
# This matches the remapped prefix used by compiletest. There's no
867+
# clear way that we can determine this, so it's hard coded.
868+
rust_src_map = f"/rustc/FAKE_PREFIX={args.rust_src}"
869+
858870
# Add fuchsia source if it's available
871+
fuchsia_src_map = None
859872
if args.fuchsia_src is not None:
860-
command += [
861-
"--build-dir",
862-
os.path.join(args.fuchsia_src, "out", "default"),
863-
]
873+
fuchsia_src_map = f"./../..={args.fuchsia_src}"
864874

865875
# Load debug symbols for the test binary and automatically attach
866876
if args.test is not None:
@@ -883,7 +893,28 @@ def debug(self, args):
883893
test_name,
884894
)
885895

896+
# The fake-test-src-base directory maps to the suite directory
897+
# e.g. tests/ui/foo.rs has a path of rust/fake-test-src-base/foo.rs
898+
fake_test_src_base = os.path.join(
899+
args.rust_src,
900+
"fake-test-src-base",
901+
)
902+
real_test_src_base = os.path.join(
903+
args.rust_src,
904+
"tests",
905+
args.test.split(os.path.sep)[0],
906+
)
907+
test_src_map = f"{fake_test_src_base}={real_test_src_base}"
908+
886909
with open(self.zxdb_script_path(), mode="w", encoding="utf-8") as f:
910+
print(f"set source-map += {test_src_map}", file=f)
911+
912+
if rust_src_map is not None:
913+
print(f"set source-map += {rust_src_map}", file=f)
914+
915+
if fuchsia_src_map is not None:
916+
print(f"set source-map += {fuchsia_src_map}", file=f)
917+
887918
print(f"attach {test_name[:31]}", file=f)
888919

889920
command += [
@@ -900,6 +931,20 @@ def debug(self, args):
900931
# Connect to the running emulator with zxdb
901932
subprocess.run(command, env=self.ffx_cmd_env(), check=False)
902933

934+
def syslog(self, args):
935+
subprocess.run(
936+
[
937+
self.tool_path("ffx"),
938+
"--config",
939+
self.ffx_user_config_path(),
940+
"log",
941+
"--since",
942+
"now",
943+
],
944+
env=self.ffx_cmd_env(),
945+
check=False,
946+
)
947+
903948

904949
def start(args):
905950
test_env = TestEnvironment.from_args(args)
@@ -933,6 +978,12 @@ def debug(args):
933978
return 0
934979

935980

981+
def syslog(args):
982+
test_env = TestEnvironment.read_from_file()
983+
test_env.syslog(args)
984+
return 0
985+
986+
936987
def main():
937988
parser = argparse.ArgumentParser()
938989

@@ -1028,6 +1079,11 @@ def print_help(args):
10281079
)
10291080
debug_parser.set_defaults(func=debug)
10301081

1082+
syslog_parser = subparsers.add_parser(
1083+
"syslog", help="prints the device syslog"
1084+
)
1085+
syslog_parser.set_defaults(func=syslog)
1086+
10311087
args = parser.parse_args()
10321088
return args.func(args)
10331089

‎src/doc/rustc/src/platform-support/fuchsia.md

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,9 @@ Rust compiler locally. See "[Targeting Fuchsia with a compiler built from source
687687
for the steps to build locally.
688688

689689
You'll also need to download a copy of the Fuchsia SDK. The current minimum
690-
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).
690+
supported SDK version is [10.20221207.2.89][minimum_supported_sdk_version].
691+
692+
[minimum_supported_sdk_version]: https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core/linux-amd64/+/version:10.20221207.2.89
691693

692694
Fuchsia's test runner interacts with the Fuchsia emulator and is located at
693695
`src/ci/docker/scripts/fuchsia-test-runner.py`. We can use it to start our
@@ -697,7 +699,7 @@ test environment with:
697699
src/ci/docker/scripts/fuchsia-test-runner.py start
698700
--rust ${RUST_SRC_PATH}/install
699701
--sdk ${SDK_PATH}
700-
--target-triple {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia}
702+
--target {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia}
701703
```
702704

703705
Where `${RUST_SRC_PATH}/install` is the `prefix` set in `config.toml` and
@@ -717,17 +719,11 @@ run the full `tests/ui` test suite:
717719
--target x86_64-unknown-fuchsia \
718720
--run=always --jobs 1 \
719721
--test-args --target-rustcflags \
720-
--test-args -L \
721-
--test-args --target-rustcflags \
722-
--test-args ${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
723-
--test-args --target-rustcflags \
724-
--test-args -L \
722+
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
725723
--test-args --target-rustcflags \
726-
--test-args ${SDK_PATH}/arch/{x64|arm64}/lib \
724+
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/lib \
727725
--test-args --target-rustcflags \
728-
--test-args -Cpanic=abort \
729-
--test-args --target-rustcflags \
730-
--test-args -Zpanic_abort_tests \
726+
--test-args -Clink-arg=--undefined-version \
731727
--test-args --remote-test-client \
732728
--test-args src/ci/docker/scripts/fuchsia-test-runner.py \
733729
)
@@ -736,7 +732,18 @@ run the full `tests/ui` test suite:
736732
*Note: The test suite cannot be run in parallel at the moment, so `x.py`
737733
must be run with `--jobs 1` to ensure only one test runs at a time.*
738734

739-
When finished, the test runner can be used to stop the test environment:
735+
By default, `x.py` compiles test binaries with `panic=unwind`. If you built your
736+
Rust toolchain with `-Cpanic=abort`, you need to tell `x.py` to compile test
737+
binaries with `panic=abort` as well:
738+
739+
```sh
740+
--test-args --target-rustcflags \
741+
--test-args -Cpanic=abort \
742+
--test-args --target-rustcflags \
743+
--test-args -Zpanic_abort_tests \
744+
```
745+
746+
When finished testing, the test runner can be used to stop the test environment:
740747

741748
```sh
742749
src/ci/docker/scripts/fuchsia-test-runner.py stop
@@ -764,8 +771,9 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
764771
* `--symbol-path` gets required symbol paths, which are
765772
necessary for stepping through your program.
766773

767-
The "[displaying source code in `zxdb`](#displaying-source-code-in-zxdb)" section describes how you can
768-
display Rust and/or Fuchsia source code in your debugging session.
774+
The "[displaying source code in `zxdb`](#displaying-source-code-in-zxdb)"
775+
section describes how you can display Rust and/or Fuchsia source code in your
776+
debugging session.
769777

770778
### Using `zxdb`
771779

@@ -866,6 +874,64 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
866874
Linking to a Fuchsia checkout can help with debugging Fuchsia libraries,
867875
such as [fdio].
868876

877+
### Debugging the compiler test suite
878+
879+
Debugging the compiler test suite requires some special configuration:
880+
881+
First, we have to properly configure zxdb so it will be able to find debug
882+
symbols and source information for our test. The test runner can do this for us
883+
with:
884+
885+
```sh
886+
src/ci/docker/scripts/fuchsia-test-runner.py debug \
887+
--rust-src ${RUST_SRC_PATH} \
888+
--fuchsia-src ${FUCHSIA_SRC_PATH} \
889+
--test ${TEST}
890+
```
891+
892+
where `${TEST}` is relative to Rust's `tests` directory (e.g. `ui/abi/...`).
893+
894+
This will start a zxdb session that is properly configured for the specific test
895+
being run. All three arguments are optional, so you can omit `--fuchsia-src` if
896+
you don't have it downloaded. Now is a good time to set any desired breakpoints,
897+
like `b main`.
898+
899+
Next, we have to tell `x.py` not to optimize or strip debug symbols from our
900+
test suite binaries. We can do this by passing some new arguments to `rustc`
901+
through our `x.py` invocation. The full invocation is:
902+
903+
```sh
904+
( \
905+
source config-env.sh && \
906+
./x.py \
907+
--config config.toml \
908+
--stage=2 \
909+
test tests/${TEST} \
910+
--target x86_64-unknown-fuchsia \
911+
--run=always --jobs 1 \
912+
--test-args --target-rustcflags \
913+
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
914+
--test-args --target-rustcflags \
915+
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/lib \
916+
--test-args --target-rustcflags \
917+
--test-args -Clink-arg=--undefined-version \
918+
--test-args --target-rustcflags \
919+
--test-args -Cdebuginfo=2 \
920+
--test-args --target-rustcflags \
921+
--test-args -Copt-level=0 \
922+
--test-args --target-rustcflags \
923+
--test-args -Cstrip=none \
924+
--test-args --remote-test-client \
925+
--test-args src/ci/docker/scripts/fuchsia-test-runner.py \
926+
)
927+
```
928+
929+
*If you built your Rust toolchain with `panic=abort`, make sure to include the
930+
previous flags so your test binaries are also compiled with `panic=abort`.*
931+
932+
Upon running this command, the test suite binary will be run and zxdb will
933+
attach and load any relevant debug symbols.
934+
869935
[Fuchsia team]: https://team-api.infra.rust-lang.org/v1/teams/fuchsia.json
870936
[Fuchsia]: https://fuchsia.dev/
871937
[source tree]: https://fuchsia.dev/fuchsia-src/get-started/learn/build

‎src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> SummaryLine<'a, I> {
552552
}
553553

554554
fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
555-
matches!(
556-
t,
557-
Tag::Paragraph | Tag::Item | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote
558-
)
555+
matches!(t, Tag::Paragraph | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote)
559556
}
560557

561558
fn is_forbidden_tag(t: &Tag<'_>) -> bool {

‎tests/rustdoc-gui/help-page.goml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,4 @@ size: (1000, 1000) // Popover only appears when the screen width is >700px.
6868
assert-false: "#help"
6969
click: "#help-button > a"
7070
click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']"
71-
wait-for: 2000
72-
assert-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}
71+
wait-for-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @has item_desc_list_at_start/index.html
2+
// @count - '//ul[@class="item-table"]/li/div/li' 0
3+
// @count - '//ul[@class="item-table"]/li' 1
4+
// @snapshot item-table - '//ul[@class="item-table"]'
5+
6+
// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16
7+
8+
/// * Groups: `SamplePatternSGIS`, `SamplePatternEXT`
9+
pub const MY_CONSTANT: usize = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.