From 53bf79e11c136d8e177ad83cfab371af43100b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Thu, 27 May 2021 23:12:15 +0200 Subject: [PATCH 01/10] Do not try to build LLVM with Zlib on Windows We do not install Zlib on the CI but recent builds somehow started picking it's shared version. To avoid relying on CI binaries so let's explicitly disable it. --- src/bootstrap/native.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index bde0a96f03013..3f4715e78a9ab 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -181,7 +181,7 @@ impl Step for Llvm { .define("LLVM_TARGET_ARCH", target_native.split('-').next().unwrap()) .define("LLVM_DEFAULT_TARGET_TRIPLE", target_native); - if target != "aarch64-apple-darwin" { + if target != "aarch64-apple-darwin" && !target.contains("windows") { cfg.define("LLVM_ENABLE_ZLIB", "ON"); } else { cfg.define("LLVM_ENABLE_ZLIB", "OFF"); From 8b6dad2a124f8f27fa79da2dac1d90d8789f861b Mon Sep 17 00:00:00 2001 From: Boris-Chengbiao Zhou Date: Fri, 28 May 2021 21:23:39 +0200 Subject: [PATCH 02/10] Remove `--print unversioned-files` from rustdoc This flag isn't needed anymore. See #83784. --- src/librustdoc/config.rs | 7 ------- src/librustdoc/html/render/mod.rs | 1 - src/librustdoc/html/render/write_shared.rs | 2 +- src/librustdoc/lib.rs | 3 --- .../print-unversioned-files/Makefile | 4 ---- .../unversioned-files.txt | 18 ------------------ 6 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 src/test/run-make-fulldeps/print-unversioned-files/Makefile delete mode 100644 src/test/run-make-fulldeps/print-unversioned-files/unversioned-files.txt diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 6e1fdf67a652f..90b3733821622 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -349,13 +349,6 @@ impl Options { return Err(0); } - if matches.opt_strs("print").iter().any(|opt| opt == "unversioned-files") { - for file in crate::html::render::FILES_UNVERSIONED.keys() { - println!("{}", file); - } - return Err(0); - } - let color = config::parse_color(&matches); let config::JsonConfig { json_rendered, json_unused_externs, .. } = config::parse_json(&matches); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 29b10fb8457b0..507c5e175f9b4 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -33,7 +33,6 @@ mod print_item; mod write_shared; crate use context::*; -crate use write_shared::FILES_UNVERSIONED; use std::collections::VecDeque; use std::default::Default; diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index dd0fb3a9e02ee..73ffec0dd4eeb 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -18,7 +18,7 @@ use crate::docfs::PathError; use crate::error::Error; use crate::html::{layout, static_files}; -crate static FILES_UNVERSIONED: Lazy> = Lazy::new(|| { +static FILES_UNVERSIONED: Lazy> = Lazy::new(|| { map! { "FiraSans-Regular.woff2" => static_files::fira_sans::REGULAR2, "FiraSans-Medium.woff2" => static_files::fira_sans::MEDIUM2, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 6488625c5a84d..bf0be62635630 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -581,9 +581,6 @@ fn opts() -> Vec { "Generate JSON file at the top level instead of generating HTML redirection files", ) }), - unstable("print", |o| { - o.optmulti("", "print", "Rustdoc information to print on stdout", "[unversioned-files]") - }), unstable("emit", |o| { o.optmulti( "", diff --git a/src/test/run-make-fulldeps/print-unversioned-files/Makefile b/src/test/run-make-fulldeps/print-unversioned-files/Makefile deleted file mode 100644 index e368f61cddfc3..0000000000000 --- a/src/test/run-make-fulldeps/print-unversioned-files/Makefile +++ /dev/null @@ -1,4 +0,0 @@ --include ../tools.mk - -all: - $(RUSTDOC) -Z unstable-options --print unversioned-files | sort | diff - unversioned-files.txt diff --git a/src/test/run-make-fulldeps/print-unversioned-files/unversioned-files.txt b/src/test/run-make-fulldeps/print-unversioned-files/unversioned-files.txt deleted file mode 100644 index 348cd1fdf37b3..0000000000000 --- a/src/test/run-make-fulldeps/print-unversioned-files/unversioned-files.txt +++ /dev/null @@ -1,18 +0,0 @@ -COPYRIGHT.txt -FiraSans-LICENSE.txt -FiraSans-Medium.woff -FiraSans-Medium.woff2 -FiraSans-Regular.woff -FiraSans-Regular.woff2 -LICENSE-APACHE.txt -LICENSE-MIT.txt -SourceCodePro-It.ttf.woff -SourceCodePro-LICENSE.txt -SourceCodePro-Regular.ttf.woff -SourceCodePro-Semibold.ttf.woff -SourceSerif4-Bold.ttf.woff -SourceSerif4-It.ttf.woff -SourceSerif4-LICENSE.md -SourceSerif4-Regular.ttf.woff -noto-sans-kr-v13-korean-regular-LICENSE.txt -noto-sans-kr-v13-korean-regular.woff From 23f9b92c5e3fd6dcff19fb185b64990f0336a8bf Mon Sep 17 00:00:00 2001 From: Waffle Date: Sat, 29 May 2021 10:36:30 +0300 Subject: [PATCH 03/10] Add `String::extend_from_within` This patch adds `String::extend_from_within` function under the `string_extend_from_within` feature gate similar to the `Vec::extend_from_within` function. --- library/alloc/src/lib.rs | 1 + library/alloc/src/string.rs | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 97765c36d9300..7bc9aa69be98e 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -144,6 +144,7 @@ #![feature(associated_type_bounds)] #![feature(slice_group_by)] #![feature(decl_macro)] +#![feature(bindings_after_at)] // Allow testing this library #[cfg(test)] diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index ec09595e357a6..dbe5bc1da460d 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -843,6 +843,42 @@ impl String { self.vec.extend_from_slice(string.as_bytes()) } + /// Copies elements from `src` range to the end of the string. + /// + /// ## Panics + /// + /// Panics if the starting point or end point do not lie on a [`char`] + /// boundary, or if they're out of bounds. + /// + /// ## Examples + /// + /// ``` + /// #![feature(string_extend_from_within)] + /// let mut string = String::from("abcde"); + /// + /// string.extend_from_within(2..); + /// assert_eq!(string, "abcdecde"); + /// + /// string.extend_from_within(..2); + /// assert_eq!(string, "abcdecdeab"); + /// + /// string.extend_from_within(4..8); + /// assert_eq!(string, "abcdecdeabecde"); + /// ``` + #[cfg(not(no_global_oom_handling))] + #[unstable(feature = "string_extend_from_within", issue = "none")] + pub fn extend_from_within(&mut self, src: R) + where + R: RangeBounds, + { + let src @ Range { start, end } = slice::range(src, ..self.len()); + + assert!(self.is_char_boundary(start)); + assert!(self.is_char_boundary(end)); + + self.vec.extend_from_within(src); + } + /// Returns this `String`'s capacity, in bytes. /// /// # Examples From 2f1372bbd398f1a38f6e1f993a8e38008243942b Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Fri, 28 May 2021 14:23:12 +0200 Subject: [PATCH 04/10] Add documentation for aarch64-apple-ios-sim target --- src/doc/rustc/src/SUMMARY.md | 1 + src/doc/rustc/src/platform-support.md | 2 +- .../platform-support/aarch64-apple-ios-sim.md | 56 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index b269aab98142d..bc1873b6836be 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -13,6 +13,7 @@ - [JSON Output](json.md) - [Tests](tests/index.md) - [Platform Support](platform-support.md) + - [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md) - [Target Tier Policy](target-tier-policy.md) - [Targets](targets/index.md) - [Built-in Targets](targets/built-in.md) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index b3c67b84da617..53c82b73a17db 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -196,7 +196,7 @@ host tools. target | std | host | notes -------|-----|------|------- `aarch64-apple-ios-macabi` | ? | | Apple Catalyst on ARM64 -`aarch64-apple-ios-sim` | ? | | Apple iOS Simulator on ARM64 +[`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | | Apple iOS Simulator on ARM64 `aarch64-apple-tvos` | * | | ARM64 tvOS `aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD `aarch64-unknown-hermit` | ? | | diff --git a/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md b/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md new file mode 100644 index 0000000000000..9aa5db26f917e --- /dev/null +++ b/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md @@ -0,0 +1,56 @@ +# aarch64-apple-ios-sim + +**Tier: 3** + +Apple iOS Simulator on ARM64. + +## Designated Developers + +* [@badboy](https://github.com/badboy) +* [@deg4uss3r](https://github.com/deg4uss3r) + +## Requirements + +This target is cross-compiled. +To build this target Xcode 12 or higher on macOS is required. + +## Building + +The target can be built by enabling it for a `rustc` build: + +```toml +[build] +build-stage = 1 +target = ["aarch64-apple-ios-sim"] +``` + +## Cross-compilation + +This target can be cross-compiled from `x86_64` or `aarch64` macOS hosts. + +Other hosts are not supported for cross-compilation, but might work when also providing the required Xcode SDK. + +## Testing + +Currently there is no support to run the rustc test suite for this target. + + +## Building Rust programs + +*Note: Building for this target requires the corresponding iOS SDK, as provided by Xcode 12+.* + +If `rustc` has support for that target and the library artifacts are available, +then Rust programs can be built for that target: + +```text +rustc --target aarch64-apple-ios-sim your-code.rs +``` + +On Rust Nightly it is possible to build without the target artifacts available: + +```text +cargo build -Z build-std --target aarch64-apple-ios-sim +``` + +There is no easy way to run simple programs in the iOS simulator. +Static library builds can be embedded into iOS applications. From aa1b127281ec019c65eeddabb7ba7b55b0f55752 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Fri, 28 May 2021 15:33:09 +0200 Subject: [PATCH 05/10] tier-check: Check for lines with '[' such as those containing links --- src/tools/tier-check/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/tier-check/src/main.rs b/src/tools/tier-check/src/main.rs index 6a492bbff4d40..a41e2d6e3aa45 100644 --- a/src/tools/tier-check/src/main.rs +++ b/src/tools/tier-check/src/main.rs @@ -24,7 +24,7 @@ fn main() { let doc_targets_md = std::fs::read_to_string(&src).expect("failed to read input source"); let doc_targets: HashSet<_> = doc_targets_md .lines() - .filter(|line| line.starts_with('`') && line.contains('|')) + .filter(|line| line.starts_with(&['`', '['][..]) && line.contains('|')) .map(|line| line.split('`').skip(1).next().expect("expected target code span")) .collect(); From d874ecc84f84cb4b3e1675c560759bb5deccf8d2 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Tue, 25 May 2021 22:58:42 -0500 Subject: [PATCH 06/10] Use correct edition when parsing `:pat` matchers As described in issue #85708, we currently do not properly decode `SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a result, when we decode a span from a foreign crate with `SyntaxContext::root()`, we end up up considering it to have the edition of the *current* crate, instead of the foreign crate where it was originally created. A full fix for this issue will be a fairly significant undertaking. Fortunately, it's possible to implement a partial fix, which gives us the correct edition-dependent behavior for `:pat` matchers when the macro is loaded from another crate. Since we have the edition of the macro's defining crate available, we can 'recover' from seeing a `SyntaxContext::root()` and use the edition of the macro's defining crate. Any solution to issue #85708 must reproduce the behavior of this targeted fix - properly preserving a foreign `SyntaxContext::root()` means (among other things) preserving its edition, which by definition is the edition of the foreign crate itself. Therefore, this fix moves us closer to the correct overall solution, and does not expose any new incorrect behavior to macros. --- compiler/rustc_expand/src/mbe/macro_rules.rs | 2 ++ compiler/rustc_expand/src/mbe/quoted.rs | 27 +++++++++++++++---- .../auxiliary/foreign-crate-macro-pat.rs | 11 ++++++++ src/test/ui/macros/cross-crate-pat-span.rs | 12 +++++++++ .../ui/macros/issue-84429-matches-edition.rs | 9 +++++++ 5 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 src/test/ui/macros/auxiliary/foreign-crate-macro-pat.rs create mode 100644 src/test/ui/macros/cross-crate-pat-span.rs create mode 100644 src/test/ui/macros/issue-84429-matches-edition.rs diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 91d4a0f0d6581..6608573d720a8 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -467,6 +467,7 @@ pub fn compile_declarative_macro( &sess.parse_sess, def.id, features, + edition, ) .pop() .unwrap(); @@ -492,6 +493,7 @@ pub fn compile_declarative_macro( &sess.parse_sess, def.id, features, + edition, ) .pop() .unwrap(); diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs index aca02ef93f8b5..fb7479eafc86f 100644 --- a/compiler/rustc_expand/src/mbe/quoted.rs +++ b/compiler/rustc_expand/src/mbe/quoted.rs @@ -9,7 +9,8 @@ use rustc_feature::Features; use rustc_session::parse::ParseSess; use rustc_span::symbol::{kw, Ident}; -use rustc_span::Span; +use rustc_span::edition::Edition; +use rustc_span::{Span, SyntaxContext}; use rustc_data_structures::sync::Lrc; @@ -32,6 +33,7 @@ const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \ /// - `sess`: the parsing session. Any errors will be emitted to this session. /// - `node_id`: the NodeId of the macro we are parsing. /// - `features`: language features so we can do feature gating. +/// - `edition`: the edition of the crate defining the macro /// /// # Returns /// @@ -42,6 +44,7 @@ pub(super) fn parse( sess: &ParseSess, node_id: NodeId, features: &Features, + edition: Edition, ) -> Vec { // Will contain the final collection of `self::TokenTree` let mut result = Vec::new(); @@ -52,7 +55,7 @@ pub(super) fn parse( while let Some(tree) = trees.next() { // Given the parsed tree, if there is a metavar and we are expecting matchers, actually // parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`). - let tree = parse_tree(tree, &mut trees, expect_matchers, sess, node_id, features); + let tree = parse_tree(tree, &mut trees, expect_matchers, sess, node_id, features, edition); match tree { TokenTree::MetaVar(start_sp, ident) if expect_matchers => { let span = match trees.next() { @@ -64,7 +67,19 @@ pub(super) fn parse( let kind = token::NonterminalKind::from_symbol(frag.name, || { - span.edition() + // FIXME(#85708) - once we properly decode a foreign + // crate's `SyntaxContext::root`, then we can replace + // this with just `span.edition()`. A + // `SyntaxContext::root()` from the current crate will + // have the edition of the current crate, and a + // `SyntaxxContext::root()` from a foreign crate will + // have the edition of that crate (which we manually + // retrieve via the `edition` parameter). + if span.ctxt() == SyntaxContext::root() { + edition + } else { + span.edition() + } }) .unwrap_or_else( || { @@ -117,6 +132,7 @@ pub(super) fn parse( /// - `expect_matchers`: same as for `parse` (see above). /// - `sess`: the parsing session. Any errors will be emitted to this session. /// - `features`: language features so we can do feature gating. +/// - `edition` - the edition of the crate defining the macro fn parse_tree( tree: tokenstream::TokenTree, outer_trees: &mut impl Iterator, @@ -124,6 +140,7 @@ fn parse_tree( sess: &ParseSess, node_id: NodeId, features: &Features, + edition: Edition, ) -> TokenTree { // Depending on what `tree` is, we could be parsing different parts of a macro match tree { @@ -151,7 +168,7 @@ fn parse_tree( sess.span_diagnostic.span_err(span.entire(), &msg); } // Parse the contents of the sequence itself - let sequence = parse(tts, expect_matchers, sess, node_id, features); + let sequence = parse(tts, expect_matchers, sess, node_id, features, edition); // Get the Kleene operator and optional separator let (separator, kleene) = parse_sep_and_kleene_op(&mut trees, span.entire(), sess); @@ -204,7 +221,7 @@ fn parse_tree( span, Lrc::new(Delimited { delim, - tts: parse(tts, expect_matchers, sess, node_id, features), + tts: parse(tts, expect_matchers, sess, node_id, features, edition), }), ), } diff --git a/src/test/ui/macros/auxiliary/foreign-crate-macro-pat.rs b/src/test/ui/macros/auxiliary/foreign-crate-macro-pat.rs new file mode 100644 index 0000000000000..26d4c96d52433 --- /dev/null +++ b/src/test/ui/macros/auxiliary/foreign-crate-macro-pat.rs @@ -0,0 +1,11 @@ +// edition:2018 + +#[macro_export] +macro_rules! custom_matches { + ($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => { + match $expression { + $( $pattern )|+ $( if $guard )? => true, + _ => false + } + } +} diff --git a/src/test/ui/macros/cross-crate-pat-span.rs b/src/test/ui/macros/cross-crate-pat-span.rs new file mode 100644 index 0000000000000..ed67142ce3de2 --- /dev/null +++ b/src/test/ui/macros/cross-crate-pat-span.rs @@ -0,0 +1,12 @@ +// edition:2021 +// check-pass +// aux-build: foreign-crate-macro-pat.rs +// +// Tests that the edition of the foreign crate is used +// when determining the behavior of the `:pat` matcher. + +extern crate foreign_crate_macro_pat; + +fn main() { + let _b = foreign_crate_macro_pat::custom_matches!(b'3', b'0' ..= b'9'); +} diff --git a/src/test/ui/macros/issue-84429-matches-edition.rs b/src/test/ui/macros/issue-84429-matches-edition.rs new file mode 100644 index 0000000000000..53f134c265fd7 --- /dev/null +++ b/src/test/ui/macros/issue-84429-matches-edition.rs @@ -0,0 +1,9 @@ +// edition:2021 +// check-pass +// +// Regression test for issue #84429 +// Tests that we can properly invoke `matches!` from a 2021-edition crate. + +fn main() { + let _b = matches!(b'3', b'0' ..= b'9'); +} From 8d70f40b31c360f3b61e15dc3706bad762eb9a56 Mon Sep 17 00:00:00 2001 From: r00ster Date: Sun, 30 May 2021 00:06:27 +0200 Subject: [PATCH 07/10] Fix a typo --- library/alloc/src/vec/is_zero.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/vec/is_zero.rs b/library/alloc/src/vec/is_zero.rs index 6fade636df9e2..0efc4893c3c42 100644 --- a/library/alloc/src/vec/is_zero.rs +++ b/library/alloc/src/vec/is_zero.rs @@ -73,7 +73,7 @@ unsafe impl IsZero for Option> { // `Option` and similar have a representation guarantee that // they're the same size as the corresponding `u32` type, as well as a guarantee // that transmuting between `NonZeroU32` and `Option` works. -// While the documentation officially makes in UB to transmute from `None`, +// While the documentation officially makes it UB to transmute from `None`, // we're the standard library so we can make extra inferences, and we know that // the only niche available to represent `None` is the one that's all zeros. From b237f90ab9a83ffe3a56338b89dfa1d21f5a2560 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Sun, 30 May 2021 00:07:34 +0200 Subject: [PATCH 08/10] Don't drop `PResult` without handling the error --- compiler/rustc_parse/src/parser/item.rs | 5 +++- .../ui/parser/fn-field-parse-error-ice.rs | 10 ++++++++ .../ui/parser/fn-field-parse-error-ice.stderr | 24 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/parser/fn-field-parse-error-ice.rs create mode 100644 src/test/ui/parser/fn-field-parse-error-ice.stderr diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index c64fab0507c94..54e6ff6272c05 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1474,7 +1474,10 @@ impl<'a> Parser<'a> { self.sess.gated_spans.gate(sym::unnamed_fields, lo); } else { let err = if self.check_fn_front_matter(false) { - let _ = self.parse_fn(&mut Vec::new(), |_| true, lo); + // We use `parse_fn` to get a span for the function + if let Err(mut db) = self.parse_fn(&mut Vec::new(), |_| true, lo) { + db.delay_as_bug(); + } let mut err = self.struct_span_err( lo.to(self.prev_token.span), &format!("functions are not allowed in {} definitions", adt_ty), diff --git a/src/test/ui/parser/fn-field-parse-error-ice.rs b/src/test/ui/parser/fn-field-parse-error-ice.rs new file mode 100644 index 0000000000000..4ea55062fc4be --- /dev/null +++ b/src/test/ui/parser/fn-field-parse-error-ice.rs @@ -0,0 +1,10 @@ +// Regression test for #85794 + +struct Baz { + inner : dyn fn () + //~^ ERROR expected `,`, or `}`, found keyword `fn` + //~| ERROR functions are not allowed in struct definitions + //~| ERROR cannot find type `dyn` in this scope +} + +fn main() {} diff --git a/src/test/ui/parser/fn-field-parse-error-ice.stderr b/src/test/ui/parser/fn-field-parse-error-ice.stderr new file mode 100644 index 0000000000000..d582f61cc97a9 --- /dev/null +++ b/src/test/ui/parser/fn-field-parse-error-ice.stderr @@ -0,0 +1,24 @@ +error: expected `,`, or `}`, found keyword `fn` + --> $DIR/fn-field-parse-error-ice.rs:4:16 + | +LL | inner : dyn fn () + | ^ help: try adding a comma: `,` + +error: functions are not allowed in struct definitions + --> $DIR/fn-field-parse-error-ice.rs:4:17 + | +LL | inner : dyn fn () + | ^^ + | + = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks + = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information + +error[E0412]: cannot find type `dyn` in this scope + --> $DIR/fn-field-parse-error-ice.rs:4:13 + | +LL | inner : dyn fn () + | ^^^ not found in this scope + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0412`. From b4148e926a84482c5733a17a7469d9334e5a5557 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 14 May 2021 13:41:19 +0200 Subject: [PATCH 09/10] Add eslint checks in CI --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index fd6dc563a0ec8..66afe84be4a27 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -22,6 +22,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}" # Install es-check # Pin its version to prevent unrelated CI failures due to future es-check versions. RUN npm install es-check@5.2.3 -g +RUN npm install eslint@7.20.0 -g COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh @@ -37,4 +38,5 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \ python3 ../x.py doc --stage 0 library/test && \ /scripts/validate-toolstate.sh && \ # Runs checks to ensure that there are no ES5 issues in our JS code. - es-check es5 ../src/librustdoc/html/static/*.js + es-check es5 ../src/librustdoc/html/static/*.js && \ + eslint ../src/librustdoc/html/static/*.js From 558b073c4c8f73bac8061befef7cff01d038910a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 30 May 2021 20:20:59 +0200 Subject: [PATCH 10/10] Fix eslint error in sidebar-items.js --- src/librustdoc/html/static/sidebar-items.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/sidebar-items.js b/src/librustdoc/html/static/sidebar-items.js index 81172ba0d9280..256cd2740a010 100644 --- a/src/librustdoc/html/static/sidebar-items.js +++ b/src/librustdoc/html/static/sidebar-items.js @@ -1 +1,2 @@ +/* global initSidebarItems */ initSidebarItems({});