Skip to content

Commit ed8b708

Browse files
committed
Auto merge of #64658 - Centril:rollup-9s3raz6, r=Centril
Rollup of 9 pull requests Successful merges: - #64010 (Stabilize `param_attrs` in Rust 1.39.0) - #64136 (Document From trait for LhsExpr in parser) - #64342 (factor out pluralisation remains after #64280) - #64347 (Add long error explanation for E0312) - #64621 (Add Compatibility Notes to RELEASES.md for 1.38.0) - #64632 (remove the extra comma after the match arm) - #64640 (No home directory on vxWorks) - #64641 (Exempt extern "Rust" from improper_ctypes) - #64642 (Fix the span used to suggest avoiding for-loop moves) Failed merges: r? @ghost
2 parents 5349e69 + 97ca073 commit ed8b708

File tree

67 files changed

+261
-280
lines changed

Some content is hidden

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

67 files changed

+261
-280
lines changed

RELEASES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ Misc
6868
- [`rustc` will now warn about some incorrect uses of
6969
`mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346]
7070

71+
Compatibility Notes
72+
-------------------
73+
- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785]
74+
with rustc 1.39.0.
75+
- The [`armv7-unknown-linux-gnueabihf` platform is also known to have
76+
issues][62896] for certain crates such as libc.
77+
7178
[60260]: https://github.com/rust-lang/rust/pull/60260/
7279
[61457]: https://github.com/rust-lang/rust/pull/61457/
7380
[61491]: https://github.com/rust-lang/rust/pull/61491/
@@ -79,7 +86,9 @@ Misc
7986
[62735]: https://github.com/rust-lang/rust/pull/62735/
8087
[62766]: https://github.com/rust-lang/rust/pull/62766/
8188
[62784]: https://github.com/rust-lang/rust/pull/62784/
89+
[62785]: https://github.com/rust-lang/rust/issues/62785/
8290
[62814]: https://github.com/rust-lang/rust/pull/62814/
91+
[62896]: https://github.com/rust-lang/rust/issues/62896/
8392
[63000]: https://github.com/rust-lang/rust/pull/63000/
8493
[63056]: https://github.com/rust-lang/rust/pull/63056/
8594
[63107]: https://github.com/rust-lang/rust/pull/63107/

src/doc/unstable-book/src/language-features/param-attrs.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/liballoc/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pub(crate) unsafe fn box_free<T: ?Sized>(ptr: Unique<T>) {
240240
#[stable(feature = "global_alloc", since = "1.28.0")]
241241
#[rustc_allocator_nounwind]
242242
pub fn handle_alloc_error(layout: Layout) -> ! {
243-
#[allow(improper_ctypes)]
243+
#[cfg_attr(bootstrap, allow(improper_ctypes))]
244244
extern "Rust" {
245245
#[lang = "oom"]
246246
fn oom_impl(layout: Layout) -> !;

src/libcore/panicking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn panic_fmt(fmt: fmt::Arguments<'_>, file_line_col: &(&'static str, u32, u3
7171
}
7272

7373
// NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
74-
#[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe
74+
#[cfg_attr(boostrap_stdarch_ignore_this, allow(improper_ctypes))]
7575
extern "Rust" {
7676
#[lang = "panic_impl"]
7777
fn panic_impl(pi: &PanicInfo<'_>) -> !;

src/librustc/error_codes.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,39 @@ struct Foo<T: 'static> {
13471347
```
13481348
"##,
13491349

1350+
E0312: r##"
1351+
Reference's lifetime of borrowed content doesn't match the expected lifetime.
1352+
1353+
Erroneous code example:
1354+
1355+
```compile_fail,E0312
1356+
pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'static str {
1357+
if maybestr.is_none() {
1358+
"(none)"
1359+
} else {
1360+
let s: &'a str = maybestr.as_ref().unwrap();
1361+
s // Invalid lifetime!
1362+
}
1363+
}
1364+
```
1365+
1366+
To fix this error, either lessen the expected lifetime or find a way to not have
1367+
to use this reference outside of its current scope (by running the code directly
1368+
in the same block for example?):
1369+
1370+
```
1371+
// In this case, we can fix the issue by switching from "static" lifetime to 'a
1372+
pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'a str {
1373+
if maybestr.is_none() {
1374+
"(none)"
1375+
} else {
1376+
let s: &'a str = maybestr.as_ref().unwrap();
1377+
s // Ok!
1378+
}
1379+
}
1380+
```
1381+
"##,
1382+
13501383
E0317: r##"
13511384
This error occurs when an `if` expression without an `else` block is used in a
13521385
context where a type other than `()` is expected, for example a `let`
@@ -2202,7 +2235,6 @@ static X: u32 = 42;
22022235
// E0304, // expected signed integer constant
22032236
// E0305, // expected constant
22042237
E0311, // thing may not live long enough
2205-
E0312, // lifetime of reference outlives lifetime of borrowed content
22062238
E0313, // lifetime of borrowed pointer outlives lifetime of captured
22072239
// variable
22082240
E0314, // closure outlives stack frame

src/librustc/lint/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use crate::lint::{LintPass, LateLintPass, LintArray};
88
use crate::middle::stability;
99
use crate::session::Session;
10-
use errors::{Applicability, DiagnosticBuilder};
10+
use errors::{Applicability, DiagnosticBuilder, pluralise};
1111
use syntax::ast;
1212
use syntax::source_map::Span;
1313
use syntax::symbol::Symbol;
@@ -524,7 +524,7 @@ pub(crate) fn add_elided_lifetime_in_path_suggestion(
524524
};
525525
db.span_suggestion(
526526
replace_span,
527-
&format!("indicate the anonymous lifetime{}", if n >= 2 { "s" } else { "" }),
527+
&format!("indicate the anonymous lifetime{}", pluralise!(n)),
528528
suggestion,
529529
Applicability::MachineApplicable
530530
);

src/librustc/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};
1717
use crate::rustc::lint;
1818
use crate::session::Session;
1919
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet};
20-
use errors::{Applicability, DiagnosticBuilder};
20+
use errors::{Applicability, DiagnosticBuilder, pluralise};
2121
use rustc_macros::HashStable;
2222
use std::borrow::Cow;
2323
use std::cell::Cell;
@@ -3047,7 +3047,7 @@ pub fn report_missing_lifetime_specifiers(
30473047
span,
30483048
E0106,
30493049
"missing lifetime specifier{}",
3050-
if count > 1 { "s" } else { "" }
3050+
pluralise!(count)
30513051
)
30523052
}
30533053

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::ty::subst::Subst;
3333
use crate::ty::SubtypePredicate;
3434
use crate::util::nodemap::{FxHashMap, FxHashSet};
3535

