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

[stable] 1.44 release #72883

Merged
merged 5 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
162 changes: 162 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,165 @@
Version 1.44.0 (2020-06-04)
==========================

Language
--------
- [You can now use `async/.await` with `#[no_std]` enabled.][69033]
- [Added the `unused_braces` lint.][70081]

**Syntax-only changes**

- [Expansion-driven outline module parsing][69838]
```rust
#[cfg(FALSE)]
mod foo {
mod bar {
mod baz; // `foo/bar/baz.rs` doesn't exist, but no error!
}
}
```

These are still rejected semantically, so you will likely receive an error but
these changes can be seen and parsed by macros and conditional compilation.

Compiler
--------
- [Rustc now respects the `-C codegen-units` flag in incremental mode.][70156]
Additionally when in incremental mode rustc defaults to 256 codegen units.
- [Refactored `catch_unwind`, to have zero-cost unless unwinding is enabled and
a panic is thrown.][67502]
- [Added tier 3\* support for the `aarch64-unknown-none` and
`aarch64-unknown-none-softfloat` targets.][68334]
- [Added tier 3 support for `arm64-apple-tvos` and
`x86_64-apple-tvos` targets.][68191]


Libraries
---------
- [Special cased `vec![]` to map directly to `Vec::new()`.][70632] This allows
`vec![]` to be able to be used in `const` contexts.
- [`convert::Infallible` now implements `Hash`.][70281]
- [`OsString` now implements `DerefMut` and `IndexMut` returning
a `&mut OsStr`.][70048]
- [Unicode 13 is now supported.][69929]
- [`String` now implements `From<&mut str>`.][69661]
- [`IoSlice` now implements `Copy`.][69403]
- [`Vec<T>` now implements `From<[T; N]>`.][68692] Where `N` is less than 32.
- [`proc_macro::LexError` now implements `fmt::Display` and `Error`.][68899]
- [`from_le_bytes`, `to_le_bytes`, `from_be_bytes`, `to_be_bytes`,
`from_ne_bytes`, and `to_ne_bytes` methods are now `const` for all
integer types.][69373]

Stabilized APIs
---------------
- [`PathBuf::with_capacity`]
- [`PathBuf::capacity`]
- [`PathBuf::clear`]
- [`PathBuf::reserve`]
- [`PathBuf::reserve_exact`]
- [`PathBuf::shrink_to_fit`]
- [`f32::to_int_unchecked`]
- [`f64::to_int_unchecked`]
- [`Layout::align_to`]
- [`Layout::pad_to_align`]
- [`Layout::array`]
- [`Layout::extend`]

Cargo
-----
- [Added the `cargo tree` command which will print a tree graph of
your dependencies.][cargo/8062] E.g.
```
mdbook v0.3.2 (/Users/src/rust/mdbook)
├── ammonia v3.0.0
│ ├── html5ever v0.24.0
│ │ ├── log v0.4.8
│ │ │ └── cfg-if v0.1.9
│ │ ├── mac v0.1.1
│ │ └── markup5ever v0.9.0
│ │ ├── log v0.4.8 (*)
│ │ ├── phf v0.7.24
│ │ │ └── phf_shared v0.7.24
│ │ │ ├── siphasher v0.2.3
│ │ │ └── unicase v1.4.2
│ │ │ [build-dependencies]
│ │ │ └── version_check v0.1.5
...
```
You can also display dependencies on multiple versions of the same crate with
`cargo tree -d` (short for `cargo tree --duplicates`).

Misc
----
- [Rustdoc now allows you to specify `--crate-version` to have rustdoc include
the version in the sidebar.][69494]

