Skip to content

Commit bacf770

Browse files
committed
Auto merge of #84956 - RalfJung:rollup-m70mx2n, r=RalfJung
Rollup of 11 pull requests Successful merges: - #83553 (Update `ptr` docs with regards to `ptr::addr_of!`) - #84183 (Update RELEASES.md for 1.52.0) - #84709 (Add doc alias for `chdir` to `std::env::set_current_dir`) - #84803 (Reduce duplication in `impl_dep_tracking_hash` macros) - #84808 (Account for unsatisfied bounds in E0599) - #84843 (use else if in std library ) - #84865 (rustbuild: Pass a `threads` flag that works to windows-gnu lld) - #84878 (Clarify documentation for `[T]::contains`) - #84882 (platform-support: Center the contents of the `std` and `host` columns) - #84903 (Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`) - #84913 (Do not ICE on invalid const param) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 342db70 + 2cbcfae commit bacf770

File tree

16 files changed

+362
-123
lines changed

16 files changed

+362
-123
lines changed

RELEASES.md

+148
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,151 @@
1+
Version 1.52.0 (2021-05-06)
2+
============================
3+
4+
Language
5+
--------
6+
- [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether the unsafe code
7+
in an `unsafe fn` is wrapped in a `unsafe` block.][79208] This lint
8+
is allowed by default, and may become a warning or hard error in a
9+
future edition.
10+
- [You can now cast mutable references to arrays to a pointer of the same type as
11+
the element.][81479]
12+
13+
Compiler
14+
--------
15+
- [Upgraded the default LLVM to LLVM 12.][81451]
16+
17+
Added tier 3\* support for the following targets.
18+
19+
- [`s390x-unknown-linux-musl`][82166]
20+
- [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202]
21+
- [`powerpc-unknown-openbsd`][82733]
22+
23+
\* Refer to Rust's [platform support page][platform-support-doc] for more
24+
information on Rust's tiered platform support.
25+
26+
Libraries
27+
---------
28+
- [`OsString` now implements `Extend` and `FromIterator`.][82121]
29+
- [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879]
30+
- [`Arc<impl Error>` now implements `error::Error`.][80553]
31+
- [All integer division and remainder operations are now `const`.][80962]
32+
33+
Stabilised APIs
34+
-------------
35+
- [`Arguments::as_str`]
36+
- [`char::MAX`]
37+
- [`char::REPLACEMENT_CHARACTER`]
38+
- [`char::UNICODE_VERSION`]
39+
- [`char::decode_utf16`]
40+
- [`char::from_digit`]
41+
- [`char::from_u32_unchecked`]
42+
- [`char::from_u32`]
43+
- [`slice::partition_point`]
44+
- [`str::rsplit_once`]
45+
- [`str::split_once`]
46+
47+
The following previously stable APIs are now `const`.
48+
49+
- [`char::len_utf8`]
50+
- [`char::len_utf16`]
51+
- [`char::to_ascii_uppercase`]
52+
- [`char::to_ascii_lowercase`]
53+
- [`char::eq_ignore_ascii_case`]
54+
- [`u8::to_ascii_uppercase`]
55+
- [`u8::to_ascii_lowercase`]
56+
- [`u8::eq_ignore_ascii_case`]
57+
58+
Rustdoc
59+
-------
60+
- [Rustdoc lints are now treated as a tool lint, meaning that
61+
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527]
62+
Using the old style is still allowed, and will become a warning in
63+
a future release.
64+
- [Rustdoc now supports argument files.][82261]
65+
- [Rustdoc now generates smart punctuation for documentation.][79423]
66+
- [You can now use "task lists" in Rustdoc Markdown.][81766] E.g.
67+
```markdown
68+
- [x] Complete
69+
- [ ] Todo
70+
```
71+
72+
Misc
73+
----
74+
- [You can now pass multiple filters to tests.][81356] E.g.
75+
`cargo test -- foo bar` will run all tests that match `foo` and `bar`.
76+
- [Rustup now distributes PDB symbols for the `std` library on Windows,
77+
allowing you to see `std` symbols when debugging.][82218]
78+
79+
Internal Only
80+
-------------
81+
These changes provide no direct user facing benefits, but represent significant
82+
improvements to the internals and overall performance of rustc and
83+
related tools.
84+
85+
- [Check the result cache before the DepGraph when ensuring queries][81855]
86+
- [Try fast_reject::simplify_type in coherence before doing full check][81744]
87+
- [Only store a LocalDefId in some HIR nodes][81611]
88+
- [Store HIR attributes in a side table][79519]
89+
90+
Compatibility Notes
91+
-------------------
92+
- [Cargo build scripts are now forbidden from setting `RUSTC_BOOTSTRAP`.][cargo/9181]
93+
- [Removed support for the `x86_64-rumprun-netbsd` target.][82594]
94+
- [Deprecated the `x86_64-sun-solaris` target in favor of `x86_64-pc-solaris`.][82216]
95+
- [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying
96+
languages in code blocks.][78429]
97+
- [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763]
98+
- [Changes in how proc macros handle whitespace may lead to panics when used
99+
with older `proc-macro-hack` versions. A `cargo update` should be sufficient to fix this in all cases.][84136]
100+
101+
[84136]: https://github.com/rust-lang/rust/issues/84136
102+
[80763]: https://github.com/rust-lang/rust/pull/80763
103+
[82166]: https://github.com/rust-lang/rust/pull/82166
104+
[82121]: https://github.com/rust-lang/rust/pull/82121
105+
[81879]: https://github.com/rust-lang/rust/pull/81879
106+
[82261]: https://github.com/rust-lang/rust/pull/82261
107+
[82218]: https://github.com/rust-lang/rust/pull/82218
108+
[82216]: https://github.com/rust-lang/rust/pull/82216
109+
[82202]: https://github.com/rust-lang/rust/pull/82202
110+
[81855]: https://github.com/rust-lang/rust/pull/81855
111+
[81766]: https://github.com/rust-lang/rust/pull/81766
112+
[81744]: https://github.com/rust-lang/rust/pull/81744
113+
[81611]: https://github.com/rust-lang/rust/pull/81611
114+
[81479]: https://github.com/rust-lang/rust/pull/81479
115+
[81451]: https://github.com/rust-lang/rust/pull/81451
116+
[81356]: https://github.com/rust-lang/rust/pull/81356
117+
[80962]: https://github.com/rust-lang/rust/pull/80962
118+
[80553]: https://github.com/rust-lang/rust/pull/80553
119+
[80527]: https://github.com/rust-lang/rust/pull/80527
120+
[79519]: https://github.com/rust-lang/rust/pull/79519
121+
[79423]: https://github.com/rust-lang/rust/pull/79423
122+
[79208]: https://github.com/rust-lang/rust/pull/79208
123+
[78429]: https://github.com/rust-lang/rust/pull/78429
124+
[82733]: https://github.com/rust-lang/rust/pull/82733
125+
[82594]: https://github.com/rust-lang/rust/pull/82594
126+
[cargo/9181]: https://github.com/rust-lang/cargo/pull/9181
127+
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
128+
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
129+
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
130+
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
131+
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
132+
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
133+
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
134+
[`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if
135+
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq
136+
[`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str
137+
[`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once
138+
[`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once
139+
[`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point
140+
[`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8
141+
[`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16
142+
[`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase
143+
[`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase
144+
[`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case
145+
[`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase
146+
[`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase
147+
[`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case
148+
1149
Version 1.51.0 (2021-03-25)
2150
============================
3151

compiler/rustc_middle/src/mir/interpret/error.rs

-5
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ impl fmt::Display for InvalidProgramInfo<'_> {
171171
#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)]
172172
pub enum CheckInAllocMsg {
173173
MemoryAccessTest,
174-
NullPointerTest,
175174
PointerArithmeticTest,
176175
InboundsTest,
177176
}
@@ -185,7 +184,6 @@ impl fmt::Display for CheckInAllocMsg {
185184
"{}",
186185
match *self {
187186
CheckInAllocMsg::MemoryAccessTest => "memory access",
188-
CheckInAllocMsg::NullPointerTest => "null pointer test",
189187
CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic",
190188
CheckInAllocMsg::InboundsTest => "inbounds test",
191189
}
@@ -308,9 +306,6 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
308306
ptr.alloc_id,
309307
allocation_size.bytes()
310308
),
311-
DanglingIntPointer(_, CheckInAllocMsg::NullPointerTest) => {
312-
write!(f, "null pointer is not allowed for this operation")
313-
}
314309
DanglingIntPointer(i, msg) => {
315310
write!(f, "{} failed: 0x{:x} is not a valid pointer", msg, i)
316311
}

compiler/rustc_session/src/config.rs

+61-57
Original file line numberDiff line numberDiff line change
@@ -2332,17 +2332,17 @@ crate mod dep_tracking {
23322332
}
23332333

23342334
macro_rules! impl_dep_tracking_hash_via_hash {
2335-
($t:ty) => {
2335+
($($t:ty),+ $(,)?) => {$(
23362336
impl DepTrackingHash for $t {
23372337
fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
23382338
Hash::hash(self, hasher);
23392339
}
23402340
}
2341-
};
2341+
)+};
23422342
}
23432343

23442344
macro_rules! impl_dep_tracking_hash_for_sortable_vec_of {
2345-
($t:ty) => {
2345+
($($t:ty),+ $(,)?) => {$(
23462346
impl DepTrackingHash for Vec<$t> {
23472347
fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
23482348
let mut elems: Vec<&$t> = self.iter().collect();
@@ -2354,61 +2354,65 @@ crate mod dep_tracking {
23542354
}
23552355
}
23562356
}
2357-
};
2358-
}
2357+
)+};
2358+
}
2359+
2360+
impl_dep_tracking_hash_via_hash!(
2361+
bool,
2362+
usize,
2363+
u64,
2364+
String,
2365+
PathBuf,
2366+
lint::Level,
2367+
Option<bool>,
2368+
Option<u32>,
2369+
Option<usize>,
2370+
Option<NonZeroUsize>,
2371+
Option<String>,
2372+
Option<(String, u64)>,
2373+
Option<Vec<String>>,
2374+
Option<MergeFunctions>,
2375+
Option<RelocModel>,
2376+
Option<CodeModel>,
2377+
Option<TlsModel>,
2378+
Option<WasiExecModel>,
2379+
Option<PanicStrategy>,
2380+
Option<RelroLevel>,
2381+
Option<InstrumentCoverage>,
2382+
Option<lint::Level>,
2383+
Option<PathBuf>,
2384+
CrateType,
2385+
MergeFunctions,
2386+
PanicStrategy,
2387+
RelroLevel,
2388+
Passes,
2389+
OptLevel,
2390+
LtoCli,
2391+
DebugInfo,
2392+
UnstableFeatures,
2393+
OutputTypes,
2394+
NativeLibKind,
2395+
SanitizerSet,
2396+
CFGuard,
2397+
TargetTriple,
2398+
Edition,
2399+
LinkerPluginLto,
2400+
Option<SplitDebuginfo>,
2401+
SwitchWithOptPath,
2402+
Option<SymbolManglingVersion>,
2403+
Option<SourceFileHashAlgorithm>,
2404+
TrimmedDefPaths,
2405+
);
23592406

2360-
impl_dep_tracking_hash_via_hash!(bool);
2361-
impl_dep_tracking_hash_via_hash!(usize);
2362-
impl_dep_tracking_hash_via_hash!(u64);
2363-
impl_dep_tracking_hash_via_hash!(String);
2364-
impl_dep_tracking_hash_via_hash!(PathBuf);
2365-
impl_dep_tracking_hash_via_hash!(lint::Level);
2366-
impl_dep_tracking_hash_via_hash!(Option<bool>);
2367-
impl_dep_tracking_hash_via_hash!(Option<u32>);
2368-
impl_dep_tracking_hash_via_hash!(Option<usize>);
2369-
impl_dep_tracking_hash_via_hash!(Option<NonZeroUsize>);
2370-
impl_dep_tracking_hash_via_hash!(Option<String>);
2371-
impl_dep_tracking_hash_via_hash!(Option<(String, u64)>);
2372-
impl_dep_tracking_hash_via_hash!(Option<Vec<String>>);
2373-
impl_dep_tracking_hash_via_hash!(Option<MergeFunctions>);
2374-
impl_dep_tracking_hash_via_hash!(Option<RelocModel>);
2375-
impl_dep_tracking_hash_via_hash!(Option<CodeModel>);
2376-
impl_dep_tracking_hash_via_hash!(Option<TlsModel>);
2377-
impl_dep_tracking_hash_via_hash!(Option<WasiExecModel>);
2378-
impl_dep_tracking_hash_via_hash!(Option<PanicStrategy>);
2379-
impl_dep_tracking_hash_via_hash!(Option<RelroLevel>);
2380-
impl_dep_tracking_hash_via_hash!(Option<InstrumentCoverage>);
2381-
impl_dep_tracking_hash_via_hash!(Option<lint::Level>);
2382-
impl_dep_tracking_hash_via_hash!(Option<PathBuf>);
2383-
impl_dep_tracking_hash_via_hash!(CrateType);
2384-
impl_dep_tracking_hash_via_hash!(MergeFunctions);
2385-
impl_dep_tracking_hash_via_hash!(PanicStrategy);
2386-
impl_dep_tracking_hash_via_hash!(RelroLevel);
2387-
impl_dep_tracking_hash_via_hash!(Passes);
2388-
impl_dep_tracking_hash_via_hash!(OptLevel);
2389-
impl_dep_tracking_hash_via_hash!(LtoCli);
2390-
impl_dep_tracking_hash_via_hash!(DebugInfo);
2391-
impl_dep_tracking_hash_via_hash!(UnstableFeatures);
2392-
impl_dep_tracking_hash_via_hash!(OutputTypes);
2393-
impl_dep_tracking_hash_via_hash!(NativeLibKind);
2394-
impl_dep_tracking_hash_via_hash!(SanitizerSet);
2395-
impl_dep_tracking_hash_via_hash!(CFGuard);
2396-
impl_dep_tracking_hash_via_hash!(TargetTriple);
2397-
impl_dep_tracking_hash_via_hash!(Edition);
2398-
impl_dep_tracking_hash_via_hash!(LinkerPluginLto);
2399-
impl_dep_tracking_hash_via_hash!(Option<SplitDebuginfo>);
2400-
impl_dep_tracking_hash_via_hash!(SwitchWithOptPath);
2401-
impl_dep_tracking_hash_via_hash!(Option<SymbolManglingVersion>);
2402-
impl_dep_tracking_hash_via_hash!(Option<SourceFileHashAlgorithm>);
2403-
impl_dep_tracking_hash_via_hash!(TrimmedDefPaths);
2404-
2405-
impl_dep_tracking_hash_for_sortable_vec_of!(String);
2406-
impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);
2407-
impl_dep_tracking_hash_for_sortable_vec_of!((PathBuf, PathBuf));
2408-
impl_dep_tracking_hash_for_sortable_vec_of!(CrateType);
2409-
impl_dep_tracking_hash_for_sortable_vec_of!((String, lint::Level));
2410-
impl_dep_tracking_hash_for_sortable_vec_of!((String, Option<String>, NativeLibKind));
2411-
impl_dep_tracking_hash_for_sortable_vec_of!((String, u64));
2407+
impl_dep_tracking_hash_for_sortable_vec_of!(
2408+
String,
2409+
PathBuf,
2410+
(PathBuf, PathBuf),
2411+
CrateType,
2412+
(String, lint::Level),
2413+
(String, Option<String>, NativeLibKind),
2414+
(String, u64)
2415+
);
24122416

24132417
impl<T1, T2> DepTrackingHash for (T1, T2)
24142418
where

compiler/rustc_typeck/src/check/method/suggest.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
579579
}
580580

581581
let mut restrict_type_params = false;
582+
let mut unsatisfied_bounds = false;
582583
if !unsatisfied_predicates.is_empty() {
583584
let def_span = |def_id| {
584585
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id))
@@ -739,6 +740,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
739740
err.note(&format!(
740741
"the following trait bounds were not satisfied:\n{bound_list}"
741742
));
743+
unsatisfied_bounds = true;
742744
}
743745
}
744746

@@ -752,6 +754,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
752754
source,
753755
out_of_scope_traits,
754756
&unsatisfied_predicates,
757+
unsatisfied_bounds,
755758
);
756759
}
757760

@@ -984,9 +987,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
984987
source: SelfSource<'tcx>,
985988
valid_out_of_scope_traits: Vec<DefId>,
986989
unsatisfied_predicates: &[(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)],
990+
unsatisfied_bounds: bool,
987991
) {
988992
let mut alt_rcvr_sugg = false;
989-
if let SelfSource::MethodCall(rcvr) = source {
993+
if let (SelfSource::MethodCall(rcvr), false) = (source, unsatisfied_bounds) {
990994
debug!(?span, ?item_name, ?rcvr_ty, ?rcvr);
991995
let skippable = [
992996
self.tcx.lang_items().clone_trait(),

compiler/rustc_typeck/src/collect/type_of.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,25 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
191191
Res::Def(DefKind::Ctor(..), def_id) => {
192192
tcx.generics_of(tcx.parent(def_id).unwrap())
193193
}
194-
Res::Def(_, def_id) => tcx.generics_of(def_id),
194+
// Other `DefKind`s don't have generics and would ICE when calling
195+
// `generics_of`.
196+
Res::Def(
197+
DefKind::Struct
198+
| DefKind::Union
199+
| DefKind::Enum
200+
| DefKind::Variant
201+
| DefKind::Trait
202+
| DefKind::OpaqueTy
203+
| DefKind::TyAlias
204+
| DefKind::ForeignTy
205+
| DefKind::TraitAlias
206+
| DefKind::AssocTy
207+
| DefKind::Fn
208+
| DefKind::AssocFn
209+
| DefKind::AssocConst
210+
| DefKind::Impl,
211+
def_id,
212+
) => tcx.generics_of(def_id),
195213
Res::Err => {
196214
tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err");
197215
return None;

0 commit comments

Comments
 (0)