Skip to content

Commit

Permalink
Auto merge of rust-lang#98440 - ehuss:update-beta-cargo, r=ehuss
Browse files Browse the repository at this point in the history
[beta] Beta backports

* Remove the unused-#[doc(hidden)] logic from the unused_attributes lint rust-lang#98336
* debuginfo: Fix NatVis for Rc and Arc with unsized pointees. rust-lang#98137
* Revert "remove num_cpus dependency" in rustc and update cargo rust-lang#97911
* Update LLVM submodule rust-lang#97690
* Revert rust-lang#96682. rust-lang#97636
* don't do Sized and other return type checks on RPIT's real type rust-lang#97431
* Temporarily disable submodule archive downloads. rust-lang#98423
  • Loading branch information
bors committed Jun 24, 2022
2 parents 1bc802e + 31eb5f7 commit d8ffc1f
Show file tree
Hide file tree
Showing 38 changed files with 333 additions and 415 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ dependencies = [
"getopts",
"ignore",
"libc",
"num_cpus",
"once_cell",
"opener",
"pretty_assertions",
Expand Down Expand Up @@ -247,6 +248,7 @@ dependencies = [
"anyhow",
"flate2",
"hex 0.4.2",
"num_cpus",
"rayon",
"serde",
"serde_json",
Expand Down Expand Up @@ -346,6 +348,7 @@ dependencies = [
"libgit2-sys",
"log",
"memchr",
"num_cpus",
"opener",
"openssl",
"os_info",
Expand Down Expand Up @@ -4338,6 +4341,7 @@ name = "rustc_session"
version = "0.0.0"
dependencies = [
"getopts",
"num_cpus",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ pub enum Delimiter {
Brace,
/// `[ ... ]`
Bracket,
/// `/*«*/ ... /*»*/`
/// `Ø ... Ø`
/// An invisible delimiter, that may, for example, appear around tokens coming from a
/// "macro variable" `$var`. It is important to preserve operator priorities in cases like
/// `$var * 3` where `$var` is `1 + 2`.
/// Invisible delimiters are not directly writable in normal Rust code except as comments.
/// Therefore, they might not survive a roundtrip of a token stream through a string.
/// Invisible delimiters might not survive roundtrip of a token stream through a string.
Invisible,
}

Expand Down
23 changes: 5 additions & 18 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,28 +590,14 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
self.nbsp();
}
self.word("{");
let empty = tts.is_empty();
if !empty {
if !tts.is_empty() {
self.space();
}
self.ibox(0);
self.print_tts(tts, convert_dollar_crate);
self.end();
self.bclose(span, empty);
}
Some(Delimiter::Invisible) => {
self.word("/*«*/");
let empty = tts.is_empty();
if !empty {
self.space();
}
self.ibox(0);
self.print_tts(tts, convert_dollar_crate);
self.end();
if !empty {
self.space();
}
self.word("/*»*/");
self.bclose(span, empty);
}
Some(delim) => {
let token_str = self.token_kind_to_string(&token::OpenDelim(delim));
Expand Down Expand Up @@ -786,8 +772,9 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
token::CloseDelim(Delimiter::Bracket) => "]".into(),
token::OpenDelim(Delimiter::Brace) => "{".into(),
token::CloseDelim(Delimiter::Brace) => "}".into(),
token::OpenDelim(Delimiter::Invisible) => "/*«*/".into(),
token::CloseDelim(Delimiter::Invisible) => "/*»*/".into(),
token::OpenDelim(Delimiter::Invisible) | token::CloseDelim(Delimiter::Invisible) => {
"".into()
}
token::Pound => "#".into(),
token::Dollar => "$".into(),
token::Question => "?".into(),
Expand Down
76 changes: 2 additions & 74 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
//! conflicts between multiple such attributes attached to the same
//! item.

use rustc_ast::tokenstream::DelimSpan;
use rustc_ast::{ast, AttrStyle, Attribute, Lit, LitKind, MacArgs, MetaItemKind, NestedMetaItem};
use rustc_ast::{ast, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{pluralize, struct_span_err, Applicability, MultiSpan};
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
Expand Down Expand Up @@ -815,68 +814,6 @@ impl CheckAttrVisitor<'_> {
}
}

/// Checks `#[doc(hidden)]` attributes. Returns `true` if valid.
fn check_doc_hidden(
&self,
attr: &Attribute,
meta_index: usize,
meta: &NestedMetaItem,
hir_id: HirId,
target: Target,
) -> bool {
if let Target::AssocConst
| Target::AssocTy
| Target::Method(MethodKind::Trait { body: true }) = target
{
let parent_hir_id = self.tcx.hir().get_parent_item(hir_id);
let containing_item = self.tcx.hir().expect_item(parent_hir_id);

if Target::from_item(containing_item) == Target::Impl {
let meta_items = attr.meta_item_list().unwrap();

let (span, replacement_span) = if meta_items.len() == 1 {
(attr.span, attr.span)
} else {
let meta_span = meta.span();
(
meta_span,
meta_span.until(match meta_items.get(meta_index + 1) {
Some(next_item) => next_item.span(),
None => match attr.get_normal_item().args {
MacArgs::Delimited(DelimSpan { close, .. }, ..) => close,
_ => unreachable!(),
},
}),
)
};

// FIXME: #[doc(hidden)] was previously erroneously allowed on trait impl items,
// so for backward compatibility only emit a warning and do not mark it as invalid.
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, span, |lint| {
lint.build("`#[doc(hidden)]` is ignored on trait impl items")
.warn(
"this was previously accepted by the compiler but is \
being phased out; it will become a hard error in \
a future release!",
)
.note(
"whether the impl item is `doc(hidden)` or not \
entirely depends on the corresponding trait item",
)
.span_suggestion(
replacement_span,
"remove this attribute",
String::new(),
Applicability::MachineApplicable,
)
.emit();
});
}
}

true
}

/// Checks that an attribute is *not* used at the crate level. Returns `true` if valid.
fn check_attr_not_crate_level(
&self,
Expand Down Expand Up @@ -995,7 +932,7 @@ impl CheckAttrVisitor<'_> {
let mut is_valid = true;

if let Some(mi) = attr.meta() && let Some(list) = mi.meta_item_list() {
for (meta_index, meta) in list.into_iter().enumerate() {
for meta in list {
if let Some(i_meta) = meta.meta_item() {
match i_meta.name_or_empty() {
sym::alias
Expand Down Expand Up @@ -1036,15 +973,6 @@ impl CheckAttrVisitor<'_> {
is_valid = false;
}

sym::hidden if !self.check_doc_hidden(attr,
meta_index,
meta,
hir_id,
target,
) => {
is_valid = false;
}

// no_default_passes: deprecated
// passes: deprecated
// plugins: removed, but rustdoc warns about it itself
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ rustc_serialize = { path = "../rustc_serialize" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_span = { path = "../rustc_span" }
rustc_fs_util = { path = "../rustc_fs_util" }
num_cpus = "1.0"
rustc_ast = { path = "../rustc_ast" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ mod parse {
crate fn parse_threads(slot: &mut usize, v: Option<&str>) -> bool {
match v.and_then(|s| s.parse().ok()) {
Some(0) => {
*slot = std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get);
*slot = ::num_cpus::get();
true
}
Some(i) => {
Expand Down
13 changes: 6 additions & 7 deletions compiler/rustc_typeck/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ pub(super) fn check_fn<'a, 'tcx>(
DUMMY_SP,
param_env,
));
// HACK(oli-obk): we rewrite the declared return type, too, so that we don't end up inferring all
// unconstrained RPIT to have `()` as their hidden type. This would happen because further down we
// compare the ret_coercion with declared_ret_ty, and anything uninferred would be inferred to the
// opaque type itself. That again would cause writeback to assume we have a recursive call site
// and do the sadly stabilized fallback to `()`.
let declared_ret_ty = ret_ty;
fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(ret_ty)));
fcx.ret_type_span = Some(decl.output.span());

Expand Down Expand Up @@ -252,7 +246,12 @@ pub(super) fn check_fn<'a, 'tcx>(
fcx.next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::DynReturnFn, span });
debug!("actual_return_ty replaced with {:?}", actual_return_ty);
}
fcx.demand_suptype(span, declared_ret_ty, actual_return_ty);

// HACK(oli-obk, compiler-errors): We should be comparing this against
// `declared_ret_ty`, but then anything uninferred would be inferred to
// the opaque type itself. That again would cause writeback to assume
// we have a recursive call site and do the sadly stabilized fallback to `()`.
fcx.demand_suptype(span, ret_ty, actual_return_ty);

// Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
if let Some(panic_impl_did) = tcx.lang_items().panic_impl()
Expand Down
5 changes: 2 additions & 3 deletions library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,11 @@ pub enum Delimiter {
/// `[ ... ]`
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
Bracket,
/// `/*«*/ ... /*»*/`
/// `Ø ... Ø`
/// An invisible delimiter, that may, for example, appear around tokens coming from a
/// "macro variable" `$var`. It is important to preserve operator priorities in cases like
/// `$var * 3` where `$var` is `1 + 2`.
/// Invisible delimiters are not directly writable in normal Rust code except as comments.
/// Therefore, they might not survive a roundtrip of a token stream through a string.
/// Invisible delimiters might not survive roundtrip of a token stream through a string.
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
None,
}
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test = false
[dependencies]
cmake = "0.1.38"
filetime = "0.2"
num_cpus = "1.0"
getopts = "0.2.19"
cc = "1.0.69"
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ fn set<T>(field: &mut T, val: Option<T>) {

fn threads_from_config(v: u32) -> u32 {
match v {
0 => std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32,
0 => num_cpus::get() as u32,
n => n,
}
}
2 changes: 1 addition & 1 deletion src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
let j_msg = format!(
"number of jobs to run in parallel; \
defaults to {} (this host's logical CPU count)",
std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get)
num_cpus::get()
);
opts.optopt("j", "jobs", &j_msg, "JOBS");
opts.optflag("h", "help", "print this help message");
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,7 @@ impl Build {
/// Returns the number of parallel jobs that have been configured for this
/// build.
fn jobs(&self) -> u32 {
self.config.jobs.unwrap_or_else(|| {
std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
})
self.config.jobs.unwrap_or_else(|| num_cpus::get() as u32)
}

fn debuginfo_map_to(&self, which: GitRepo) -> Option<String> {
Expand Down
19 changes: 11 additions & 8 deletions src/ci/init_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ function fetch_github_commit_archive {
rm $cached
}

included="src/llvm-project src/doc/book src/doc/rust-by-example"
# Archive downloads are temporarily disabled due to sudden 504
# gateway timeout errors.
# included="src/llvm-project src/doc/book src/doc/rust-by-example"
included=""
modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
modules=($modules)
use_git=""
Expand All @@ -75,10 +78,10 @@ for i in ${!modules[@]}; do
done
retry sh -c "git submodule deinit -f $use_git && \
git submodule sync && \
git submodule update -j 16 --init --recursive $use_git"
STATUS=0
for pid in ${bg_pids[*]}
do
wait $pid || STATUS=1
done
exit ${STATUS}
git submodule update -j 16 --init --recursive --depth 1 $use_git"
# STATUS=0
# for pid in ${bg_pids[*]}
# do
# wait $pid || STATUS=1
# done
# exit ${STATUS}

0 comments on commit d8ffc1f

Please sign in to comment.