Auto merge of #93085 - matthiaskrgr:rollup-mgpu2ju, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #92316 (mangling_v0: Skip extern blocks during mangling)
 - #92630 (Change PhantomData type for `BuildHasherDefault` (and more))
 - #92800 (Add manifest docs fallback.)
 - #93005 (Move back templates into html folder)
 - #93065 (Pretty printer algorithm revamp step 2)
 - #93077 (remove `List::is_noop`)

Failed merges:

 - #93068 (Fix spacing for `·` between stability and source)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-01-19 22:34:55 +00:00
commit 237949b6c8
26 changed files with 247 additions and 197 deletions

View File

@ -320,7 +320,7 @@ jobs:
- name: dist-aarch64-apple
env:
SCRIPT: "./x.py dist --stage 2"
RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-full-tools --enable-sanitizers --enable-profiler --disable-docs --set rust.jemalloc --set llvm.ninja=false"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
USE_XCODE_CLANG: 1
MACOSX_DEPLOYMENT_TARGET: 11.0

View File

@ -152,7 +152,9 @@ dependencies = [
"nom",
"proc-macro2",
"quote",
"serde",
"syn",
"toml",
]
[[package]]

View File

@ -167,14 +167,9 @@ pub enum Token {
Break(BreakToken),
Begin(BeginToken),
End,
Eof,
}
impl Token {
crate fn is_eof(&self) -> bool {
matches!(self, Token::Eof)
}
pub fn is_hardbreak_tok(&self) -> bool {
matches!(self, Token::Break(BreakToken { offset: 0, blank_space: SIZE_INFINITY }))
}
@ -187,7 +182,6 @@ impl fmt::Display for Token {
Token::Break(_) => f.write_str("BREAK"),
Token::Begin(_) => f.write_str("BEGIN"),
Token::End => f.write_str("END"),
Token::Eof => f.write_str("EOF"),
}
}
}
@ -212,10 +206,6 @@ pub struct Printer {
margin: isize,
/// Number of spaces left on line
space: isize,
/// Index of left side of input stream
left: usize,
/// Index of right side of input stream
right: usize,
/// Ring-buffer of tokens and calculated sizes
buf: RingBuffer<BufEntry>,
/// Running size of stream "...left"
@ -233,6 +223,9 @@ pub struct Printer {
print_stack: Vec<PrintStackElem>,
/// Buffered indentation to avoid writing trailing whitespace
pending_indentation: isize,
/// The token most recently popped from the left boundary of the
/// ring-buffer for printing
last_printed: Option<Token>,
}
#[derive(Clone)]
@ -241,39 +234,34 @@ struct BufEntry {
size: isize,
}
impl Default for BufEntry {
fn default() -> Self {
BufEntry { token: Token::Eof, size: 0 }
}
}
impl Printer {
pub fn new() -> Self {
let linewidth = 78;
let mut buf = RingBuffer::new();
buf.advance_right();
Printer {
out: String::new(),
margin: linewidth as isize,
space: linewidth as isize,
left: 0,
right: 0,
buf,
buf: RingBuffer::new(),
left_total: 0,
right_total: 0,
scan_stack: VecDeque::new(),
print_stack: Vec::new(),
pending_indentation: 0,
last_printed: None,
}
}
pub fn last_token(&self) -> Token {
self.buf[self.right].token.clone()
pub fn last_token(&self) -> Option<&Token> {
self.last_token_still_buffered().or_else(|| self.last_printed.as_ref())
}
pub fn last_token_still_buffered(&self) -> Option<&Token> {
self.buf.last().map(|last| &last.token)
}
/// Be very careful with this!
pub fn replace_last_token(&mut self, t: Token) {
self.buf[self.right].token = t;
pub fn replace_last_token_still_buffered(&mut self, t: Token) {
self.buf.last_mut().unwrap().token = t;
}
fn scan_eof(&mut self) {
@ -287,20 +275,18 @@ impl Printer {
if self.scan_stack.is_empty() {
self.left_total = 1;
self.right_total = 1;
self.right = self.left;
self.buf.truncate(1);
} else {
self.advance_right();
self.buf.clear();
}
self.scan_push(BufEntry { token: Token::Begin(b), size: -self.right_total });
let right = self.buf.push(BufEntry { token: Token::Begin(b), size: -self.right_total });
self.scan_stack.push_front(right);
}
fn scan_end(&mut self) {
if self.scan_stack.is_empty() {
self.print_end();
} else {
self.advance_right();
self.scan_push(BufEntry { token: Token::End, size: -1 });
let right = self.buf.push(BufEntry { token: Token::End, size: -1 });
self.scan_stack.push_front(right);
}
}
@ -308,68 +294,44 @@ impl Printer {
if self.scan_stack.is_empty() {
self.left_total = 1;
self.right_total = 1;
self.right = self.left;
self.buf.truncate(1);
self.buf.clear();
} else {
self.advance_right();
self.check_stack(0);
}
self.check_stack(0);
self.scan_push(BufEntry { token: Token::Break(b), size: -self.right_total });
let right = self.buf.push(BufEntry { token: Token::Break(b), size: -self.right_total });
self.scan_stack.push_front(right);
self.right_total += b.blank_space;
}
fn scan_string(&mut self, s: Cow<'static, str>) {
if self.scan_stack.is_empty() {
self.print_string(s);
self.print_string(&s);
} else {
self.advance_right();
let len = s.len() as isize;
self.buf[self.right] = BufEntry { token: Token::String(s), size: len };
self.buf.push(BufEntry { token: Token::String(s), size: len });
self.right_total += len;
self.check_stream();
}
}
fn check_stream(&mut self) {
if self.right_total - self.left_total > self.space {
if Some(&self.left) == self.scan_stack.back() {
let scanned = self.scan_pop_bottom();
self.buf[scanned].size = SIZE_INFINITY;
while self.right_total - self.left_total > self.space {
if *self.scan_stack.back().unwrap() == self.buf.index_of_first() {
self.scan_stack.pop_back().unwrap();
self.buf.first_mut().unwrap().size = SIZE_INFINITY;
}
self.advance_left();
if self.left != self.right {
self.check_stream();
if self.buf.is_empty() {
break;
}
}
}
fn scan_push(&mut self, entry: BufEntry) {
self.buf[self.right] = entry;
self.scan_stack.push_front(self.right);
}
fn scan_pop(&mut self) -> usize {
self.scan_stack.pop_front().unwrap()
}
fn scan_top(&self) -> usize {
*self.scan_stack.front().unwrap()
}
fn scan_pop_bottom(&mut self) -> usize {
self.scan_stack.pop_back().unwrap()
}
fn advance_right(&mut self) {
self.right += 1;
self.buf.advance_right();
}
fn advance_left(&mut self) {
let mut left_size = self.buf[self.left].size;
let mut left_size = self.buf.first().unwrap().size;
while left_size >= 0 {
let left = self.buf[self.left].token.clone();
let left = self.buf.first().unwrap().token.clone();
let len = match left {
Token::Break(b) => b.blank_space,
@ -385,39 +347,38 @@ impl Printer {
self.left_total += len;
if self.left == self.right {
self.buf.advance_left();
if self.buf.is_empty() {
break;
}
self.buf.advance_left();
self.left += 1;
left_size = self.buf[self.left].size;
left_size = self.buf.first().unwrap().size;
}
}
fn check_stack(&mut self, k: usize) {
if !self.scan_stack.is_empty() {
let x = self.scan_top();
match self.buf[x].token {
fn check_stack(&mut self, mut k: usize) {
while let Some(&x) = self.scan_stack.front() {
let mut entry = &mut self.buf[x];
match entry.token {
Token::Begin(_) => {
if k > 0 {
self.scan_pop();
self.buf[x].size += self.right_total;
self.check_stack(k - 1);
if k == 0 {
break;
}
self.scan_stack.pop_front().unwrap();
entry.size += self.right_total;
k -= 1;
}
Token::End => {
// paper says + not =, but that makes no sense.
self.scan_pop();
self.buf[x].size = 1;
self.check_stack(k + 1);
self.scan_stack.pop_front().unwrap();
entry.size = 1;
k += 1;
}
_ => {
self.scan_pop();
self.buf[x].size += self.right_total;
if k > 0 {
self.check_stack(k);
self.scan_stack.pop_front().unwrap();
entry.size += self.right_total;
if k == 0 {
break;
}
}
}
@ -477,7 +438,7 @@ impl Printer {
}
}
fn print_string(&mut self, s: Cow<'static, str>) {
fn print_string(&mut self, s: &str) {
let len = s.len() as isize;
// assert!(len <= space);
self.space -= len;
@ -491,21 +452,21 @@ impl Printer {
self.out.reserve(self.pending_indentation as usize);
self.out.extend(std::iter::repeat(' ').take(self.pending_indentation as usize));
self.pending_indentation = 0;
self.out.push_str(&s);
self.out.push_str(s);
}
fn print(&mut self, token: Token, l: isize) {
match token {
Token::Begin(b) => self.print_begin(b, l),
match &token {
Token::Begin(b) => self.print_begin(*b, l),
Token::End => self.print_end(),
Token::Break(b) => self.print_break(b, l),
Token::Break(b) => self.print_break(*b, l),
Token::String(s) => {
let len = s.len() as isize;
assert_eq!(len, l);
self.print_string(s);
}
Token::Eof => panic!(), // Eof should never get here.
}
self.last_printed = Some(token);
}
// Convenience functions to talk to the printer.
@ -560,7 +521,10 @@ impl Printer {
}
pub fn is_beginning_of_line(&self) -> bool {
self.last_token().is_eof() || self.last_token().is_hardbreak_tok()
match self.last_token() {
Some(last_token) => last_token.is_hardbreak_tok(),
None => true,
}
}
pub fn hardbreak_tok_offset(off: isize) -> Token {

View File

@ -22,11 +22,14 @@ impl<T> RingBuffer<T> {
RingBuffer { data: VecDeque::new(), offset: 0 }
}
pub fn advance_right(&mut self)
where
T: Default,
{
self.data.push_back(T::default());
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
pub fn push(&mut self, value: T) -> usize {
let index = self.offset + self.data.len();
self.data.push_back(value);
index
}
pub fn advance_left(&mut self) {
@ -34,8 +37,28 @@ impl<T> RingBuffer<T> {
self.offset += 1;
}
pub fn truncate(&mut self, len: usize) {
self.data.truncate(len);
pub fn clear(&mut self) {
self.data.clear();
}
pub fn index_of_first(&self) -> usize {
self.offset
}
pub fn first(&self) -> Option<&T> {
self.data.front()
}
pub fn first_mut(&mut self) -> Option<&mut T> {
self.data.front_mut()
}
pub fn last(&self) -> Option<&T> {
self.data.back()
}
pub fn last_mut(&mut self) -> Option<&mut T> {
self.data.back_mut()
}
}

View File

@ -328,9 +328,9 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
CommentStyle::BlankLine => {
// We need to do at least one, possibly two hardbreaks.
let twice = match self.last_token() {
pp::Token::String(s) => ";" == s,
pp::Token::Begin(_) => true,
pp::Token::End => true,
Some(pp::Token::String(s)) => ";" == s,
Some(pp::Token::Begin(_)) => true,
Some(pp::Token::End) => true,
_ => false,
};
if twice {
@ -686,11 +686,15 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
fn break_offset_if_not_bol(&mut self, n: usize, off: isize) {
if !self.is_beginning_of_line() {
self.break_offset(n, off)
} else if off != 0 && self.last_token().is_hardbreak_tok() {
// We do something pretty sketchy here: tuck the nonzero
// offset-adjustment we were going to deposit along with the
// break into the previous hardbreak.
self.replace_last_token(pp::Printer::hardbreak_tok_offset(off));
} else if off != 0 {
if let Some(last_token) = self.last_token_still_buffered() {
if last_token.is_hardbreak_tok() {
// We do something pretty sketchy here: tuck the nonzero
// offset-adjustment we were going to deposit along with the
// break into the previous hardbreak.
self.replace_last_token_still_buffered(pp::Printer::hardbreak_tok_offset(off));
}
}
}
}

View File

@ -90,7 +90,7 @@ macro call_intrinsic_match {
match $intrinsic {
$(
sym::$name => {
assert!($substs.is_noop());
assert!($substs.is_empty());
if let [$(ref $arg),*] = *$args {
let ($($arg,)*) = (
$(codegen_operand($fx, $arg),)*

View File

@ -275,10 +275,6 @@ impl<'a, 'tcx> InternalSubsts<'tcx> {
}
}
pub fn is_noop(&self) -> bool {
self.is_empty()
}
#[inline]
pub fn types(&'a self) -> impl DoubleEndedIterator<Item = Ty<'tcx>> + 'a {
self.iter()

View File

@ -772,9 +772,9 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
disambiguated_data: &DisambiguatedDefPathData,
) -> Result<Self::Path, Self::Error> {
let ns = match disambiguated_data.data {
// FIXME: It shouldn't be necessary to add anything for extern block segments,
// but we add 't' for backward compatibility.
DefPathData::ForeignMod => 't',
// Extern block segments can be skipped, names from extern blocks
// are effectively living in their parent modules.
DefPathData::ForeignMod => return print_prefix(self),
// Uppercase categories are more stable than lowercase ones.
DefPathData::TypeNs(_) => 't',

View File

@ -484,7 +484,7 @@ crate fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Option<St
let mut types_without_default_bounds = FxHashSet::default();
let sized_trait = tcx.lang_items().sized_trait();
if !substs.is_noop() {
if !substs.is_empty() {
types_without_default_bounds.extend(substs.types());
w.push('<');
w.push_str(

View File

@ -182,7 +182,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// `foo.bar::<u32>(...)` -- the `Self` type here will be the
// type of `foo` (possibly adjusted), but we don't want to
// include that. We want just the `[_, u32]` part.
if !method.substs.is_noop() {
if !method.substs.is_empty() {
let method_generics = self.tcx.generics_of(method.def_id);
if !method_generics.params.is_empty() {
let user_type_annotation = self.infcx.probe(|_| {
@ -211,7 +211,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
pub fn write_substs(&self, node_id: hir::HirId, substs: SubstsRef<'tcx>) {
if !substs.is_noop() {
if !substs.is_empty() {
debug!("write_substs({:?}, {:?}) in fcx {}", node_id, substs, self.tag());
self.typeck_results.borrow_mut().node_substs_mut().insert(node_id, substs);

View File

@ -12,7 +12,7 @@ use crate::task::{Context, Poll};
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Pending<T> {
_data: marker::PhantomData<T>,
_data: marker::PhantomData<fn() -> T>,
}
/// Creates a future which never resolves, representing a computation that never
@ -43,9 +43,6 @@ impl<T> Future for Pending<T> {
}
}
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
impl<T> Unpin for Pending<T> {}
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
impl<T> Debug for Pending<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

View File

@ -602,7 +602,7 @@ pub trait BuildHasher {
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
/// [zero-sized]: https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts
#[stable(since = "1.7.0", feature = "build_hasher")]
pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
pub struct BuildHasherDefault<H>(marker::PhantomData<fn() -> H>);
#[stable(since = "1.9.0", feature = "core_impl_debug")]
impl<H> fmt::Debug for BuildHasherDefault<H> {

View File

@ -22,17 +22,17 @@ pub const fn empty<T>() -> Empty<T> {
Empty(marker::PhantomData)
}
// Newtype for use in `PhantomData` to avoid
// > error: const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]`
// in `const fn empty<T>()` above.
struct FnReturning<T>(fn() -> T);
/// An iterator that yields nothing.
///
/// This `struct` is created by the [`empty()`] function. See its documentation for more.
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[stable(feature = "iter_empty", since = "1.2.0")]
pub struct Empty<T>(marker::PhantomData<T>);
#[stable(feature = "iter_empty_send_sync", since = "1.42.0")]
unsafe impl<T> Send for Empty<T> {}
#[stable(feature = "iter_empty_send_sync", since = "1.42.0")]
unsafe impl<T> Sync for Empty<T> {}
pub struct Empty<T>(marker::PhantomData<FnReturning<T>>);
#[stable(feature = "core_impl_debug", since = "1.9.0")]
impl<T> fmt::Debug for Empty<T> {

View File

@ -1483,11 +1483,10 @@ impl Step for Extended {
};
prepare("rustc");
prepare("cargo");
prepare("rust-docs");
prepare("rust-std");
prepare("rust-analysis");
prepare("clippy");
for tool in &["rust-demangler", "rls", "rust-analyzer", "miri"] {
for tool in &["rust-docs", "rust-demangler", "rls", "rust-analyzer", "miri"] {
if built_tools.contains(tool) {
prepare(tool);
}

View File

@ -496,6 +496,7 @@ jobs:
--enable-full-tools
--enable-sanitizers
--enable-profiler
--disable-docs
--set rust.jemalloc
--set llvm.ninja=false
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1

View File

@ -8,7 +8,7 @@ path = "lib.rs"
[dependencies]
arrayvec = { version = "0.7", default-features = false }
askama = { version = "0.11", default-features = false }
askama = { version = "0.11", default-features = false, features = ["config"] }
atty = "0.2"
pulldown-cmark = { version = "0.9", default-features = false }
minifier = "0.0.41"

View File

@ -0,0 +1,2 @@
[general]
dirs = ["html/templates"]

View File

@ -0,0 +1,19 @@
// build-fail
// compile-flags: -C symbol-mangling-version=v0
#![feature(extern_types)]
#![feature(rustc_attrs)]
extern "C" {
type ForeignType;
}
struct Check<T: ?Sized>(T);
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMCs
//~| ERROR demangling(<foreign_types[
//~| ERROR demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>)
impl Check<ForeignType> {}
fn main() {}

View File

@ -0,0 +1,20 @@
error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvB<REF>_11ForeignTypeE)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<foreign_types[HASH]::Check<foreign_types[HASH]::ForeignType>>)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -20,8 +20,7 @@ Then, you can generate the manifest and all the packages from `path/to/dist` to
`path/to/output` with:
```
$ cargo +nightly run path/to/dist path/to/output 1970-01-01 http://example.com \
CHANNEL VERSION
$ cargo +nightly run path/to/dist path/to/output 1970-01-01 http://example.com CHANNEL
```
Remember to replace `CHANNEL` with the channel you produced dist artifacts of

View File

@ -155,17 +155,19 @@ static TARGETS: &[&str] = &[
"x86_64-unknown-hermit",
];
static DOCS_TARGETS: &[&str] = &[
"aarch64-unknown-linux-gnu",
"i686-apple-darwin",
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
/// This allows the manifest to contain rust-docs for hosts that don't build
/// docs.
///
/// Tuples of `(host_partial, host_instead)`. If the host does not have the
/// rust-docs component available, then if the host name contains
/// `host_partial`, it will use the docs from `host_instead` instead.
///
/// The order here matters, more specific entries should be first.
static DOCS_FALLBACK: &[(&str, &str)] = &[
("-apple-", "x86_64-apple-darwin"),
("aarch64", "aarch64-unknown-linux-gnu"),
("arm-", "aarch64-unknown-linux-gnu"),
("", "x86_64-unknown-linux-gnu"),
];
static MSI_INSTALLERS: &[&str] = &[
@ -301,23 +303,27 @@ impl Builder {
}
fn add_packages_to(&mut self, manifest: &mut Manifest) {
let mut package = |name, targets| self.package(name, &mut manifest.pkg, targets);
package("rustc", HOSTS);
package("rustc-dev", HOSTS);
package("reproducible-artifacts", HOSTS);
package("rustc-docs", HOSTS);
package("cargo", HOSTS);
package("rust-mingw", MINGW);
package("rust-std", TARGETS);
package("rust-docs", DOCS_TARGETS);
package("rust-src", &["*"]);
package("rls-preview", HOSTS);
package("rust-analyzer-preview", HOSTS);
package("clippy-preview", HOSTS);
package("miri-preview", HOSTS);
package("rustfmt-preview", HOSTS);
package("rust-analysis", TARGETS);
package("llvm-tools-preview", TARGETS);
macro_rules! package {
($name:expr, $targets:expr) => {
self.package($name, &mut manifest.pkg, $targets, &[])
};
}
package!("rustc", HOSTS);
package!("rustc-dev", HOSTS);
package!("reproducible-artifacts", HOSTS);
package!("rustc-docs", HOSTS);
package!("cargo", HOSTS);
package!("rust-mingw", MINGW);
package!("rust-std", TARGETS);
self.package("rust-docs", &mut manifest.pkg, HOSTS, DOCS_FALLBACK);
package!("rust-src", &["*"]);
package!("rls-preview", HOSTS);
package!("rust-analyzer-preview", HOSTS);
package!("clippy-preview", HOSTS);
package!("miri-preview", HOSTS);
package!("rustfmt-preview", HOSTS);
package!("rust-analysis", TARGETS);
package!("llvm-tools-preview", TARGETS);
}
fn add_artifacts_to(&mut self, manifest: &mut Manifest) {
@ -500,7 +506,13 @@ impl Builder {
.extend(pkgs.iter().map(|s| (*s).to_owned()));
}
fn package(&mut self, pkgname: &str, dst: &mut BTreeMap<String, Package>, targets: &[&str]) {
fn package(
&mut self,
pkgname: &str,
dst: &mut BTreeMap<String, Package>,
targets: &[&str],
fallback: &[(&str, &str)],
) {
let version_info = self
.versions
.version(&PkgType::from_component(pkgname))
@ -512,16 +524,32 @@ impl Builder {
is_present = false; // Pretend the component is entirely missing.
}
macro_rules! tarball_name {
($target_name:expr) => {
self.versions.tarball_name(&PkgType::from_component(pkgname), $target_name).unwrap()
};
}
let mut target_from_compressed_tar = |target_name| {
let target = Target::from_compressed_tar(self, &tarball_name!(target_name));
if target.available {
return target;
}
for (substr, fallback_target) in fallback {
if target_name.contains(substr) {
let t = Target::from_compressed_tar(self, &tarball_name!(fallback_target));
// Fallbacks must always be available.
assert!(t.available);
return t;
}
}
Target::unavailable()
};
let targets = targets
.iter()
.map(|name| {
let target = if is_present {
let filename = self
.versions
.tarball_name(&PkgType::from_component(pkgname), name)
.unwrap();
Target::from_compressed_tar(self, &filename)
target_from_compressed_tar(name)
} else {
// If the component is not present for this build add it anyway but mark it as
// unavailable -- this way rustup won't allow upgrades without --force

View File

@ -169,7 +169,7 @@ impl Versions {
}
pub(crate) fn archive_name(
&mut self,
&self,
package: &PkgType,
target: &str,
extension: &str,
@ -189,11 +189,7 @@ impl Versions {
}
}
pub(crate) fn tarball_name(
&mut self,
package: &PkgType,
target: &str,
) -> Result<String, Error> {
pub(crate) fn tarball_name(&self, package: &PkgType, target: &str) -> Result<String, Error> {
self.archive_name(package, target, "tar.gz")
}

View File

@ -29,14 +29,14 @@ cc[4d6468d6c9fd4bb3]::spawn::{closure#0}::{closure#0}
<core[846817f741e54dfd]::slice::Iter<u8> as core[846817f741e54dfd]::iter::iterator::Iterator>::rposition::<core[846817f741e54dfd]::slice::memchr::memrchr::{closure#1}>::{closure#0}
alloc[f15a878b47eb696b]::alloc::box_free::<dyn alloc[f15a878b47eb696b]::boxed::FnBox<(), Output = ()>>
INtC8arrayvec8ArrayVechKj7b_E
<const_generic[317d481089b8c8fe]::Unsigned<11: u8>>
<const_generic[317d481089b8c8fe]::Signed<152: i16>>
<const_generic[317d481089b8c8fe]::Signed<-11: i8>>
<const_generic[317d481089b8c8fe]::Bool<false: bool>>
<const_generic[317d481089b8c8fe]::Bool<true: bool>>
<const_generic[317d481089b8c8fe]::Char<'v': char>>
<const_generic[317d481089b8c8fe]::Char<'\n': char>>
<const_generic[317d481089b8c8fe]::Char<'∂': char>>
<const_generic[317d481089b8c8fe]::Unsigned<11u8>>
<const_generic[317d481089b8c8fe]::Signed<152i16>>
<const_generic[317d481089b8c8fe]::Signed<-11i8>>
<const_generic[317d481089b8c8fe]::Bool<false>>
<const_generic[317d481089b8c8fe]::Bool<true>>
<const_generic[317d481089b8c8fe]::Char<'v'>>
<const_generic[317d481089b8c8fe]::Char<'\n'>>
<const_generic[317d481089b8c8fe]::Char<'∂'>>
<const_generic[317d481089b8c8fe]::Foo<_>>::foo::FOO
foo[0]
foo[0]
@ -51,14 +51,14 @@ cc::spawn::{closure#0}::{closure#0}
<core::slice::Iter<u8> as core::iter::iterator::Iterator>::rposition::<core::slice::memchr::memrchr::{closure#1}>::{closure#0}
alloc::alloc::box_free::<dyn alloc::boxed::FnBox<(), Output = ()>>
INtC8arrayvec8ArrayVechKj7b_E
<const_generic::Unsigned<11: u8>>
<const_generic::Signed<152: i16>>
<const_generic::Signed<-11: i8>>
<const_generic::Bool<false: bool>>
<const_generic::Bool<true: bool>>
<const_generic::Char<'v': char>>
<const_generic::Char<'\n': char>>
<const_generic::Char<'∂': char>>
<const_generic::Unsigned<11u8>>
<const_generic::Signed<152i16>>
<const_generic::Signed<-11i8>>
<const_generic::Bool<false>>
<const_generic::Bool<true>>
<const_generic::Char<'v'>>
<const_generic::Char<'\n'>>
<const_generic::Char<'∂'>>
<const_generic::Foo<_>>::foo::FOO
foo[0]
foo[0]