Skip to content

Commit 96ddd32

Browse files
committed
Auto merge of rust-lang#104387 - Manishearth:rollup-9e551p5, r=Manishearth
Rollup of 9 pull requests Successful merges: - rust-lang#103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0) - rust-lang#103744 (Upgrade cc for working is_flag_supported on cross-compiles) - rust-lang#104105 (llvm: dwo only emitted when object code emitted) - rust-lang#104158 (Return .efi extension for EFI executable) - rust-lang#104181 (Add a few known-bug tests) - rust-lang#104266 (Regression test for coercion of mut-ref to dyn-star) - rust-lang#104300 (Document `Path::parent` behavior around relative paths) - rust-lang#104304 (Enable profiler in dist-s390x-linux) - rust-lang#104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents f90a4ff + 4fdd944 commit 96ddd32

File tree

29 files changed

+681
-56
lines changed

29 files changed

+681
-56
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ version = "0.1.0"
473473

474474
[[package]]
475475
name = "cc"
476-
version = "1.0.73"
476+
version = "1.0.76"
477477
source = "registry+https://github.com/rust-lang/crates.io-index"
478-
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
478+
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
479479
dependencies = [
480480
"jobserver",
481481
]

compiler/rustc_codegen_llvm/src/back/write.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,21 @@ pub(crate) unsafe fn codegen(
765765
drop(handlers);
766766
}
767767

768+
// `.dwo` files are only emitted if:
769+
//
770+
// - Object files are being emitted (i.e. bitcode only or metadata only compilations will not
771+
// produce dwarf objects, even if otherwise enabled)
772+
// - Target supports Split DWARF
773+
// - Split debuginfo is enabled
774+
// - Split DWARF kind is `split` (i.e. debuginfo is split into `.dwo` files, not different
775+
// sections in the `.o` files).
776+
let dwarf_object_emitted = matches!(config.emit_obj, EmitObj::ObjectCode(_))
777+
&& cgcx.target_can_use_split_dwarf
778+
&& cgcx.split_debuginfo != SplitDebuginfo::Off
779+
&& cgcx.split_dwarf_kind == SplitDwarfKind::Split;
768780
Ok(module.into_compiled_module(
769781
config.emit_obj != EmitObj::None,
770-
cgcx.target_can_use_split_dwarf
771-
&& cgcx.split_debuginfo != SplitDebuginfo::Off
772-
&& cgcx.split_dwarf_kind == SplitDwarfKind::Split,
782+
dwarf_object_emitted,
773783
config.emit_bc,
774784
&cgcx.output_filenames,
775785
))

compiler/rustc_llvm/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ fn main() {
334334
"c++"
335335
} else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
336336
// NetBSD uses a separate library when relocation is required
337-
"stdc++_pic"
337+
"stdc++_p"
338338
} else if llvm_use_libcxx.is_some() {
339339
"c++"
340340
} else {

compiler/rustc_parse/src/parser/attr_wrapper.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use rustc_ast::tokenstream::{AttrTokenTree, DelimSpan, LazyAttrTokenStream, Spac
55
use rustc_ast::{self as ast};
66
use rustc_ast::{AttrVec, Attribute, HasAttrs, HasTokens};
77
use rustc_errors::PResult;
8-
use rustc_span::{sym, Span};
8+
use rustc_session::parse::ParseSess;
9+
use rustc_span::{sym, Span, DUMMY_SP};
910

1011
use std::convert::TryInto;
1112
use std::ops::Range;
@@ -39,8 +40,13 @@ impl AttrWrapper {
3940
pub fn empty() -> AttrWrapper {
4041
AttrWrapper { attrs: AttrVec::new(), start_pos: usize::MAX }
4142
}
42-
// FIXME: Delay span bug here?
43-
pub(crate) fn take_for_recovery(self) -> AttrVec {
43+
44+
pub(crate) fn take_for_recovery(self, sess: &ParseSess) -> AttrVec {
45+
sess.span_diagnostic.delay_span_bug(
46+
self.attrs.get(0).map(|attr| attr.span).unwrap_or(DUMMY_SP),
47+
"AttrVec is taken for recovery but no error is produced",
48+
);
49+
4450
self.attrs
4551
}
4652

compiler/rustc_parse/src/parser/expr.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ impl<'a> Parser<'a> {
22722272
self.mk_block_err(cond_span.shrink_to_hi())
22732273
}
22742274
} else {
2275-
let attrs = self.parse_outer_attributes()?.take_for_recovery(); // For recovery.
2275+
let attrs = self.parse_outer_attributes()?; // For recovery.
22762276
let block = if self.check(&token::OpenDelim(Delimiter::Brace)) {
22772277
self.parse_block()?
22782278
} else {
@@ -2289,7 +2289,7 @@ impl<'a> Parser<'a> {
22892289
})?
22902290
}
22912291
};
2292-
self.error_on_if_block_attrs(lo, false, block.span, &attrs);
2292+
self.error_on_if_block_attrs(lo, false, block.span, attrs);
22932293
block
22942294
};
22952295
let els = if self.eat_keyword(kw::Else) { Some(self.parse_else_expr()?) } else { None };
@@ -2350,7 +2350,7 @@ impl<'a> Parser<'a> {
23502350
/// Parses an `else { ... }` expression (`else` token already eaten).
23512351
fn parse_else_expr(&mut self) -> PResult<'a, P<Expr>> {
23522352
let else_span = self.prev_token.span; // `else`
2353-
let attrs = self.parse_outer_attributes()?.take_for_recovery(); // For recovery.
2353+
let attrs = self.parse_outer_attributes()?; // For recovery.
23542354
let expr = if self.eat_keyword(kw::If) {
23552355
self.parse_if_expr()?
23562356
} else if self.check(&TokenKind::OpenDelim(Delimiter::Brace)) {
@@ -2385,7 +2385,7 @@ impl<'a> Parser<'a> {
23852385
},
23862386
}
23872387
};
2388-
self.error_on_if_block_attrs(else_span, true, expr.span, &attrs);
2388+
self.error_on_if_block_attrs(else_span, true, expr.span, attrs);
23892389
Ok(expr)
23902390
}
23912391

