Skip to content

Commit f7af19c

Browse files
committed
Auto merge of #63592 - Centril:rollup-7c6dg3e, r=Centril
Rollup of 9 pull requests Successful merges: - #63155 (Add UWP MSVC targets) - #63165 (Add builtin targets for mips64(el)-unknown-linux-muslabi64) - #63306 (Adapt AddRetag for shallow retagging) - #63467 (Add Catalyst (iOS apps running on macOS) target) - #63546 (Remove uses of `mem::uninitialized()` from cloudabi) - #63572 (remove unused Level::PhaseFatal) - #63577 (Test HRTB issue accepted by compiler) - #63582 (Fix ICE #63226) - #63586 (cleanup: Remove `Spanned` where possible) Failed merges: r? @ghost
2 parents 1cdcea9 + 6e8fabb commit f7af19c

Some content is hidden

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

66 files changed

+501
-223
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ then you may need to force rustbuild to use an older version. This can be done
144144
by manually calling the appropriate vcvars file before running the bootstrap.
145145
146146
```batch
147-
> CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
147+
> CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
148148
> python x.py build
149149
```
150150

src/librustc/cfg/construct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
136136
}
137137

138138
PatKind::Struct(_, ref subpats, _) => {
139-
let pats_exit = self.pats_all(subpats.iter().map(|f| &f.node.pat), pred);
139+
let pats_exit = self.pats_all(subpats.iter().map(|f| &f.pat), pred);
140140
self.add_ast_node(pat.hir_id.local_id, &[pats_exit])
141141
}
142142

