Auto merge of #77867 - JohnTitor:rollup-0odg1n4, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #77550 (add shims for WithOptConstParam query calls) - #77699 (Add word wrap for short descriptions) - #77724 (Implement `AsRawFd` for `StdinLock` etc. on WASI.) - #77746 (Fix `x.py setup` sets `changelog-seen`) - #77784 (Fix intra-docs link in core::ffi::VaList) - #77811 (rustdoc: Make some functions private that don't need to be public) - #77818 (Mono collector: replace pair of ints with Range) - #77831 (Use std methods on char instead of open coding them) - #77852 (update url in bootstrap README (gcc-rs -> cc-rs)) - #77863 (Remove `mark-i-m` from rustc-dev-guide maintainers) Failed merges: r? `@ghost`
This commit is contained in:
commit
16788545e7
17 changed files with 98 additions and 86 deletions
|
@ -385,7 +385,7 @@ pub mod printf {
|
|||
if let Start = state {
|
||||
match c {
|
||||
'1'..='9' => {
|
||||
let end = at_next_cp_while(next, is_digit);
|
||||
let end = at_next_cp_while(next, char::is_ascii_digit);
|
||||
match end.next_cp() {
|
||||
// Yes, this *is* the parameter.
|
||||
Some(('$', end2)) => {
|
||||
|
@ -427,7 +427,7 @@ pub mod printf {
|
|||
move_to!(next);
|
||||
}
|
||||
'1'..='9' => {
|
||||
let end = at_next_cp_while(next, is_digit);
|
||||
let end = at_next_cp_while(next, char::is_ascii_digit);
|
||||
state = Prec;
|
||||
width = Some(Num::from_str(at.slice_between(end).unwrap(), None));
|
||||
move_to!(end);
|
||||
|
@ -441,7 +441,7 @@ pub mod printf {
|
|||
}
|
||||
|
||||
if let WidthArg = state {
|
||||
let end = at_next_cp_while(at, is_digit);
|
||||
let end = at_next_cp_while(at, char::is_ascii_digit);
|
||||
match end.next_cp() {
|
||||
Some(('$', end2)) => {
|
||||
state = Prec;
|
||||
|
@ -473,7 +473,7 @@ pub mod printf {
|
|||
if let PrecInner = state {
|
||||
match c {
|
||||
'*' => {
|
||||
let end = at_next_cp_while(next, is_digit);
|
||||
let end = at_next_cp_while(next, char::is_ascii_digit);
|
||||
match end.next_cp() {
|
||||
Some(('$', end2)) => {
|
||||
state = Length;
|
||||
|
@ -488,7 +488,7 @@ pub mod printf {
|
|||
}
|
||||
}
|
||||
'0'..='9' => {
|
||||
let end = at_next_cp_while(next, is_digit);
|
||||
let end = at_next_cp_while(next, char::is_ascii_digit);
|
||||
state = Length;
|
||||
precision = Some(Num::from_str(at.slice_between(end).unwrap(), None));
|
||||
move_to!(end);
|
||||
|
@ -563,12 +563,12 @@ pub mod printf {
|
|||
|
||||
fn at_next_cp_while<F>(mut cur: Cur<'_>, mut pred: F) -> Cur<'_>
|
||||
where
|
||||
F: FnMut(char) -> bool,
|
||||
F: FnMut(&char) -> bool,
|
||||
{
|
||||
loop {
|
||||
match cur.next_cp() {
|
||||
Some((c, next)) => {
|
||||
if pred(c) {
|
||||
if pred(&c) {
|
||||
cur = next;
|
||||
} else {
|
||||
return cur;
|
||||
|
@ -579,14 +579,7 @@ pub mod printf {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_digit(c: char) -> bool {
|
||||
match c {
|
||||
'0'..='9' => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_flag(c: char) -> bool {
|
||||
fn is_flag(c: &char) -> bool {
|
||||
match c {
|
||||
'0' | '-' | '+' | ' ' | '#' | '\'' => true,
|
||||
_ => false,
|
||||
|
@ -723,17 +716,11 @@ pub mod shell {
|
|||
}
|
||||
|
||||
fn is_ident_head(c: char) -> bool {
|
||||
match c {
|
||||
'a'..='z' | 'A'..='Z' | '_' => true,
|
||||
_ => false,
|
||||
}
|
||||
c.is_ascii_alphabetic() || c == '_'
|
||||
}
|
||||
|
||||
fn is_ident_tail(c: char) -> bool {
|
||||
match c {
|
||||
'0'..='9' => true,
|
||||
c => is_ident_head(c),
|
||||
}
|
||||
c.is_ascii_alphanumeric() || c == '_'
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
//! Values computed by queries that use MIR.
|
||||
|
||||
use crate::mir::{Body, Promoted};
|
||||
use crate::mir::{abstract_const, Body, Promoted};
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_index::bit_set::BitMatrix;
|
||||
|
@ -407,7 +408,12 @@ pub struct CoverageInfo {
|
|||
pub num_expressions: u32,
|
||||
}
|
||||
|
||||
/// Shims which make dealing with `WithOptConstParam` easier.
|
||||
///
|
||||
/// For more information on why this is needed, consider looking
|
||||
/// at the docs for `WithOptConstParam` itself.
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
#[inline]
|
||||
pub fn mir_borrowck_opt_const_arg(
|
||||
self,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
|
@ -419,6 +425,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mir_const_qualif_opt_const_arg(
|
||||
self,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
|
@ -430,7 +437,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn promoted_mir_of_opt_const_arg(
|
||||
#[inline]
|
||||
pub fn promoted_mir_opt_const_arg(
|
||||
self,
|
||||
def: ty::WithOptConstParam<DefId>,
|
||||
) -> &'tcx IndexVec<Promoted, Body<'tcx>> {
|
||||
|
@ -440,4 +448,28 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.promoted_mir(def.did)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn optimized_mir_opt_const_arg(
|
||||
self,
|
||||
def: ty::WithOptConstParam<DefId>,
|
||||
) -> &'tcx Body<'tcx> {
|
||||
if let Some((did, param_did)) = def.as_const_arg() {
|
||||
self.optimized_mir_of_const_arg((did, param_did))
|
||||
} else {
|
||||
self.optimized_mir(def.did)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mir_abstract_const_opt_const_arg(
|
||||
self,
|
||||
def: ty::WithOptConstParam<DefId>,
|
||||
) -> Result<Option<&'tcx [abstract_const::Node<'tcx>]>, ErrorReported> {
|
||||
if let Some((did, param_did)) = def.as_const_arg() {
|
||||
self.mir_abstract_const_of_const_arg((did, param_did))
|
||||
} else {
|
||||
self.mir_abstract_const(def.did)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2953,13 +2953,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
/// Returns the possibly-auto-generated MIR of a `(DefId, Subst)` pair.
|
||||
pub fn instance_mir(self, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> {
|
||||
match instance {
|
||||
ty::InstanceDef::Item(def) => {
|
||||
if let Some((did, param_did)) = def.as_const_arg() {
|
||||
self.optimized_mir_of_const_arg((did, param_did))
|
||||
} else {
|
||||
self.optimized_mir(def.did)
|
||||
}
|
||||
}
|
||||
ty::InstanceDef::Item(def) => self.optimized_mir_opt_const_arg(def),
|
||||
ty::InstanceDef::VtableShim(..)
|
||||
| ty::InstanceDef::ReifyShim(..)
|
||||
| ty::InstanceDef::Intrinsic(..)
|
||||
|
|
|
@ -343,7 +343,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
|||
// deny-by-default lint
|
||||
_ => {
|
||||
if let Some(p) = cid.promoted {
|
||||
let span = tcx.promoted_mir_of_opt_const_arg(def.to_global())[p].span;
|
||||
let span = tcx.promoted_mir_opt_const_arg(def.to_global())[p].span;
|
||||
if let err_inval!(ReferencedConstant) = err.error {
|
||||
Err(err.report_as_error(
|
||||
tcx.at(span),
|
||||
|
|
|
@ -477,16 +477,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
}
|
||||
trace!("load mir(instance={:?}, promoted={:?})", instance, promoted);
|
||||
if let Some(promoted) = promoted {
|
||||
return Ok(&self.tcx.promoted_mir_of_opt_const_arg(def)[promoted]);
|
||||
return Ok(&self.tcx.promoted_mir_opt_const_arg(def)[promoted]);
|
||||
}
|
||||
match instance {
|
||||
ty::InstanceDef::Item(def) => {
|
||||
if self.tcx.is_mir_available(def.did) {
|
||||
if let Some((did, param_did)) = def.as_const_arg() {
|
||||
Ok(self.tcx.optimized_mir_of_const_arg((did, param_did)))
|
||||
} else {
|
||||
Ok(self.tcx.optimized_mir(def.did))
|
||||
}
|
||||
Ok(self.tcx.optimized_mir_opt_const_arg(def))
|
||||
} else {
|
||||
throw_unsup!(NoMirFor(def.did))
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ use rustc_session::config::EntryFnType;
|
|||
use rustc_span::source_map::{dummy_spanned, respan, Span, Spanned, DUMMY_SP};
|
||||
use smallvec::SmallVec;
|
||||
use std::iter;
|
||||
use std::ops::Range;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
@ -210,9 +211,8 @@ pub enum MonoItemCollectionMode {
|
|||
pub struct InliningMap<'tcx> {
|
||||
// Maps a source mono item to the range of mono items
|
||||
// accessed by it.
|
||||
// The two numbers in the tuple are the start (inclusive) and
|
||||
// end index (exclusive) within the `targets` vecs.
|
||||
index: FxHashMap<MonoItem<'tcx>, (usize, usize)>,
|
||||
// The range selects elements within the `targets` vecs.
|
||||
index: FxHashMap<MonoItem<'tcx>, Range<usize>>,
|
||||
targets: Vec<MonoItem<'tcx>>,
|
||||
|
||||
// Contains one bit per mono item in the `targets` field. That bit
|
||||
|
@ -245,7 +245,7 @@ impl<'tcx> InliningMap<'tcx> {
|
|||
}
|
||||
|
||||
let end_index = self.targets.len();
|
||||
assert!(self.index.insert(source, (start_index, end_index)).is_none());
|
||||
assert!(self.index.insert(source, start_index..end_index).is_none());
|
||||
}
|
||||
|
||||
// Internally iterate over all items referenced by `source` which will be
|
||||
|
@ -254,9 +254,9 @@ impl<'tcx> InliningMap<'tcx> {
|
|||
where
|
||||
F: FnMut(MonoItem<'tcx>),
|
||||
{
|
||||
if let Some(&(start_index, end_index)) = self.index.get(&source) {
|
||||
for (i, candidate) in self.targets[start_index..end_index].iter().enumerate() {
|
||||
if self.inlines.contains(start_index + i) {
|
||||
if let Some(range) = self.index.get(&source) {
|
||||
for (i, candidate) in self.targets[range.clone()].iter().enumerate() {
|
||||
if self.inlines.contains(range.start + i) {
|
||||
f(*candidate);
|
||||
}
|
||||
}
|
||||
|
@ -268,8 +268,8 @@ impl<'tcx> InliningMap<'tcx> {
|
|||
where
|
||||
F: FnMut(MonoItem<'tcx>, &[MonoItem<'tcx>]),
|
||||
{
|
||||
for (&accessor, &(start_index, end_index)) in &self.index {
|
||||
f(accessor, &self.targets[start_index..end_index])
|
||||
for (&accessor, range) in &self.index {
|
||||
f(accessor, &self.targets[range.clone()])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,11 +287,7 @@ fn mir_promoted(
|
|||
// this point, before we steal the mir-const result.
|
||||
// Also this means promotion can rely on all const checks having been done.
|
||||
let _ = tcx.mir_const_qualif_opt_const_arg(def);
|
||||
let _ = if let Some(param_did) = def.const_param_did {
|
||||
tcx.mir_abstract_const_of_const_arg((def.did, param_did))
|
||||
} else {
|
||||
tcx.mir_abstract_const(def.did.to_def_id())
|
||||
};
|
||||
let _ = tcx.mir_abstract_const_opt_const_arg(def.to_global());
|
||||
let mut body = tcx.mir_const(def).steal();
|
||||
|
||||
let mut required_consts = Vec::new();
|
||||
|
|
|
@ -147,11 +147,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
|
|||
if concrete.is_ok() && substs.has_param_types_or_consts() {
|
||||
match infcx.tcx.def_kind(def.did) {
|
||||
DefKind::AnonConst => {
|
||||
let mir_body = if let Some(def) = def.as_const_arg() {
|
||||
infcx.tcx.optimized_mir_of_const_arg(def)
|
||||
} else {
|
||||
infcx.tcx.optimized_mir(def.did)
|
||||
};
|
||||
let mir_body = infcx.tcx.optimized_mir_opt_const_arg(def);
|
||||
|
||||
if mir_body.is_polymorphic {
|
||||
future_compat_lint();
|
||||
|
@ -212,13 +208,7 @@ impl AbstractConst<'tcx> {
|
|||
def: ty::WithOptConstParam<DefId>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> Result<Option<AbstractConst<'tcx>>, ErrorReported> {
|
||||
let inner = match (def.did.as_local(), def.const_param_did) {
|
||||
(Some(did), Some(param_did)) => {
|
||||
tcx.mir_abstract_const_of_const_arg((did, param_did))?
|
||||
}
|
||||
_ => tcx.mir_abstract_const(def.did)?,
|
||||
};
|
||||
|
||||
let inner = tcx.mir_abstract_const_opt_const_arg(def)?;
|
||||
Ok(inner.map(|inner| AbstractConst { inner, substs }))
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ impl<'a, 'f: 'a> DerefMut for VaList<'a, 'f> {
|
|||
// within a private module. Once RFC 2145 has been implemented look into
|
||||
// improving this.
|
||||
mod sealed_trait {
|
||||
/// Trait which permits the allowed types to be used with [VaList::arg].
|
||||
/// Trait which permits the allowed types to be used with [super::VaListImpl::arg].
|
||||
#[unstable(
|
||||
feature = "c_variadic",
|
||||
reason = "the `c_variadic` feature has not been properly tested on \
|
||||
|
|
|
@ -160,3 +160,21 @@ impl AsRawFd for io::Stderr {
|
|||
sys::stdio::Stderr.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AsRawFd for io::StdinLock<'a> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
sys::stdio::Stdin.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AsRawFd for io::StdoutLock<'a> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
sys::stdio::Stdout.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AsRawFd for io::StderrLock<'a> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
sys::stdio::Stderr.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,12 +93,12 @@ handled naturally. `./configure` should almost never be used for local
|
|||
installations, and is primarily useful for CI. Prefer to customize behavior
|
||||
using `config.toml`.
|
||||
|
||||
Finally, rustbuild makes use of the [gcc-rs crate] which has [its own
|
||||
Finally, rustbuild makes use of the [cc-rs crate] which has [its own
|
||||
method][env-vars] of configuring C compilers and C flags via environment
|
||||
variables.
|
||||
|
||||
[gcc-rs crate]: https://github.com/alexcrichton/gcc-rs
|
||||
[env-vars]: https://github.com/alexcrichton/gcc-rs#external-configuration-via-environment-variables
|
||||
[cc-rs crate]: https://github.com/alexcrichton/cc-rs
|
||||
[env-vars]: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables
|
||||
|
||||
## Build stages
|
||||
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
|
||||
use std::env;
|
||||
|
||||
use bootstrap::{Build, Config, Subcommand};
|
||||
use bootstrap::{Build, Config, Subcommand, VERSION};
|
||||
|
||||
fn main() {
|
||||
let args = env::args().skip(1).collect::<Vec<_>>();
|
||||
let config = Config::parse(&args);
|
||||
|
||||
let changelog_suggestion = check_version(&config);
|
||||
// check_version warnings are not printed during setup
|
||||
let changelog_suggestion =
|
||||
if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) };
|
||||
|
||||
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
|
||||
// changelog warning, not the `x.py setup` message.
|
||||
|
@ -40,8 +42,6 @@ fn main() {
|
|||
}
|
||||
|
||||
fn check_version(config: &Config) -> Option<String> {
|
||||
const VERSION: usize = 2;
|
||||
|
||||
let mut msg = String::new();
|
||||
|
||||
let suggestion = if let Some(seen) = config.changelog_seen {
|
||||
|
|
|
@ -179,6 +179,8 @@ const LLVM_TOOLS: &[&str] = &[
|
|||
"llvm-ar", // used for creating and modifying archive files
|
||||
];
|
||||
|
||||
pub const VERSION: usize = 2;
|
||||
|
||||
/// A structure representing a Rust compiler.
|
||||
///
|
||||
/// Each compiler has a `stage` that it is associated with and a `host` that
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::t;
|
||||
use crate::{t, VERSION};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::{
|
||||
|
@ -69,8 +69,9 @@ pub fn setup(src_path: &Path, profile: Profile) {
|
|||
let path = cfg_file.unwrap_or_else(|| src_path.join("config.toml"));
|
||||
let settings = format!(
|
||||
"# Includes one of the default files in src/bootstrap/defaults\n\
|
||||
profile = \"{}\"\n",
|
||||
profile
|
||||
profile = \"{}\"\n\
|
||||
changelog-seen = {}\n",
|
||||
profile, VERSION
|
||||
);
|
||||
t!(fs::write(path, settings));
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ pub fn get_deprecation(cx: &DocContext<'_>, def_id: DefId) -> Option<Deprecation
|
|||
cx.tcx.lookup_deprecation(def_id).clean(cx)
|
||||
}
|
||||
|
||||
pub fn external_generic_args(
|
||||
fn external_generic_args(
|
||||
cx: &DocContext<'_>,
|
||||
trait_did: Option<DefId>,
|
||||
has_self: bool,
|
||||
|
@ -159,7 +159,7 @@ pub fn external_generic_args(
|
|||
|
||||
// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
|
||||
// from Fn<(A, B,), C> to Fn(A, B) -> C
|
||||
pub fn external_path(
|
||||
pub(super) fn external_path(
|
||||
cx: &DocContext<'_>,
|
||||
name: Symbol,
|
||||
trait_did: Option<DefId>,
|
||||
|
|
|
@ -390,17 +390,13 @@ nav.sub {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.docblock-short {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.docblock-short p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.docblock-short.nowrap {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.docblock-short p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -33,7 +33,7 @@ MAINTAINERS = {
|
|||
'rust-by-example': {'steveklabnik', 'marioidival'},
|
||||
'embedded-book': {'adamgreig', 'andre-richter', 'jamesmunns', 'therealprof'},
|
||||
'edition-guide': {'ehuss', 'steveklabnik'},
|
||||
'rustc-dev-guide': {'mark-i-m', 'spastorino', 'amanjeev', 'JohnTitor'},
|
||||
'rustc-dev-guide': {'spastorino', 'amanjeev', 'JohnTitor'},
|
||||
}
|
||||
|
||||
LABELS = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue