Skip to content

Commit 0040709

Browse files
committed
Auto merge of rust-lang#104447 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backport * Use nominal_obligations_without_const in wf for FnDef rust-lang#104180 * Don't silently eat label before block in block-like expr rust-lang#103986 * Revert "Update CI to use Android NDK r25b" rust-lang#104628 * rustdoc: Resolve doc links in external traits having local impls rust-lang#104364 * Use 64 bits for incremental cache in-file positions rust-lang#104164 * rustdoc: Do not add external traits to the crate in register_res rust-lang#103649 * Revert "Normalize opaques with escaping bound vars" rust-lang#103509 * Bump to released stable compiler * [beta] Update cargo rust-lang#104486 r? `@Mark-Simulacrum`
2 parents e080cc5 + 2caaf98 commit 0040709

File tree

34 files changed

+652
-520
lines changed

34 files changed

+652
-520
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -2456,11 +2456,15 @@ impl<'a> Parser<'a> {
24562456
}
24572457

24582458
pub(crate) fn maybe_recover_unexpected_block_label(&mut self) -> bool {
2459-
let Some(label) = self.eat_label().filter(|_| {
2460-
self.eat(&token::Colon) && self.token.kind == token::OpenDelim(Delimiter::Brace)
2461-
}) else {
2459+
// Check for `'a : {`
2460+
if !(self.check_lifetime()
2461+
&& self.look_ahead(1, |tok| tok.kind == token::Colon)
2462+
&& self.look_ahead(2, |tok| tok.kind == token::OpenDelim(Delimiter::Brace)))
2463+
{
24622464
return false;
2463-
};
2465+
}
2466+
let label = self.eat_label().expect("just checked if a label exists");
2467+
self.bump(); // eat `:`
24642468
let span = label.ident.span.to(self.prev_token.span);
24652469
let mut err = self.struct_span_err(span, "block label not supported here");
24662470
err.span_label(span, "not supported here");

compiler/rustc_query_impl/src/on_disk_cache.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ pub type EncodedDepNodeIndex = Vec<(SerializedDepNodeIndex, AbsoluteBytePos)>;
119119
struct SourceFileIndex(u32);
120120

121121
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Encodable, Decodable)]
122-
pub struct AbsoluteBytePos(u32);
122+
pub struct AbsoluteBytePos(u64);
123123

