Skip to content

Commit ded0270

Browse files
committed
Auto merge of #69359 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.41.1 release This backports the following PRs: * Revert "Remove `checked_add` in `Layout::repeat`" #69241 * Do not ICE when encountering `yield` inside `async` block #69175 * Correct ICE caused by macros generating invalid spans. #68611 * Changelog: Demonstrate final build-override syntax #68603 * Resolve long compile times when evaluating always valid constants #67667 * Fix MIR typeck soundness holes #69145 This also includes a commit which rustfmt's files which the latter commits touched (and perhaps a bit more) to make rebasing the PRs go more smoothly (thankfully, this should be the last time we need to do so). I have removed stable-nominated tags from PRs successfully backported.
2 parents 5e1a799 + 53139c5 commit ded0270

25 files changed

+1155
-979
lines changed

RELEASES.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Version 1.41.1 (2020-02-27)
2+
===========================
3+
4+
* [Always check types of static items][69145]
5+
* [Always check lifetime bounds of `Copy` impls][69145]
6+
* [Fix miscompilation in callers of `Layout::repeat`][69225]
7+
8+
[69225]: https://github.com/rust-lang/rust/issues/69225
9+
[69145]: https://github.com/rust-lang/rust/pull/69145
10+
111
Version 1.41.0 (2020-01-30)
212
===========================
313