36-
use errors::{Applicability, DiagnosticBuilder};
36+
use errors::{Applicability, DiagnosticBuilder, pluralise};
3737
use std::fmt;
3838
use syntax::ast;
3939
use syntax::symbol::{sym, kw};
@@ -1214,7 +1214,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12141214
_ => format!("{} {}argument{}",
12151215
arg_length,
12161216
if distinct && arg_length > 1 { "distinct " } else { "" },
1217-
if arg_length == 1 { "" } else { "s" }),
1217+
pluralise!(arg_length))
12181218
}
12191219
};
12201220

src/librustc/ty/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'tcx> ty::TyS<'tcx> {
196196
let n = tcx.lift_to_global(&n).unwrap();
197197
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
198198
Some(n) => {
199-
format!("array of {} element{}", n, if n != 1 { "s" } else { "" }).into()
199+
format!("array of {} element{}", n, pluralise!(n)).into()
200200
}
201201
None => "array".into(),
202202
}

src/librustc_lint/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
975975
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::ForeignItem) {
976976
let mut vis = ImproperCTypesVisitor { cx };
977977
let abi = cx.tcx.hir().get_foreign_abi(it.hir_id);
978-
if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic {
978+
if let Abi::Rust | Abi::RustCall | Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi {
979+
// Don't worry about types in internal ABIs.
980+
} else {
979981
match it.node {
980982
hir::ForeignItemKind::Fn(ref decl, _, _) => {
981983
vis.check_foreign_fn(it.hir_id, decl);

0 commit comments

Comments
 (0)