124124
impl AbsoluteBytePos {
125125
fn new(pos: usize) -> AbsoluteBytePos {
126-
debug_assert!(pos <= u32::MAX as usize);
127-
AbsoluteBytePos(pos as u32)
126+
AbsoluteBytePos(pos.try_into().expect("Incremental cache file size overflowed u64."))
128127
}
129128

130129
fn to_usize(self) -> usize {

compiler/rustc_resolve/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,11 @@ impl<'a> Resolver<'a> {
19101910
}
19111911
}
19121912

1913+
/// For rustdoc.
1914+
pub fn get_partial_res(&self, node_id: NodeId) -> Option<PartialRes> {
1915+
self.partial_res_map.get(&node_id).copied()
1916+
}
1917+
19131918
/// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
19141919
#[inline]
19151920
pub fn opt_span(&self, def_id: DefId) -> Option<Span> {

compiler/rustc_trait_selection/src/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
508508
// This is really important. While we *can* handle this, this has
509509
// severe performance implications for large opaque types with
510510
// late-bound regions. See `issue-88862` benchmark.
511-
ty::Opaque(def_id, substs) => {
511+
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
512512
// Only normalize `impl Trait` outside of type inference, usually in codegen.
513513
match self.param_env.reveal() {
514514
Reveal::UserFacing => ty.super_fold_with(self),

compiler/rustc_trait_selection/src/traits/query/normalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
198198
// This is really important. While we *can* handle this, this has
199199
// severe performance implications for large opaque types with
200200
// late-bound regions. See `issue-88862` benchmark.
201-
ty::Opaque(def_id, substs) => {
201+
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
202202
// Only normalize `impl Trait` outside of type inference, usually in codegen.
203203
match self.param_env.reveal() {
204204
Reveal::UserFacing => ty.try_super_fold_with(self),

compiler/rustc_trait_selection/src/traits/wf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<'tcx> WfPredicates<'tcx> {
547547
}
548548

549549
ty::FnDef(did, substs) => {
550-
let obligations = self.nominal_obligations(did, substs);
550+
let obligations = self.nominal_obligations_without_const(did, substs);
551551
self.out.extend(obligations);
552552
}
553553

src/bootstrap/cc_detect.rs

+7-18
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> {
4747
Some(PathBuf::from("ar"))
4848
} else if target.contains("vxworks") {
4949
Some(PathBuf::from("wr-ar"))
50-
} else if target.contains("android") {
51-
Some(cc.parent().unwrap().join(PathBuf::from("llvm-ar")))
5250
} else {
5351
let parent = cc.parent().unwrap();
5452
let file = cc.file_name().unwrap().to_str().unwrap();
@@ -168,22 +166,13 @@ fn set_compiler(
168166
// compiler already takes into account the triple in question.
169167
t if t.contains("android") => {
170168
if let Some(ndk) = config.and_then(|c| c.ndk.as_ref()) {
171-
let mut triple_iter = target.triple.split("-");
172-
let triple_translated = if let Some(arch) = triple_iter.next() {
173-
let arch_new = match arch {
174-
"arm" | "armv7" | "armv7neon" | "thumbv7" | "thumbv7neon" => "armv7a",
175-
other => other,
176-
};
177-
std::iter::once(arch_new).chain(triple_iter).collect::<Vec<&str>>().join("-")
178-
} else {
179-
target.triple.to_string()
180-
};
181-
182-
// API 19 is the earliest API level supported by NDK r25b but AArch64 and x86_64 support
183-
// begins at API level 21.
184-
let api_level =
185-
if t.contains("aarch64") || t.contains("x86_64") { "21" } else { "19" };
186-
let compiler = format!("{}{}-{}", triple_translated, api_level, compiler.clang());
169+
let target = target
170+
.triple
171+
.replace("armv7neon", "arm")
172+
.replace("armv7", "arm")
173+
.replace("thumbv7neon", "arm")
174+
.replace("thumbv7", "arm");
175+
let compiler = format!("{}-{}", target, compiler.clang());
187176
cfg.compiler(ndk.join("bin").join(compiler));
188177
}
189178
}

src/ci/docker/host-x86_64/arm-android/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN sh /scripts/android-base-apt-get.sh
66

77
COPY scripts/android-ndk.sh /scripts/
88
RUN . /scripts/android-ndk.sh && \
9-
download_ndk android-ndk-r25b-linux.zip
9+
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip arm 14
1010

1111
RUN dpkg --add-architecture i386 && \
1212
apt-get update && \
@@ -30,7 +30,7 @@ ENV PATH=$PATH:/android/sdk/platform-tools
3030

3131
ENV TARGETS=arm-linux-androideabi
3232

33-
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/
33+
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14
3434

3535
ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target $TARGETS
3636

src/ci/docker/host-x86_64/dist-android/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ RUN sh /scripts/android-base-apt-get.sh
66
# ndk
77
COPY scripts/android-ndk.sh /scripts/
88
RUN . /scripts/android-ndk.sh && \
9-
download_ndk android-ndk-r25b-linux.zip
9+
download_ndk android-ndk-r15c-linux-x86_64.zip && \
10+
make_standalone_toolchain arm 14 && \
11+
make_standalone_toolchain x86 14 && \
12+
make_standalone_toolchain arm 21 && \
13+
make_standalone_toolchain x86 21 && \
14+
make_standalone_toolchain arm64 21 && \
15+
make_standalone_toolchain x86_64 21 && \
16+
remove_ndk
1017

1118
# env
1219
ENV TARGETS=arm-linux-androideabi
@@ -19,12 +26,12 @@ ENV TARGETS=$TARGETS,x86_64-linux-android
1926
ENV RUST_CONFIGURE_ARGS \
2027
--enable-extended \
2128
--enable-profiler \
22-
--arm-linux-androideabi-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
23-
--armv7-linux-androideabi-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
24-
--thumbv7neon-linux-androideabi-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
25-
--i686-linux-android-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
26-
--aarch64-linux-android-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
27-
--x86_64-linux-android-ndk=/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/ \
29+
--arm-linux-androideabi-ndk=/android/ndk/arm-14 \
30+
--armv7-linux-androideabi-ndk=/android/ndk/arm-14 \
31+
--thumbv7neon-linux-androideabi-ndk=/android/ndk/arm-14 \
32+
--i686-linux-android-ndk=/android/ndk/x86-14 \
33+
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
34+
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
2835
--disable-docs
2936

3037
ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS

src/ci/docker/scripts/android-ndk.sh

+20-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,28 @@ set -ex
44
URL=https://dl.google.com/android/repository
55

66
download_ndk() {
7-
mkdir /android/
8-
cd /android
7+
mkdir -p /android/ndk
8+
cd /android/ndk
99
curl -fO $URL/$1
1010
unzip -q $1
1111
rm $1
1212
mv android-ndk-* ndk
1313
}
14+
15+
make_standalone_toolchain() {
16+
# See https://developer.android.com/ndk/guides/standalone_toolchain.htm
17+
python3 /android/ndk/ndk/build/tools/make_standalone_toolchain.py \
18+
--install-dir /android/ndk/$1-$2 \
19+
--arch $1 \
20+
--api $2
21+
}
22+
23+
remove_ndk() {
24+
rm -rf /android/ndk/ndk
25+
}
26+
27+
download_and_make_toolchain() {
28+
download_ndk $1 && \
29+
make_standalone_toolchain $2 $3 && \
30+
remove_ndk
31+
}

src/librustdoc/clean/utils.rs

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::clean::{
77
PathSegment, Primitive, PrimitiveType, Type, TypeBinding, Visibility,
88
};
99
use crate::core::DocContext;
10-
use crate::formats::item_type::ItemType;
1110
use crate::visit_lib::LibEmbargoVisitor;
1211

1312
use rustc_ast as ast;
@@ -504,9 +503,6 @@ pub(crate) fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
504503
return did;
505504
}
506505
inline::record_extern_fqn(cx, did, kind);
507-
if let ItemType::Trait = kind {
508-
inline::record_extern_trait(cx, did);
509-
}
510506
did
511507
}
512508

src/librustdoc/passes/collect_intra_doc_links/early.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,14 @@ impl Visitor<'_> for EarlyDocLinkResolver<'_, '_> {
354354
self.parent_scope.module = old_module;
355355
} else {
356356
match &item.kind {
357-
ItemKind::Impl(box ast::Impl { of_trait: Some(..), .. }) => {
357+
ItemKind::Impl(box ast::Impl { of_trait: Some(trait_ref), .. }) => {
358+
if let Some(partial_res) = self.resolver.get_partial_res(trait_ref.ref_id)
359+
&& let Some(res) = partial_res.full_res()
360+
&& let Some(trait_def_id) = res.opt_def_id()
361+
&& !trait_def_id.is_local()
362+
&& self.visited_mods.insert(trait_def_id) {
363+
self.resolve_doc_links_extern_impl(trait_def_id, false);
364+
}
358365
self.all_trait_impls.push(self.resolver.local_def_id(item.id).to_def_id());
359366
}
360367
ItemKind::MacroDef(macro_def) if macro_def.macro_rules => {

0 commit comments

Comments
 (0)