Compatibility Notes
-------------------
- [Rustc now correctly generates static libraries on Windows GNU targets with
the `.a` extension, rather than the previous `.lib`.][70937]
- [Removed the `-C no_integrated_as` flag from rustc.][70345]
- [The `file_name` property in JSON output of macro errors now points the actual
source file rather than the previous format of `<NAME macros>`.][70969]
**Note:** this may not point a file that actually exists on the user's system.
- [The minimum required external LLVM version has been bumped to LLVM 8.][71147]
- [`mem::{zeroed, uninitialised}` will now panic when used with types that do
not allow zero initialization such as `NonZeroU8`.][66059] This was
previously a warning.
- [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as`
operator has been defined as a saturating operation.][71269] This was previously
undefined behaviour, you can use the `{f64, f32}::to_int_unchecked` methods to
continue using the current behaviour which may desirable in rare performance
sensitive situations.

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.

- [dep_graph Avoid allocating a set on when the number reads are small.][69778]
- [Replace big JS dict with JSON parsing.][71250]

[69373]: https://github.com/rust-lang/rust/pull/69373/
[66059]: https://github.com/rust-lang/rust/pull/66059/
[68191]: https://github.com/rust-lang/rust/pull/68191/
[68899]: https://github.com/rust-lang/rust/pull/68899/
[71147]: https://github.com/rust-lang/rust/pull/71147/
[71250]: https://github.com/rust-lang/rust/pull/71250/
[70937]: https://github.com/rust-lang/rust/pull/70937/
[70969]: https://github.com/rust-lang/rust/pull/70969/
[70632]: https://github.com/rust-lang/rust/pull/70632/
[70281]: https://github.com/rust-lang/rust/pull/70281/
[70345]: https://github.com/rust-lang/rust/pull/70345/
[70048]: https://github.com/rust-lang/rust/pull/70048/
[70081]: https://github.com/rust-lang/rust/pull/70081/
[70156]: https://github.com/rust-lang/rust/pull/70156/
[71269]: https://github.com/rust-lang/rust/pull/71269/
[69838]: https://github.com/rust-lang/rust/pull/69838/
[69929]: https://github.com/rust-lang/rust/pull/69929/
[69661]: https://github.com/rust-lang/rust/pull/69661/
[69778]: https://github.com/rust-lang/rust/pull/69778/
[69494]: https://github.com/rust-lang/rust/pull/69494/
[69403]: https://github.com/rust-lang/rust/pull/69403/
[69033]: https://github.com/rust-lang/rust/pull/69033/
[68692]: https://github.com/rust-lang/rust/pull/68692/
[68334]: https://github.com/rust-lang/rust/pull/68334/
[67502]: https://github.com/rust-lang/rust/pull/67502/
[cargo/8062]: https://github.com/rust-lang/cargo/pull/8062/
[`PathBuf::with_capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.with_capacity
[`PathBuf::capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.capacity
[`PathBuf::clear`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.clear
[`PathBuf::reserve`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve
[`PathBuf::reserve_exact`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve_exact
[`PathBuf::shrink_to_fit`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.shrink_to_fit
[`f32::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f32.html#method.to_int_unchecked
[`f64::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f64.html#method.to_int_unchecked
[`Layout::align_to`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.align_to
[`Layout::pad_to_align`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.pad_to_align
[`Layout::array`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.array
[`Layout::extend`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.extend


Version 1.43.1 (2020-05-07)
===========================

Expand Down
2 changes: 1 addition & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
#
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
# either automatically or manually.
export RUST_RELEASE_CHANNEL=beta
export RUST_RELEASE_CHANNEL=stable

# Always set the release channel for bootstrap; this is normally not important (i.e., only dist
# builds would seem to matter) but in practice bootstrap wants to know whether we're targeting
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_expand/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ impl<'a> ExtCtxt<'a> {
if !path.is_absolute() {
let callsite = span.source_callsite();
let mut result = match self.source_map().span_to_unmapped_path(callsite) {
FileName::Real(path) => path,
FileName::Real(name) => name.into_local_path(),
FileName::DocTest(path, _) => path,
other => {
return Err(self.struct_span_err(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_expand/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
let mut module = ModuleData {
mod_path: vec![Ident::from_str(&self.cx.ecfg.crate_name)],
directory: match self.cx.source_map().span_to_unmapped_path(krate.span) {
FileName::Real(path) => path,
FileName::Real(name) => name.into_local_path(),
other => PathBuf::from(other.to_string()),
},
};
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_expand/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ crate fn parse_external_mod(
// Extract the directory path for submodules of `module`.
let path = sess.source_map().span_to_unmapped_path(module.inner);
let mut path = match path {
FileName::Real(path) => path,
FileName::Real(name) => name.into_local_path(),
other => PathBuf::from(other.to_string()),
};
path.pop();
Expand Down Expand Up @@ -189,7 +189,8 @@ fn error_cannot_declare_mod_here<'a, T>(
let mut err =
sess.span_diagnostic.struct_span_err(span, "cannot declare a new module at this location");
if !span.is_dummy() {
if let FileName::Real(src_path) = sess.source_map().span_to_filename(span) {
if let FileName::Real(src_name) = sess.source_map().span_to_filename(span) {
let src_path = src_name.into_local_path();
if let Some(stem) = src_path.file_stem() {
let mut dest_path = src_path.clone();
dest_path.set_file_name(stem);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_expand/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ impl server::SourceFile for Rustc<'_> {
}
fn path(&mut self, file: &Self::SourceFile) -> String {
match file.name {
FileName::Real(ref path) => path
FileName::Real(ref name) => name
.local_path()
.to_str()
.expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
.to_string(),
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use rustc_session::output::{filename_for_input, filename_for_metadata};
use rustc_session::search_paths::PathKind;
use rustc_session::Session;
use rustc_span::symbol::Symbol;
use rustc_span::FileName;
use rustc_span::{FileName, RealFileName};
use rustc_trait_selection::traits;
use rustc_typeck as typeck;

Expand Down Expand Up @@ -570,13 +570,16 @@ fn write_out_deps(
for cnum in resolver.cstore().crates_untracked() {
let source = resolver.cstore().crate_source_untracked(cnum);
if let Some((path, _)) = source.dylib {
files.push(escape_dep_filename(&FileName::Real(path)));
let file_name = FileName::Real(RealFileName::Named(path));
files.push(escape_dep_filename(&file_name));
}
if let Some((path, _)) = source.rlib {
files.push(escape_dep_filename(&FileName::Real(path)));
let file_name = FileName::Real(RealFileName::Named(path));
files.push(escape_dep_filename(&file_name));
}
if let Some((path, _)) = source.rmeta {
files.push(escape_dep_filename(&FileName::Real(path)));
let file_name = FileName::Real(RealFileName::Named(path));
files.push(escape_dep_filename(&file_name));
}
}
});
Expand Down
25 changes: 16 additions & 9 deletions src/librustc_metadata/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,15 +1485,22 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {

if let Some(virtual_dir) = virtual_rust_source_base_dir {
if let Some(real_dir) = &sess.real_rust_source_base_dir {
if let rustc_span::FileName::Real(path) = name {
if let Ok(rest) = path.strip_prefix(virtual_dir) {
let new_path = real_dir.join(rest);
debug!(
"try_to_translate_virtual_to_real: `{}` -> `{}`",
path.display(),
new_path.display(),
);
*path = new_path;
if let rustc_span::FileName::Real(old_name) = name {
if let rustc_span::RealFileName::Named(one_path) = old_name {
if let Ok(rest) = one_path.strip_prefix(virtual_dir) {
let virtual_name = one_path.clone();
let new_path = real_dir.join(rest);
debug!(
"try_to_translate_virtual_to_real: `{}` -> `{}`",
virtual_name.display(),
new_path.display(),
);
let new_name = rustc_span::RealFileName::Devirtualized {
local_path: new_path,
virtual_name,
};
*old_name = new_name;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_metadata/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ impl<'tcx> EncodeContext<'tcx> {
// any relative paths are potentially relative to a
// wrong directory.
FileName::Real(ref name) => {
let name = name.stable_name();
let mut adapted = (**source_file).clone();
adapted.name = Path::new(&working_dir).join(name).into();
adapted.name_hash = {
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_save_analysis/span_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ impl<'a> SpanUtils<'a> {

pub fn make_filename_string(&self, file: &SourceFile) -> String {
match &file.name {
FileName::Real(path) if !file.name_was_remapped => {
FileName::Real(name) if !file.name_was_remapped => {
let path = name.local_path();
if path.is_absolute() {
self.sess
.source_map()
.path_mapping()
.map_prefix(path.clone())
.map_prefix(path.into())
.0
.display()
.to_string()
Expand Down
Loading