@@ -2394,8 +2394,13 @@ impl<'a> Parser<'a> {
23942394
ctx_span: Span,
23952395
is_ctx_else: bool,
23962396
branch_span: Span,
2397-
attrs: &[ast::Attribute],
2397+
attrs: AttrWrapper,
23982398
) {
2399+
if attrs.is_empty() {
2400+
return;
2401+
}
2402+
2403+
let attrs: &[ast::Attribute] = &attrs.take_for_recovery(self.sess);
23992404
let (attributes, last) = match attrs {
24002405
[] => return,
24012406
[x0 @ xn] | [x0, .., xn] => (x0.span.to(xn.span), xn.span),

compiler/rustc_parse/src/parser/stmt.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_ast as ast;
1919
use rustc_ast::ptr::P;
2020
use rustc_ast::token::{self, Delimiter, TokenKind};
2121
use rustc_ast::util::classify;
22-
use rustc_ast::{AttrStyle, AttrVec, Attribute, LocalKind, MacCall, MacCallStmt, MacStmtStyle};
22+
use rustc_ast::{AttrStyle, AttrVec, LocalKind, MacCall, MacCallStmt, MacStmtStyle};
2323
use rustc_ast::{Block, BlockCheckMode, Expr, ExprKind, HasAttrs, Local, Stmt};
2424
use rustc_ast::{StmtKind, DUMMY_NODE_ID};
2525
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, PResult};
@@ -101,7 +101,7 @@ impl<'a> Parser<'a> {
101101
self.mk_stmt(lo.to(item.span), StmtKind::Item(P(item)))
102102
} else if self.eat(&token::Semi) {
103103
// Do not attempt to parse an expression if we're done here.
104-
self.error_outer_attrs(&attrs.take_for_recovery());
104+
self.error_outer_attrs(attrs);
105105
self.mk_stmt(lo, StmtKind::Empty)
106106
} else if self.token != token::CloseDelim(Delimiter::Brace) {
107107
// Remainder are line-expr stmts.
@@ -120,7 +120,7 @@ impl<'a> Parser<'a> {
120120
}
121121
self.mk_stmt(lo.to(e.span), StmtKind::Expr(e))
122122
} else {
123-
self.error_outer_attrs(&attrs.take_for_recovery());
123+
self.error_outer_attrs(attrs);
124124
return Ok(None);
125125
}))
126126
}
@@ -199,8 +199,10 @@ impl<'a> Parser<'a> {
199199

200200
/// Error on outer attributes in this context.
201201
/// Also error if the previous token was a doc comment.
202-
fn error_outer_attrs(&self, attrs: &[Attribute]) {
203-
if let [.., last] = attrs {
202+
fn error_outer_attrs(&self, attrs: AttrWrapper) {
203+
if !attrs.is_empty()
204+
&& let attrs = attrs.take_for_recovery(self.sess)
205+
&& let attrs @ [.., last] = &*attrs {
204206
if last.is_doc_comment() {
205207
self.sess.emit_err(DocCommentDoesNotDocumentAnything {
206208
span: last.span,

library/std/src/path.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,10 @@ impl Path {
21422142

21432143
/// Returns the `Path` without its final component, if there is one.
21442144
///
2145-
/// Returns [`None`] if the path terminates in a root or prefix.
2145+
/// This means it returns `Some("")` for relative paths with one component.
2146+
///
2147+
/// Returns [`None`] if the path terminates in a root or prefix, or if it's
2148+
/// the empty string.
21462149
///
21472150
/// # Examples
21482151
///
@@ -2156,6 +2159,14 @@ impl Path {
21562159
/// let grand_parent = parent.parent().unwrap();
21572160
/// assert_eq!(grand_parent, Path::new("/"));
21582161
/// assert_eq!(grand_parent.parent(), None);
2162+
///
2163+
/// let relative_path = Path::new("foo/bar");
2164+
/// let parent = relative_path.parent();
2165+
/// assert_eq!(parent, Some(Path::new("foo")));
2166+
/// let grand_parent = parent.and_then(Path::parent);
2167+
/// assert_eq!(grand_parent, Some(Path::new("")));
2168+
/// let great_grand_parent = grand_parent.and_then(Path::parent);
2169+
/// assert_eq!(great_grand_parent, None);
21592170
/// ```
21602171
#[stable(feature = "rust1", since = "1.0.0")]
21612172
#[doc(alias = "dirname")]

library/unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ compiler_builtins = "0.1.0"
2020
cfg-if = "1.0"
2121

2222
[build-dependencies]
23-
cc = "1.0.69"
23+
cc = "1.0.76"
2424

2525
[features]
2626

src/bootstrap/util.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ pub use t;
4444
/// Given an executable called `name`, return the filename for the
4545
/// executable for a particular target.
4646
pub fn exe(name: &str, target: TargetSelection) -> String {
47-
if target.contains("windows") { format!("{}.exe", name) } else { name.to_string() }
47+
if target.contains("windows") {
48+
format!("{}.exe", name)
49+
} else if target.contains("uefi") {
50+
format!("{}.efi", name)
51+
} else {
52+
name.to_string()
53+
}
4854
}
4955

5056
/// Returns `true` if the file name given looks like a dynamic library.

src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ ENV \
2828

2929
ENV HOSTS=s390x-unknown-linux-gnu
3030

31-
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs
31+
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-profiler --disable-docs
3232
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:20.04
22

33
COPY scripts/cross-apt-packages.sh /scripts/
44
RUN sh /scripts/cross-apt-packages.sh
5+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zlib1g-dev
56

67
COPY host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/
78
RUN /tmp/build-netbsd-toolchain.sh
89

910
COPY scripts/sccache.sh /scripts/
1011
RUN sh /scripts/sccache.sh
1112

12-
COPY scripts/cmake.sh /scripts/
13-
RUN /scripts/cmake.sh
14-
1513
ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin
1614

1715
ENV \
@@ -21,6 +19,5 @@ ENV \
2119

2220
ENV HOSTS=x86_64-unknown-netbsd
2321

24-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
25-
--set llvm.allow-old-toolchain
22+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
2623
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh

+13-13
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ cd netbsd
2525

2626
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
2727

28-
URL=https://ci-mirrors.rust-lang.org/rustc
29-
30-
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz
31-
curl $URL/2018-03-01-netbsd-src.tgz | tar xzf -
32-
curl $URL/2018-03-01-netbsd-gnusrc.tgz | tar xzf -
33-
curl $URL/2018-03-01-netbsd-sharesrc.tgz | tar xzf -
34-
curl $URL/2018-03-01-netbsd-syssrc.tgz | tar xzf -
35-
36-
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/amd64/binary/sets/*.tgz
37-
curl $URL/2018-03-01-netbsd-base.tgz | \
38-
tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
39-
curl $URL/2018-03-01-netbsd-comp.tgz | \
40-
tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib
28+
# URL=https://ci-mirrors.rust-lang.org/rustc
29+
30+
SOURCE_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/source/sets
31+
curl $SOURCE_URL/src.tgz | tar xzf -
32+
curl $SOURCE_URL/gnusrc.tgz | tar xzf -
33+
curl $SOURCE_URL/sharesrc.tgz | tar xzf -
34+
curl $SOURCE_URL/syssrc.tgz | tar xzf -
35+
36+
BINARY_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/amd64/binary/sets
37+
curl $BINARY_URL/base.tar.xz | \
38+
tar xJf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
39+
curl $BINARY_URL/comp.tar.xz | \
40+
tar xJf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib
4141

4242
cd usr/src
4343

src/test/incremental/issue-101518.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// revisions: cfail1
2+
// should-ice
3+
// error-pattern: forcing query
4+
// known-bug: #101518
5+
6+
#[derive(PartialEq, Eq)]
7+
struct Id<'a> {
8+
ns: &'a str,
9+
}
10+
fn visit_struct() {
11+
let id = Id { ns: "random1" };
12+
const FLAG: Id<'static> = Id {
13+
ns: "needs_to_be_the_same",
14+
};
15+
match id {
16+
FLAG => {}
17+
_ => {}
18+
}
19+
}
20+
fn visit_struct2() {
21+
let id = Id { ns: "random2" };
22+
const FLAG: Id<'static> = Id {
23+
ns: "needs_to_be_the_same",
24+
};
25+
match id {
26+
FLAG => {}
27+
_ => {}
28+
}
29+
}
30+
31+
fn main() {}

0 commit comments

Comments
 (0)