Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #84956

Merged
merged 22 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c185f08
Add doc alias for `chdir` to `std::env::set_current_dir`
joshtriplett Apr 29, 2021
dd43d13
Reduce duplication in `impl_dep_tracking_hash` macros
jyn514 Apr 22, 2021
1e89b58
Account for unsatisfied bounds in E0599
estebank May 2, 2021
2e559c8
use `else if` in std library
wcampbell0x2a May 3, 2021
b4bfb0e
Update RELEASES.md for 1.52.0
XAMPPRocky Apr 14, 2021
f9eda61
rustbuild: Pass a `threads` flag that works to windows-gnu lld
petrochenkov May 3, 2021
d53469c
Clarify documentation for `[T]::contains`. Fixes #84877.
jimblandy May 3, 2021
d459b5d
platform-support: Center the contents of the `std` and `host` columns
joshtriplett May 3, 2021
389333a
Update `ptr` docs with regards to `ptr::addr_of!`
jfrimmel Mar 27, 2021
ee7a6c6
Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`
May 4, 2021
11379f0
Do not ICE on invalid const param
estebank May 4, 2021
722bebf
Rollup merge of #83553 - jfrimmel:addr-of, r=m-ou-se
RalfJung May 5, 2021
d84fcc8
Rollup merge of #84183 - rust-lang:relnotes-1.52.0, r=pietroalbini
RalfJung May 5, 2021
4c4b3e8
Rollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnay
RalfJung May 5, 2021
b1e152c
Rollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov
RalfJung May 5, 2021
db77072
Rollup merge of #84808 - estebank:issue-84769, r=petrochenkov
RalfJung May 5, 2021
9ffba09
Rollup merge of #84843 - wcampbell0x2a:use-else-if-let, r=dtolnay
RalfJung May 5, 2021
b2bb687
Rollup merge of #84865 - petrochenkov:llthread, r=Mark-Simulacrum
RalfJung May 5, 2021
92f3f08
Rollup merge of #84878 - jimblandy:contains-doc-fix, r=joshtriplett
RalfJung May 5, 2021
2cb9c6c
Rollup merge of #84882 - joshtriplett:platform-support-formatting, r=…
RalfJung May 5, 2021
2c7bf41
Rollup merge of #84903 - hyd-dev:dead-check-in-alloc-msg, r=RalfJung
RalfJung May 5, 2021
2cbcfae
Rollup merge of #84913 - estebank:issue-84831, r=varkor
RalfJung May 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,151 @@
Version 1.52.0 (2021-05-06)
============================

Language
--------
- [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether the unsafe code
in an `unsafe fn` is wrapped in a `unsafe` block.][79208] This lint
is allowed by default, and may become a warning or hard error in a
future edition.
- [You can now cast mutable references to arrays to a pointer of the same type as
the element.][81479]

Compiler
--------
- [Upgraded the default LLVM to LLVM 12.][81451]

Added tier 3\* support for the following targets.

- [`s390x-unknown-linux-musl`][82166]
- [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202]
- [`powerpc-unknown-openbsd`][82733]

\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.

Libraries
---------
- [`OsString` now implements `Extend` and `FromIterator`.][82121]
- [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879]
- [`Arc<impl Error>` now implements `error::Error`.][80553]
- [All integer division and remainder operations are now `const`.][80962]

Stabilised APIs
-------------
- [`Arguments::as_str`]
- [`char::MAX`]
- [`char::REPLACEMENT_CHARACTER`]
- [`char::UNICODE_VERSION`]
- [`char::decode_utf16`]
- [`char::from_digit`]
- [`char::from_u32_unchecked`]
- [`char::from_u32`]
- [`slice::partition_point`]
- [`str::rsplit_once`]
- [`str::split_once`]

The following previously stable APIs are now `const`.

- [`char::len_utf8`]
- [`char::len_utf16`]
- [`char::to_ascii_uppercase`]
- [`char::to_ascii_lowercase`]
- [`char::eq_ignore_ascii_case`]
- [`u8::to_ascii_uppercase`]
- [`u8::to_ascii_lowercase`]
- [`u8::eq_ignore_ascii_case`]

Rustdoc
-------
- [Rustdoc lints are now treated as a tool lint, meaning that
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527]
Using the old style is still allowed, and will become a warning in
a future release.
- [Rustdoc now supports argument files.][82261]
- [Rustdoc now generates smart punctuation for documentation.][79423]
- [You can now use "task lists" in Rustdoc Markdown.][81766] E.g.
```markdown
- [x] Complete
- [ ] Todo
```

Misc
----
- [You can now pass multiple filters to tests.][81356] E.g.
`cargo test -- foo bar` will run all tests that match `foo` and `bar`.
- [Rustup now distributes PDB symbols for the `std` library on Windows,
allowing you to see `std` symbols when debugging.][82218]

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Check the result cache before the DepGraph when ensuring queries][81855]
- [Try fast_reject::simplify_type in coherence before doing full check][81744]
- [Only store a LocalDefId in some HIR nodes][81611]
- [Store HIR attributes in a side table][79519]

Compatibility Notes
-------------------
- [Cargo build scripts are now forbidden from setting `RUSTC_BOOTSTRAP`.][cargo/9181]
- [Removed support for the `x86_64-rumprun-netbsd` target.][82594]
- [Deprecated the `x86_64-sun-solaris` target in favor of `x86_64-pc-solaris`.][82216]
- [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying
languages in code blocks.][78429]
- [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763]
- [Changes in how proc macros handle whitespace may lead to panics when used
with older `proc-macro-hack` versions. A `cargo update` should be sufficient to fix this in all cases.][84136]

[84136]: https://github.com/rust-lang/rust/issues/84136
[80763]: https://github.com/rust-lang/rust/pull/80763
[82166]: https://github.com/rust-lang/rust/pull/82166
[82121]: https://github.com/rust-lang/rust/pull/82121
[81879]: https://github.com/rust-lang/rust/pull/81879
[82261]: https://github.com/rust-lang/rust/pull/82261
[82218]: https://github.com/rust-lang/rust/pull/82218
[82216]: https://github.com/rust-lang/rust/pull/82216
[82202]: https://github.com/rust-lang/rust/pull/82202
[81855]: https://github.com/rust-lang/rust/pull/81855
[81766]: https://github.com/rust-lang/rust/pull/81766
[81744]: https://github.com/rust-lang/rust/pull/81744
[81611]: https://github.com/rust-lang/rust/pull/81611
[81479]: https://github.com/rust-lang/rust/pull/81479
[81451]: https://github.com/rust-lang/rust/pull/81451
[81356]: https://github.com/rust-lang/rust/pull/81356
[80962]: https://github.com/rust-lang/rust/pull/80962
[80553]: https://github.com/rust-lang/rust/pull/80553
[80527]: https://github.com/rust-lang/rust/pull/80527
[79519]: https://github.com/rust-lang/rust/pull/79519
[79423]: https://github.com/rust-lang/rust/pull/79423
[79208]: https://github.com/rust-lang/rust/pull/79208
[78429]: https://github.com/rust-lang/rust/pull/78429
[82733]: https://github.com/rust-lang/rust/pull/82733
[82594]: https://github.com/rust-lang/rust/pull/82594
[cargo/9181]: https://github.com/rust-lang/cargo/pull/9181
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
[`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq
[`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str
[`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once
[`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once
[`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point
[`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8
[`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16
[`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase
[`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase
[`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case
[`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase
[`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase
[`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case

Version 1.51.0 (2021-03-25)
============================

Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ impl fmt::Display for InvalidProgramInfo<'_> {
#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)]
pub enum CheckInAllocMsg {
MemoryAccessTest,
NullPointerTest,
PointerArithmeticTest,
InboundsTest,
}
Expand All @@ -185,7 +184,6 @@ impl fmt::Display for CheckInAllocMsg {
"{}",
match *self {
CheckInAllocMsg::MemoryAccessTest => "memory access",
CheckInAllocMsg::NullPointerTest => "null pointer test",
CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic",
CheckInAllocMsg::InboundsTest => "inbounds test",
}
Expand Down Expand Up @@ -308,9 +306,6 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
ptr.alloc_id,
allocation_size.bytes()
),
DanglingIntPointer(_, CheckInAllocMsg::NullPointerTest) => {
write!(f, "null pointer is not allowed for this operation")
}
DanglingIntPointer(i, msg) => {
write!(f, "{} failed: 0x{:x} is not a valid pointer", msg, i)
}
Expand Down
118 changes: 61 additions & 57 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,17 +2332,17 @@ crate mod dep_tracking {
}

macro_rules! impl_dep_tracking_hash_via_hash {
($t:ty) => {
($($t:ty),+ $(,)?) => {$(
impl DepTrackingHash for $t {
fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
Hash::hash(self, hasher);
}
}
};
)+};
}

macro_rules! impl_dep_tracking_hash_for_sortable_vec_of {
($t:ty) => {
($($t:ty),+ $(,)?) => {$(
impl DepTrackingHash for Vec<$t> {
fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
let mut elems: Vec<&$t> = self.iter().collect();
Expand All @@ -2354,61 +2354,65 @@ crate mod dep_tracking {
}
}
}
};
}
)+};
}

impl_dep_tracking_hash_via_hash!(
bool,
usize,
u64,
String,
PathBuf,
lint::Level,
Option<bool>,
Option<u32>,
Option<usize>,
Option<NonZeroUsize>,
Option<String>,
Option<(String, u64)>,
Option<Vec<String>>,
Option<MergeFunctions>,
Option<RelocModel>,
Option<CodeModel>,
Option<TlsModel>,
Option<WasiExecModel>,
Option<PanicStrategy>,
Option<RelroLevel>,
Option<InstrumentCoverage>,
Option<lint::Level>,
Option<PathBuf>,
CrateType,
MergeFunctions,
PanicStrategy,
RelroLevel,
Passes,
OptLevel,
LtoCli,
DebugInfo,
UnstableFeatures,
OutputTypes,
NativeLibKind,
SanitizerSet,
CFGuard,
TargetTriple,
Edition,
LinkerPluginLto,
Option<SplitDebuginfo>,
SwitchWithOptPath,
Option<SymbolManglingVersion>,
Option<SourceFileHashAlgorithm>,
TrimmedDefPaths,
);

impl_dep_tracking_hash_via_hash!(bool);
impl_dep_tracking_hash_via_hash!(usize);
impl_dep_tracking_hash_via_hash!(u64);
impl_dep_tracking_hash_via_hash!(String);
impl_dep_tracking_hash_via_hash!(PathBuf);
impl_dep_tracking_hash_via_hash!(lint::Level);
impl_dep_tracking_hash_via_hash!(Option<bool>);
impl_dep_tracking_hash_via_hash!(Option<u32>);
impl_dep_tracking_hash_via_hash!(Option<usize>);
impl_dep_tracking_hash_via_hash!(Option<NonZeroUsize>);
impl_dep_tracking_hash_via_hash!(Option<String>);
impl_dep_tracking_hash_via_hash!(Option<(String, u64)>);
impl_dep_tracking_hash_via_hash!(Option<Vec<String>>);
impl_dep_tracking_hash_via_hash!(Option<MergeFunctions>);
impl_dep_tracking_hash_via_hash!(Option<RelocModel>);
impl_dep_tracking_hash_via_hash!(Option<CodeModel>);
impl_dep_tracking_hash_via_hash!(Option<TlsModel>);
impl_dep_tracking_hash_via_hash!(Option<WasiExecModel>);
impl_dep_tracking_hash_via_hash!(Option<PanicStrategy>);
impl_dep_tracking_hash_via_hash!(Option<RelroLevel>);
impl_dep_tracking_hash_via_hash!(Option<InstrumentCoverage>);
impl_dep_tracking_hash_via_hash!(Option<lint::Level>);
impl_dep_tracking_hash_via_hash!(Option<PathBuf>);
impl_dep_tracking_hash_via_hash!(CrateType);
impl_dep_tracking_hash_via_hash!(MergeFunctions);
impl_dep_tracking_hash_via_hash!(PanicStrategy);
impl_dep_tracking_hash_via_hash!(RelroLevel);
impl_dep_tracking_hash_via_hash!(Passes);
impl_dep_tracking_hash_via_hash!(OptLevel);
impl_dep_tracking_hash_via_hash!(LtoCli);
impl_dep_tracking_hash_via_hash!(DebugInfo);
impl_dep_tracking_hash_via_hash!(UnstableFeatures);
impl_dep_tracking_hash_via_hash!(OutputTypes);
impl_dep_tracking_hash_via_hash!(NativeLibKind);
impl_dep_tracking_hash_via_hash!(SanitizerSet);
impl_dep_tracking_hash_via_hash!(CFGuard);
impl_dep_tracking_hash_via_hash!(TargetTriple);
impl_dep_tracking_hash_via_hash!(Edition);
impl_dep_tracking_hash_via_hash!(LinkerPluginLto);
impl_dep_tracking_hash_via_hash!(Option<SplitDebuginfo>);
impl_dep_tracking_hash_via_hash!(SwitchWithOptPath);
impl_dep_tracking_hash_via_hash!(Option<SymbolManglingVersion>);
impl_dep_tracking_hash_via_hash!(Option<SourceFileHashAlgorithm>);
impl_dep_tracking_hash_via_hash!(TrimmedDefPaths);

impl_dep_tracking_hash_for_sortable_vec_of!(String);
impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);
impl_dep_tracking_hash_for_sortable_vec_of!((PathBuf, PathBuf));
impl_dep_tracking_hash_for_sortable_vec_of!(CrateType);
impl_dep_tracking_hash_for_sortable_vec_of!((String, lint::Level));
impl_dep_tracking_hash_for_sortable_vec_of!((String, Option<String>, NativeLibKind));
impl_dep_tracking_hash_for_sortable_vec_of!((String, u64));
impl_dep_tracking_hash_for_sortable_vec_of!(
String,
PathBuf,
(PathBuf, PathBuf),
CrateType,
(String, lint::Level),
(String, Option<String>, NativeLibKind),
(String, u64)
);

impl<T1, T2> DepTrackingHash for (T1, T2)
where
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_typeck/src/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

let mut restrict_type_params = false;
let mut unsatisfied_bounds = false;
if !unsatisfied_predicates.is_empty() {
let def_span = |def_id| {
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id))
Expand Down Expand Up @@ -739,6 +740,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err.note(&format!(
"the following trait bounds were not satisfied:\n{bound_list}"
));
unsatisfied_bounds = true;
}
}

