Skip to content

Commit d097af1

Browse files
committed
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
2 parents 72bfc37 + 5f51210 commit d097af1

File tree

14 files changed

+140
-32
lines changed

14 files changed

+140
-32
lines changed

src/ci/docker/dist-various-1/install-mipsel-musl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mkdir /usr/local/mipsel-linux-musl
55
# Note that this originally came from:
66
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/
77
# OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
8-
URL="https://rust-lang-ci2.s3.amazonaws.com/libc"
8+
URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
99
FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
1010
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
1111

src/librustc_codegen_llvm/debuginfo/metadata.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,13 @@ pub fn type_metadata(
683683
}
684684
ty::Closure(def_id, substs) => {
685685
let upvar_tys : Vec<_> = substs.upvar_tys(def_id, cx.tcx).collect();
686+
let containing_scope = get_namespace_for_item(cx, def_id);
686687
prepare_tuple_metadata(cx,
687688
t,
688689
&upvar_tys,
689690
unique_type_id,
690-
usage_site_span).finalize(cx)
691+
usage_site_span,
692+
Some(containing_scope)).finalize(cx)
691693
}
692694
ty::Generator(def_id, substs, _) => {
693695
let upvar_tys : Vec<_> = substs.prefix_tys(def_id, cx.tcx).map(|t| {
@@ -728,7 +730,8 @@ pub fn type_metadata(
728730
t,
729731
&tys,
730732
unique_type_id,
731-
usage_site_span).finalize(cx)
733+
usage_site_span,
734+
NO_SCOPE_METADATA).finalize(cx)
732735
}
733736
_ => {
734737
bug!("debuginfo: unexpected type in type_metadata: {:?}", t)
@@ -1205,14 +1208,15 @@ fn prepare_tuple_metadata(
12051208
component_types: &[Ty<'tcx>],
12061209
unique_type_id: UniqueTypeId,
12071210
span: Span,
1211+
containing_scope: Option<&'ll DIScope>,
12081212
) -> RecursiveTypeDescription<'ll, 'tcx> {
12091213
let tuple_name = compute_debuginfo_type_name(cx.tcx, tuple_type, false);
12101214

12111215
let struct_stub = create_struct_stub(cx,
12121216
tuple_type,
12131217
&tuple_name[..],
12141218
unique_type_id,
1215-
NO_SCOPE_METADATA);
1219+
containing_scope);
12161220

12171221
create_and_register_recursive_type_forward_declaration(
12181222
cx,

src/librustc_codegen_ssa/debuginfo/type_names.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,17 @@ pub fn push_debuginfo_type_name<'tcx>(
190190
// processing
191191
visited.remove(t);
192192
},
193-
ty::Closure(..) => {
194-
output.push_str("closure");
193+
ty::Closure(def_id, ..) => {
194+
output.push_str(&format!(
195+
"closure-{}",
196+
tcx.def_key(def_id).disambiguated_data.disambiguator
197+
));
195198
}
196-
ty::Generator(..) => {
197-
output.push_str("generator");
199+
ty::Generator(def_id, ..) => {
200+
output.push_str(&format!(
201+
"generator-{}",
202+
tcx.def_key(def_id).disambiguated_data.disambiguator
203+
));
198204
}
199205
ty::Error |
200206
ty::Infer(_) |

src/librustc_resolve/macros.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ impl<'a> base::Resolver for Resolver<'a> {
182182

183183
fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: ExpnId, force: bool)
184184
-> Result<Option<Lrc<SyntaxExtension>>, Indeterminate> {
185+
if !self.invocations.contains_key(&invoc.expansion_data.id) {
186+
self.invocations.insert(invoc.expansion_data.id, self.invocations[&invoc_id]);
187+
}
188+
let invoc_id = invoc.expansion_data.id;
185189
let (path, kind, derives_in_scope, after_derive) = match invoc.kind {
186190
InvocationKind::Attr { ref attr, ref derives, after_derive, .. } =>
187191
(&attr.path, MacroKind::Attr, derives.clone(), after_derive),
@@ -201,7 +205,7 @@ impl<'a> base::Resolver for Resolver<'a> {
201205
match self.resolve_macro_path(path, Some(MacroKind::Derive),
202206
parent_scope, true, force) {
203207
Ok((Some(ref ext), _)) if ext.is_derive_copy => {
204-
self.add_derives(invoc.expansion_data.id, SpecialDerives::COPY);
208+
self.add_derives(invoc_id, SpecialDerives::COPY);
205209
return Ok(None);
206210
}
207211
Err(Determinacy::Undetermined) => result = Err(Indeterminate),
@@ -217,17 +221,15 @@ impl<'a> base::Resolver for Resolver<'a> {
217221
let (ext, res) = self.smart_resolve_macro_path(path, kind, parent_scope, force)?;
218222

219223
let span = invoc.span();
220-
invoc.expansion_data.id.set_expn_info(ext.expn_info(span, fast_print_path(path)));
224+
invoc_id.set_expn_info(ext.expn_info(span, fast_print_path(path)));
221225

222226
if let Res::Def(_, def_id) = res {
223227
if after_derive {
224228
self.session.span_err(span, "macro attributes must be placed before `#[derive]`");
225229
}
226-
self.macro_defs.insert(invoc.expansion_data.id, def_id);
227-
let normal_module_def_id =
228-
self.macro_def_scope(invoc.expansion_data.id).normal_ancestor_id;
229-
self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.id,
230-
normal_module_def_id);
230+
self.macro_defs.insert(invoc_id, def_id);
231+
let normal_module_def_id = self.macro_def_scope(invoc_id).normal_ancestor_id;
232+
self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id);
231233
}
232234

233235
Ok(Some(ext))

src/libsyntax/ext/base.rs

-3
Original file line numberDiff line numberDiff line change
@@ -944,9 +944,6 @@ pub fn expr_to_spanned_string<'a>(
944944
mut expr: P<ast::Expr>,
945945
err_msg: &str,
946946
) -> Result<Spanned<(Symbol, ast::StrStyle)>, Option<DiagnosticBuilder<'a>>> {
947-
// Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation.
948-
expr.span = expr.span.apply_mark(cx.current_expansion.id);
949-
950947
// we want to be able to handle e.g., `concat!("foo", "bar")`
951948
cx.expander().visit_expr(&mut expr);
952949
Err(match expr.node {

src/libsyntax/ext/expand.rs

-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
331331
progress = true;
332332
let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data;
333333
self.cx.current_expansion = invoc.expansion_data.clone();
334-
self.cx.current_expansion.id = scope;
335334

336335
// FIXME(jseyfried): Refactor out the following logic
337336
let (expanded_fragment, new_invocations) = if let Some(ext) = ext {

src/stage0.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
1313
# `0.x.0` for Cargo where they were released on `date`.
1414

15-
date: 2019-08-13
15+
date: 2019-08-15
1616
rustc: 1.37.0
1717
cargo: 0.38.0
1818

@@ -25,7 +25,7 @@ cargo: 0.38.0
2525
#
2626
# This means that there's a small window of time (a few days) where artifacts
2727
# are downloaded from dev-static.rust-lang.org instead of static.rust-lang.org.
28-
# In order to ease this transition we have an extra key which is in the
28+
# In order to ease this transition we have an extra key which is in the
2929
# configuration file below. When uncommented this will instruct the bootstrap.py
3030
# script to download from dev-static.rust-lang.org.
3131
#
@@ -34,4 +34,4 @@ cargo: 0.38.0
3434
# looking at a beta source tarball and it's uncommented we'll shortly comment it
3535
# out.
3636

37-
dev: 1
37+
#dev: 1

src/test/debuginfo/generator-objects.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@
1010

1111
// gdb-command:run
1212
// gdb-command:print b
13-
// 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 {[...]}}}
13+
// 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 {[...]}}}
1414
// gdb-command:continue
1515
// gdb-command:print b
16-
// 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 {[...]}}}
16+
// 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 {[...]}}}
1717
// gdb-command:continue
1818
// gdb-command:print b
19-
// 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}}}
19+
// 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}}}
2020
// gdb-command:continue
2121
// gdb-command:print b
22-
// 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 {[...]}}}
22+
// 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 {[...]}}}
2323

2424
// === LLDB TESTS ==================================================================================
2525

2626
// lldb-command:run
2727
// lldb-command:print b
28-
// lldbg-check:(generator_objects::main::generator) $0 = generator(&0x[...])
28+
// lldbg-check:(generator_objects::main::generator-0) $0 = generator-0(&0x[...])
2929
// lldb-command:continue
3030
// lldb-command:print b
31-
// lldbg-check:(generator_objects::main::generator) $1 = generator(&0x[...])
31+
// lldbg-check:(generator_objects::main::generator-0) $1 = generator-0(&0x[...])
3232
// lldb-command:continue
3333
// lldb-command:print b
34-
// lldbg-check:(generator_objects::main::generator) $2 = generator(&0x[...])
34+
// lldbg-check:(generator_objects::main::generator-0) $2 = generator-0(&0x[...])
3535
// lldb-command:continue
3636
// lldb-command:print b
37-
// lldbg-check:(generator_objects::main::generator) $3 = generator(&0x[...])
37+
// lldbg-check:(generator_objects::main::generator-0) $3 = generator-0(&0x[...])
3838

3939
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
4040
#![omit_gdb_pretty_printer_section]

src/test/debuginfo/issue-57822.rs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// This test makes sure that the LLDB pretty printer does not throw an exception
2+
// for nested closures and generators.
3+
4+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
5+
// min-system-llvm-version: 8.0
6+
// min-gdb-version: 8.2
7+
// ignore-tidy-linelength
8+
9+
// compile-flags:-g
10+
11+
// === GDB TESTS ===================================================================================
12+
13+
// gdb-command:run
14+
15+
// gdb-command:print g
16+
// gdb-check:$1 = issue_57822::main::closure-1 (issue_57822::main::closure-0 (1))
17+
18+
// gdb-command:print b
19+
// gdb-check:$2 = issue_57822::main::generator-3 {__0: issue_57822::main::generator-2 {__0: 2, <<variant>>: {[...]}}, <<variant>>: {[...]}}
20+
21+
// === LLDB TESTS ==================================================================================
22+
23+
// lldb-command:run
24+
25+
// lldb-command:print g
26+
// lldbg-check:(issue_57822::main::closure-1) $0 = closure-1(closure-0(1))
27+
28+
// lldb-command:print b
29+
// lldbg-check:(issue_57822::main::generator-3) $1 = generator-3(generator-2(2))
30+
31+
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
32+
#![omit_gdb_pretty_printer_section]
33+
34+
use std::ops::Generator;
35+
use std::pin::Pin;
36+
37+
fn main() {
38+
let mut x = 1;
39+
let f = move || x;
40+
let g = move || f();
41+
42+
let mut y = 2;
43+
let mut a = move || {
44+
y += 1;
45+
yield;
46+
};
47+
let mut b = move || {
48+
Pin::new(&mut a).resume();
49+
yield;
50+
};
51+
52+
zzz(); // #break
53+
}
54+
55+
fn zzz() { () }
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Regression test for the issue #63460.
2+
3+
// check-pass
4+
5+
#[macro_export]
6+
macro_rules! separator {
7+
() => { "/" };
8+
}
9+
10+
#[macro_export]
11+
macro_rules! concat_separator {
12+
( $e:literal, $($other:literal),+ ) => {
13+
concat!($e, $crate::separator!(), $crate::concat_separator!($($other),+))
14+
};
15+
( $e:literal ) => {
16+
$e
17+
}
18+
}
19+
20+
fn main() {
21+
println!("{}", concat_separator!(2, 3, 4))
22+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Opaque macro can eagerly expand its input without breaking its resolution.
2+
// Regression test for issue #63685.
3+
4+
// check-pass
5+
6+
macro_rules! foo {
7+
() => {
8+
"foo"
9+
};
10+
}
11+
12+
macro_rules! bar {
13+
() => {
14+
foo!()
15+
};
16+
}
17+
18+
fn main() {
19+
format_args!(bar!());
20+
}

src/test/ui/macros/derive-in-eager-expansion-hang.stderr

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ LL | |
88
LL | | ""
99
LL | | }
1010
| |_____^
11+
...
12+
LL | format_args!(hang!());
13+
| ------- in this macro invocation
1114
help: you might be missing a string literal to format with
1215
|
1316
LL | format_args!("{}", hang!());

src/tools/clippy

src/tools/rust-installer

0 commit comments

Comments
 (0)