Auto merge of #64097 - pietroalbini:beta-rollup, r=pietroalbini
[beta] Rollup backports Rolled up: * [beta] Utilize released stable over dev-static #64046 Cherry picked: * Update rust-installer to limit memory use #63984 * debuginfo: give unique names to closure and generator types #63875 * ci: move libc mirrors to the rust-lang-ci-mirrors bucket #63772 * Fix nested eager expansions in arguments of `format_args` #63717 r? @ghost
This commit is contained in:
commit
d097af1055
14 changed files with 140 additions and 32 deletions
|
|
@ -5,7 +5,7 @@ mkdir /usr/local/mipsel-linux-musl
|
|||
# Note that this originally came from:
|
||||
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/
|
||||
# OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
|
||||
URL="https://rust-lang-ci2.s3.amazonaws.com/libc"
|
||||
URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
|
||||
FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
|
||||
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
|
||||
|
||||
|
|
|
|||
|
|
@ -683,11 +683,13 @@ pub fn type_metadata(
|
|||
}
|
||||
ty::Closure(def_id, substs) => {
|
||||
let upvar_tys : Vec<_> = substs.upvar_tys(def_id, cx.tcx).collect();
|
||||
let containing_scope = get_namespace_for_item(cx, def_id);
|
||||
prepare_tuple_metadata(cx,
|
||||
t,
|
||||
&upvar_tys,
|
||||
unique_type_id,
|
||||
usage_site_span).finalize(cx)
|
||||
usage_site_span,
|
||||
Some(containing_scope)).finalize(cx)
|
||||
}
|
||||
ty::Generator(def_id, substs, _) => {
|
||||
let upvar_tys : Vec<_> = substs.prefix_tys(def_id, cx.tcx).map(|t| {
|
||||
|
|
@ -728,7 +730,8 @@ pub fn type_metadata(
|
|||
t,
|
||||
&tys,
|
||||
unique_type_id,
|
||||
usage_site_span).finalize(cx)
|
||||
usage_site_span,
|
||||
NO_SCOPE_METADATA).finalize(cx)
|
||||
}
|
||||
_ => {
|
||||
bug!("debuginfo: unexpected type in type_metadata: {:?}", t)
|
||||
|
|
@ -1205,6 +1208,7 @@ fn prepare_tuple_metadata(
|
|||
component_types: &[Ty<'tcx>],
|
||||
unique_type_id: UniqueTypeId,
|
||||
span: Span,
|
||||
containing_scope: Option<&'ll DIScope>,
|
||||
) -> RecursiveTypeDescription<'ll, 'tcx> {
|
||||
let tuple_name = compute_debuginfo_type_name(cx.tcx, tuple_type, false);
|
||||
|
||||
|
|
@ -1212,7 +1216,7 @@ fn prepare_tuple_metadata(
|
|||
tuple_type,
|
||||
&tuple_name[..],
|
||||
unique_type_id,
|
||||
NO_SCOPE_METADATA);
|
||||
containing_scope);
|
||||
|
||||
create_and_register_recursive_type_forward_declaration(
|
||||
cx,
|
||||
|
|
|
|||
|
|
@ -190,11 +190,17 @@ pub fn push_debuginfo_type_name<'tcx>(
|
|||
// processing
|
||||
visited.remove(t);
|
||||
},
|
||||
ty::Closure(..) => {
|
||||
output.push_str("closure");
|
||||
ty::Closure(def_id, ..) => {
|
||||
output.push_str(&format!(
|
||||
"closure-{}",
|
||||
tcx.def_key(def_id).disambiguated_data.disambiguator
|
||||
));
|
||||
}
|
||||
ty::Generator(..) => {
|
||||
output.push_str("generator");
|
||||
ty::Generator(def_id, ..) => {
|
||||
output.push_str(&format!(
|
||||
"generator-{}",
|
||||
tcx.def_key(def_id).disambiguated_data.disambiguator
|
||||
));
|
||||
}
|
||||
ty::Error |
|
||||
ty::Infer(_) |
|
||||
|
|
|
|||
|
|
@ -182,6 +182,10 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
|
||||
fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: ExpnId, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Indeterminate> {
|
||||
if !self.invocations.contains_key(&invoc.expansion_data.id) {
|
||||
self.invocations.insert(invoc.expansion_data.id, self.invocations[&invoc_id]);
|
||||
}
|
||||
let invoc_id = invoc.expansion_data.id;
|
||||
let (path, kind, derives_in_scope, after_derive) = match invoc.kind {
|
||||
InvocationKind::Attr { ref attr, ref derives, after_derive, .. } =>
|
||||
(&attr.path, MacroKind::Attr, derives.clone(), after_derive),
|
||||
|
|
@ -201,7 +205,7 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
match self.resolve_macro_path(path, Some(MacroKind::Derive),
|
||||
parent_scope, true, force) {
|
||||
Ok((Some(ref ext), _)) if ext.is_derive_copy => {
|
||||
self.add_derives(invoc.expansion_data.id, SpecialDerives::COPY);
|
||||
self.add_derives(invoc_id, SpecialDerives::COPY);
|
||||
return Ok(None);
|
||||
}
|
||||
Err(Determinacy::Undetermined) => result = Err(Indeterminate),
|
||||
|
|
@ -217,17 +221,15 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
let (ext, res) = self.smart_resolve_macro_path(path, kind, parent_scope, force)?;
|
||||
|
||||
let span = invoc.span();
|
||||
invoc.expansion_data.id.set_expn_info(ext.expn_info(span, fast_print_path(path)));
|
||||
invoc_id.set_expn_info(ext.expn_info(span, fast_print_path(path)));
|
||||
|
||||
if let Res::Def(_, def_id) = res {
|
||||
if after_derive {
|
||||
self.session.span_err(span, "macro attributes must be placed before `#[derive]`");
|
||||
}
|
||||
self.macro_defs.insert(invoc.expansion_data.id, def_id);
|
||||
let normal_module_def_id =
|
||||
self.macro_def_scope(invoc.expansion_data.id).normal_ancestor_id;
|
||||
self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.id,
|
||||
normal_module_def_id);
|
||||
self.macro_defs.insert(invoc_id, def_id);
|
||||
let normal_module_def_id = self.macro_def_scope(invoc_id).normal_ancestor_id;
|
||||
self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id);
|
||||
}
|
||||
|
||||
Ok(Some(ext))
|
||||
|
|
|
|||
|
|
@ -944,9 +944,6 @@ pub fn expr_to_spanned_string<'a>(
|
|||
mut expr: P<ast::Expr>,
|
||||
err_msg: &str,
|
||||
) -> Result<Spanned<(Symbol, ast::StrStyle)>, Option<DiagnosticBuilder<'a>>> {
|
||||
// Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation.
|
||||
expr.span = expr.span.apply_mark(cx.current_expansion.id);
|
||||
|
||||
// we want to be able to handle e.g., `concat!("foo", "bar")`
|
||||
cx.expander().visit_expr(&mut expr);
|
||||
Err(match expr.node {
|
||||
|
|
|
|||
|
|
@ -331,7 +331,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
progress = true;
|
||||
let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data;
|
||||
self.cx.current_expansion = invoc.expansion_data.clone();
|
||||
self.cx.current_expansion.id = scope;
|
||||
|
||||
// FIXME(jseyfried): Refactor out the following logic
|
||||
let (expanded_fragment, new_invocations) = if let Some(ext) = ext {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
|
||||
# `0.x.0` for Cargo where they were released on `date`.
|
||||
|
||||
date: 2019-08-13
|
||||
date: 2019-08-15
|
||||
rustc: 1.37.0
|
||||
cargo: 0.38.0
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ cargo: 0.38.0
|
|||
#
|
||||
# This means that there's a small window of time (a few days) where artifacts
|
||||
# are downloaded from dev-static.rust-lang.org instead of static.rust-lang.org.
|
||||
# In order to ease this transition we have an extra key which is in the
|
||||
# In order to ease this transition we have an extra key which is in the
|
||||
# configuration file below. When uncommented this will instruct the bootstrap.py
|
||||
# script to download from dev-static.rust-lang.org.
|
||||
#
|
||||
|
|
@ -34,4 +34,4 @@ cargo: 0.38.0
|
|||
# looking at a beta source tarball and it's uncommented we'll shortly comment it
|
||||
# out.
|
||||
|
||||
dev: 1
|
||||
#dev: 1
|
||||
|
|
|
|||
|
|
@ -10,31 +10,31 @@
|
|||
|
||||
// gdb-command:run
|
||||
// gdb-command:print b
|
||||
// gdb-check:$1 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 0, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
|
||||
// gdb-check:$1 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 0, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}
|
||||
// gdb-command:continue
|
||||
// gdb-command:print b
|
||||
// gdb-check:$2 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 3, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {c: 6, d: 7}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
|
||||
// gdb-check:$2 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 3, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {c: 6, d: 7}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}
|
||||
// gdb-command:continue
|
||||
// gdb-command:print b
|
||||
// gdb-check:$3 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 4, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {c: 7, d: 8}}}
|
||||
// gdb-check:$3 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 4, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {c: 7, d: 8}}}
|
||||
// gdb-command:continue
|
||||
// gdb-command:print b
|
||||
// gdb-check:$4 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 1, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
|
||||
// gdb-check:$4 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 1, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}
|
||||
|
||||
// === LLDB TESTS ==================================================================================
|
||||
|
||||
// lldb-command:run
|
||||
// lldb-command:print b
|
||||
// lldbg-check:(generator_objects::main::generator) $0 = generator(&0x[...])
|
||||
// lldbg-check:(generator_objects::main::generator-0) $0 = generator-0(&0x[...])
|
||||
// lldb-command:continue
|
||||
// lldb-command:print b
|
||||
// lldbg-check:(generator_objects::main::generator) $1 = generator(&0x[...])
|
||||
// lldbg-check:(generator_objects::main::generator-0) $1 = generator-0(&0x[...])
|
||||
// lldb-command:continue
|
||||
// lldb-command:print b
|
||||
// lldbg-check:(generator_objects::main::generator) $2 = generator(&0x[...])
|
||||
// lldbg-check:(generator_objects::main::generator-0) $2 = generator-0(&0x[...])
|
||||
// lldb-command:continue
|
||||
// lldb-command:print b
|
||||
// lldbg-check:(generator_objects::main::generator) $3 = generator(&0x[...])
|
||||
// lldbg-check:(generator_objects::main::generator-0) $3 = generator-0(&0x[...])
|
||||
|
||||
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
|
||||
#![omit_gdb_pretty_printer_section]
|
||||
|
|
|
|||
55
src/test/debuginfo/issue-57822.rs
Normal file
55
src/test/debuginfo/issue-57822.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
// This test makes sure that the LLDB pretty printer does not throw an exception
|
||||
// for nested closures and generators.
|
||||
|
||||
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
|
||||
// min-system-llvm-version: 8.0
|
||||
// min-gdb-version: 8.2
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// compile-flags:-g
|
||||
|
||||
// === GDB TESTS ===================================================================================
|
||||
|
||||
// gdb-command:run
|
||||
|
||||
// gdb-command:print g
|
||||
// gdb-check:$1 = issue_57822::main::closure-1 (issue_57822::main::closure-0 (1))
|
||||
|
||||
// gdb-command:print b
|
||||
// gdb-check:$2 = issue_57822::main::generator-3 {__0: issue_57822::main::generator-2 {__0: 2, <<variant>>: {[...]}}, <<variant>>: {[...]}}
|
||||
|
||||
// === LLDB TESTS ==================================================================================
|
||||
|
||||
// lldb-command:run
|
||||
|
||||
// lldb-command:print g
|
||||
// lldbg-check:(issue_57822::main::closure-1) $0 = closure-1(closure-0(1))
|
||||
|
||||
// lldb-command:print b
|
||||
// lldbg-check:(issue_57822::main::generator-3) $1 = generator-3(generator-2(2))
|
||||
|
||||
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
|
||||
#![omit_gdb_pretty_printer_section]
|
||||
|
||||
use std::ops::Generator;
|
||||
use std::pin::Pin;
|
||||
|
||||
fn main() {
|
||||
let mut x = 1;
|
||||
let f = move || x;
|
||||
let g = move || f();
|
||||
|
||||
let mut y = 2;
|
||||
let mut a = move || {
|
||||
y += 1;
|
||||
yield;
|
||||
};
|
||||
let mut b = move || {
|
||||
Pin::new(&mut a).resume();
|
||||
yield;
|
||||
};
|
||||
|
||||
zzz(); // #break
|
||||
}
|
||||
|
||||
fn zzz() { () }
|
||||
22
src/test/ui/hygiene/eager-from-opaque-2.rs
Normal file
22
src/test/ui/hygiene/eager-from-opaque-2.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Regression test for the issue #63460.
|
||||
|
||||
// check-pass
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! separator {
|
||||
() => { "/" };
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! concat_separator {
|
||||
( $e:literal, $($other:literal),+ ) => {
|
||||
concat!($e, $crate::separator!(), $crate::concat_separator!($($other),+))
|
||||
};
|
||||
( $e:literal ) => {
|
||||
$e
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", concat_separator!(2, 3, 4))
|
||||
}
|
||||
20
src/test/ui/hygiene/eager-from-opaque.rs
Normal file
20
src/test/ui/hygiene/eager-from-opaque.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Opaque macro can eagerly expand its input without breaking its resolution.
|
||||
// Regression test for issue #63685.
|
||||
|
||||
// check-pass
|
||||
|
||||
macro_rules! foo {
|
||||
() => {
|
||||
"foo"
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! bar {
|
||||
() => {
|
||||
foo!()
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
format_args!(bar!());
|
||||
}
|
||||
|
|
@ -8,6 +8,9 @@ LL | |
|
|||
LL | | ""
|
||||
LL | | }
|
||||
| |_____^
|
||||
...
|
||||
LL | format_args!(hang!());
|
||||
| ------- in this macro invocation
|
||||
help: you might be missing a string literal to format with
|
||||
|
|
||||
LL | format_args!("{}", hang!());
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 72da1015d6d918fe1b29170acbf486d30e0c2695
|
||||
Subproject commit 3aea86030eeca7dff94139b24d6b76294609dbce
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 85958b001dbff8523396809bfa844fc34a7869a8
|
||||
Subproject commit 9f66c14c3f91a48a118c7817f434167b311c3515
|
||||
Loading…
Add table
Add a link
Reference in a new issue