diff --git a/Cargo.lock b/Cargo.lock index 2f143b097b7f4..a186e173ccf8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,6 +218,7 @@ dependencies = [ "getopts", "ignore", "libc", + "num_cpus", "once_cell", "opener", "pretty_assertions", @@ -247,6 +248,7 @@ dependencies = [ "anyhow", "flate2", "hex 0.4.2", + "num_cpus", "rayon", "serde", "serde_json", @@ -346,6 +348,7 @@ dependencies = [ "libgit2-sys", "log", "memchr", + "num_cpus", "opener", "openssl", "os_info", @@ -4338,6 +4341,7 @@ name = "rustc_session" version = "0.0.0" dependencies = [ "getopts", + "num_cpus", "rustc_ast", "rustc_data_structures", "rustc_errors", diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 35eca23a11625..72dd44a4b4d98 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -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, } diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index f520b54112464..2fffa529d2126 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -590,28 +590,14 @@ pub trait PrintState<'a>: std::ops::Deref + 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)); @@ -786,8 +772,9 @@ pub trait PrintState<'a>: std::ops::Deref + 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(), diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 8d207e4e1a924..72cbdbcf8cff1 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -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}; @@ -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, @@ -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 @@ -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 diff --git a/compiler/rustc_session/Cargo.toml b/compiler/rustc_session/Cargo.toml index 6b1eaa4d399d9..37cfc4a0dc3c2 100644 --- a/compiler/rustc_session/Cargo.toml +++ b/compiler/rustc_session/Cargo.toml @@ -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" } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 14e918660dd39..5c404b6cd2282 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -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) => { diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 3e76738cc5d9e..da51633df9911 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -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()); @@ -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() diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 6f7c6305afc14..f1c5eaad868e9 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -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, } diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index dea8d998bdeda..cea7b7c949e26 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -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" diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e39c9fa1c5a6d..5457cb52cc8b4 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1345,7 +1345,7 @@ fn set(field: &mut T, val: Option) { 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, } } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 4cd835ade6421..bddf70424bec7 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -210,7 +210,7 @@ To learn more about a subcommand, run `./x.py -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"); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 5d32b4f801a18..68d387b042574 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -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 { diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index 93af8c26111c2..87a5eece39fde 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -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="" @@ -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} diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index 83ca8ed932e46..912418fa7d1eb 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -59,39 +59,133 @@ + + - {ptr.pointer->value} + {ptr.pointer->value} - ptr.pointer->value - ptr.pointer->strong - ptr.pointer->weak + + ptr.pointer->value + ptr.pointer->strong + ptr.pointer->weak + + + ptr.pointer.pointer->strong + ptr.pointer.pointer->weak + + + + + + {{ len={ptr.pointer.length} }} + + ptr.pointer.length + ptr.pointer.data_ptr->strong + ptr.pointer.data_ptr->weak + + ptr.pointer.length + + ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2) + + + - {ptr.pointer->value} + {ptr.pointer->value} + + + ptr.pointer->value + ptr.pointer->strong + ptr.pointer->weak + + + ptr.pointer.pointer->strong + ptr.pointer.pointer->weak + + + + + + {{ len={ptr.pointer.length} }} - ptr.pointer->value - ptr.pointer->strong - ptr.pointer->weak + ptr.pointer.length + ptr.pointer.data_ptr->strong + ptr.pointer.data_ptr->weak + + ptr.pointer.length + ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2) + + - {ptr.pointer->data} + {ptr.pointer->data} - ptr.pointer->data - ptr.pointer->strong - ptr.pointer->weak + + ptr.pointer->data + ptr.pointer->strong + ptr.pointer->weak + + + ptr.pointer.pointer->strong + ptr.pointer.pointer->weak + + + + + + {{ len={ptr.pointer.length} }} + + ptr.pointer.length + ptr.pointer.data_ptr->strong + ptr.pointer.data_ptr->weak + + ptr.pointer.length + ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2) + + + - {ptr.pointer->data} + {ptr.pointer->data} - ptr.pointer->data - ptr.pointer->strong - ptr.pointer->weak + + ptr.pointer->data + ptr.pointer->strong + ptr.pointer->weak + + + ptr.pointer.pointer->strong + ptr.pointer.pointer->weak + + + + + + {{ len={ptr.pointer.length} }} + + ptr.pointer.length + ptr.pointer.data_ptr->strong + ptr.pointer.data_ptr->weak + + ptr.pointer.length + ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2) + + Borrowed({__0}) Owned({__0}) diff --git a/src/llvm-project b/src/llvm-project index 47848665966fc..c9e2e89ed3aa5 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 47848665966fc7393cb6f898077994f6dec2b591 +Subproject commit c9e2e89ed3aa5a3be77143aa0c86906b4138374a diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs index 8470ace24b845..c05c565d95634 100644 --- a/src/test/debuginfo/rc_arc.rs +++ b/src/test/debuginfo/rc_arc.rs @@ -8,74 +8,138 @@ // gdb-command:run -// gdb-command:print r -// gdb-check:[...]$1 = Rc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1} -// gdb-command:print a -// gdb-check:[...]$2 = Arc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1} - +// gdb-command:print rc +// gdb-check:[...]$1 = Rc(strong=11, weak=1) = {value = 111, strong = 11, weak = 1} +// gdb-command:print arc +// gdb-check:[...]$2 = Arc(strong=21, weak=1) = {value = 222, strong = 21, weak = 1} // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print r -// lldb-check:[...]$0 = strong=2, weak=1 { value = 42 } -// lldb-command:print a -// lldb-check:[...]$1 = strong=2, weak=1 { data = 42 } +// lldb-command:print rc +// lldb-check:[...]$0 = strong=11, weak=1 { value = 111 } +// lldb-command:print arc +// lldb-check:[...]$1 = strong=21, weak=1 { data = 222 } // === CDB TESTS ================================================================================== // cdb-command:g -// cdb-command:dx r,d -// cdb-check:r,d : 42 [Type: alloc::rc::Rc] -// cdb-check: [] [Type: alloc::rc::Rc] -// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-command:dx rc,d +// cdb-check:rc,d : 111 [Type: alloc::rc::Rc] +// cdb-check: [Reference count] : 11 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] + +// cdb-command:dx weak_rc,d +// cdb-check:weak_rc,d : 111 [Type: alloc::rc::Weak] +// cdb-check: [Reference count] : 11 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] + +// cdb-command:dx arc,d +// cdb-check:arc,d : 222 [Type: alloc::sync::Arc] +// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] + +// cdb-command:dx weak_arc,d +// cdb-check:weak_arc,d : 222 [Type: alloc::sync::Weak] +// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] + +// cdb-command:dx dyn_rc,d +// cdb-check:dyn_rc,d [Type: alloc::rc::Rc >] +// cdb-check: [Reference count] : 31 [Type: core::cell::Cell] // cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] -// cdb-command:dx r1,d -// cdb-check:r1,d : 42 [Type: alloc::rc::Rc] -// cdb-check: [] [Type: alloc::rc::Rc] -// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-command:dx dyn_rc_weak,d +// cdb-check:dyn_rc_weak,d [Type: alloc::rc::Weak >] +// cdb-check: [Reference count] : 31 [Type: core::cell::Cell] // cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] -// cdb-command:dx w1,d -// cdb-check:w1,d : 42 [Type: alloc::rc::Weak] -// cdb-check: [] [Type: alloc::rc::Weak] -// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-command:dx slice_rc,d +// cdb-check:slice_rc,d : { len=3 } [Type: alloc::rc::Rc >] +// cdb-check: [Length] : 3 [Type: [...]] +// cdb-check: [Reference count] : 41 [Type: core::cell::Cell] // cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] +// cdb-check: [0] : 1 [Type: u32] +// cdb-check: [1] : 2 [Type: u32] +// cdb-check: [2] : 3 [Type: u32] + +// cdb-command:dx slice_rc_weak,d +// cdb-check:slice_rc_weak,d : { len=3 } [Type: alloc::rc::Weak >] +// cdb-check: [Length] : 3 [Type: [...]] +// cdb-check: [Reference count] : 41 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] +// cdb-check: [0] : 1 [Type: u32] +// cdb-check: [1] : 2 [Type: u32] +// cdb-check: [2] : 3 [Type: u32] -// cdb-command:dx a,d -// cdb-check:a,d : 42 [Type: alloc::sync::Arc] -// cdb-check: [] [Type: alloc::sync::Arc] -// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-command:dx dyn_arc,d +// cdb-check:dyn_arc,d [Type: alloc::sync::Arc >] +// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize] // cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] -// cdb-command:dx a1,d -// cdb-check:a1,d : 42 [Type: alloc::sync::Arc] -// cdb-check: [] [Type: alloc::sync::Arc] -// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-command:dx dyn_arc_weak,d +// cdb-check:dyn_arc_weak,d [Type: alloc::sync::Weak >] +// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize] // cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] -// cdb-command:dx w2,d -// cdb-check:w2,d : 42 [Type: alloc::sync::Weak] -// cdb-check: [] [Type: alloc::sync::Weak] -// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-command:dx slice_arc,d +// cdb-check:slice_arc,d : { len=3 } [Type: alloc::sync::Arc >] +// cdb-check: [Length] : 3 [Type: [...]] +// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [0] : 4 [Type: u32] +// cdb-check: [1] : 5 [Type: u32] +// cdb-check: [2] : 6 [Type: u32] + +// cdb-command:dx slice_arc_weak,d +// cdb-check:slice_arc_weak,d : { len=3 } [Type: alloc::sync::Weak >] +// cdb-check: [Length] : 3 [Type: [...]] +// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize] // cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [0] : 4 [Type: u32] +// cdb-check: [1] : 5 [Type: u32] +// cdb-check: [2] : 6 [Type: u32] +use std::fmt::Debug; use std::rc::Rc; use std::sync::Arc; fn main() { - let r = Rc::new(42); - let r1 = Rc::clone(&r); - let w1 = Rc::downgrade(&r); + let rc = Rc::new(111); + inc_ref_count(&rc, 10); + let weak_rc = Rc::downgrade(&rc); + + let arc = Arc::new(222); + inc_ref_count(&arc, 20); + let weak_arc = Arc::downgrade(&arc); + + let dyn_rc: Rc = Rc::new(333); + inc_ref_count(&dyn_rc, 30); + let dyn_rc_weak = Rc::downgrade(&dyn_rc); + + let slice_rc: Rc<[u32]> = Rc::from(vec![1, 2, 3]); + inc_ref_count(&slice_rc, 40); + let slice_rc_weak = Rc::downgrade(&slice_rc); - let a = Arc::new(42); - let a1 = Arc::clone(&a); - let w2 = Arc::downgrade(&a); + let dyn_arc: Arc = Arc::new(444); + inc_ref_count(&dyn_arc, 50); + let dyn_arc_weak = Arc::downgrade(&dyn_arc); + + let slice_arc: Arc<[u32]> = Arc::from(vec![4, 5, 6]); + inc_ref_count(&slice_arc, 60); + let slice_arc_weak = Arc::downgrade(&slice_arc); zzz(); // #break } -fn zzz() { () } +fn inc_ref_count(rc: &T, count: usize) { + for _ in 0..count { + std::mem::forget(rc.clone()); + } +} + +fn zzz() { + () +} diff --git a/src/test/ui/impl-trait/rpit-not-sized.rs b/src/test/ui/impl-trait/rpit-not-sized.rs new file mode 100644 index 0000000000000..bd25940780a16 --- /dev/null +++ b/src/test/ui/impl-trait/rpit-not-sized.rs @@ -0,0 +1,6 @@ +fn foo() -> impl ?Sized { + //~^ ERROR the size for values of type `impl ?Sized` cannot be known at compilation time + () +} + +fn main() {} diff --git a/src/test/ui/impl-trait/rpit-not-sized.stderr b/src/test/ui/impl-trait/rpit-not-sized.stderr new file mode 100644 index 0000000000000..608c94fc07237 --- /dev/null +++ b/src/test/ui/impl-trait/rpit-not-sized.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `impl ?Sized` cannot be known at compilation time + --> $DIR/rpit-not-sized.rs:1:13 + | +LL | fn foo() -> impl ?Sized { + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `impl ?Sized` + = note: the return type of a function must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed b/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed deleted file mode 100644 index 36a14097ac308..0000000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed +++ /dev/null @@ -1,42 +0,0 @@ -#![deny(unused_attributes)] -#![crate_type = "lib"] -// run-rustfix - -pub trait Trait { - type It; - const IT: (); - fn it0(); - fn it1(); - fn it2(); -} - -pub struct Implementor; - -impl Trait for Implementor { - - type It = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - - const IT: () = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "aka")] - fn it0() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "this", )] - fn it1() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc()] - fn it2() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - //~| ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted -} diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs b/src/test/ui/lint/unused/unused-attr-doc-hidden.rs deleted file mode 100644 index e58c4f22f31ab..0000000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs +++ /dev/null @@ -1,42 +0,0 @@ -#![deny(unused_attributes)] -#![crate_type = "lib"] -// run-rustfix - -pub trait Trait { - type It; - const IT: (); - fn it0(); - fn it1(); - fn it2(); -} - -pub struct Implementor; - -impl Trait for Implementor { - #[doc(hidden)] - type It = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden)] - const IT: () = (); - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden, alias = "aka")] - fn it0() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(alias = "this", hidden,)] - fn it1() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - - #[doc(hidden, hidden)] - fn it2() {} - //~^^ ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted - //~| ERROR `#[doc(hidden)]` is ignored - //~| WARNING this was previously accepted -} diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr b/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr deleted file mode 100644 index fd1202a29de2e..0000000000000 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:16:5 - | -LL | #[doc(hidden)] - | ^^^^^^^^^^^^^^ help: remove this attribute - | -note: the lint level is defined here - --> $DIR/unused-attr-doc-hidden.rs:1:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - = warning: 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 - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:21:5 - | -LL | #[doc(hidden)] - | ^^^^^^^^^^^^^^ help: remove this attribute - | - = warning: 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 - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:26:11 - | -LL | #[doc(hidden, alias = "aka")] - | ^^^^^^-- - | | - | help: remove this attribute - | - = warning: 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 - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:31:27 - | -LL | #[doc(alias = "this", hidden,)] - | ^^^^^^- - | | - | help: remove this attribute - | - = warning: 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 - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:36:11 - | -LL | #[doc(hidden, hidden)] - | ^^^^^^-- - | | - | help: remove this attribute - | - = warning: 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 - -error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:36:19 - | -LL | #[doc(hidden, hidden)] - | ^^^^^^ help: remove this attribute - | - = warning: 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 - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/proc-macro/auxiliary/expand-expr.rs b/src/test/ui/proc-macro/auxiliary/expand-expr.rs index a2e30e2e93b5a..2bc34f3c6bfc0 100644 --- a/src/test/ui/proc-macro/auxiliary/expand-expr.rs +++ b/src/test/ui/proc-macro/auxiliary/expand-expr.rs @@ -12,15 +12,6 @@ use std::str::FromStr; #[proc_macro] pub fn expand_expr_is(input: TokenStream) -> TokenStream { - expand_expr_is_inner(input, false) -} - -#[proc_macro] -pub fn expand_expr_is_trim(input: TokenStream) -> TokenStream { - expand_expr_is_inner(input, true) -} - -fn expand_expr_is_inner(input: TokenStream, trim_invisible: bool) -> TokenStream { let mut iter = input.into_iter(); let mut expected_tts = Vec::new(); loop { @@ -31,18 +22,14 @@ fn expand_expr_is_inner(input: TokenStream, trim_invisible: bool) -> TokenStream } } - // If requested, trim the "invisible" delimiters at the start and end. - let expected = expected_tts.into_iter().collect::().to_string(); - let expected = if trim_invisible { - let len1 = "/*«*/ ".len(); - let len2 = " /*»*/".len(); - &expected[len1..expected.len() - len2] - } else { - &expected[..] - }; - let expanded = iter.collect::().expand_expr().unwrap().to_string(); - - assert_eq!(expected, expanded); + let expected = expected_tts.into_iter().collect::(); + let expanded = iter.collect::().expand_expr().expect("expand_expr failed"); + assert!( + expected.to_string() == expanded.to_string(), + "assert failed\nexpected: `{}`\nexpanded: `{}`", + expected.to_string(), + expanded.to_string() + ); TokenStream::new() } diff --git a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout index 3d0e7eaff00d8..4de8746a1b460 100644 --- a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout +++ b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): self -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ self /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, @@ -14,10 +13,8 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ ] PRINT-BANG INPUT (DISPLAY): 1 + 1, { "a" }, let a = 1;, String, my_name, 'a, my_val = 30, std::option::Option, pub(in some::path) , [a b c], -30 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 1 + 1 /*»*/, /*«*/ { "a" } /*»*/, /*«*/ let a = 1 /*»*/, /*«*/ -String /*»*/, my_name, /*«*/ 'a /*»*/, /*«*/ my_val = 30 /*»*/, /*«*/ -std :: option :: Option /*»*/, /*«*/ pub(in some :: path) /*»*/, [a b c], -/*«*/ - 30 /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): 1 + 1, { "a" }, let a = 1, String, my_name, 'a, my_val = 30, +std :: option :: Option, pub(in some :: path), [a b c], - 30 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, @@ -298,7 +295,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): (a, b) -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ (a, b) /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/capture-unglued-token.stdout b/src/test/ui/proc-macro/capture-unglued-token.stdout index 5fe6ff72b4544..7e6b540332c79 100644 --- a/src/test/ui/proc-macro/capture-unglued-token.stdout +++ b/src/test/ui/proc-macro/capture-unglued-token.stdout @@ -1,5 +1,5 @@ PRINT-BANG INPUT (DISPLAY): Vec -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ Vec < u8 > /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): Vec < u8 > PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/expand-expr.rs b/src/test/ui/proc-macro/expand-expr.rs index edcb30f892cdf..d1146d9703062 100644 --- a/src/test/ui/proc-macro/expand-expr.rs +++ b/src/test/ui/proc-macro/expand-expr.rs @@ -2,9 +2,9 @@ extern crate expand_expr; -use expand_expr::{check_expand_expr_file, echo_pm, expand_expr_fail, expand_expr_is}; -use expand_expr::{expand_expr_is_trim, recursive_expand}; - +use expand_expr::{ + check_expand_expr_file, echo_pm, expand_expr_fail, expand_expr_is, recursive_expand, +}; // Check builtin macros can be expanded. @@ -47,21 +47,21 @@ macro_rules! echo_expr { macro_rules! simple_lit { ($l:literal) => { - expand_expr_is_trim!($l, $l); - expand_expr_is_trim!($l, echo_lit!($l)); - expand_expr_is_trim!($l, echo_expr!($l)); - expand_expr_is_trim!($l, echo_tts!($l)); - expand_expr_is_trim!($l, echo_pm!($l)); + expand_expr_is!($l, $l); + expand_expr_is!($l, echo_lit!($l)); + expand_expr_is!($l, echo_expr!($l)); + expand_expr_is!($l, echo_tts!($l)); + expand_expr_is!($l, echo_pm!($l)); const _: () = { macro_rules! mac { () => { $l }; } - expand_expr_is_trim!($l, mac!()); - expand_expr_is_trim!($l, echo_expr!(mac!())); - expand_expr_is_trim!($l, echo_tts!(mac!())); - expand_expr_is_trim!($l, echo_pm!(mac!())); + expand_expr_is!($l, mac!()); + expand_expr_is!($l, echo_expr!(mac!())); + expand_expr_is!($l, echo_tts!(mac!())); + expand_expr_is!($l, echo_pm!(mac!())); }; }; } diff --git a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout index 04b516fd25424..686d53e887660 100644 --- a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout +++ b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout @@ -1,6 +1,5 @@ PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = #[allow(warnings)] 0 ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E -{ V = { let _ = /*«*/ #[allow(warnings)] #[allow(warnings)] 0 /*»*/ ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = #[allow(warnings)] #[allow(warnings)] 0 ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -124,7 +123,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ 0 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -204,7 +203,6 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { {} } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ {} /*»*/ } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -283,7 +281,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ PATH /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -361,7 +359,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0 + 1; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ 0 + 1 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 + 1 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -452,7 +450,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH + 1; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ PATH + 1 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH + 1 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", diff --git a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout index 55818969c7178..0fda6654ff370 100644 --- a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout +++ b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout @@ -96,7 +96,6 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): 1 + 1 * 2 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 1 + 1 /*»*/ * 2 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout b/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout index 6cf8043c34f81..60a400a5deabf 100644 --- a/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout +++ b/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout @@ -1,7 +1,7 @@ PRINT-BANG INPUT (DISPLAY): foo! { #[fake_attr] mod bar { #![doc = r" Foo"] } } -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] /*«*/ mod bar { #! [doc = r" Foo"] } /*»*/ } +PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] mod bar { #! [doc = r" Foo"] } } PRINT-BANG INPUT (DEBUG): TokenStream [ Ident { ident: "foo", diff --git a/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout b/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout index adbd653ead4b7..4b7ed874307d8 100644 --- a/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout +++ b/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): ; -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ ; /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout b/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout index b912e426d5d99..a3d24dd26fe97 100644 --- a/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout +++ b/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout @@ -1,6 +1,4 @@ PRINT-BANG INPUT (DISPLAY): 0 + 1 + 2 + 3 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 0 + 1 + 2 /*»*/ + 3 -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): /*«*/ /*«*/ /*«*/ 0 /*»*/ + 1 /*»*/ + 2 /*»*/ + 3 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/nodelim-groups.stdout b/src/test/ui/proc-macro/nodelim-groups.stdout index 0d2f33b41750d..6b410f0bfb7e3 100644 --- a/src/test/ui/proc-macro/nodelim-groups.stdout +++ b/src/test/ui/proc-macro/nodelim-groups.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): "hi" 1 + (25) + 1 (1 + 1) -PRINT-BANG RE-COLLECTED (DISPLAY): "hi" /*«*/ 1 + (25) + 1 /*»*/ (1 + 1) PRINT-BANG INPUT (DEBUG): TokenStream [ Literal { kind: Str, @@ -72,9 +71,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): "hi" "hello".len() + "world".len() (1 + 1) -PRINT-BANG RE-COLLECTED (DISPLAY): "hi" /*«*/ "hello".len() + "world".len() /*»*/ (1 + 1) -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): "hi" /*«*/ /*«*/ "hello".len() /*»*/ + /*«*/ "world".len() /*»*/ /*»*/ -(1 + 1) PRINT-BANG INPUT (DEBUG): TokenStream [ Literal { kind: Str, diff --git a/src/test/ui/proc-macro/nonterminal-expansion.stdout b/src/test/ui/proc-macro/nonterminal-expansion.stdout index 32981e7011d97..4d884348f2ca4 100644 --- a/src/test/ui/proc-macro/nonterminal-expansion.stdout +++ b/src/test/ui/proc-macro/nonterminal-expansion.stdout @@ -1,5 +1,5 @@ PRINT-ATTR_ARGS INPUT (DISPLAY): a, line!(), b -PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, /*«*/ line! () /*»*/, b +PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, line! (), b PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "a", diff --git a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout index ba18ca75d7fe4..c08e5308138c9 100644 --- a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -1,5 +1,5 @@ PRINT-BANG INPUT (DISPLAY): struct S; -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ struct S ; /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): struct S ; PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs index 71e5065a87a88..354657db4db38 100644 --- a/src/test/ui/proc-macro/parent-source-spans.rs +++ b/src/test/ui/proc-macro/parent-source-spans.rs @@ -8,16 +8,16 @@ use parent_source_spans::parent_source_spans; macro one($a:expr, $b:expr) { two!($a, $b); - //~^ ERROR first parent: /*«*/ "hello" /*»*/ - //~| ERROR second parent: /*«*/ "world" /*»*/ + //~^ ERROR first parent: "hello" + //~| ERROR second parent: "world" } macro two($a:expr, $b:expr) { three!($a, $b); - //~^ ERROR first final: /*«*/ "hello" /*»*/ - //~| ERROR second final: /*«*/ "world" /*»*/ - //~| ERROR first final: /*«*/ "yay" /*»*/ - //~| ERROR second final: /*«*/ "rust" /*»*/ + //~^ ERROR first final: "hello" + //~| ERROR second final: "world" + //~| ERROR first final: "yay" + //~| ERROR second final: "rust" } // forwarding tokens directly doesn't create a new source chain @@ -34,16 +34,16 @@ macro four($($tokens:tt)*) { fn main() { one!("hello", "world"); - //~^ ERROR first grandparent: /*«*/ "hello" /*»*/ - //~| ERROR second grandparent: /*«*/ "world" /*»*/ - //~| ERROR first source: /*«*/ "hello" /*»*/ - //~| ERROR second source: /*«*/ "world" /*»*/ + //~^ ERROR first grandparent: "hello" + //~| ERROR second grandparent: "world" + //~| ERROR first source: "hello" + //~| ERROR second source: "world" two!("yay", "rust"); - //~^ ERROR first parent: /*«*/ "yay" /*»*/ - //~| ERROR second parent: /*«*/ "rust" /*»*/ - //~| ERROR first source: /*«*/ "yay" /*»*/ - //~| ERROR second source: /*«*/ "rust" /*»*/ + //~^ ERROR first parent: "yay" + //~| ERROR second parent: "rust" + //~| ERROR first source: "yay" + //~| ERROR second source: "rust" three!("hip", "hop"); //~^ ERROR first final: "hip" diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr index e42218ea70117..4548269b50793 100644 --- a/src/test/ui/proc-macro/parent-source-spans.stderr +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -1,4 +1,4 @@ -error: first final: /*«*/ "hello" /*»*/ +error: first final: "hello" --> $DIR/parent-source-spans.rs:16:12 | LL | three!($a, $b); @@ -9,7 +9,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second final: /*«*/ "world" /*»*/ +error: second final: "world" --> $DIR/parent-source-spans.rs:16:16 | LL | three!($a, $b); @@ -20,7 +20,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first parent: /*«*/ "hello" /*»*/ +error: first parent: "hello" --> $DIR/parent-source-spans.rs:10:5 | LL | two!($a, $b); @@ -31,7 +31,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second parent: /*«*/ "world" /*»*/ +error: second parent: "world" --> $DIR/parent-source-spans.rs:10:5 | LL | two!($a, $b); @@ -42,31 +42,31 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first grandparent: /*«*/ "hello" /*»*/ +error: first grandparent: "hello" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: second grandparent: /*«*/ "world" /*»*/ +error: second grandparent: "world" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: first source: /*«*/ "hello" /*»*/ +error: first source: "hello" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: second source: /*«*/ "world" /*»*/ +error: second source: "world" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: first final: /*«*/ "yay" /*»*/ +error: first final: "yay" --> $DIR/parent-source-spans.rs:16:12 | LL | three!($a, $b); @@ -77,7 +77,7 @@ LL | two!("yay", "rust"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second final: /*«*/ "rust" /*»*/ +error: second final: "rust" --> $DIR/parent-source-spans.rs:16:16 | LL | three!($a, $b); @@ -88,25 +88,25 @@ LL | two!("yay", "rust"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first parent: /*«*/ "yay" /*»*/ +error: first parent: "yay" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: second parent: /*«*/ "rust" /*»*/ +error: second parent: "rust" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: first source: /*«*/ "yay" /*»*/ +error: first source: "yay" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: second source: /*«*/ "rust" /*»*/ +error: second source: "rust" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); diff --git a/src/tools/build-manifest/Cargo.toml b/src/tools/build-manifest/Cargo.toml index c437bde5ae69a..c022d3aa0acd7 100644 --- a/src/tools/build-manifest/Cargo.toml +++ b/src/tools/build-manifest/Cargo.toml @@ -13,3 +13,4 @@ tar = "0.4.29" sha2 = "0.10.1" rayon = "1.5.1" hex = "0.4.2" +num_cpus = "1.13.0" diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index a1dfbef0601ad..6338e467055cd 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -210,7 +210,7 @@ fn main() { let num_threads = if let Some(num) = env::var_os("BUILD_MANIFEST_NUM_THREADS") { num.to_str().unwrap().parse().expect("invalid number for BUILD_MANIFEST_NUM_THREADS") } else { - std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) + num_cpus::get() }; rayon::ThreadPoolBuilder::new() .num_threads(num_threads) diff --git a/src/tools/cargo b/src/tools/cargo index 4751950ccc948..a748cf5a3e666 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 4751950ccc948c07047e62c20adf423d7e5f668c +Subproject commit a748cf5a3e666bc2dcdf54f37adef8ef22196452