Auto merge of #117706 - matthiaskrgr:rollup-lscx7dg, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #114316 (Add AIX platform support document) - #117531 (rustdoc: properly elide cross-crate host effect args) - #117650 (Add -Zcross-crate-inline-threshold=yes) - #117663 (bump some deps) - #117667 (Document clippy_config in nightly-rustc docs) - #117698 (Clarify `space_between`) - #117700 (coverage: Rename the `run-coverage` test mode to `coverage-run`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
755629fe59
26
Cargo.lock
26
Cargo.lock
@ -1281,25 +1281,14 @@ checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.1"
|
version = "0.3.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
|
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"errno-dragonfly",
|
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "errno-dragonfly"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "error_index_generator"
|
name = "error_index_generator"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
@ -2055,7 +2044,6 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
"flate2",
|
"flate2",
|
||||||
"num_cpus",
|
|
||||||
"rayon",
|
"rayon",
|
||||||
"tar",
|
"tar",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
@ -3181,9 +3169,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.7.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
|
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"rayon-core",
|
"rayon-core",
|
||||||
@ -3191,14 +3179,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon-core"
|
name = "rayon-core"
|
||||||
version = "1.11.0"
|
version = "1.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
|
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
"num_cpus",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -146,37 +146,49 @@ pub fn print_crate<'a>(
|
|||||||
s.s.eof()
|
s.s.eof()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This makes printed token streams look slightly nicer,
|
/// Should two consecutive tokens be printed with a space between them?
|
||||||
/// and also addresses some specific regressions described in #63896 and #73345.
|
///
|
||||||
fn space_between(prev: &TokenTree, curr: &TokenTree) -> bool {
|
/// Note: some old proc macros parse pretty-printed output, so changes here can
|
||||||
if let TokenTree::Token(token, _) = prev {
|
/// break old code. For example:
|
||||||
// No space after these tokens, e.g. `x.y`, `$e`
|
/// - #63896: `#[allow(unused,` must be printed rather than `#[allow(unused ,`
|
||||||
// (The carets point to `prev`.) ^ ^
|
/// - #73345: `#[allow(unused)] must be printed rather than `# [allow(unused)]
|
||||||
if matches!(token.kind, token::Dot | token::Dollar) {
|
///
|
||||||
return false;
|
fn space_between(tt1: &TokenTree, tt2: &TokenTree) -> bool {
|
||||||
}
|
use token::*;
|
||||||
if let token::DocComment(comment_kind, ..) = token.kind {
|
use Delimiter::*;
|
||||||
return comment_kind != CommentKind::Line;
|
use TokenTree::Delimited as Del;
|
||||||
}
|
use TokenTree::Token as Tok;
|
||||||
}
|
|
||||||
match curr {
|
// Each match arm has one or more examples in comments. The default is to
|
||||||
// No space before these tokens, e.g. `foo,`, `println!`, `x.y`
|
// insert space between adjacent tokens, except for the cases listed in
|
||||||
// (The carets point to `curr`.) ^ ^ ^
|
// this match.
|
||||||
|
match (tt1, tt2) {
|
||||||
|
// No space after line doc comments.
|
||||||
|
(Tok(Token { kind: DocComment(CommentKind::Line, ..), .. }, _), _) => false,
|
||||||
|
|
||||||
|
// `.` + ANYTHING: `x.y`, `tup.0`
|
||||||
|
// `$` + ANYTHING: `$e`
|
||||||
|
(Tok(Token { kind: Dot | Dollar, .. }, _), _) => false,
|
||||||
|
|
||||||
|
// ANYTHING + `,`: `foo,`
|
||||||
|
// ANYTHING + `.`: `x.y`, `tup.0`
|
||||||
|
// ANYTHING + `!`: `foo! { ... }`
|
||||||
//
|
//
|
||||||
// FIXME: having `Not` here works well for macro invocations like
|
// FIXME: Incorrect cases:
|
||||||
// `println!()`, but is bad when `!` means "logical not" or "the never
|
// - Logical not: `x =! y`, `if! x { f(); }`
|
||||||
// type", where the lack of space causes ugliness like this:
|
// - Never type: `Fn() ->!`
|
||||||
// `Fn() ->!`, `x =! y`, `if! x { f(); }`.
|
(_, Tok(Token { kind: Comma | Dot | Not, .. }, _)) => false,
|
||||||
TokenTree::Token(token, _) => !matches!(token.kind, token::Comma | token::Not | token::Dot),
|
|
||||||
// No space before parentheses if preceded by these tokens, e.g. `foo(...)`
|
// IDENT + `(`: `f(3)`
|
||||||
TokenTree::Delimited(_, Delimiter::Parenthesis, _) => {
|
//
|
||||||
!matches!(prev, TokenTree::Token(Token { kind: token::Ident(..), .. }, _))
|
// FIXME: Incorrect cases:
|
||||||
}
|
// - Let: `let(a, b) = (1, 2)`
|
||||||
// No space before brackets if preceded by these tokens, e.g. `#[...]`
|
(Tok(Token { kind: Ident(..), .. }, _), Del(_, Parenthesis, _)) => false,
|
||||||
TokenTree::Delimited(_, Delimiter::Bracket, _) => {
|
|
||||||
!matches!(prev, TokenTree::Token(Token { kind: token::Pound, .. }, _))
|
// `#` + `[`: `#[attr]`
|
||||||
}
|
(Tok(Token { kind: Pound, .. }, _), Del(_, Bracket, _)) => false,
|
||||||
TokenTree::Delimited(..) => true,
|
|
||||||
|
_ => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@ use rustc_data_structures::profiling::TimePassesFormat;
|
|||||||
use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
|
use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
|
||||||
use rustc_session::config::{
|
use rustc_session::config::{
|
||||||
build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg,
|
build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg,
|
||||||
DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs, Input,
|
DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs,
|
||||||
InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli,
|
InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained,
|
||||||
MirSpanview, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet,
|
LinkerPluginLto, LocationDetail, LtoCli, MirSpanview, OomStrategy, Options, OutFileName,
|
||||||
Passes, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion,
|
OutputType, OutputTypes, PAuthKey, PacRet, Passes, Polonius, ProcMacroExecutionStrategy, Strip,
|
||||||
TraitSolver, WasiExecModel,
|
SwitchWithOptPath, SymbolManglingVersion, TraitSolver, WasiExecModel,
|
||||||
};
|
};
|
||||||
use rustc_session::lint::Level;
|
use rustc_session::lint::Level;
|
||||||
use rustc_session::search_paths::SearchPath;
|
use rustc_session::search_paths::SearchPath;
|
||||||
@ -748,7 +748,7 @@ fn test_unstable_options_tracking_hash() {
|
|||||||
);
|
);
|
||||||
tracked!(codegen_backend, Some("abc".to_string()));
|
tracked!(codegen_backend, Some("abc".to_string()));
|
||||||
tracked!(crate_attr, vec!["abc".to_string()]);
|
tracked!(crate_attr, vec!["abc".to_string()]);
|
||||||
tracked!(cross_crate_inline_threshold, Some(200));
|
tracked!(cross_crate_inline_threshold, InliningThreshold::Always);
|
||||||
tracked!(debug_info_for_profiling, true);
|
tracked!(debug_info_for_profiling, true);
|
||||||
tracked!(debug_macros, true);
|
tracked!(debug_macros, true);
|
||||||
tracked!(dep_info_omit_d_target, true);
|
tracked!(dep_info_omit_d_target, true);
|
||||||
|
@ -7,6 +7,7 @@ use rustc_middle::mir::visit::Visitor;
|
|||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::query::Providers;
|
use rustc_middle::query::Providers;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
|
use rustc_session::config::InliningThreshold;
|
||||||
use rustc_session::config::OptLevel;
|
use rustc_session::config::OptLevel;
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
@ -54,6 +55,12 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let threshold = match tcx.sess.opts.unstable_opts.cross_crate_inline_threshold {
|
||||||
|
InliningThreshold::Always => return true,
|
||||||
|
InliningThreshold::Sometimes(threshold) => threshold,
|
||||||
|
InliningThreshold::Never => return false,
|
||||||
|
};
|
||||||
|
|
||||||
let mir = tcx.optimized_mir(def_id);
|
let mir = tcx.optimized_mir(def_id);
|
||||||
let mut checker =
|
let mut checker =
|
||||||
CostChecker { tcx, callee_body: mir, calls: 0, statements: 0, landing_pads: 0, resumes: 0 };
|
CostChecker { tcx, callee_body: mir, calls: 0, statements: 0, landing_pads: 0, resumes: 0 };
|
||||||
@ -61,8 +68,7 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|||||||
checker.calls == 0
|
checker.calls == 0
|
||||||
&& checker.resumes == 0
|
&& checker.resumes == 0
|
||||||
&& checker.landing_pads == 0
|
&& checker.landing_pads == 0
|
||||||
&& checker.statements
|
&& checker.statements <= threshold
|
||||||
<= tcx.sess.opts.unstable_opts.cross_crate_inline_threshold.unwrap_or(100)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CostChecker<'b, 'tcx> {
|
struct CostChecker<'b, 'tcx> {
|
||||||
|
@ -3161,10 +3161,10 @@ impl PpMode {
|
|||||||
pub(crate) mod dep_tracking {
|
pub(crate) mod dep_tracking {
|
||||||
use super::{
|
use super::{
|
||||||
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression,
|
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression,
|
||||||
ErrorOutputType, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
|
ErrorOutputType, InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto,
|
||||||
LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes, Polonius,
|
LocationDetail, LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes,
|
||||||
RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind,
|
Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
|
||||||
SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
|
SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
|
||||||
};
|
};
|
||||||
use crate::lint;
|
use crate::lint;
|
||||||
use crate::options::WasiExecModel;
|
use crate::options::WasiExecModel;
|
||||||
@ -3270,6 +3270,7 @@ pub(crate) mod dep_tracking {
|
|||||||
LanguageIdentifier,
|
LanguageIdentifier,
|
||||||
TraitSolver,
|
TraitSolver,
|
||||||
Polonius,
|
Polonius,
|
||||||
|
InliningThreshold,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<T1, T2> DepTrackingHash for (T1, T2)
|
impl<T1, T2> DepTrackingHash for (T1, T2)
|
||||||
@ -3435,3 +3436,16 @@ impl Polonius {
|
|||||||
matches!(self, Polonius::Next)
|
matches!(self, Polonius::Next)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
||||||
|
pub enum InliningThreshold {
|
||||||
|
Always,
|
||||||
|
Sometimes(usize),
|
||||||
|
Never,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for InliningThreshold {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::Sometimes(100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -428,6 +428,8 @@ mod desc {
|
|||||||
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
|
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
|
||||||
pub const parse_dump_solver_proof_tree: &str = "one of: `always`, `on-request`, `on-error`";
|
pub const parse_dump_solver_proof_tree: &str = "one of: `always`, `on-request`, `on-error`";
|
||||||
pub const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`";
|
pub const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`";
|
||||||
|
pub const parse_inlining_threshold: &str =
|
||||||
|
"either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number";
|
||||||
}
|
}
|
||||||
|
|
||||||
mod parse {
|
mod parse {
|
||||||
@ -1310,6 +1312,26 @@ mod parse {
|
|||||||
};
|
};
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&str>) -> bool {
|
||||||
|
match v {
|
||||||
|
Some("always" | "yes") => {
|
||||||
|
*slot = InliningThreshold::Always;
|
||||||
|
}
|
||||||
|
Some("never") => {
|
||||||
|
*slot = InliningThreshold::Never;
|
||||||
|
}
|
||||||
|
Some(v) => {
|
||||||
|
if let Ok(threshold) = v.parse() {
|
||||||
|
*slot = InliningThreshold::Sometimes(threshold);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => return false,
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options! {
|
options! {
|
||||||
@ -1479,7 +1501,7 @@ options! {
|
|||||||
"combine CGUs into a single one"),
|
"combine CGUs into a single one"),
|
||||||
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
|
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
|
||||||
"inject the given attribute in the crate"),
|
"inject the given attribute in the crate"),
|
||||||
cross_crate_inline_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
|
cross_crate_inline_threshold: InliningThreshold = (InliningThreshold::Sometimes(100), parse_inlining_threshold, [TRACKED],
|
||||||
"threshold to allow cross crate inlining of functions"),
|
"threshold to allow cross crate inlining of functions"),
|
||||||
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
|
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
|
||||||
"emit discriminators and other data necessary for AutoFDO"),
|
"emit discriminators and other data necessary for AutoFDO"),
|
||||||
|
@ -180,16 +180,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-channel"
|
|
||||||
version = "0.5.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-deque"
|
name = "crossbeam-deque"
|
||||||
version = "0.8.2"
|
version = "0.8.2"
|
||||||
@ -323,15 +313,6 @@ version = "0.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hermit-abi"
|
|
||||||
version = "0.1.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex"
|
name = "hex"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@ -443,16 +424,6 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_cpus"
|
|
||||||
version = "1.13.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.32.0"
|
version = "0.32.0"
|
||||||
@ -514,25 +485,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.6.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b"
|
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-deque",
|
|
||||||
"either",
|
"either",
|
||||||
"rayon-core",
|
"rayon-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon-core"
|
name = "rayon-core"
|
||||||
version = "1.10.1"
|
version = "1.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3"
|
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
"num_cpus",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -887,7 +887,7 @@ tool_doc!(
|
|||||||
"src/tools/rustfmt",
|
"src/tools/rustfmt",
|
||||||
crates = ["rustfmt-nightly", "rustfmt-config_proc_macro"]
|
crates = ["rustfmt-nightly", "rustfmt-config_proc_macro"]
|
||||||
);
|
);
|
||||||
tool_doc!(Clippy, "clippy", "src/tools/clippy", crates = ["clippy_utils"]);
|
tool_doc!(Clippy, "clippy", "src/tools/clippy", crates = ["clippy_config", "clippy_utils"]);
|
||||||
tool_doc!(Miri, "miri", "src/tools/miri", crates = ["miri"]);
|
tool_doc!(Miri, "miri", "src/tools/miri", crates = ["miri"]);
|
||||||
tool_doc!(
|
tool_doc!(
|
||||||
Cargo,
|
Cargo,
|
||||||
|
@ -1434,7 +1434,7 @@ impl Step for Coverage {
|
|||||||
|
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
self.run_unified_suite(builder, CoverageMap::MODE);
|
self.run_unified_suite(builder, CoverageMap::MODE);
|
||||||
self.run_unified_suite(builder, RunCoverage::MODE);
|
self.run_unified_suite(builder, CoverageRun::MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1444,16 +1444,16 @@ coverage_test_alias!(CoverageMap {
|
|||||||
default: true,
|
default: true,
|
||||||
only_hosts: false,
|
only_hosts: false,
|
||||||
});
|
});
|
||||||
coverage_test_alias!(RunCoverage {
|
coverage_test_alias!(CoverageRun {
|
||||||
alias_and_mode: "run-coverage",
|
alias_and_mode: "coverage-run",
|
||||||
default: true,
|
default: true,
|
||||||
only_hosts: true,
|
only_hosts: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
host_test!(RunCoverageRustdoc {
|
host_test!(CoverageRunRustdoc {
|
||||||
path: "tests/run-coverage-rustdoc",
|
path: "tests/coverage-run-rustdoc",
|
||||||
mode: "run-coverage",
|
mode: "coverage-run",
|
||||||
suite: "run-coverage-rustdoc"
|
suite: "coverage-run-rustdoc"
|
||||||
});
|
});
|
||||||
|
|
||||||
// For the mir-opt suite we do not use macros, as we need custom behavior when blessing.
|
// For the mir-opt suite we do not use macros, as we need custom behavior when blessing.
|
||||||
@ -1640,7 +1640,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
|| (mode == "ui" && is_rustdoc)
|
|| (mode == "ui" && is_rustdoc)
|
||||||
|| mode == "js-doc-test"
|
|| mode == "js-doc-test"
|
||||||
|| mode == "rustdoc-json"
|
|| mode == "rustdoc-json"
|
||||||
|| suite == "run-coverage-rustdoc"
|
|| suite == "coverage-run-rustdoc"
|
||||||
{
|
{
|
||||||
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
|
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
|
||||||
}
|
}
|
||||||
@ -1662,7 +1662,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
cmd.arg("--coverage-dump-path").arg(coverage_dump);
|
cmd.arg("--coverage-dump-path").arg(coverage_dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
if mode == "run-coverage" {
|
if mode == "coverage-run" {
|
||||||
// The demangler doesn't need the current compiler, so we can avoid
|
// The demangler doesn't need the current compiler, so we can avoid
|
||||||
// unnecessary rebuilds by using the bootstrap compiler instead.
|
// unnecessary rebuilds by using the bootstrap compiler instead.
|
||||||
let rust_demangler = builder
|
let rust_demangler = builder
|
||||||
@ -1854,11 +1854,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !builder.config.dry_run()
|
if !builder.config.dry_run()
|
||||||
&& (matches!(suite, "run-make" | "run-make-fulldeps") || mode == "run-coverage")
|
&& (matches!(suite, "run-make" | "run-make-fulldeps") || mode == "coverage-run")
|
||||||
{
|
{
|
||||||
// The llvm/bin directory contains many useful cross-platform
|
// The llvm/bin directory contains many useful cross-platform
|
||||||
// tools. Pass the path to run-make tests so they can use them.
|
// tools. Pass the path to run-make tests so they can use them.
|
||||||
// (The run-coverage tests also need these tools to process
|
// (The coverage-run tests also need these tools to process
|
||||||
// coverage reports.)
|
// coverage reports.)
|
||||||
let llvm_bin_path = llvm_config
|
let llvm_bin_path = llvm_config
|
||||||
.parent()
|
.parent()
|
||||||
|
@ -729,7 +729,7 @@ impl<'a> Builder<'a> {
|
|||||||
test::RunPassValgrind,
|
test::RunPassValgrind,
|
||||||
test::Coverage,
|
test::Coverage,
|
||||||
test::CoverageMap,
|
test::CoverageMap,
|
||||||
test::RunCoverage,
|
test::CoverageRun,
|
||||||
test::MirOpt,
|
test::MirOpt,
|
||||||
test::Codegen,
|
test::Codegen,
|
||||||
test::CodegenUnits,
|
test::CodegenUnits,
|
||||||
@ -740,7 +740,7 @@ impl<'a> Builder<'a> {
|
|||||||
test::CodegenCranelift,
|
test::CodegenCranelift,
|
||||||
test::CodegenGCC,
|
test::CodegenGCC,
|
||||||
test::Rustdoc,
|
test::Rustdoc,
|
||||||
test::RunCoverageRustdoc,
|
test::CoverageRunRustdoc,
|
||||||
test::Pretty,
|
test::Pretty,
|
||||||
test::Crate,
|
test::Crate,
|
||||||
test::CrateLibrustc,
|
test::CrateLibrustc,
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
- [mipsel-sony-psx](platform-support/mipsel-sony-psx.md)
|
- [mipsel-sony-psx](platform-support/mipsel-sony-psx.md)
|
||||||
- [mipsisa\*r6\*-unknown-linux-gnu\*](platform-support/mips-release-6.md)
|
- [mipsisa\*r6\*-unknown-linux-gnu\*](platform-support/mips-release-6.md)
|
||||||
- [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
|
- [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
|
||||||
|
- [powerpc64-ibm-aix](platform-support/aix.md)
|
||||||
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
|
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
|
||||||
- [sparc-unknown-none-elf](./platform-support/sparc-unknown-none-elf.md)
|
- [sparc-unknown-none-elf](./platform-support/sparc-unknown-none-elf.md)
|
||||||
- [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md)
|
- [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md)
|
||||||
|
@ -310,7 +310,7 @@ target | std | host | notes
|
|||||||
`powerpc64-wrs-vxworks` | ? | |
|
`powerpc64-wrs-vxworks` | ? | |
|
||||||
`powerpc64le-unknown-linux-musl` | ? | |
|
`powerpc64le-unknown-linux-musl` | ? | |
|
||||||
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
||||||
`powerpc64-ibm-aix` | ? | | 64-bit AIX (7.2 and newer)
|
[`powerpc64-ibm-aix`](platform-support/aix.md) | ? | | 64-bit AIX (7.2 and newer)
|
||||||
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
|
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
|
||||||
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
|
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
|
||||||
`riscv32im-unknown-none-elf` | * | | Bare RISC-V (RV32IM ISA)
|
`riscv32im-unknown-none-elf` | * | | Bare RISC-V (RV32IM ISA)
|
||||||
|
26
src/doc/rustc/src/platform-support/aix.md
Normal file
26
src/doc/rustc/src/platform-support/aix.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# `powerpc64-ibm-aix`
|
||||||
|
|
||||||
|
**Tier: 3**
|
||||||
|
|
||||||
|
Rust for AIX operating system, currently only 64-bit PowerPC is supported.
|
||||||
|
|
||||||
|
## Target maintainers
|
||||||
|
|
||||||
|
- QIU Chaofan `qiucofan@cn.ibm.com`, https://github.com/ecnelises
|
||||||
|
- Kai LUO, `lkail@cn.ibm.com`, https://github.com/bzEq
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
This target supports host tools, std and alloc. This target cannot be cross-compiled as for now, mainly because of the unavailability of system linker on other platforms.
|
||||||
|
|
||||||
|
Binary built for this target is expected to run on Power7 or newer CPU, and AIX 7.2 or newer version.
|
||||||
|
|
||||||
|
Binary format of this platform is [XCOFF](https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format). Archive file format is ['AIX big format'](https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big).
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
This target supports running test suites natively, but it's not available to cross-compile and execute in emulator.
|
||||||
|
|
||||||
|
## Interoperability with C code
|
||||||
|
|
||||||
|
This target supports C code. C code compiled by XL, Open XL and Clang are compatible with Rust. Typical triple of AIX on 64-bit PowerPC of these compilers are also `powerpc64-ibm-aix`.
|
@ -2534,7 +2534,8 @@ fn clean_generic_args<'tcx>(
|
|||||||
}
|
}
|
||||||
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
|
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
|
||||||
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
|
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
|
||||||
// FIXME(effects): This will still emit `<true>` for non-const impls of const traits
|
// Checking for `#[rustc_host]` on the `AnonConst` not only accounts for the case
|
||||||
|
// where the argument is `host` but for all possible cases (e.g., `true`, `false`).
|
||||||
hir::GenericArg::Const(ct)
|
hir::GenericArg::Const(ct)
|
||||||
if cx.tcx.has_attr(ct.value.def_id, sym::rustc_host) =>
|
if cx.tcx.has_attr(ct.value.def_id, sym::rustc_host) =>
|
||||||
{
|
{
|
||||||
|
@ -124,11 +124,7 @@ pub(crate) fn ty_args_to_args<'tcx>(
|
|||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
GenericArgKind::Const(ct) => {
|
GenericArgKind::Const(ct) => {
|
||||||
// FIXME(effects): this relies on the host effect being called `host`, which users could also name
|
if let ty::GenericParamDefKind::Const { is_host_effect: true, .. } = params[index].kind
|
||||||
// their const generics.
|
|
||||||
// FIXME(effects): this causes `host = true` and `host = false` generics to also be emitted.
|
|
||||||
if let ty::ConstKind::Param(p) = ct.kind()
|
|
||||||
&& p.name == sym::host
|
|
||||||
{
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ string_enum! {
|
|||||||
MirOpt => "mir-opt",
|
MirOpt => "mir-opt",
|
||||||
Assembly => "assembly",
|
Assembly => "assembly",
|
||||||
CoverageMap => "coverage-map",
|
CoverageMap => "coverage-map",
|
||||||
RunCoverage => "run-coverage",
|
CoverageRun => "coverage-run",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ impl Mode {
|
|||||||
// Coverage tests use the same test files for multiple test modes,
|
// Coverage tests use the same test files for multiple test modes,
|
||||||
// so each mode should have a separate output directory.
|
// so each mode should have a separate output directory.
|
||||||
match self {
|
match self {
|
||||||
CoverageMap | RunCoverage => self.to_str(),
|
CoverageMap | CoverageRun => self.to_str(),
|
||||||
_ => "",
|
_ => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,11 +911,11 @@ pub fn make_test_description<R: Read>(
|
|||||||
let mut should_fail = false;
|
let mut should_fail = false;
|
||||||
|
|
||||||
let extra_directives: &[&str] = match config.mode {
|
let extra_directives: &[&str] = match config.mode {
|
||||||
// The run-coverage tests are treated as having these extra directives,
|
// The coverage-run tests are treated as having these extra directives,
|
||||||
// without needing to specify them manually in every test file.
|
// without needing to specify them manually in every test file.
|
||||||
// (Some of the comments below have been copied over from
|
// (Some of the comments below have been copied over from
|
||||||
// `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
|
// `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
|
||||||
Mode::RunCoverage => {
|
Mode::CoverageRun => {
|
||||||
&[
|
&[
|
||||||
"needs-profiler-support",
|
"needs-profiler-support",
|
||||||
// FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
|
// FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
|
||||||
|
@ -6,7 +6,7 @@ use crate::common::{Assembly, Incremental, JsDocTest, MirOpt, RunMake, RustdocJs
|
|||||||
use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc};
|
use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc};
|
||||||
use crate::common::{CompareMode, FailMode, PassMode};
|
use crate::common::{CompareMode, FailMode, PassMode};
|
||||||
use crate::common::{Config, TestPaths};
|
use crate::common::{Config, TestPaths};
|
||||||
use crate::common::{CoverageMap, Pretty, RunCoverage, RunPassValgrind};
|
use crate::common::{CoverageMap, CoverageRun, Pretty, RunPassValgrind};
|
||||||
use crate::common::{UI_COVERAGE, UI_COVERAGE_MAP, UI_RUN_STDERR, UI_RUN_STDOUT};
|
use crate::common::{UI_COVERAGE, UI_COVERAGE_MAP, UI_RUN_STDERR, UI_RUN_STDOUT};
|
||||||
use crate::compute_diff::{write_diff, write_filtered_diff};
|
use crate::compute_diff::{write_diff, write_filtered_diff};
|
||||||
use crate::errors::{self, Error, ErrorKind};
|
use crate::errors::{self, Error, ErrorKind};
|
||||||
@ -257,7 +257,7 @@ impl<'test> TestCx<'test> {
|
|||||||
Assembly => self.run_assembly_test(),
|
Assembly => self.run_assembly_test(),
|
||||||
JsDocTest => self.run_js_doc_test(),
|
JsDocTest => self.run_js_doc_test(),
|
||||||
CoverageMap => self.run_coverage_map_test(),
|
CoverageMap => self.run_coverage_map_test(),
|
||||||
RunCoverage => self.run_coverage_test(),
|
CoverageRun => self.run_coverage_run_test(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ impl<'test> TestCx<'test> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_coverage_test(&self) {
|
fn run_coverage_run_test(&self) {
|
||||||
let should_run = self.run_if_enabled();
|
let should_run = self.run_if_enabled();
|
||||||
let proc_res = self.compile_test(should_run, Emit::None);
|
let proc_res = self.compile_test(should_run, Emit::None);
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ impl<'test> TestCx<'test> {
|
|||||||
let mut profraw_paths = vec![profraw_path];
|
let mut profraw_paths = vec![profraw_path];
|
||||||
let mut bin_paths = vec![self.make_exe_name()];
|
let mut bin_paths = vec![self.make_exe_name()];
|
||||||
|
|
||||||
if self.config.suite == "run-coverage-rustdoc" {
|
if self.config.suite == "coverage-run-rustdoc" {
|
||||||
self.run_doctests_for_coverage(&mut profraw_paths, &mut bin_paths);
|
self.run_doctests_for_coverage(&mut profraw_paths, &mut bin_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2193,7 +2193,7 @@ impl<'test> TestCx<'test> {
|
|||||||
|| self.is_vxworks_pure_static()
|
|| self.is_vxworks_pure_static()
|
||||||
|| self.config.target.contains("bpf")
|
|| self.config.target.contains("bpf")
|
||||||
|| !self.config.target_cfg().dynamic_linking
|
|| !self.config.target_cfg().dynamic_linking
|
||||||
|| matches!(self.config.mode, CoverageMap | RunCoverage)
|
|| matches!(self.config.mode, CoverageMap | CoverageRun)
|
||||||
{
|
{
|
||||||
// We primarily compile all auxiliary libraries as dynamic libraries
|
// We primarily compile all auxiliary libraries as dynamic libraries
|
||||||
// to avoid code size bloat and large binaries as much as possible
|
// to avoid code size bloat and large binaries as much as possible
|
||||||
@ -2395,7 +2395,7 @@ impl<'test> TestCx<'test> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DebugInfo => { /* debuginfo tests must be unoptimized */ }
|
DebugInfo => { /* debuginfo tests must be unoptimized */ }
|
||||||
CoverageMap | RunCoverage => {
|
CoverageMap | CoverageRun => {
|
||||||
// Coverage mappings and coverage reports are affected by
|
// Coverage mappings and coverage reports are affected by
|
||||||
// optimization level, so they ignore the optimize-tests
|
// optimization level, so they ignore the optimize-tests
|
||||||
// setting and set an optimization level in their mode's
|
// setting and set an optimization level in their mode's
|
||||||
@ -2478,7 +2478,7 @@ impl<'test> TestCx<'test> {
|
|||||||
// by `compile-flags`.
|
// by `compile-flags`.
|
||||||
rustc.arg("-Copt-level=2");
|
rustc.arg("-Copt-level=2");
|
||||||
}
|
}
|
||||||
RunCoverage => {
|
CoverageRun => {
|
||||||
rustc.arg("-Cinstrument-coverage");
|
rustc.arg("-Cinstrument-coverage");
|
||||||
// Coverage reports are sometimes sensitive to optimizations,
|
// Coverage reports are sometimes sensitive to optimizations,
|
||||||
// and the current snapshots assume `opt-level=2` unless
|
// and the current snapshots assume `opt-level=2` unless
|
||||||
|
@ -16,7 +16,6 @@ rayon = "1.0"
|
|||||||
tar = "0.4.38"
|
tar = "0.4.38"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
xz2 = "0.1.4"
|
xz2 = "0.1.4"
|
||||||
num_cpus = "1"
|
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
features = ["derive"]
|
features = ["derive"]
|
||||||
|
@ -228,7 +228,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
|||||||
"ena",
|
"ena",
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"errno",
|
"errno",
|
||||||
"errno-dragonfly",
|
|
||||||
"expect-test",
|
"expect-test",
|
||||||
"fallible-iterator", // dependency of `thorin`
|
"fallible-iterator", // dependency of `thorin`
|
||||||
"fastrand",
|
"fastrand",
|
||||||
|
13
tests/codegen/cross-crate-inlining/always-inline.rs
Normal file
13
tests/codegen/cross-crate-inlining/always-inline.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// compile-flags: -O
|
||||||
|
// aux-build:always.rs
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
extern crate always;
|
||||||
|
|
||||||
|
// Check that we inline a cross-crate call, even though it isn't a leaf
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn outer() -> String {
|
||||||
|
// CHECK-NOT: call {{.*}}stem_fn
|
||||||
|
always::stem_fn()
|
||||||
|
}
|
20
tests/codegen/cross-crate-inlining/auxiliary/always.rs
Normal file
20
tests/codegen/cross-crate-inlining/auxiliary/always.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// compile-flags: -O -Zcross-crate-inline-threshold=always
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// This function *looks* like it contains a call, but that call will be optimized out by MIR
|
||||||
|
// optimizations.
|
||||||
|
pub fn leaf_fn() -> String {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function contains a call, even after MIR optimizations. It is only eligible for
|
||||||
|
// cross-crate-inlining with "always".
|
||||||
|
pub fn stem_fn() -> String {
|
||||||
|
inner()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(never)]
|
||||||
|
fn inner() -> String {
|
||||||
|
String::from("test")
|
||||||
|
}
|
20
tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
Normal file
20
tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// compile-flags: -O
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// This function *looks* like it contains a call, but that call will be optimized out by MIR
|
||||||
|
// optimizations.
|
||||||
|
pub fn leaf_fn() -> String {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function contains a call, even after MIR optimizations. It is only eligible for
|
||||||
|
// cross-crate-inlining with "always".
|
||||||
|
pub fn stem_fn() -> String {
|
||||||
|
inner()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(never)]
|
||||||
|
fn inner() -> String {
|
||||||
|
String::from("test")
|
||||||
|
}
|
20
tests/codegen/cross-crate-inlining/auxiliary/never.rs
Normal file
20
tests/codegen/cross-crate-inlining/auxiliary/never.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// compile-flags: -O -Zcross-crate-inline-threshold=never
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// This function *looks* like it contains a call, but that call will be optimized out by MIR
|
||||||
|
// optimizations.
|
||||||
|
pub fn leaf_fn() -> String {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function contains a call, even after MIR optimizations. It is only eligible for
|
||||||
|
// cross-crate-inlining with "always".
|
||||||
|
pub fn stem_fn() -> String {
|
||||||
|
inner()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(never)]
|
||||||
|
fn inner() -> String {
|
||||||
|
String::from("test")
|
||||||
|
}
|
20
tests/codegen/cross-crate-inlining/leaf-inlining.rs
Normal file
20
tests/codegen/cross-crate-inlining/leaf-inlining.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// compile-flags: -O -Zcross-crate-inline-threshold=yes
|
||||||
|
// aux-build:leaf.rs
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
extern crate leaf;
|
||||||
|
|
||||||
|
// Check that we inline a leaf cross-crate call
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn leaf_outer() -> String {
|
||||||
|
// CHECK-NOT: call {{.*}}leaf_fn
|
||||||
|
leaf::leaf_fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that we do not inline a non-leaf cross-crate call
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn stem_outer() -> String {
|
||||||
|
// CHECK: call {{.*}}stem_fn
|
||||||
|
leaf::stem_fn()
|
||||||
|
}
|
13
tests/codegen/cross-crate-inlining/never-inline.rs
Normal file
13
tests/codegen/cross-crate-inlining/never-inline.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// compile-flags: -O
|
||||||
|
// aux-build:never.rs
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
extern crate never;
|
||||||
|
|
||||||
|
// Check that we do not inline a cross-crate call, even though it is a leaf
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn outer() -> String {
|
||||||
|
// CHECK: call {{.*}}leaf_fn
|
||||||
|
never::leaf_fn()
|
||||||
|
}
|
@ -2,8 +2,8 @@ The tests in this directory are shared by two different test modes, and can be
|
|||||||
run in multiple different ways:
|
run in multiple different ways:
|
||||||
|
|
||||||
- `./x.py test coverage-map` (compiles to LLVM IR and checks coverage mappings)
|
- `./x.py test coverage-map` (compiles to LLVM IR and checks coverage mappings)
|
||||||
- `./x.py test run-coverage` (runs a test binary and checks its coverage report)
|
- `./x.py test coverage-run` (runs a test binary and checks its coverage report)
|
||||||
- `./x.py test coverage` (runs both `coverage-map` and `run-coverage`)
|
- `./x.py test coverage` (runs both `coverage-map` and `coverage-run`)
|
||||||
|
|
||||||
## Maintenance note
|
## Maintenance note
|
||||||
|
|
||||||
@ -11,6 +11,6 @@ These tests can be sensitive to small changes in MIR spans or MIR control flow,
|
|||||||
especially in HIR-to-MIR lowering or MIR optimizations.
|
especially in HIR-to-MIR lowering or MIR optimizations.
|
||||||
|
|
||||||
If you haven't touched the coverage code directly, and the tests still pass in
|
If you haven't touched the coverage code directly, and the tests still pass in
|
||||||
`run-coverage` mode, then it should usually be OK to just re-bless the mappings
|
`coverage-run` mode, then it should usually be OK to just re-bless the mappings
|
||||||
as necessary with `./x.py test coverage-map --bless`, without worrying too much
|
as necessary with `./x.py test coverage-map --bless`, without worrying too much
|
||||||
about the exact changes.
|
about the exact changes.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Check that we don't render host effect parameters & arguments.
|
||||||
|
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
#![feature(effects, const_trait_impl)]
|
#![feature(effects, const_trait_impl)]
|
||||||
|
|
||||||
|
16
tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs
Normal file
16
tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#![feature(effects, const_trait_impl)]
|
||||||
|
|
||||||
|
#[const_trait]
|
||||||
|
pub trait Resource {}
|
||||||
|
|
||||||
|
pub const fn load<R: ~const Resource>() -> i32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn lock<R: Resource>() {}
|
||||||
|
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
|
pub trait Clash<const host: u64> {}
|
||||||
|
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
|
pub const fn clash<T: Clash<host>, const host: u64>() {}
|
@ -1,5 +0,0 @@
|
|||||||
#![feature(effects)]
|
|
||||||
|
|
||||||
pub const fn load() -> i32 {
|
|
||||||
0
|
|
||||||
}
|
|
29
tests/rustdoc/inline_cross/const-effect-param.rs
Normal file
29
tests/rustdoc/inline_cross/const-effect-param.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Regression test for issue #116629.
|
||||||
|
// Check that we don't render host effect parameters & arguments.
|
||||||
|
|
||||||
|
// aux-crate:const_effect_param=const-effect-param.rs
|
||||||
|
// edition: 2021
|
||||||
|
#![crate_name = "user"]
|
||||||
|
|
||||||
|
// Don't render the host param on `load` and the host arg `host` passed to `Resource`.
|
||||||
|
// @has user/fn.load.html
|
||||||
|
// @has - '//pre[@class="rust item-decl"]' "pub const fn load<R>() -> i32\
|
||||||
|
// where \
|
||||||
|
// R: Resource"
|
||||||
|
pub use const_effect_param::load;
|
||||||
|
|
||||||
|
// Don't render the host arg `true` passed to `Resource`.
|
||||||
|
// @has user/fn.lock.html
|
||||||
|
// @has - '//pre[@class="rust item-decl"]' "pub const fn lock<R>()\
|
||||||
|
// where \
|
||||||
|
// R: Resource"
|
||||||
|
pub use const_effect_param::lock;
|
||||||
|
|
||||||
|
// Regression test for an issue introduced in PR #116670.
|
||||||
|
// Don't hide the const param `host` since it actually isn't the host effect param.
|
||||||
|
// @has user/fn.clash.html
|
||||||
|
// @has - '//pre[@class="rust item-decl"]' \
|
||||||
|
// "pub const fn clash<T, const host: u64>()\
|
||||||
|
// where \
|
||||||
|
// T: Clash<host>"
|
||||||
|
pub use const_effect_param::clash;
|
@ -1,10 +0,0 @@
|
|||||||
// Regression test for issue #116629.
|
|
||||||
// Check that we render the correct generic params of const fn
|
|
||||||
|
|
||||||
// aux-crate:const_fn=const-fn.rs
|
|
||||||
// edition: 2021
|
|
||||||
#![crate_name = "user"]
|
|
||||||
|
|
||||||
// @has user/fn.load.html
|
|
||||||
// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32"
|
|
||||||
pub use const_fn::load;
|
|
@ -115,6 +115,7 @@ fn test_expr() {
|
|||||||
"a + b * c - d + -1 * -2 - -3",
|
"a + b * c - d + -1 * -2 - -3",
|
||||||
"a + b * c - d + - 1 * - 2 - - 3"
|
"a + b * c - d + - 1 * - 2 - - 3"
|
||||||
);
|
);
|
||||||
|
c2!(expr, [ x = !y ], "x = !y", "x =! y"); // FIXME
|
||||||
|
|
||||||
// ExprKind::Unary
|
// ExprKind::Unary
|
||||||
c2!(expr, [ *expr ], "*expr", "* expr");
|
c2!(expr, [ *expr ], "*expr", "* expr");
|
||||||
@ -137,6 +138,7 @@ fn test_expr() {
|
|||||||
|
|
||||||
// ExprKind::If
|
// ExprKind::If
|
||||||
c1!(expr, [ if true {} ], "if true {}");
|
c1!(expr, [ if true {} ], "if true {}");
|
||||||
|
c2!(expr, [ if !true {} ], "if !true {}", "if! true {}"); // FIXME
|
||||||
c2!(expr,
|
c2!(expr,
|
||||||
[ if ::std::blah() { } else { } ],
|
[ if ::std::blah() { } else { } ],
|
||||||
"if ::std::blah() {} else {}",
|
"if ::std::blah() {} else {}",
|
||||||
@ -799,3 +801,32 @@ fn test_vis() {
|
|||||||
assert_eq!(inherited_vis!(struct), "");
|
assert_eq!(inherited_vis!(struct), "");
|
||||||
assert_eq!(stringify!(), "");
|
assert_eq!(stringify!(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! p {
|
||||||
|
([$($tt:tt)*], $s:literal) => {
|
||||||
|
assert_eq!(stringify!($($tt)*), $s);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_punct() {
|
||||||
|
// For all these cases, we must preserve spaces between the tokens.
|
||||||
|
// Otherwise, any old proc macro that parses pretty-printed code might glue
|
||||||
|
// together tokens that shouldn't be glued.
|
||||||
|
p!([ = = < < <= <= == == != != >= >= > > ], "= = < < <= <= == == != != >= >= > >");
|
||||||
|
p!([ && && & & || || | | ! ! ], "&& && & & || || | |!!"); // FIXME
|
||||||
|
p!([ ~ ~ @ @ # # ], "~ ~ @ @ # #");
|
||||||
|
p!([ . . .. .. ... ... ..= ..=], ".... .. ... ... ..= ..="); // FIXME
|
||||||
|
p!([ , , ; ; : : :: :: ], ",, ; ; : : :: ::"); // FIXME
|
||||||
|
p!([ -> -> <- <- => =>], "-> -> <- <- => =>");
|
||||||
|
p!([ $ $ ? ? ' ' ], "$$? ? ' '"); // FIXME
|
||||||
|
p!([ + + += += - - -= -= * * *= *= / / /= /= ], "+ + += += - - -= -= * * *= *= / / /= /=");
|
||||||
|
p!([ % % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>= ],
|
||||||
|
"% % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>=");
|
||||||
|
|
||||||
|
// For these one we must insert spaces between adjacent tokens, again due
|
||||||
|
// to proc macros.
|
||||||
|
p!([ +! ?= |> >>@ --> <-- $$ =====> ], "+! ? = | > >> @ - -> <- - $$== == =>"); // FIXME
|
||||||
|
p!([ ,; ;, ** @@ $+$ >< <> ?? +== ], ", ; ;, * * @ @ $+ $> < < > ? ? += ="); // FIXME
|
||||||
|
p!([ :#!@|$=&*,+;*~? ], ": #! @ | $= & *, + ; * ~ ?"); // FIXME
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user