diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 6a691abae02..9daee12ca2e 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -641,7 +641,14 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> { // current number of evaluated terminators is a power of 2. The latter gives us a cheap // way to implement exponential backoff. let span = ecx.cur_span(); - ecx.tcx.dcx().emit_warn(LongRunningWarn { span, item_span: ecx.tcx.span }); + // We store a unique number in `force_duplicate` to evade `-Z deduplicate-diagnostics`. + // `new_steps` is guaranteed to be unique because `ecx.machine.num_evaluated_steps` is + // always increasing. + ecx.tcx.dcx().emit_warn(LongRunningWarn { + span, + item_span: ecx.tcx.span, + force_duplicate: new_steps, + }); } } diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index b66b5c0a00a..06ae5b30be0 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -209,6 +209,8 @@ pub struct LongRunningWarn { pub span: Span, #[help] pub item_span: Span, + // Used for evading `-Z deduplicate-diagnostics`. + pub force_duplicate: usize, } #[derive(Subdiagnostic)] diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index 1061633be17..7af7de60fcb 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 macOS (11.0+, Big Sur+)".into()), + description: Some("ARM64 Apple macOS (11.0+, Big Sur+)".into()), tier: Some(1), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index caeb9a121e4..499f05d9ee6 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 iOS".into()), + description: Some("ARM64 Apple iOS".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index eee9eca3bcb..0fd5d0f83d2 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("Apple Catalyst on ARM64".into()), + description: Some("ARM64 Apple Mac Catalyst".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index ee58038301d..0f58d4e2730 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("Apple iOS Simulator on ARM64".into()), + description: Some("ARM64 Apple iOS Simulator".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index baca863d442..49c7b30817d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 tvOS".into()), + description: Some("ARM64 Apple tvOS".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index 1a48f8c5acf..2cb2d0b3fff 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 tvOS Simulator".into()), + description: Some("ARM64 Apple tvOS Simulator".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs index 1940a568b39..6233febd8c5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 Apple WatchOS".into()), + description: Some("ARM64 Apple watchOS".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index 6beef11c504..64d24b8a075 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("ARM64 Apple WatchOS Simulator".into()), + description: Some("ARM64 Apple watchOS Simulator".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index e9f4d9330d5..60b1c1db63a 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("Arm Apple WatchOS 64-bit with 32-bit pointers".into()), + description: Some("ARM64 Apple watchOS with 32-bit pointers".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs index deee6985f1a..5af760f68ef 100644 --- a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("Armv7-A Apple-A6 Apple iOS".into()), + description: Some("ARMv7-A Apple-A6 Apple iOS".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs index dc14cb3ec76..7078b57e98b 100644 --- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("32-bit x86 iOS".into()), + description: Some("x86 Apple iOS Simulator".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs index 3e27f1f899b..9d9a8fc6305 100644 --- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("32-bit macOS (10.12+, Sierra+)".into()), + description: Some("x86 Apple macOS (10.12+, Sierra+)".into()), tier: Some(3), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index 4304dfc3f68..70211722fa2 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("64-bit macOS (10.12+, Sierra+)".into()), + description: Some("x86_64 Apple macOS (10.12+, Sierra+)".into()), tier: Some(1), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs index 847c4f011f9..c021762aed0 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("64-bit x86 iOS".into()), + description: Some("x86_64 Apple iOS Simulator".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs index 042079f800b..a7ba81303cf 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("Apple Catalyst on x86_64".into()), + description: Some("x86_64 Apple Mac Catalyst".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs index 94708609790..d81220b6b31 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("x86 64-bit tvOS".into()), + description: Some("x86_64 Apple tvOS Simulator".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs index 1dab9598860..c7333a0bbcc 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("x86 64-bit Apple WatchOS simulator".into()), + description: Some("x86_64 Apple watchOS Simulator".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index 9fb5a46187a..e3550b6e11f 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -29,7 +29,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, metadata: crate::spec::TargetMetadata { - description: Some("macOS with late-gen Intel (at least Haswell)".into()), + description: Some("x86_64 Apple macOS with Intel Haswell+".into()), tier: Some(3), host_tools: Some(true), std: Some(true), diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index e1ab1e7599e..db7b239c0ae 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1057,6 +1057,10 @@ pub fn rustc_cargo( // killed, rather than having an error bubble up and cause a panic. cargo.rustflag("-Zon-broken-pipe=kill"); + if builder.config.llvm_enzyme { + cargo.rustflag("-l").rustflag("Enzyme-19"); + } + // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary // and may just be a time sink. if compiler.stage != 0 { diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 2124890b94f..d2c23ee8432 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -1592,12 +1592,6 @@ impl<'a> Builder<'a> { rustflags.arg(sysroot_str); } - // https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20link.20new.20library.20into.20stage1.2Frustc - if self.config.llvm_enzyme { - rustflags.arg("-l"); - rustflags.arg("Enzyme-19"); - } - let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling { Some(setting) => { // If an explicit setting is given, use that diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 6f4665db6f1..050ba60318e 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -261,7 +261,9 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> { \ ", added_classes = added_classes.join(" "), - text = Escape(&original_text), + text = Escape( + original_text.strip_suffix('\n').unwrap_or(&original_text) + ), ) .into(), )); diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index e490099a92e..3ec60c0efd2 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -524,15 +524,13 @@ fn test_ascii_with_prepending_hashtag() { ####.###..#....#....#..#. #..#.#....#....#....#..#. #..#.#....#....#....#..#. -#..#.####.####.####..##.. -", +#..#.####.####.####..##..", ); t( r#"```markdown # hello ```"#, "
\
-# hello
-
", +# hello", ); } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index a0ec45b5ef3..0eba80133df 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -986,7 +986,13 @@ function preLoadCss(cssUrl) { }()); window.rustdoc_add_line_numbers_to_examples = () => { - onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { + if (document.querySelector(".rustdoc.src")) { + // We are in the source code page, nothing to be done here! + return; + } + onEachLazy(document.querySelectorAll( + ":not(.scraped-example) > .example-wrap > pre:not(.example-line-numbers)", + ), x => { const parent = x.parentNode; const line_numbers = parent.querySelectorAll(".example-line-numbers"); if (line_numbers.length > 0) { @@ -1005,12 +1011,8 @@ function preLoadCss(cssUrl) { }; window.rustdoc_remove_line_numbers_from_examples = () => { - onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { - const parent = x.parentNode; - const line_numbers = parent.querySelectorAll(".example-line-numbers"); - for (const node of line_numbers) { - parent.removeChild(node); - } + onEachLazy(document.querySelectorAll(".example-wrap > .example-line-numbers"), x => { + x.parentNode.removeChild(x); }); }; diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index fed916ac246..53f756dfcd6 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -87,7 +87,7 @@ assert-css: ("#settings", {"display": "block"}) // Then, click the toggle button. click: "input#line-numbers" -wait-for: 100 // wait-for-false does not exist +wait-for: 100 // FIXME: `wait-for-false` does not exist assert-false: "pre.example-line-numbers" assert-local-storage: {"rustdoc-line-numbers": "false" } @@ -107,6 +107,8 @@ assert-css: ( click: "input#line-numbers" wait-for: "pre.example-line-numbers" assert-local-storage: {"rustdoc-line-numbers": "true" } +wait-for: 100 // FIXME: `wait-for-false` does not exist +assert: "pre.example-line-numbers" // Same check with scraped examples line numbers. go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" @@ -145,9 +147,6 @@ assert-css: ( ALL, ) -// Checking line numbers on scraped code examples. -go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" - define-function: ( "check-padding", [path, padding_bottom], @@ -157,19 +156,19 @@ define-function: ( "padding-bottom": "0px", "padding-left": "0px", "padding-right": "0px", - }) + }, ALL) assert-css: (|path| + " .src-line-numbers > pre", { "padding-top": "14px", "padding-bottom": |padding_bottom|, "padding-left": "0px", "padding-right": "0px", - }) + }, ALL) assert-css: (|path| + " .src-line-numbers > pre > span", { "padding-top": "0px", "padding-bottom": "0px", "padding-left": "8px", "padding-right": "8px", - }) + }, ALL) }, ) @@ -188,6 +187,35 @@ call-function: ("check-padding", { "padding_bottom": "14px", }) +define-function: ("check-line-numbers-existence", [], block { + assert-local-storage: {"rustdoc-line-numbers": "true" } + assert-false: ".example-line-numbers" + click: "#settings-menu" + wait-for: "#settings" + + // Then, click the toggle button. + click: "input#line-numbers" + wait-for: 100 // FIXME: `wait-for-false` does not exist + assert-local-storage-false: {"rustdoc-line-numbers": "true" } + assert-false: ".example-line-numbers" + // Line numbers should still be there. + assert: ".src-line-numbers" + // Now disabling the setting. + click: "input#line-numbers" + wait-for: 100 // FIXME: `wait-for-false` does not exist + assert-local-storage: {"rustdoc-line-numbers": "true" } + assert-false: ".example-line-numbers" + // Line numbers should still be there. + assert: ".src-line-numbers" + // Closing settings menu. + click: "#settings-menu" + wait-for-css: ("#settings", {"display": "none"}) +}) + +// Checking that turning off the line numbers setting won't remove line numbers from scraped +// examples. +call-function: ("check-line-numbers-existence", {}) + // Now checking the line numbers in the source code page. click: ".src" assert-css: (".src-line-numbers", { @@ -202,3 +230,28 @@ assert-css: (".src-line-numbers > a", { "padding-left": "8px", "padding-right": "8px", }) +// Checking that turning off the line numbers setting won't remove line numbers. +call-function: ("check-line-numbers-existence", {}) + +// Now checking that even non-rust code blocks have line numbers generated. +go-to: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" +assert-local-storage: {"rustdoc-line-numbers": "true" } +assert: ".example-wrap > pre.language-txt" +assert: ".example-wrap > pre.rust" +assert-count: (".example-wrap", 2) +assert-count: (".example-wrap > pre.example-line-numbers", 2) + +click: "#settings-menu" +wait-for: "#settings" + +// Then, click the toggle button. +click: "input#line-numbers" +wait-for: 100 // FIXME: `wait-for-false` does not exist +assert-local-storage-false: {"rustdoc-line-numbers": "true" } +assert-count: (".example-wrap > pre.example-line-numbers", 0) + +// Now turning off the setting. +click: "input#line-numbers" +wait-for: 100 // FIXME: `wait-for-false` does not exist +assert-local-storage: {"rustdoc-line-numbers": "true" } +assert-count: (".example-wrap > pre.example-line-numbers", 2) diff --git a/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.rs b/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.rs new file mode 100644 index 00000000000..a2d34eaa384 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.rs @@ -0,0 +1,24 @@ +//@ check-pass + +#![allow(long_running_const_eval)] + +//@ compile-flags: -Z tiny-const-eval-limit -Z deduplicate-diagnostics=yes +const FOO: () = { + let mut i = 0; + loop { + //~^ WARN is taking a long time + //~| WARN is taking a long time + //~| WARN is taking a long time + //~| WARN is taking a long time + //~| WARN is taking a long time + if i == 1000 { + break; + } else { + i += 1; + } + } +}; + +fn main() { + FOO +} diff --git a/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.stderr b/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.stderr new file mode 100644 index 00000000000..cb19c59b15b --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/evade-deduplication-issue-118612.stderr @@ -0,0 +1,92 @@ +warning: constant evaluation is taking a long time + --> $DIR/evade-deduplication-issue-118612.rs:8:5 + | +LL | / loop { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_____^ the const evaluator is currently interpreting this expression + | +help: the constant being evaluated + --> $DIR/evade-deduplication-issue-118612.rs:6:1 + | +LL | const FOO: () = { + | ^^^^^^^^^^^^^ + +warning: constant evaluation is taking a long time + --> $DIR/evade-deduplication-issue-118612.rs:8:5 + | +LL | / loop { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_____^ the const evaluator is currently interpreting this expression + | +help: the constant being evaluated + --> $DIR/evade-deduplication-issue-118612.rs:6:1 + | +LL | const FOO: () = { + | ^^^^^^^^^^^^^ + +warning: constant evaluation is taking a long time + --> $DIR/evade-deduplication-issue-118612.rs:8:5 + | +LL | / loop { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_____^ the const evaluator is currently interpreting this expression + | +help: the constant being evaluated + --> $DIR/evade-deduplication-issue-118612.rs:6:1 + | +LL | const FOO: () = { + | ^^^^^^^^^^^^^ + +warning: constant evaluation is taking a long time + --> $DIR/evade-deduplication-issue-118612.rs:8:5 + | +LL | / loop { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_____^ the const evaluator is currently interpreting this expression + | +help: the constant being evaluated + --> $DIR/evade-deduplication-issue-118612.rs:6:1 + | +LL | const FOO: () = { + | ^^^^^^^^^^^^^ + +warning: constant evaluation is taking a long time + --> $DIR/evade-deduplication-issue-118612.rs:8:5 + | +LL | / loop { +LL | | +LL | | +LL | | +... | +LL | | } +LL | | } + | |_____^ the const evaluator is currently interpreting this expression + | +help: the constant being evaluated + --> $DIR/evade-deduplication-issue-118612.rs:6:1 + | +LL | const FOO: () = { + | ^^^^^^^^^^^^^ + +warning: 5 warnings emitted + diff --git a/tests/ui/lint/extern-C-fnptr-lints-slices.rs b/tests/ui/lint/extern-C-fnptr-lints-slices.rs new file mode 100644 index 00000000000..0c35eb37a48 --- /dev/null +++ b/tests/ui/lint/extern-C-fnptr-lints-slices.rs @@ -0,0 +1,9 @@ +#[deny(improper_ctypes_definitions)] + +// It's an improper ctype (a slice) arg in an extern "C" fnptr. + +pub type F = extern "C" fn(&[u8]); +//~^ ERROR: `extern` fn uses type `[u8]`, which is not FFI-safe + + +fn main() {} diff --git a/tests/ui/lint/extern-C-fnptr-lints-slices.stderr b/tests/ui/lint/extern-C-fnptr-lints-slices.stderr new file mode 100644 index 00000000000..d13f93ca96f --- /dev/null +++ b/tests/ui/lint/extern-C-fnptr-lints-slices.stderr @@ -0,0 +1,16 @@ +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/extern-C-fnptr-lints-slices.rs:5:14 + | +LL | pub type F = extern "C" fn(&[u8]); + | ^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent +note: the lint level is defined here + --> $DIR/extern-C-fnptr-lints-slices.rs:1:8 + | +LL | #[deny(improper_ctypes_definitions)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error +