@@ -62,9 +72,9 @@ Cargo
6272
- [Cargo.lock now uses a more git friendly format that should help to reduce
6373
merge conflicts.][cargo/7579]
6474
- [You can now override specific dependencies's build settings][cargo/7591] E.g.
65-
`[profile.dev.overrides.image] opt-level = 2` sets the `image` crate's
75+
`[profile.dev.package.image] opt-level = 2` sets the `image` crate's
6676
optimisation level to `2` for debug builds. You can also use
67-
`[profile.<profile>.build_overrides]` to override build scripts and
77+
`[profile.<profile>.build-override]` to override build scripts and
6878
their dependencies.
6979

7080
Misc
@@ -208,7 +218,7 @@ Compatibility Notes
208218
- [Using `#[inline]` on function prototypes and consts now emits a warning under
209219
`unused_attribute` lint.][65294] Using `#[inline]` anywhere else inside traits
210220
or `extern` blocks now correctly emits a hard error.
211-
221+
212222
[65294]: https://github.com/rust-lang/rust/pull/65294/
213223
[66103]: https://github.com/rust-lang/rust/pull/66103/
214224
[65843]: https://github.com/rust-lang/rust/pull/65843/

src/bootstrap/channel.rs

+15-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use build_helper::output;
1313
use crate::Build;
1414

1515
// The version number
16-
pub const CFG_RELEASE_NUM: &str = "1.41.0";
16+
pub const CFG_RELEASE_NUM: &str = "1.41.1";
1717

1818
pub struct GitInfo {
1919
inner: Option<Info>,
@@ -29,31 +29,28 @@ impl GitInfo {
2929
pub fn new(ignore_git: bool, dir: &Path) -> GitInfo {
3030
// See if this even begins to look like a git dir
3131
if ignore_git || !dir.join(".git").exists() {
32-
return GitInfo { inner: None }
32+
return GitInfo { inner: None };
3333
}
3434

3535
// Make sure git commands work
36-
match Command::new("git")
37-
.arg("rev-parse")
38-
.current_dir(dir)
39-
.output()
40-
{
36+
match Command::new("git").arg("rev-parse").current_dir(dir).output() {
4137
Ok(ref out) if out.status.success() => {}
4238
_ => return GitInfo { inner: None },
4339
}
4440

4541
// Ok, let's scrape some info
46-
let ver_date = output(Command::new("git").current_dir(dir)
47-
.arg("log").arg("-1")
48-
.arg("--date=short")
49-
.arg("--pretty=format:%cd"));
50-
let ver_hash = output(Command::new("git").current_dir(dir)
51-
.arg("rev-parse").arg("HEAD"));
52-
let short_ver_hash = output(Command::new("git")
53-
.current_dir(dir)
54-
.arg("rev-parse")
55-
.arg("--short=9")
56-
.arg("HEAD"));
42+
let ver_date = output(
43+
Command::new("git")
44+
.current_dir(dir)
45+
.arg("log")
46+
.arg("-1")
47+
.arg("--date=short")
48+
.arg("--pretty=format:%cd"),
49+
);
50+
let ver_hash = output(Command::new("git").current_dir(dir).arg("rev-parse").arg("HEAD"));
51+
let short_ver_hash = output(
52+
Command::new("git").current_dir(dir).arg("rev-parse").arg("--short=9").arg("HEAD"),
53+
);
5754
GitInfo {
5855
inner: Some(Info {
5956
commit_date: ver_date.trim().to_string(),

src/ci/azure-pipelines/steps/run.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ steps:
3131
- bash: src/ci/scripts/setup-environment.sh
3232
displayName: Setup environment
3333

34+
- bash: src/ci/scripts/clean-disk.sh
35+
displayName: Clean disk
36+
3437
- bash: src/ci/scripts/should-skip-this.sh
3538
displayName: Decide whether to run this job
3639

src/ci/scripts/clean-disk.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# This script deletes some of the Azure-provided artifacts. We don't use these,
3+
# and disk space is at a premium on our builders.
4+
5+
set -euo pipefail
6+
IFS=$'\n\t'
7+
8+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
9+
10+
# All the Linux builds happen inside Docker.
11+
if isLinux; then
12+
# 6.7GB
13+
sudo rm -rf /opt/ghc
14+
# 16GB
15+
sudo rm -rf /usr/share/dotnet
16+
fi

src/libcore/alloc.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,14 @@ impl Layout {
240240
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
241241
#[inline]
242242
pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
243-
// This cannot overflow. Quoting from the invariant of Layout:
244-
// > `size`, when rounded up to the nearest multiple of `align`,
245-
// > must not overflow (i.e., the rounded value must be less than
246-
// > `usize::MAX`)
247-
let padded_size = self.size() + self.padding_needed_for(self.align());
248-
let alloc_size = padded_size.checked_mul(n)
243+
// Warning, removing the checked_add here led to segfaults in #67174. Further
244+
// analysis in #69225 seems to indicate that this is an LTO-related
245+
// miscompilation, so #67174 might be able to be reapplied in the future.
246+
let padded_size = self
247+
.size()
248+
.checked_add(self.padding_needed_for(self.align()))
249249
.ok_or(LayoutErr { private: () })?;
250+
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutErr { private: () })?;
250251

251252
unsafe {
252253
// self.align is already known to be valid and alloc_size has been

src/librustc/hir/map/blocks.rs

+68-64
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
//! for the `Code` associated with a particular NodeId.
1313
1414
use crate::hir as ast;
15+
use crate::hir::intravisit::FnKind;
1516
use crate::hir::map;
1617
use crate::hir::{Expr, FnDecl, Node};
17-
use crate::hir::intravisit::FnKind;
1818
use syntax::ast::{Attribute, Ident};
1919
use syntax_pos::Span;
2020

@@ -29,11 +29,15 @@ use syntax_pos::Span;
2929
///
3030
/// To construct one, use the `Code::from_node` function.
3131
#[derive(Copy, Clone, Debug)]
32-
pub struct FnLikeNode<'a> { node: Node<'a> }
32+
pub struct FnLikeNode<'a> {
33+
node: Node<'a>,
34+
}
3335

3436
/// MaybeFnLike wraps a method that indicates if an object
3537
/// corresponds to some FnLikeNode.
36-
trait MaybeFnLike { fn is_fn_like(&self) -> bool; }
38+
trait MaybeFnLike {
39+
fn is_fn_like(&self) -> bool;
40+
}
3741

3842
impl MaybeFnLike for ast::Item {
3943
fn is_fn_like(&self) -> bool {
@@ -96,23 +100,23 @@ impl<'a> Code<'a> {
96100
Code::from_node(map, map.get_parent_node(id))
97101
}
98102
map::Node::Expr(expr) => Some(Code::Expr(expr)),
99-
node => FnLikeNode::from_node(node).map(Code::FnLike)
103+
node => FnLikeNode::from_node(node).map(Code::FnLike),
100104
}
101105
}
102106
}
103107

104108
/// These are all the components one can extract from a fn item for
105109
/// use when implementing FnLikeNode operations.
106110
struct ItemFnParts<'a> {
107-
ident: Ident,
108-
decl: &'a ast::FnDecl,
109-
header: ast::FnHeader,
110-
vis: &'a ast::Visibility,
111+
ident: Ident,
112+
decl: &'a ast::FnDecl,
113+
header: ast::FnHeader,
114+
vis: &'a ast::Visibility,
111115
generics: &'a ast::Generics,
112-
body: ast::BodyId,
113-
id: ast::HirId,
114-
span: Span,
115-
attrs: &'a [Attribute],
116+
body: ast::BodyId,
117+
id: ast::HirId,
118+
span: Span,
119+
attrs: &'a [Attribute],
116120
}
117121

118122
/// These are all the components one can extract from a closure expr
@@ -127,13 +131,7 @@ struct ClosureParts<'a> {
127131

128132
impl<'a> ClosureParts<'a> {
129133
fn new(d: &'a FnDecl, b: ast::BodyId, id: ast::HirId, s: Span, attrs: &'a [Attribute]) -> Self {
130-
ClosureParts {
131-
decl: d,
132-
body: b,
133-
id,
134-
span: s,
135-
attrs,
136-
}
134+
ClosureParts { decl: d, body: b, id, span: s, attrs }
137135
}
138136
}
139137

@@ -145,33 +143,41 @@ impl<'a> FnLikeNode<'a> {
145143
map::Node::TraitItem(tm) => tm.is_fn_like(),
146144
map::Node::ImplItem(it) => it.is_fn_like(),
147145
map::Node::Expr(e) => e.is_fn_like(),
148-
_ => false
146+
_ => false,
149147
};
150148
fn_like.then_some(FnLikeNode { node })
151149
}
152150

153151
pub fn body(self) -> ast::BodyId {
154-
self.handle(|i: ItemFnParts<'a>| i.body,
155-
|_, _, _: &'a ast::FnSig, _, body: ast::BodyId, _, _| body,
156-
|c: ClosureParts<'a>| c.body)
152+
self.handle(
153+
|i: ItemFnParts<'a>| i.body,
154+
|_, _, _: &'a ast::FnSig, _, body: ast::BodyId, _, _| body,
155+
|c: ClosureParts<'a>| c.body,
156+
)
157157
}
158158

159159
pub fn decl(self) -> &'a FnDecl {
160-
self.handle(|i: ItemFnParts<'a>| &*i.decl,
161-
|_, _, sig: &'a ast::FnSig, _, _, _, _| &sig.decl,
162-
|c: ClosureParts<'a>| c.decl)
160+
self.handle(
161+
|i: ItemFnParts<'a>| &*i.decl,
162+
|_, _, sig: &'a ast::FnSig, _, _, _, _| &sig.decl,
163+
|c: ClosureParts<'a>| c.decl,
164+
)
163165
}
164166

165167
pub fn span(self) -> Span {
166-
self.handle(|i: ItemFnParts<'_>| i.span,
167-
|_, _, _: &'a ast::FnSig, _, _, span, _| span,
168-
|c: ClosureParts<'_>| c.span)
168+
self.handle(
169+
|i: ItemFnParts<'_>| i.span,
170+
|_, _, _: &'a ast::FnSig, _, _, span, _| span,
171+
|c: ClosureParts<'_>| c.span,
172+
)
169173
}
170174

171175
pub fn id(self) -> ast::HirId {
172-
self.handle(|i: ItemFnParts<'_>| i.id,
173-
|id, _, _: &'a ast::FnSig, _, _, _, _| id,
174-
|c: ClosureParts<'_>| c.id)
176+
self.handle(
177+
|i: ItemFnParts<'_>| i.id,
178+
|id, _, _: &'a ast::FnSig, _, _, _, _| id,
179+
|c: ClosureParts<'_>| c.id,
180+
)
175181
}
176182

177183
pub fn constness(self) -> ast::Constness {
@@ -190,41 +196,40 @@ impl<'a> FnLikeNode<'a> {
190196
let item = |p: ItemFnParts<'a>| -> FnKind<'a> {
191197
FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs)
192198
};
193-
let closure = |c: ClosureParts<'a>| {
194-
FnKind::Closure(c.attrs)
195-
};
199+
let closure = |c: ClosureParts<'a>| FnKind::Closure(c.attrs);
196200
let method = |_, ident: Ident, sig: &'a ast::FnSig, vis, _, _, attrs| {
197201
FnKind::Method(ident, sig, vis, attrs)
198202
};
199203
self.handle(item, method, closure)
200204
}
201205

202-
fn handle<A, I, M, C>(self, item_fn: I, method: M, closure: C) -> A where
206+
fn handle<A, I, M, C>(self, item_fn: I, method: M, closure: C) -> A
207+
where
203208
I: FnOnce(ItemFnParts<'a>) -> A,
204-
M: FnOnce(ast::HirId,
205-
Ident,
206-
&'a ast::FnSig,
207-
Option<&'a ast::Visibility>,
208-
ast::BodyId,
209-
Span,
210-
&'a [Attribute])
211-
-> A,
209+
M: FnOnce(
210+
ast::HirId,
211+
Ident,
212+
&'a ast::FnSig,
213+
Option<&'a ast::Visibility>,
214+
ast::BodyId,
215+
Span,
216+
&'a [Attribute],
217+
) -> A,
212218
C: FnOnce(ClosureParts<'a>) -> A,
213219
{
214220
match self.node {
215221
map::Node::Item(i) => match i.kind {
216-
ast::ItemKind::Fn(ref sig, ref generics, block) =>
217-
item_fn(ItemFnParts {
218-
id: i.hir_id,
219-
ident: i.ident,
220-
decl: &sig.decl,
221-
body: block,
222-
vis: &i.vis,
223-
span: i.span,
224-
attrs: &i.attrs,
225-
header: sig.header,
226-
generics,
227-
}),
222+
ast::ItemKind::Fn(ref sig, ref generics, block) => item_fn(ItemFnParts {
223+
id: i.hir_id,
224+
ident: i.ident,
225+
decl: &sig.decl,
226+
body: block,
227+
vis: &i.vis,
228+
span: i.span,
229+
attrs: &i.attrs,
230+
header: sig.header,
231+
generics,
232+
}),
228233
_ => bug!("item FnLikeNode that is not fn-like"),
229234
},
230235
map::Node::TraitItem(ti) => match ti.kind {
@@ -233,17 +238,16 @@ impl<'a> FnLikeNode<'a> {
233238
}
234239
_ => bug!("trait method FnLikeNode that is not fn-like"),
235240
},
236-
map::Node::ImplItem(ii) => {
237-
match ii.kind {
238-
ast::ImplItemKind::Method(ref sig, body) => {
239-
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
240-
}
241-
_ => bug!("impl method FnLikeNode that is not fn-like")
241+
map::Node::ImplItem(ii) => match ii.kind {
242+
ast::ImplItemKind::Method(ref sig, body) => {
243+
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
242244
}
245+
_ => bug!("impl method FnLikeNode that is not fn-like"),
243246
},
244247
map::Node::Expr(e) => match e.kind {
245-
ast::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) =>
246-
closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs)),
248+
ast::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) => {
249+
closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs))
250+
}
247251
_ => bug!("expr FnLikeNode that is not fn-like"),
248252
},
249253
_ => bug!("other FnLikeNode that is not fn-like"),

0 commit comments

Comments
 (0)