From a7633b8a71d163a7392f4ef2cb80ea7076302f71 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Thu, 17 Aug 2023 12:07:22 +0100 Subject: [PATCH 1/3] Add an (perma-)unstable option to disable vtable vptr This flag is intended for evaluation of trait upcasting space cost for embedded use cases. --- compiler/rustc_interface/src/tests.rs | 1 + compiler/rustc_session/src/options.rs | 2 ++ compiler/rustc_trait_selection/src/traits/vtable.rs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index e3d66d18388c6..b53ba251bcd5b 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -807,6 +807,7 @@ fn test_unstable_options_tracking_hash() { tracked!(no_jump_tables, true); tracked!(no_link, true); tracked!(no_profiler_runtime, true); + tracked!(no_trait_vptr, true); tracked!(no_unique_section_names, true); tracked!(oom, OomStrategy::Panic); tracked!(osx_rpath_install_name, true); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 055ab2d9c1583..40099de707be6 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1631,6 +1631,8 @@ options! { "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"), no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED], "prevent automatic injection of the profiler_builtins crate"), + no_trait_vptr: bool = (false, parse_no_flag, [TRACKED], + "disable generation of trait vptr in vtable for upcasting"), no_unique_section_names: bool = (false, parse_bool, [TRACKED], "do not use unique names for text and data sections when -Z function-sections is used"), normalize_docs: bool = (false, parse_bool, [TRACKED], diff --git a/compiler/rustc_trait_selection/src/traits/vtable.rs b/compiler/rustc_trait_selection/src/traits/vtable.rs index 427ac36843215..e41073937be11 100644 --- a/compiler/rustc_trait_selection/src/traits/vtable.rs +++ b/compiler/rustc_trait_selection/src/traits/vtable.rs @@ -152,7 +152,7 @@ fn prepare_vtable_segments_inner<'tcx, T>( while let Some((inner_most_trait_ref, emit_vptr, mut siblings)) = stack.pop() { segment_visitor(VtblSegment::TraitOwnEntries { trait_ref: inner_most_trait_ref, - emit_vptr, + emit_vptr: emit_vptr && !tcx.sess.opts.unstable_opts.no_trait_vptr, })?; // If we've emitted (fed to `segment_visitor`) a trait that has methods present in the vtable, From 879e106460b929932bf3819df6da79834dd4b490 Mon Sep 17 00:00:00 2001 From: ozkanonur Date: Sun, 27 Aug 2023 06:26:02 +0300 Subject: [PATCH 2/3] replace outdated github username 'ozkanonur' Signed-off-by: ozkanonur --- src/bootstrap/config/tests.rs | 2 +- triagebot.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/config/tests.rs b/src/bootstrap/config/tests.rs index c340bb2982a2b..b8f3be9606291 100644 --- a/src/bootstrap/config/tests.rs +++ b/src/bootstrap/config/tests.rs @@ -35,7 +35,7 @@ fn download_ci_llvm() { )); } -// FIXME(ozkanonur): extend scope of the test +// FIXME(onur-ozkan): extend scope of the test // refs: // - https://github.com/rust-lang/rust/issues/109120 // - https://github.com/rust-lang/rust/pull/109162#issuecomment-1496782487 diff --git a/triagebot.toml b/triagebot.toml index aef5b5bb8dc06..7aaf90d49a7a1 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -616,7 +616,7 @@ libs = [ bootstrap = [ "@Mark-Simulacrum", "@albertlarsan68", - "@ozkanonur", + "@onur-ozkan", "@clubby789", ] infra-ci = [ @@ -749,4 +749,4 @@ style-team = [ "/src/tools/rustdoc-themes" = ["rustdoc"] "/src/tools/tidy" = ["bootstrap"] "/src/tools/x" = ["bootstrap"] -"/src/tools/rustdoc-gui-test" = ["bootstrap", "@ozkanonur"] +"/src/tools/rustdoc-gui-test" = ["bootstrap", "@onur-ozkan"] From fde47b62936124e2c28ddcdf6a128be9e7cb702b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 27 Aug 2023 11:02:53 +0200 Subject: [PATCH 3/3] Unify CSS color formats a bit more --- src/librustdoc/html/static/css/themes/ayu.css | 6 +++--- src/librustdoc/html/static/css/themes/dark.css | 10 +++++----- src/librustdoc/html/static/css/themes/light.css | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index c81a80eeca059..873a1668f8b99 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -31,7 +31,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) --codeblock-error-color: rgba(255, 0, 0, .5); --codeblock-ignore-hover-color: rgb(255, 142, 0); --codeblock-ignore-color: rgba(255, 142, 0, .6); - --warning-border-color: rgb(255, 142, 0); + --warning-border-color: #ff8e00; --type-link-color: #ffa0a5; --trait-link-color: #39afd7; --assoc-item-link-color: #39afd7; @@ -96,8 +96,8 @@ Original by Dempfi (https://github.com/dempfi/ayu) --codeblock-link-background: #333; --scrape-example-toggle-line-background: #999; --scrape-example-toggle-line-hover-background: #c5c5c5; - --scrape-example-code-line-highlight: rgb(91, 59, 1); - --scrape-example-code-line-highlight-focus: rgb(124, 75, 15); + --scrape-example-code-line-highlight: #5b3b01; + --scrape-example-code-line-highlight-focus: #7c4b0f; --scrape-example-help-border-color: #aaa; --scrape-example-help-color: #eee; --scrape-example-help-hover-border-color: #fff; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 0f8b1dc24a651..2b6e28d35a5ff 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -26,7 +26,7 @@ --codeblock-error-color: rgba(255, 0, 0, .5); --codeblock-ignore-hover-color: rgb(255, 142, 0); --codeblock-ignore-color: rgba(255, 142, 0, .6); - --warning-border-color: rgb(255, 142, 0); + --warning-border-color: #ff8e00; --type-link-color: #2dbfb8; --trait-link-color: #b78cf2; --assoc-item-link-color: #d2991d; @@ -69,7 +69,7 @@ --test-arrow-color: #dedede; --test-arrow-background-color: rgba(78, 139, 202, 0.2); --test-arrow-hover-color: #dedede; - --test-arrow-hover-background-color: rgb(78, 139, 202); + --test-arrow-hover-background-color: #4e8bca; --target-background-color: #494a3d; --target-border-color: #bb7410; --kbd-color: #000; @@ -87,12 +87,12 @@ --crate-search-hover-border: #2196f3; --src-sidebar-background-selected: #333; --src-sidebar-background-hover: #444; - --table-alt-row-background-color: #2A2A2A; + --table-alt-row-background-color: #2a2a2a; --codeblock-link-background: #333; --scrape-example-toggle-line-background: #999; --scrape-example-toggle-line-hover-background: #c5c5c5; - --scrape-example-code-line-highlight: rgb(91, 59, 1); - --scrape-example-code-line-highlight-focus: rgb(124, 75, 15); + --scrape-example-code-line-highlight: #5b3b01; + --scrape-example-code-line-highlight-focus: #7c4b0f; --scrape-example-help-border-color: #aaa; --scrape-example-help-color: #eee; --scrape-example-help-hover-border-color: #fff; diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 39ea44a116544..9c016db4502c9 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -5,9 +5,9 @@ --settings-input-border-color: #717171; --settings-button-color: #000; --settings-button-border-focus: #717171; - --sidebar-background-color: #F5F5F5; - --sidebar-background-color-hover: #E0E0E0; - --code-block-background-color: #F5F5F5; + --sidebar-background-color: #f5f5f5; + --sidebar-background-color-hover: #e0e0e0; + --code-block-background-color: #f5f5f5; --scrollbar-track-background-color: #dcdcdc; --scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6); --scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9; @@ -26,7 +26,7 @@ --codeblock-error-color: rgba(255, 0, 0, .5); --codeblock-ignore-hover-color: rgb(255, 142, 0); --codeblock-ignore-color: rgba(255, 142, 0, .6); - --warning-border-color: rgb(255, 142, 0); + --warning-border-color: #ff8e00; --type-link-color: #ad378a; --trait-link-color: #6e4fc9; --assoc-item-link-color: #3873ad; @@ -47,7 +47,7 @@ --search-tab-button-not-selected-border-top-color: #e6e6e6; --search-tab-button-not-selected-background: #e6e6e6; --search-tab-button-selected-border-top-color: #0089ff; - --search-tab-button-selected-background: #ffffff; + --search-tab-button-selected-background: #fff; --stab-background-color: #fff5d6; --stab-code-color: #000; --code-highlight-kw-color: #8959a8; @@ -84,7 +84,7 @@ --crate-search-hover-border: #717171; --src-sidebar-background-selected: #fff; --src-sidebar-background-hover: #e0e0e0; - --table-alt-row-background-color: #F5F5F5; + --table-alt-row-background-color: #f5f5f5; --codeblock-link-background: #eee; --scrape-example-toggle-line-background: #ccc; --scrape-example-toggle-line-hover-background: #999;