Skip to content

Commit 5a6d801

Browse files
committed
Auto merge of #63627 - Centril:rollup-v8i7x5i, r=Centril
Rollup of 7 pull requests Successful merges: - #62593 (Group all ABI tests.) - #63173 (Use libunwind from llvm-project submodule for musl targets) - #63535 (Continue refactoring resolve and hygiene) - #63539 (Suggest Rust 2018 on `<expr>.await` with no such field) - #63584 (libcore: more cleanups using `#![feature(associated_type_bounds)]`) - #63612 (Do not suggest `try_into` for base types inside of macro expansions) - #63615 (Fix typo in DoubleEndedIterator::nth_back doc) Failed merges: r? @ghost
2 parents f7af19c + 0bd3a85 commit 5a6d801

File tree

138 files changed

+1041
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1041
-896
lines changed

src/bootstrap/sanity.rs

-4
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ pub fn check(build: &mut Build) {
202202
panic!("couldn't find libc.a in musl dir: {}",
203203
root.join("lib").display());
204204
}
205-
if fs::metadata(root.join("lib/libunwind.a")).is_err() {
206-
panic!("couldn't find libunwind.a in musl dir: {}",
207-
root.join("lib").display());
208-
}
209205
}
210206
None => {
211207
panic!("when targeting MUSL either the rust.musl-root \

src/ci/docker/scripts/musl-toolchain.sh

-26
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,3 @@ if [ "$REPLACE_CC" = "1" ]; then
5454
ln -s $TARGET-g++ /usr/local/bin/$exec
5555
done
5656
fi
57-
58-
export CC=$TARGET-gcc
59-
export CXX=$TARGET-g++
60-
61-
LLVM=70
62-
63-
# may have been downloaded in a previous run
64-
if [ ! -d libunwind-release_$LLVM ]; then
65-
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
66-
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
67-
fi
68-
69-
# fixme(mati865): Replace it with https://github.com/rust-lang/rust/pull/59089
70-
mkdir libunwind-build
71-
cd libunwind-build
72-
cmake ../libunwind-release_$LLVM \
73-
-DLLVM_PATH=/build/llvm-release_$LLVM \
74-
-DLIBUNWIND_ENABLE_SHARED=0 \
75-
-DCMAKE_C_COMPILER=$CC \
76-
-DCMAKE_CXX_COMPILER=$CXX \
77-
-DCMAKE_C_FLAGS="$CFLAGS" \
78-
-DCMAKE_CXX_FLAGS="$CXXFLAGS"
79-
80-
hide_output make -j$(nproc)
81-
cp lib/libunwind.a $OUTPUT/$TARGET/lib
82-
cd - && rm -rf libunwind-build

src/ci/docker/scripts/musl.sh

+2-24
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ exit 1
2020
TAG=$1
2121
shift
2222

23+
# Ancient binutils versions don't understand debug symbols produced by more recent tools.
24+
# Apparently applying `-fPIC` everywhere allows them to link successfully.
2325
export CFLAGS="-fPIC $CFLAGS"
2426

2527
MUSL=musl-1.1.22
@@ -38,27 +40,3 @@ else
3840
fi
3941
hide_output make install
4042
hide_output make clean
41-
42-
cd ..
43-
44-
LLVM=70
45-
46-
# may have been downloaded in a previous run
47-
if [ ! -d libunwind-release_$LLVM ]; then
48-
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
49-
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
50-
fi
51-
52-
mkdir libunwind-build
53-
cd libunwind-build
54-
cmake ../libunwind-release_$LLVM \
55-
-DLLVM_PATH=/build/llvm-release_$LLVM \
56-
-DLIBUNWIND_ENABLE_SHARED=0 \
57-
-DCMAKE_C_COMPILER=$CC \
58-
-DCMAKE_CXX_COMPILER=$CXX \
59-
-DCMAKE_C_FLAGS="$CFLAGS" \
60-
-DCMAKE_CXX_FLAGS="$CXXFLAGS"
61-
62-
hide_output make -j$(nproc)
63-
cp lib/libunwind.a /musl-$TAG/lib
64-
cd ../ && rm -rf libunwind-build

src/libcore/iter/adapters/flatten.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ impl<I: Iterator, U: IntoIterator, F> Iterator for FlatMap<I, U, F>
7272
impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F>
7373
where
7474
F: FnMut(I::Item) -> U,
75-
U: IntoIterator,
76-
U::IntoIter: DoubleEndedIterator,
75+
U: IntoIterator<IntoIter: DoubleEndedIterator>,
7776
{
7877
#[inline]
7978
fn next_back(&mut self) -> Option<U::Item> { self.inner.next_back() }
@@ -107,10 +106,7 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
107106
/// [`Iterator`]: trait.Iterator.html
108107
#[must_use = "iterators are lazy and do nothing unless consumed"]
109108
#[stable(feature = "iterator_flatten", since = "1.29.0")]
110-
pub struct Flatten<I: Iterator>
111-
where
112-
I::Item: IntoIterator,
113-
{
109+
pub struct Flatten<I: Iterator<Item: IntoIterator>> {
114110
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
115111
}
116112

src/libcore/iter/traits/double_ended.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub trait DoubleEndedIterator: Iterator {
6969
/// Returns the `n`th element from the end of the iterator.
7070
///
7171
/// This is essentially the reversed version of [`nth`]. Although like most indexing
72-
/// operations, the count starts from zero, so `nth_back(0)` returns the first value fro
72+
/// operations, the count starts from zero, so `nth_back(0)` returns the first value from
7373
/// the end, `nth_back(1)` the second, and so on.
7474
///
7575
/// Note that all elements between the end and the returned element will be

src/librustc/hir/lowering.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use syntax::errors;
6767
use syntax::ext::base::SpecialDerives;
6868
use syntax::ext::hygiene::ExpnId;
6969
use syntax::print::pprust;
70-
use syntax::source_map::{respan, ExpnInfo, ExpnKind, DesugaringKind, Spanned};
70+
use syntax::source_map::{respan, ExpnData, ExpnKind, DesugaringKind, Spanned};
7171
use syntax::symbol::{kw, sym, Symbol};
7272
use syntax::tokenstream::{TokenStream, TokenTree};
7373
use syntax::parse::token::{self, Token};
@@ -704,10 +704,9 @@ impl<'a> LoweringContext<'a> {
704704
span: Span,
705705
allow_internal_unstable: Option<Lrc<[Symbol]>>,
706706
) -> Span {
707-
span.fresh_expansion(ExpnId::root(), ExpnInfo {
708-
def_site: span,
707+
span.fresh_expansion(ExpnData {
709708
allow_internal_unstable,
710-
..ExpnInfo::default(ExpnKind::Desugaring(reason), span, self.sess.edition())
709+
..ExpnData::default(ExpnKind::Desugaring(reason), span, self.sess.edition())
711710
})
712711
}
713712

@@ -1224,7 +1223,7 @@ impl<'a> LoweringContext<'a> {
12241223
P(hir::Path {
12251224
res,
12261225
segments: hir_vec![hir::PathSegment::from_ident(
1227-
Ident::with_empty_ctxt(kw::SelfUpper)
1226+
Ident::with_dummy_span(kw::SelfUpper)
12281227
)],
12291228
span: t.span,
12301229
}),
@@ -1558,7 +1557,7 @@ impl<'a> LoweringContext<'a> {
15581557

15591558
let (name, kind) = match name {
15601559
hir::LifetimeName::Underscore => (
1561-
hir::ParamName::Plain(Ident::with_empty_ctxt(kw::UnderscoreLifetime)),
1560+
hir::ParamName::Plain(Ident::with_dummy_span(kw::UnderscoreLifetime)),
15621561
hir::LifetimeParamKind::Elided,
15631562
),
15641563
hir::LifetimeName::Param(param_name) => (
@@ -2002,7 +2001,7 @@ impl<'a> LoweringContext<'a> {
20022001
bindings: hir_vec![
20032002
hir::TypeBinding {
20042003
hir_id: this.next_id(),
2005-
ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
2004+
ident: Ident::with_dummy_span(FN_OUTPUT_NAME),
20062005
kind: hir::TypeBindingKind::Equality {
20072006
ty: output
20082007
.as_ref()
@@ -2394,7 +2393,7 @@ impl<'a> LoweringContext<'a> {
23942393
let future_params = P(hir::GenericArgs {
23952394
args: hir_vec![],
23962395
bindings: hir_vec![hir::TypeBinding {
2397-
ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
2396+
ident: Ident::with_dummy_span(FN_OUTPUT_NAME),
23982397
kind: hir::TypeBindingKind::Equality {
23992398
ty: output_ty,
24002399
},

src/librustc/hir/lowering/expr.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl LoweringContext<'_> {
552552

553553
// let mut pinned = <expr>;
554554
let expr = P(self.lower_expr(expr));
555-
let pinned_ident = Ident::with_empty_ctxt(sym::pinned);
555+
let pinned_ident = Ident::with_dummy_span(sym::pinned);
556556
let (pinned_pat, pinned_pat_hid) = self.pat_ident_binding_mode(
557557
span,
558558
pinned_ident,
@@ -593,7 +593,7 @@ impl LoweringContext<'_> {
593593
let loop_node_id = self.sess.next_node_id();
594594
let loop_hir_id = self.lower_node_id(loop_node_id);
595595
let ready_arm = {
596-
let x_ident = Ident::with_empty_ctxt(sym::result);
596+
let x_ident = Ident::with_dummy_span(sym::result);
597597
let (x_pat, x_pat_hid) = self.pat_ident(span, x_ident);
598598
let x_expr = P(self.expr_ident(span, x_ident, x_pat_hid));
599599
let ready_pat = self.pat_std_enum(
@@ -1070,9 +1070,9 @@ impl LoweringContext<'_> {
10701070
);
10711071
head.span = desugared_span;
10721072

1073-
let iter = Ident::with_empty_ctxt(sym::iter);
1073+
let iter = Ident::with_dummy_span(sym::iter);
10741074

1075-
let next_ident = Ident::with_empty_ctxt(sym::__next);
1075+
let next_ident = Ident::with_dummy_span(sym::__next);
10761076
let (next_pat, next_pat_hid) = self.pat_ident_binding_mode(
10771077
desugared_span,
10781078
next_ident,
@@ -1081,7 +1081,7 @@ impl LoweringContext<'_> {
10811081

10821082
// `::std::option::Option::Some(val) => __next = val`
10831083
let pat_arm = {
1084-
let val_ident = Ident::with_empty_ctxt(sym::val);
1084+
let val_ident = Ident::with_dummy_span(sym::val);
10851085
let (val_pat, val_pat_hid) = self.pat_ident(pat.span, val_ident);
10861086
let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat_hid));
10871087
let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat_hid));
@@ -1247,7 +1247,7 @@ impl LoweringContext<'_> {
12471247

12481248
// `Ok(val) => #[allow(unreachable_code)] val,`
12491249
let ok_arm = {
1250-
let val_ident = Ident::with_empty_ctxt(sym::val);
1250+
let val_ident = Ident::with_dummy_span(sym::val);
12511251
let (val_pat, val_pat_nid) = self.pat_ident(span, val_ident);
12521252
let val_expr = P(self.expr_ident_with_attrs(
12531253
span,
@@ -1263,7 +1263,7 @@ impl LoweringContext<'_> {
12631263
// `Err(err) => #[allow(unreachable_code)]
12641264
// return Try::from_error(From::from(err)),`
12651265
let err_arm = {
1266-
let err_ident = Ident::with_empty_ctxt(sym::err);
1266+
let err_ident = Ident::with_dummy_span(sym::err);
12671267
let (err_local, err_local_nid) = self.pat_ident(try_span, err_ident);
12681268
let from_expr = {
12691269
let from_path = &[sym::convert, sym::From, sym::from];

src/librustc/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl ParamName {
202202
match *self {
203203
ParamName::Plain(ident) => ident,
204204
ParamName::Fresh(_) |
205-
ParamName::Error => Ident::with_empty_ctxt(kw::UnderscoreLifetime),
205+
ParamName::Error => Ident::with_dummy_span(kw::UnderscoreLifetime),
206206
}
207207
}
208208

@@ -237,8 +237,8 @@ impl LifetimeName {
237237
pub fn ident(&self) -> Ident {
238238
match *self {
239239
LifetimeName::Implicit | LifetimeName::Error => Ident::invalid(),
240-
LifetimeName::Underscore => Ident::with_empty_ctxt(kw::UnderscoreLifetime),
241-
LifetimeName::Static => Ident::with_empty_ctxt(kw::StaticLifetime),
240+
LifetimeName::Underscore => Ident::with_dummy_span(kw::UnderscoreLifetime),
241+
LifetimeName::Static => Ident::with_dummy_span(kw::StaticLifetime),
242242
LifetimeName::Param(param_name) => param_name.ident(),
243243
}
244244
}

src/librustc/hir/print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ impl<'a> State<'a> {
14571457
}
14581458

14591459
pub fn print_name(&mut self, name: ast::Name) {
1460-
self.print_ident(ast::Ident::with_empty_ctxt(name))
1460+
self.print_ident(ast::Ident::with_dummy_span(name))
14611461
}
14621462

14631463
pub fn print_for_decl(&mut self, loc: &hir::Local, coll: &hir::Expr) {

src/librustc/ich/hcx.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
350350
let line_col_len = col | line | len;
351351
std_hash::Hash::hash(&line_col_len, hasher);
352352

353-
if span.ctxt == SyntaxContext::empty() {
353+
if span.ctxt == SyntaxContext::root() {
354354
TAG_NO_EXPANSION.hash_stable(hcx, hasher);
355355
} else {
356356
TAG_EXPANSION.hash_stable(hcx, hasher);
@@ -370,7 +370,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
370370
}
371371

372372
let mut hasher = StableHasher::new();
373-
expn_id.expn_info().hash_stable(hcx, &mut hasher);
373+
expn_id.expn_data().hash_stable(hcx, &mut hasher);
374374
let sub_hash: Fingerprint = hasher.finish();
375375
let sub_hash = sub_hash.to_smaller_hash();
376376
cache.borrow_mut().insert(expn_id, sub_hash);

src/librustc/ich/impls_syntax.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,10 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::Transparency {
397397
Opaque,
398398
});
399399

400-
impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnInfo {
401-
call_site,
400+
impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnData {
402401
kind,
402+
parent -> _,
403+
call_site,
403404
def_site,
404405
default_transparency,
405406
allow_internal_unstable,

src/librustc/lint/internal.rs

+12-23
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use errors::Applicability;
99
use rustc_data_structures::fx::FxHashMap;
1010
use syntax::ast::{Ident, Item, ItemKind};
1111
use syntax::symbol::{sym, Symbol};
12-
use syntax_pos::ExpnInfo;
1312

1413
declare_tool_lint! {
1514
pub rustc::DEFAULT_HASH_TYPES,
@@ -108,7 +107,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyTyKind {
108107
.help("try using `Ty` instead")
109108
.emit();
110109
} else {
111-
if ty.span.ctxt().outer_expn_info().is_some() {
110+
if ty.span.from_expansion() {
112111
return;
113112
}
114113
if let Some(t) = is_ty_or_ty_ctxt(cx, ty) {
@@ -228,30 +227,20 @@ impl EarlyLintPass for LintPassImpl {
228227
if let ItemKind::Impl(_, _, _, _, Some(lint_pass), _, _) = &item.node {
229228
if let Some(last) = lint_pass.path.segments.last() {
230229
if last.ident.name == sym::LintPass {
231-
match &lint_pass.path.span.ctxt().outer_expn_info() {
232-
Some(info) if is_lint_pass_expansion(info) => {}
233-
_ => {
234-
cx.struct_span_lint(
235-
LINT_PASS_IMPL_WITHOUT_MACRO,
236-
lint_pass.path.span,
237-
"implementing `LintPass` by hand",
238-
)
239-
.help("try using `declare_lint_pass!` or `impl_lint_pass!` instead")
240-
.emit();
241-
}
230+
let expn_data = lint_pass.path.span.ctxt().outer_expn_data();
231+
let call_site = expn_data.call_site;
232+
if expn_data.kind.descr() != sym::impl_lint_pass &&
233+
call_site.ctxt().outer_expn_data().kind.descr() != sym::declare_lint_pass {
234+
cx.struct_span_lint(
235+
LINT_PASS_IMPL_WITHOUT_MACRO,
236+
lint_pass.path.span,
237+
"implementing `LintPass` by hand",
238+
)
239+
.help("try using `declare_lint_pass!` or `impl_lint_pass!` instead")
240+
.emit();
242241
}
243242
}
244243
}
245244
}
246245
}
247246
}
248-
249-
fn is_lint_pass_expansion(expn_info: &ExpnInfo) -> bool {
250-
if expn_info.kind.descr() == sym::impl_lint_pass {
251-
true
252-
} else if let Some(info) = expn_info.call_site.ctxt().outer_expn_info() {
253-
info.kind.descr() == sym::declare_lint_pass
254-
} else {
255-
false
256-
}
257-
}

src/librustc/lint/mod.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -885,21 +885,16 @@ pub fn provide(providers: &mut Providers<'_>) {
885885
/// This is used to test whether a lint should not even begin to figure out whether it should
886886
/// be reported on the current node.
887887
pub fn in_external_macro(sess: &Session, span: Span) -> bool {
888-
let info = match span.ctxt().outer_expn_info() {
889-
Some(info) => info,
890-
// no ExpnInfo means this span doesn't come from a macro
891-
None => return false,
892-
};
893-
894-
match info.kind {
888+
let expn_data = span.ctxt().outer_expn_data();
889+
match expn_data.kind {
895890
ExpnKind::Root | ExpnKind::Desugaring(DesugaringKind::ForLoop) => false,
896891
ExpnKind::Desugaring(_) => true, // well, it's "external"
897892
ExpnKind::Macro(MacroKind::Bang, _) => {
898-
if info.def_site.is_dummy() {
893+
if expn_data.def_site.is_dummy() {
899894
// dummy span for the def_site means it's an external macro
900895
return true;
901896
}
902-
match sess.source_map().span_to_snippet(info.def_site) {
897+
match sess.source_map().span_to_snippet(expn_data.def_site) {
903898
Ok(code) => !code.starts_with("macro_rules"),
904899
// no snippet = external macro or compiler-builtin expansion
905900
Err(_) => true,
@@ -911,10 +906,8 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
911906

912907
/// Returns whether `span` originates in a derive macro's expansion
913908
pub fn in_derive_expansion(span: Span) -> bool {
914-
if let Some(info) = span.ctxt().outer_expn_info() {
915-
if let ExpnKind::Macro(MacroKind::Derive, _) = info.kind {
916-
return true;
917-
}
909+
if let ExpnKind::Macro(MacroKind::Derive, _) = span.ctxt().outer_expn_data().kind {
910+
return true;
918911
}
919912
false
920913
}

0 commit comments

Comments
 (0)