diff options
| author | bors <bors@rust-lang.org> | 2024-11-01 21:49:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-01 21:49:15 +0000 |
| commit | 7c7bb7dc017545db732f5cffec684bbaeae0a9a0 (patch) | |
| tree | 4b759b4f7ab6c0ed78607950af67edbb169d342e /src | |
| parent | 705cfe0e966399e061d64dd3661bfbc57553ed87 (diff) | |
| parent | 305ca05cbe1015f7841427a5c014b435ce7319ce (diff) | |
Auto merge of #132470 - GuillaumeGomez:rollup-1a1mkmp, r=GuillaumeGomez
Rollup of 14 pull requests Successful merges: - #131829 (Remove support for `-Zprofile` (gcov-style coverage instrumentation)) - #132369 (style-guide: Only use the new binop heuristic for assignments) - #132383 (Implement suggestion for never type fallback lints) - #132413 (update offset_of! docs to reflect the stabilization of nesting) - #132438 (Remove unncessary option for default rust-analyzer setting) - #132439 (Add `f16` and `f128` to `invalid_nan_comparison`) - #132444 (rustdoc: Directly use rustc_abi instead of reexports) - #132445 (Cleanup attributes around unchecked shifts and unchecked negation in const) - #132448 (Add missing backtick) - #132450 (Show actual MIR when MIR building forgot to terminate block) - #132451 (remove some unnecessary rustc_allow_const_fn_unstable) - #132455 (make const_alloc_layout feature gate only about functions that are already stable) - #132456 (Move remaining inline assembly test files into asm directory) - #132459 (feat(byte_sub_ptr): unstably add ptr::byte_sub_ptr) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/setup.rs | 1 | ||||
| -rw-r--r-- | src/doc/rustc/src/instrument-coverage.md | 8 | ||||
| -rw-r--r-- | src/doc/style-guide/src/editions.md | 5 | ||||
| -rw-r--r-- | src/doc/style-guide/src/expressions.md | 12 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/profile.md | 27 | ||||
| -rw-r--r-- | src/etc/rust_analyzer_settings.json | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/types.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/type_layout.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 22 |
11 files changed, 28 insertions, 66 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 51964977933..704fa46ab1e 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -571,6 +571,7 @@ Select which editor you would like to set up [default: None]: "; "b526bd58d0262dd4dda2bff5bc5515b705fb668a46235ace3e057f807963a11a", "828666b021d837a33e78d870b56d34c88a5e2c85de58b693607ec574f0c27000", "811fb3b063c739d261fd8590dd30242e117908f5a095d594fa04585daa18ec4d", + "4eecb58a2168b252077369da446c30ed0e658301efe69691979d1ef0443928f4", ], EditorKind::Emacs => vec![ "51068d4747a13732440d1a8b8f432603badb1864fa431d83d0fd4f8fa57039e0", diff --git a/src/doc/rustc/src/instrument-coverage.md b/src/doc/rustc/src/instrument-coverage.md index ed091d8fc57..41da47e9206 100644 --- a/src/doc/rustc/src/instrument-coverage.md +++ b/src/doc/rustc/src/instrument-coverage.md @@ -2,12 +2,8 @@ ## Introduction -The Rust compiler includes two code coverage implementations: - -- A GCC-compatible, gcov-based coverage implementation, enabled with `-Z profile`, which derives coverage data based on DebugInfo. -- A source-based code coverage implementation, enabled with `-C instrument-coverage`, which uses LLVM's native, efficient coverage instrumentation to generate very precise coverage data. - -This document describes how to enable and use the LLVM instrumentation-based coverage, via the `-C instrument-coverage` compiler flag. +This document describes how to enable and use LLVM instrumentation-based coverage, +via the `-C instrument-coverage` compiler flag. ## How it works diff --git a/src/doc/style-guide/src/editions.md b/src/doc/style-guide/src/editions.md index 74e873e35ff..d9dba641495 100644 --- a/src/doc/style-guide/src/editions.md +++ b/src/doc/style-guide/src/editions.md @@ -40,8 +40,9 @@ include: of a delimited expression, delimited expressions are generally combinable, regardless of the number of members. Previously only applied with exactly one member (except for closures with explicit blocks). -- When line-breaking a binary operator, if the first operand spans multiple - lines, use the base indentation of the last line. +- When line-breaking an assignment operator, if the left-hand side spans + multiple lines, use the base indentation of the last line of the left-hand + side to indent the right-hand side. - Miscellaneous `rustfmt` bugfixes. - Use version-sort (sort `x8`, `x16`, `x32`, `x64`, `x128` in that order). - Change "ASCIIbetical" sort to Unicode-aware "non-lowercase before lowercase". diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md index 3bb0ee6d5ff..4f63a632030 100644 --- a/src/doc/style-guide/src/expressions.md +++ b/src/doc/style-guide/src/expressions.md @@ -328,9 +328,9 @@ foo_bar Prefer line-breaking at an assignment operator (either `=` or `+=`, etc.) rather than at other binary operators. -If line-breaking at a binary operator (including assignment operators) where the -first operand spans multiple lines, use the base indentation of the *last* -line of the first operand, and indent relative to that: +If line-breaking an assignment operator where the left-hand side spans multiple +lines, use the base indentation of the *last* line of the left-hand side, and +indent the right-hand side relative to that: ```rust impl SomeType { @@ -344,12 +344,6 @@ impl SomeType { self.array[array_index as usize] .as_mut() .expect("thing must exist") - .extra_info - + long_long_long_long_long_long_long_long_long_long_long_long_long_long_long; - - self.array[array_index as usize] - .as_mut() - .expect("thing must exist") .extra_info = Some(ExtraInfo { parent, count: count as u16, diff --git a/src/doc/unstable-book/src/compiler-flags/profile.md b/src/doc/unstable-book/src/compiler-flags/profile.md deleted file mode 100644 index 71303bfaff2..00000000000 --- a/src/doc/unstable-book/src/compiler-flags/profile.md +++ /dev/null @@ -1,27 +0,0 @@ -# `profile` - -The tracking issue for this feature is: [#42524](https://github.com/rust-lang/rust/issues/42524). - ------------------------- - -This feature allows the generation of code coverage reports. - -Set the `-Zprofile` compiler flag in order to enable gcov profiling. - -For example: -```Bash -cargo new testgcov --bin -cd testgcov -export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" -export CARGO_INCREMENTAL=0 -cargo build -cargo run -``` - -Once you've built and run your program, files with the `gcno` (after build) and `gcda` (after execution) extensions will be created. -You can parse them with [llvm-cov gcov](https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-gcov) or [grcov](https://github.com/mozilla/grcov). - -Please note that `RUSTFLAGS` by default applies to everything that cargo builds and runs during a build! -When the `--target` flag is explicitly passed to cargo, the `RUSTFLAGS` no longer apply to build scripts and procedural macros. -For more fine-grained control consider passing a `RUSTC_WRAPPER` program to cargo that only adds the profiling flags to -rustc for the specific crates you want to profile. diff --git a/src/etc/rust_analyzer_settings.json b/src/etc/rust_analyzer_settings.json index a20105f0ef3..d1b186fd316 100644 --- a/src/etc/rust_analyzer_settings.json +++ b/src/etc/rust_analyzer_settings.json @@ -1,6 +1,5 @@ { "git.detectSubmodulesLimit": 20, - "rust-analyzer.check.invocationLocation": "root", "rust-analyzer.check.invocationStrategy": "once", "rust-analyzer.check.overrideCommand": [ "python3", @@ -24,7 +23,6 @@ "rust-analyzer.procMacro.server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv", "rust-analyzer.procMacro.enable": true, "rust-analyzer.cargo.buildScripts.enable": true, - "rust-analyzer.cargo.buildScripts.invocationLocation": "root", "rust-analyzer.cargo.buildScripts.invocationStrategy": "once", "rust-analyzer.cargo.buildScripts.overrideCommand": [ "python3", diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index c62144be3da..d49b4320db6 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -5,6 +5,7 @@ use std::sync::{Arc, OnceLock as OnceCell}; use std::{fmt, iter}; use arrayvec::ArrayVec; +use rustc_abi::{ExternAbi, VariantIdx}; use rustc_ast::MetaItemInner; use rustc_ast_pretty::pprust; use rustc_attr::{ConstStability, Deprecation, Stability, StableSince}; @@ -26,8 +27,6 @@ use rustc_session::Session; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{Ident, Symbol, kw, sym}; use rustc_span::{DUMMY_SP, FileName, Loc}; -use rustc_target::abi::VariantIdx; -use rustc_target::spec::abi::Abi; use thin_vec::ThinVec; use tracing::{debug, trace}; use {rustc_ast as ast, rustc_hir as hir}; @@ -656,7 +655,7 @@ impl Item { let def_id = self.def_id().unwrap(); let abi = tcx.fn_sig(def_id).skip_binder().abi(); hir::FnHeader { - safety: if abi == Abi::RustIntrinsic { + safety: if abi == ExternAbi::RustIntrinsic { intrinsic_operation_unsafety(tcx, def_id.expect_local()) } else { safety @@ -2342,7 +2341,7 @@ pub(crate) struct BareFunctionDecl { pub(crate) safety: hir::Safety, pub(crate) generic_params: Vec<GenericParamDef>, pub(crate) decl: FnDecl, - pub(crate) abi: Abi, + pub(crate) abi: ExternAbi, } #[derive(Clone, Debug)] diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 47c21d89177..e9d5ba2ea57 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -13,6 +13,7 @@ use std::fmt::{self, Display, Write}; use std::iter::{self, once}; use itertools::Itertools; +use rustc_abi::ExternAbi; use rustc_attr::{ConstStability, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashSet; @@ -23,7 +24,6 @@ use rustc_metadata::creader::{CStore, LoadedMacro}; use rustc_middle::ty::{self, TyCtxt, TypingMode}; use rustc_span::symbol::kw; use rustc_span::{Symbol, sym}; -use rustc_target::spec::abi::Abi; use tracing::{debug, trace}; use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length}; @@ -1787,11 +1787,11 @@ impl clean::AssocItemConstraint { } } -pub(crate) fn print_abi_with_space(abi: Abi) -> impl Display { +pub(crate) fn print_abi_with_space(abi: ExternAbi) -> impl Display { display_fn(move |f| { let quot = if f.alternate() { "\"" } else { """ }; match abi { - Abi::Rust => Ok(()), + ExternAbi::Rust => Ok(()), abi => write!(f, "extern {0}{1}{0} ", quot, abi.name()), } }) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 5e9cbef99a9..c6a2d87cbd0 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -5,6 +5,7 @@ use std::rc::Rc; use itertools::Itertools; use rinja::Template; +use rustc_abi::VariantIdx; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_hir as hir; @@ -14,7 +15,6 @@ use rustc_index::IndexVec; use rustc_middle::ty::{self, TyCtxt}; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{Symbol, kw, sym}; -use rustc_target::abi::VariantIdx; use tracing::{debug, info}; use super::type_layout::document_type_layout; diff --git a/src/librustdoc/html/render/type_layout.rs b/src/librustdoc/html/render/type_layout.rs index 79209cee94f..d85ba3a2b14 100644 --- a/src/librustdoc/html/render/type_layout.rs +++ b/src/librustdoc/html/render/type_layout.rs @@ -1,13 +1,13 @@ use std::fmt; use rinja::Template; +use rustc_abi::{Primitive, TagEncoding, Variants}; use rustc_data_structures::captures::Captures; use rustc_hir::def_id::DefId; use rustc_middle::span_bug; use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::{self}; use rustc_span::symbol::Symbol; -use rustc_target::abi::{Primitive, TagEncoding, Variants}; use crate::html::format::display_fn; use crate::html::render::Context; diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 7270f170780..1c8303d4c20 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -4,6 +4,7 @@ #![allow(rustc::default_hash_types)] +use rustc_abi::ExternAbi; use rustc_ast::ast; use rustc_attr::DeprecatedSince; use rustc_hir::def::{CtorKind, DefKind}; @@ -11,7 +12,6 @@ use rustc_hir::def_id::DefId; use rustc_metadata::rendered_const; use rustc_middle::{bug, ty}; use rustc_span::{Pos, Symbol, sym}; -use rustc_target::spec::abi::Abi as RustcAbi; use rustdoc_json_types::*; use super::FullItemId; @@ -421,17 +421,17 @@ pub(crate) fn from_fn_header(header: &rustc_hir::FnHeader) -> FunctionHeader { } } -fn convert_abi(a: RustcAbi) -> Abi { +fn convert_abi(a: ExternAbi) -> Abi { match a { - RustcAbi::Rust => Abi::Rust, - RustcAbi::C { unwind } => Abi::C { unwind }, - RustcAbi::Cdecl { unwind } => Abi::Cdecl { unwind }, - RustcAbi::Stdcall { unwind } => Abi::Stdcall { unwind }, - RustcAbi::Fastcall { unwind } => Abi::Fastcall { unwind }, - RustcAbi::Aapcs { unwind } => Abi::Aapcs { unwind }, - RustcAbi::Win64 { unwind } => Abi::Win64 { unwind }, - RustcAbi::SysV64 { unwind } => Abi::SysV64 { unwind }, - RustcAbi::System { unwind } => Abi::System { unwind }, + ExternAbi::Rust => Abi::Rust, + ExternAbi::C { unwind } => Abi::C { unwind }, + ExternAbi::Cdecl { unwind } => Abi::Cdecl { unwind }, + ExternAbi::Stdcall { unwind } => Abi::Stdcall { unwind }, + ExternAbi::Fastcall { unwind } => Abi::Fastcall { unwind }, + ExternAbi::Aapcs { unwind } => Abi::Aapcs { unwind }, + ExternAbi::Win64 { unwind } => Abi::Win64 { unwind }, + ExternAbi::SysV64 { unwind } => Abi::SysV64 { unwind }, + ExternAbi::System { unwind } => Abi::System { unwind }, _ => Abi::Other(a.to_string()), } } |