src/librustc/hir/intravisit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) {
704704
PatKind::Struct(ref qpath, ref fields, _) => {
705705
visitor.visit_qpath(qpath, pattern.hir_id, pattern.span);
706706
for field in fields {
707-
visitor.visit_id(field.node.hir_id);
708-
visitor.visit_ident(field.node.ident);
709-
visitor.visit_pat(&field.node.pat)
707+
visitor.visit_id(field.hir_id);
708+
visitor.visit_ident(field.ident);
709+
visitor.visit_pat(&field.pat)
710710
}
711711
}
712712
PatKind::Tuple(ref tuple_elements, _) => {

src/librustc/hir/lowering.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -2691,16 +2691,12 @@ impl<'a> LoweringContext<'a> {
26912691

26922692
let fs = fields
26932693
.iter()
2694-
.map(|f| {
2695-
Spanned {
2696-
span: f.span,
2697-
node: hir::FieldPat {
2698-
hir_id: self.next_id(),
2699-
ident: f.node.ident,
2700-
pat: self.lower_pat(&f.node.pat),
2701-
is_shorthand: f.node.is_shorthand,
2702-
},
2703-
}
2694+
.map(|f| hir::FieldPat {
2695+
hir_id: self.next_id(),
2696+
ident: f.ident,
2697+
pat: self.lower_pat(&f.pat),
2698+
is_shorthand: f.is_shorthand,
2699+
span: f.span,
27042700
})
27052701
.collect();
27062702
hir::PatKind::Struct(qpath, fs, etc)

src/librustc/hir/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ impl Pat {
877877
match self.node {
878878
PatKind::Binding(.., Some(ref p)) => p.walk_(it),
879879
PatKind::Struct(_, ref fields, _) => {
880-
fields.iter().all(|field| field.node.pat.walk_(it))
880+
fields.iter().all(|field| field.pat.walk_(it))
881881
}
882882
PatKind::TupleStruct(_, ref s, _) | PatKind::Tuple(ref s, _) => {
883883
s.iter().all(|p| p.walk_(it))
@@ -923,6 +923,7 @@ pub struct FieldPat {
923923
/// The pattern the field is destructured to.
924924
pub pat: P<Pat>,
925925
pub is_shorthand: bool,
926+
pub span: Span,
926927
}
927928

928929
/// Explicit binding annotations given in the HIR for a binding. Note
@@ -968,7 +969,7 @@ pub enum PatKind {
968969

969970
/// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
970971
/// The `bool` is `true` in the presence of a `..`.
971-
Struct(QPath, HirVec<Spanned<FieldPat>>, bool),
972+
Struct(QPath, HirVec<FieldPat>, bool),
972973

973974
/// A tuple struct/variant pattern `Variant(x, y, .., z)`.
974975
/// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.

src/librustc/hir/print.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1670,14 +1670,14 @@ impl<'a> State<'a> {
16701670
&fields[..],
16711671
|s, f| {
16721672
s.cbox(INDENT_UNIT);
1673-
if !f.node.is_shorthand {
1674-
s.print_ident(f.node.ident);
1673+
if !f.is_shorthand {
1674+
s.print_ident(f.ident);
16751675
s.word_nbsp(":");
16761676
}
1677-
s.print_pat(&f.node.pat);
1677+
s.print_pat(&f.pat);
16781678
s.end()
16791679
},
1680-
|f| f.node.pat.span);
1680+
|f| f.pat.span);
16811681
if etc {
16821682
if !fields.is_empty() {
16831683
self.word_space(",");

src/librustc/ich/impls_hir.rs

-4
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
153153
}
154154
}
155155

156-
impl_stable_hash_for_spanned!(hir::FieldPat);
157-
158156
impl_stable_hash_for_spanned!(hir::BinOpKind);
159157

160158
impl_stable_hash_for!(struct hir::Stmt {
@@ -187,8 +185,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr {
187185

188186
impl_stable_hash_for_spanned!(usize);
189187

190-
impl_stable_hash_for_spanned!(ast::Ident);
191-
192188
impl_stable_hash_for!(struct ast::Ident {
193189
name,
194190
span,

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
13451345
// part of `walk_mac`, and (b) we should be calling
13461346
// `visit_path`, *but* that would require a `NodeId`, and I
13471347
// want to get #53686 fixed quickly. -nmatsakis
1348-
ast_visit::walk_path(self, &mac.node.path);
1348+
ast_visit::walk_path(self, &mac.path);
13491349

13501350
run_early_pass!(self, check_mac, mac);
13511351
}

src/librustc/middle/dead.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ use crate::util::nodemap::FxHashSet;
1717

1818
use rustc_data_structures::fx::FxHashMap;
1919

20-
use syntax::{ast, source_map};
21-
use syntax::attr;
20+
use syntax::{ast, attr};
2221
use syntax::symbol::sym;
2322
use syntax_pos;
2423

@@ -119,17 +118,16 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
119118
}
120119
}
121120

122-
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, res: Res,
123-
pats: &[source_map::Spanned<hir::FieldPat>]) {
121+
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, res: Res, pats: &[hir::FieldPat]) {
124122
let variant = match self.tables.node_type(lhs.hir_id).sty {
125123
ty::Adt(adt, _) => adt.variant_of_res(res),
126124
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
127125
};
128126
for pat in pats {
129-
if let PatKind::Wild = pat.node.pat.node {
127+
if let PatKind::Wild = pat.pat.node {
130128
continue;
131129
}
132-
let index = self.tcx.field_index(pat.node.hir_id, self.tables);
130+
let index = self.tcx.field_index(pat.hir_id, self.tables);
133131
self.insert_def_id(variant.fields[index].did);
134132
}
135133
}

src/librustc/middle/liveness.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ fn add_from_pat<'tcx>(ir: &mut IrMaps<'tcx>, pat: &P<hir::Pat>) {
418418
}
419419
Struct(_, ref fields, _) => {
420420
for field in fields {
421-
if field.node.is_shorthand {
422-
shorthand_field_ids.insert(field.node.pat.hir_id);
421+
if field.is_shorthand {
422+
shorthand_field_ids.insert(field.pat.hir_id);
423423
}
424424
}
425425
}

src/librustc/middle/mem_categorization.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1282,11 +1282,11 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
12821282
};
12831283

12841284
for fp in field_pats {
1285-
let field_ty = self.pat_ty_adjusted(&fp.node.pat)?; // see (*2)
1286-
let f_index = self.tcx.field_index(fp.node.hir_id, self.tables);
1285+
let field_ty = self.pat_ty_adjusted(&fp.pat)?; // see (*2)
1286+
let f_index = self.tcx.field_index(fp.hir_id, self.tables);
12871287
let cmt_field = Rc::new(self.cat_field(pat, cmt.clone(), f_index,
1288-
fp.node.ident, field_ty));
1289-
self.cat_pattern_(cmt_field, &fp.node.pat, op)?;
1288+
fp.ident, field_ty));
1289+
self.cat_pattern_(cmt_field, &fp.pat, op)?;
12901290
}
12911291
}
12921292

src/librustc/middle/reachable.rs

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
3333
}
3434

3535
match item.node {
36+
hir::ItemKind::Fn(_, header, ..) if header.is_const() => {
37+
return true;
38+
}
3639
hir::ItemKind::Impl(..) |
3740
hir::ItemKind::Fn(..) => {
3841
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
@@ -52,6 +55,11 @@ fn method_might_be_inlined(
5255
if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
5356
return true
5457
}
58+
if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.node {
59+
if method_sig.header.is_const() {
60+
return true
61+
}
62+
}
5563
if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_src) {
5664
match tcx.hir().find(impl_hir_id) {
5765
Some(Node::Item(item)) =>

src/librustc/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ fn resolve_local<'tcx>(
12071207
PatKind::Binding(hir::BindingAnnotation::RefMut, ..) => true,
12081208

12091209
PatKind::Struct(_, ref field_pats, _) => {
1210-
field_pats.iter().any(|fp| is_binding_pat(&fp.node.pat))
1210+
field_pats.iter().any(|fp| is_binding_pat(&fp.pat))
12111211
}
12121212

12131213
PatKind::Slice(ref pats1, ref pats2, ref pats3) => {

src/librustc_codegen_ssa/back/link.rs

+32
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use std::path::{Path, PathBuf};
3232
use std::process::{Output, Stdio, ExitStatus};
3333
use std::str;
3434
use std::env;
35+
use std::ffi::OsString;
3536

3637
pub use rustc_codegen_utils::link::*;
3738

@@ -158,6 +159,36 @@ pub fn get_linker(sess: &Session, linker: &Path, flavor: LinkerFlavor) -> (PathB
158159
}
159160
};
160161

162+
// UWP apps have API restrictions enforced during Store submissions.
163+
// To comply with the Windows App Certification Kit,
164+
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
165+
let t = &sess.target.target;
166+
if flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" {
167+
if let Some(ref tool) = msvc_tool {
168+
let original_path = tool.path();
169+
if let Some(ref root_lib_path) = original_path.ancestors().skip(4).next() {
170+
let arch = match t.arch.as_str() {
171+
"x86_64" => Some("x64".to_string()),
172+
"x86" => Some("x86".to_string()),
173+
"aarch64" => Some("arm64".to_string()),
174+
_ => None,
175+
};
176+
if let Some(ref a) = arch {
177+
let mut arg = OsString::from("/LIBPATH:");
178+
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a.to_string()));
179+
cmd.arg(&arg);
180+
}
181+
else {
182+
warn!("arch is not supported");
183+
}
184+
} else {
185+
warn!("MSVC root path lib location not found");
186+
}
187+
} else {
188+
warn!("link.exe not found");
189+
}
190+
}
191+
161192
// The compiler's sysroot often has some bundled tools, so add it to the
162193
// PATH for the child.
163194
let mut new_path = sess.host_filesearch(PathKind::All)
@@ -1027,6 +1058,7 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
10271058
let t = &sess.target.target;
10281059

10291060
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
1061+
10301062
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
10311063
cmd.add_object(obj);
10321064
}

src/librustc_errors/annotate_snippet_emitter_writer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a> DiagnosticConverter<'a> {
148148
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
149149
fn annotation_type_for_level(level: Level) -> AnnotationType {
150150
match level {
151-
Level::Bug | Level::Fatal | Level::PhaseFatal | Level::Error => AnnotationType::Error,
151+
Level::Bug | Level::Fatal | Level::Error => AnnotationType::Error,
152152
Level::Warning => AnnotationType::Warning,
153153
Level::Note => AnnotationType::Note,
154154
Level::Help => AnnotationType::Help,

src/librustc_errors/diagnostic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ impl Diagnostic {
9494
match self.level {
9595
Level::Bug |
9696
Level::Fatal |
97-
Level::PhaseFatal |
9897
Level::Error |
9998
Level::FailureNote => {
10099
true

src/librustc_errors/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,6 @@ impl Handler {
787787
pub enum Level {
788788
Bug,
789789
Fatal,
790-
// An error which while not immediately fatal, should stop the compiler
791-
// progressing beyond the current phase.
792-
PhaseFatal,
793790
Error,
794791
Warning,
795792
Note,
@@ -808,7 +805,7 @@ impl Level {
808805
fn color(self) -> ColorSpec {
809806
let mut spec = ColorSpec::new();
810807
match self {
811-
Bug | Fatal | PhaseFatal | Error => {
808+
Bug | Fatal | Error => {
812809
spec.set_fg(Some(Color::Red))
813810
.set_intense(true);
814811
}
@@ -833,7 +830,7 @@ impl Level {
833830
pub fn to_str(self) -> &'static str {
834831
match self {
835832
Bug => "error: internal compiler error",
836-
Fatal | PhaseFatal | Error => "error",
833+
Fatal | Error => "error",
837834
Warning => "warning",
838835
Note => "note",
839836
Help => "help",

src/librustc_lint/builtin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
164164
.expect("struct pattern type is not an ADT")
165165
.variant_of_res(cx.tables.qpath_res(qpath, pat.hir_id));
166166
for fieldpat in field_pats {
167-
if fieldpat.node.is_shorthand {
167+
if fieldpat.is_shorthand {
168168
continue;
169169
}
170170
if fieldpat.span.ctxt().outer_expn_info().is_some() {
@@ -173,9 +173,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
173173
// (Issue #49588)
174174
continue;
175175
}
176-
if let PatKind::Binding(_, _, ident, None) = fieldpat.node.pat.node {
176+
if let PatKind::Binding(_, _, ident, None) = fieldpat.pat.node {
177177
if cx.tcx.find_field_index(ident, &variant) ==
178-
Some(cx.tcx.field_index(fieldpat.node.hir_id, cx.tables)) {
178+
Some(cx.tcx.field_index(fieldpat.hir_id, cx.tables)) {
179179
let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS,
180180
fieldpat.span,
181181
&format!("the `{}:` in this pattern is redundant", ident));
@@ -1493,7 +1493,7 @@ impl EarlyLintPass for KeywordIdents {
14931493
self.check_tokens(cx, mac_def.stream());
14941494
}
14951495
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
1496-
self.check_tokens(cx, mac.node.tts.clone().into());
1496+
self.check_tokens(cx, mac.tts.clone().into());
14971497
}
14981498
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) {
14991499
self.check_ident_token(cx, UnderMacro(false), ident);

src/librustc_mir/hair/pattern/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,9 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
645645
fields.iter()
646646
.map(|field| {
647647
FieldPattern {
648-
field: Field::new(self.tcx.field_index(field.node.hir_id,
648+
field: Field::new(self.tcx.field_index(field.hir_id,
649649
self.tables)),
650-
pattern: self.lower_pattern(&field.node.pat),
650+
pattern: self.lower_pattern(&field.pat),
651651
}
652652
})
653653
.collect();

src/librustc_mir/transform/add_retag.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ fn is_stable(
4242
}
4343
}
4444

45-
/// Determine whether this type may have a reference in it, recursing below compound types but
46-
/// not below references.
47-
fn may_have_reference<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> bool {
45+
/// Determine whether this type may be a reference (or box), and thus needs retagging.
46+
fn may_be_reference<'tcx>(ty: Ty<'tcx>) -> bool {
4847
match ty.sty {
4948
// Primitive types that are not references
5049
ty::Bool | ty::Char |
@@ -55,15 +54,12 @@ fn may_have_reference<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> bool {
5554
// References
5655
ty::Ref(..) => true,
5756
ty::Adt(..) if ty.is_box() => true,
58-
// Compound types
59-
ty::Array(ty, ..) | ty::Slice(ty) =>
60-
may_have_reference(ty, tcx),
61-
ty::Tuple(tys) =>
62-
tys.iter().any(|ty| may_have_reference(ty.expect_ty(), tcx)),
63-
ty::Adt(adt, substs) =>
64-
adt.variants.iter().any(|v| v.fields.iter().any(|f|
65-
may_have_reference(f.ty(tcx, substs), tcx)
66-
)),
57+
// Compound types are not references
58+
ty::Array(..) |
59+
ty::Slice(..) |
60+
ty::Tuple(..) |
61+
ty::Adt(..) =>
62+
false,
6763
// Conservative fallback
6864
_ => true,
6965
}
@@ -80,7 +76,7 @@ impl MirPass for AddRetag {
8076
// FIXME: Instead of giving up for unstable places, we should introduce
8177
// a temporary and retag on that.
8278
is_stable(place.as_ref())
83-
&& may_have_reference(place.ty(&*local_decls, tcx).ty, tcx)
79+
&& may_be_reference(place.ty(&*local_decls, tcx).ty)
8480
};
8581

8682
// PART 1

0 commit comments

Comments
 (0)