Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr

Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-11-15 06:43:28 +00:00
commit ca92d90b59
38 changed files with 1444 additions and 349 deletions

File diff suppressed because it is too large Load diff

View file

@ -641,8 +641,60 @@ available on the [Fuchsia devsite].
### Running the compiler test suite
Running the Rust test suite on Fuchsia is [not currently supported], but work is
underway to enable it.
Pre-requisites for running the Rust test suite on Fuchsia are:
1. Checkout of Rust source.
1. Setup of `config-env.sh` and `config.toml` from "[Targeting Fuchsia with a compiler built from source](#targeting-fuchsia-with-a-compiler-built-from-source)".
1. Download of the Fuchsia SDK. 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)
Interfacing with the Fuchsia emulator is handled by our test runner script located
at `${RUST_SRC_PATH}/src/ci/docker/scripts/fuchsia-test-runner.py`.
We start by activating our Fuchsia test environment. From a terminal:
**Issue command from ${RUST_SRC_PATH}**
```sh
src/ci/docker/scripts/fuchsia-test-runner.py start
--rust .
--sdk ${SDK_PATH}
--target-arch {x64,arm64}
```
Next, for ease of commands, we copy `config-env.sh` and `config.toml` into our Rust source
code path, `${RUST_SRC_PATH}`.
From there, we utilize `x.py` to run our tests, using the test runner script to
run the tests on our emulator. To run the full `src/test/ui` test suite:
**Run from ${RUST_SRC_PATH}**
```sh
( \
source config-env.sh && \
./x.py \
--config config.toml \
--stage=2 \
test src/test/ui \
--target x86_64-fuchsia \
--run=always --jobs 1 \
--test-args --target-rustcflags -L \
--test-args --target-rustcflags ${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
--test-args --target-rustcflags -L \
--test-args --target-rustcflags ${SDK_PATH}/arch/{x64|arm64}/lib \
--test-args --target-rustcflags -Cpanic=abort \
--test-args --target-rustcflags -Zpanic_abort_tests \
--test-args --remote-test-client \
--test-args src/ci/docker/scripts/fuchsia-test-runner.py \
)
```
*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, stop the test environment:
**Issue command from ${RUST_SRC_PATH}**
```sh
src/ci/docker/scripts/fuchsia-test-runner.py stop
```
## Debugging

View file

@ -1262,10 +1262,6 @@ h3.variant {
margin-left: 24px;
}
:target > code, :target > .code-header {
opacity: 1;
}
:target {
padding-right: 3px;
background-color: var(--target-background-color);

View file

@ -1491,6 +1491,7 @@ function initSearch(rawSearchIndex) {
const target = searchState.focusedByTab[searchState.currentTab] ||
document.querySelectorAll(".search-results.active a").item(0) ||
document.querySelectorAll("#titles > button").item(searchState.currentTab);
searchState.focusedByTab[searchState.currentTab] = null;
if (target) {
target.focus();
}

View file

@ -19,9 +19,13 @@ impl StaticFile {
}
pub(crate) fn minified(&self) -> Vec<u8> {
if self.filename.ends_with(".css") {
let extension = match self.filename.extension() {
Some(e) => e,
None => return self.bytes.to_owned(),
};
if extension == "css" {
minifier::css::minify(str::from_utf8(self.bytes).unwrap()).unwrap().to_string().into()
} else if self.filename.ends_with(".js") {
} else if extension == "js" {
minifier::js::minify(str::from_utf8(self.bytes).unwrap()).to_string().into()
} else {
self.bytes.to_owned()

View file

@ -0,0 +1,28 @@
// Checks that the search tab results work correctly with function signature syntax
// First, try a search-by-name
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
wait-for: "#titles"
// Now use the keyboard commands to switch to the third result.
press-key: "ArrowDown"
press-key: "ArrowDown"
press-key: "ArrowDown"
assert: ".search-results.active > a:focus:nth-of-type(3)"
// Now switch to the second tab, then back to the first one, then arrow back up.
press-key: "ArrowRight"
assert: ".search-results.active:nth-of-type(2) > a:focus:nth-of-type(1)"
press-key: "ArrowLeft"
assert: ".search-results.active:nth-of-type(1) > a:focus:nth-of-type(3)"
press-key: "ArrowUp"
assert: ".search-results.active > a:focus:nth-of-type(2)"
press-key: "ArrowUp"
assert: ".search-results.active > a:focus:nth-of-type(1)"
press-key: "ArrowUp"
assert: ".search-input:focus"
press-key: "ArrowDown"
assert: ".search-results.active > a:focus:nth-of-type(1)"

View file

@ -0,0 +1,13 @@
trait A<Y, N> {
type B;
}
type MaybeBox<T> = <T as A<T, Box<T>>>::B;
struct P {
t: MaybeBox<P>
}
impl<Y, N> A<Y, N> for P {
type B = N;
}
fn main() {
let t: MaybeBox<P>;
}

View file

@ -0,0 +1,4 @@
fn main() {
1_u32.MAX();
//~^ ERROR no method named `MAX` found for type `u32` in the current scope
}

View file

@ -0,0 +1,15 @@
error[E0599]: no method named `MAX` found for type `u32` in the current scope
--> $DIR/dont-suggest-ufcs-for-const.rs:2:11
|
LL | 1_u32.MAX();
| ------^^^--
| | |
| | this is an associated function, not a method
| help: use associated function syntax instead: `u32::MAX()`
|
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
= note: the candidate is defined in an impl for the type `u32`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View file

@ -0,0 +1,15 @@
// run-rustfix
#![allow(unused)]
struct Foo<T>(T);
impl<T> Foo<T> {
fn test() -> i32 { 1 }
}
fn main() {
let x = Box::new(Foo(1i32));
Foo::<i32>::test();
//~^ ERROR no method named `test` found for struct `Box<Foo<i32>>` in the current scope
}

View file

@ -0,0 +1,15 @@
// run-rustfix
#![allow(unused)]
struct Foo<T>(T);
impl<T> Foo<T> {
fn test() -> i32 { 1 }
}
fn main() {
let x = Box::new(Foo(1i32));
x.test();
//~^ ERROR no method named `test` found for struct `Box<Foo<i32>>` in the current scope
}

View file

@ -0,0 +1,19 @@
error[E0599]: no method named `test` found for struct `Box<Foo<i32>>` in the current scope
--> $DIR/suggest-assoc-fn-call-deref.rs:13:7
|
LL | x.test();
| --^^^^--
| | |
| | this is an associated function, not a method
| help: use associated function syntax instead: `Foo::<i32>::test()`
|
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
note: the candidate is defined in an impl for the type `Foo<T>`
--> $DIR/suggest-assoc-fn-call-deref.rs:8:5
|
LL | fn test() -> i32 { 1 }
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View file

@ -199,12 +199,12 @@ pub fn first_node_in_macro(cx: &LateContext<'_>, node: &impl HirNode) -> Option<
pub fn is_panic(cx: &LateContext<'_>, def_id: DefId) -> bool {
let Some(name) = cx.tcx.get_diagnostic_name(def_id) else { return false };
matches!(
name.as_str(),
"core_panic_macro"
| "std_panic_macro"
| "core_panic_2015_macro"
| "std_panic_2015_macro"
| "core_panic_2021_macro"
name,
sym::core_panic_macro
| sym::std_panic_macro
| sym::core_panic_2015_macro
| sym::std_panic_2015_macro
| sym::core_panic_2021_macro
)
}