Expand All @@ -752,6 +754,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
source,
out_of_scope_traits,
&unsatisfied_predicates,
unsatisfied_bounds,
);
}

Expand Down Expand Up @@ -984,9 +987,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
source: SelfSource<'tcx>,
valid_out_of_scope_traits: Vec<DefId>,
unsatisfied_predicates: &[(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)],
unsatisfied_bounds: bool,
) {
let mut alt_rcvr_sugg = false;
if let SelfSource::MethodCall(rcvr) = source {
if let (SelfSource::MethodCall(rcvr), false) = (source, unsatisfied_bounds) {
debug!(?span, ?item_name, ?rcvr_ty, ?rcvr);
let skippable = [
self.tcx.lang_items().clone_trait(),
Expand Down
20 changes: 19 additions & 1 deletion compiler/rustc_typeck/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,25 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
Res::Def(DefKind::Ctor(..), def_id) => {
tcx.generics_of(tcx.parent(def_id).unwrap())
}
Res::Def(_, def_id) => tcx.generics_of(def_id),
// Other `DefKind`s don't have generics and would ICE when calling
// `generics_of`.
Res::Def(
DefKind::Struct
| DefKind::Union
| DefKind::Enum
| DefKind::Variant
| DefKind::Trait
| DefKind::OpaqueTy
| DefKind::TyAlias
| DefKind::ForeignTy
| DefKind::TraitAlias
| DefKind::AssocTy
| DefKind::Fn
| DefKind::AssocFn
| DefKind::AssocConst
| DefKind::Impl,
def_id,
) => tcx.generics_of(def_id),
Res::Err => {
tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err");
return None;
Expand Down
Loading