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 #74312

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2e21af2
Document the union keyword
poliorcetics Jun 29, 2020
614f773
Clarify some parts by applying the suggestions from review
poliorcetics Jun 30, 2020
310c97b
Fix caching issue when building tools.
ehuss Jul 4, 2020
00980b6
clean up E0718 explanation
GuillaumeGomez Jul 7, 2020
c8b16cd
rustdoc: Allow linking from private items to private types
dennis-hamester Jul 8, 2020
689e360
test: rustdoc-ui: Add issue-74134, replacing test/rustdoc/issue-74134-*
dennis-hamester Jul 11, 2020
9704859
test: rustdoc-ui: Expand issue-74134 to cover types in a private module
dennis-hamester Jul 11, 2020
8789525
test: rustdoc-ui: issue-74134: Shorten a too long line
dennis-hamester Jul 11, 2020
0979545
rustdoc: insert newlines between attributes
euclio Jun 28, 2020
4728438
Improve wording
GuillaumeGomez Jul 11, 2020
5afbc52
typeck: report placeholder type error w/out span
davidtwco Jul 12, 2020
5daedea
Detect tuple struct incorrectly used as struct pat
estebank Jul 9, 2020
ffac887
Update RELEASES.md for 1.45.0
XAMPPRocky Jun 14, 2020
ed587f8
Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit whi…
AdrianCX Jul 11, 2020
9a3a31a
Added tests for volatile and nearbyint intrinsics
theo-lw Jul 13, 2020
5ff7e1a
Added ui tests for volatile and nearby intrinsics
theo-lw Jul 13, 2020
eac8092
Removed trailing whitespace
theo-lw Jul 13, 2020
e3ae4c7
Added proper explanation of ErrorCode-E0688
Polkaverse Jul 13, 2020
bc2b37a
Merge branch 'master' into E0688
Polkaverse Jul 13, 2020
8df79fc
Remove trailing whitespace
theo-lw Jul 13, 2020
2689859
Rollup merge of #73354 - XAMPPRocky:relnotes-1.45.0, r=Mark-Simulacrum
Manishearth Jul 14, 2020
ce24567
Rollup merge of #73852 - euclio:rustdoc-attr-newlines, r=GuillaumeGomez
Manishearth Jul 14, 2020
8f767c9
Rollup merge of #73867 - poliorcetics:union-keyword, r=joshtriplett
Manishearth Jul 14, 2020
c21e6c3
Rollup merge of #74046 - ehuss:deny-warnings-caching, r=Mark-Simulacrum
Manishearth Jul 14, 2020
3742222
Rollup merge of #74123 - GuillaumeGomez:cleanup-e0718, r=pickfire
Manishearth Jul 14, 2020
cb8a764
Rollup merge of #74147 - dennis-hamester:fix/issue-74134, r=jyn514
Manishearth Jul 14, 2020
3eb4256
Rollup merge of #74173 - estebank:struct-pat-as-enum, r=petrochenkov
Manishearth Jul 14, 2020
70fa235
Rollup merge of #74239 - AdrianCX:master, r=cuviper
Manishearth Jul 14, 2020
bed27ce
Rollup merge of #74270 - davidtwco:issue-74086-more-placeholder-type-…
Manishearth Jul 14, 2020
2bb4bbf
Rollup merge of #74285 - wangtheo:issue-71669, r=lcnr
Manishearth Jul 14, 2020
8aabb0d
Rollup merge of #74286 - PankajChaudhary5:E0688, r=GuillaumeGomez
Manishearth Jul 14, 2020
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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3996,6 +3996,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_middle",
Expand Down
163 changes: 163 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,166 @@
Version 1.45.0 (2020-07-16)
==========================

Language
--------
- [Out of range float to int conversions using `as` has been defined as a saturating
conversion.][71269] This was previously undefined behaviour, but you can use the
`{f64, f32}::to_int_unchecked` methods to continue using the current behaviour, which
may be desirable in rare performance sensitive situations.
- [`mem::Discriminant<T>` now uses `T`'s discriminant type instead of always
using `u64`.][70705]
- [Function like procedural macros can now be used in expression, pattern, and statement
positions.][68717] This means you can now use a function-like procedural macro
anywhere you can use a declarative (`macro_rules!`) macro.

Compiler
--------
- [You can now override individual target features through the `target-feature`
flag.][72094] E.g. `-C target-feature=+avx2 -C target-feature=+fma` is now
equivalent to `-C target-feature=+avx2,+fma`.
- [Added the `force-unwind-tables` flag.][69984] This option allows
rustc to always generate unwind tables regardless of panic strategy.
- [Added the `embed-bitcode` flag.][71716] This codegen flag allows rustc
to include LLVM bitcode into generated `rlib`s (this is on by default).
- [Added the `tiny` value to the `code-model` codegen flag.][72397]
- [Added tier 3 support\* for the `mipsel-sony-psp` target.][72062]
- [Added tier 3 support for the `thumbv7a-uwp-windows-msvc` target.][72133]

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


Libraries
---------
- [`net::{SocketAddr, SocketAddrV4, SocketAddrV6}` now implements `PartialOrd`
and `Ord`.][72239]
- [`proc_macro::TokenStream` now implements `Default`.][72234]
- [You can now use `char` with
`ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo}` to iterate over
a range of codepoints.][72413] E.g.
you can now write the following;
```rust
for ch in 'a'..='z' {
print!("{}", ch);
}
println!();
// Prints "abcdefghijklmnopqrstuvwxyz"
```
- [`OsString` now implements `FromStr`.][71662]
- [The `saturating_neg` method as been added to all signed integer primitive
types, and the `saturating_abs` method has been added for all integer
primitive types.][71886]
- [`Arc<T>`, `Rc<T>` now implement `From<Cow<'_, T>>`, and `Box` now
implements `From<Cow>` when `T` is `[T: Copy]`, `str`, `CStr`, `OsStr`,
or `Path`.][71447]
- [`Box<[T]>` now implements `From<[T; N]>`.][71095]
- [`BitOr` and `BitOrAssign` are implemented for all `NonZero`
integer types.][69813]
- [The `fetch_min`, and `fetch_max` methods have been added to all atomic
integer types.][72324]
- [The `fetch_update` method has been added to all atomic integer types.][71843]

Stabilized APIs
---------------
- [`Arc::as_ptr`]
- [`BTreeMap::remove_entry`]
- [`Rc::as_ptr`]
- [`rc::Weak::as_ptr`]
- [`rc::Weak::from_raw`]
- [`rc::Weak::into_raw`]
- [`str::strip_prefix`]
- [`str::strip_suffix`]
- [`sync::Weak::as_ptr`]
- [`sync::Weak::from_raw`]
- [`sync::Weak::into_raw`]
- [`char::UNICODE_VERSION`]
- [`Span::resolved_at`]
- [`Span::located_at`]
- [`Span::mixed_site`]
- [`unix::process::CommandExt::arg0`]

Cargo
-----

Misc
----
- [Rustdoc now supports strikethrough text in Markdown.][71928] E.g.
`~~outdated information~~` becomes "~~outdated information~~".
- [Added an emoji to Rustdoc's deprecated API message.][72014]

Compatibility Notes
-------------------
- [Trying to self initialize a static value (that is creating a value using
itself) is unsound and now causes a compile error.][71140]
- [`{f32, f64}::powi` now returns a slightly different value on Windows.][73420]
This is due to changes in LLVM's intrinsics which `{f32, f64}::powi` uses.
- [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
previously undocumented and not intended for public use. Rustdoc still provides
a non-zero exit code on errors.

Internals Only
--------------
- [Make clippy a git subtree instead of a git submodule][70655]
- [Unify the undo log of all snapshot types][69464]

[73420]: https://github.com/rust-lang/rust/issues/73420/
[72324]: https://github.com/rust-lang/rust/pull/72324/
[71843]: https://github.com/rust-lang/rust/pull/71843/
[71886]: https://github.com/rust-lang/rust/pull/71886/
[72234]: https://github.com/rust-lang/rust/pull/72234/
[72239]: https://github.com/rust-lang/rust/pull/72239/
[72397]: https://github.com/rust-lang/rust/pull/72397/
[72413]: https://github.com/rust-lang/rust/pull/72413/
[72014]: https://github.com/rust-lang/rust/pull/72014/
[72062]: https://github.com/rust-lang/rust/pull/72062/
[72094]: https://github.com/rust-lang/rust/pull/72094/
[72133]: https://github.com/rust-lang/rust/pull/72133/
[71900]: https://github.com/rust-lang/rust/pull/71900/
[71928]: https://github.com/rust-lang/rust/pull/71928/
[71662]: https://github.com/rust-lang/rust/pull/71662/
[71716]: https://github.com/rust-lang/rust/pull/71716/
[71447]: https://github.com/rust-lang/rust/pull/71447/
[71269]: https://github.com/rust-lang/rust/pull/71269/
[71095]: https://github.com/rust-lang/rust/pull/71095/
[71140]: https://github.com/rust-lang/rust/pull/71140/
[70655]: https://github.com/rust-lang/rust/pull/70655/
[70705]: https://github.com/rust-lang/rust/pull/70705/
[69984]: https://github.com/rust-lang/rust/pull/69984/
[69813]: https://github.com/rust-lang/rust/pull/69813/
[69464]: https://github.com/rust-lang/rust/pull/69464/
[68717]: https://github.com/rust-lang/rust/pull/68717/
[`Arc::as_ptr`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.as_ptr
[`BTreeMap::remove_entry`]: https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html#method.remove_entry
[`Rc::as_ptr`]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr
[`rc::Weak::as_ptr`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.as_ptr
[`rc::Weak::from_raw`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.from_raw
[`rc::Weak::into_raw`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.into_raw
[`sync::Weak::as_ptr`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.as_ptr
[`sync::Weak::from_raw`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.from_raw
[`sync::Weak::into_raw`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.into_raw
[`str::strip_prefix`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_prefix
[`str::strip_suffix`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_suffix
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/stable/std/char/constant.UNICODE_VERSION.html
[`Span::resolved_at`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.resolved_at
[`Span::located_at`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.located_at
[`Span::mixed_site`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.mixed_site
[`unix::process::CommandExt::arg0`]: https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.arg0


Version 1.44.1 (2020-06-18)
===========================

* [rustfmt accepts rustfmt_skip in cfg_attr again.][73078]
* [Don't hash executable filenames on apple platforms, fixing backtraces.][cargo/8329]
* [Fix crashes when finding backtrace on macOS.][71397]
* [Clippy applies lint levels into different files.][clippy/5356]

[71397]: https://github.com/rust-lang/rust/issues/71397
[73078]: https://github.com/rust-lang/rust/issues/73078
[cargo/8329]: https://github.com/rust-lang/cargo/pull/8329
[clippy/5356]: https://github.com/rust-lang/rust-clippy/issues/5356


Version 1.44.0 (2020-06-04)
==========================

Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ fn main() {
cmd.env("RUST_BACKTRACE", "1");
}

if let Ok(lint_flags) = env::var("RUSTC_LINT_FLAGS") {
cmd.args(lint_flags.split_whitespace());
}

if target.is_some() {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option,
Expand Down
18 changes: 14 additions & 4 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,22 +1130,32 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_VERBOSE", self.verbosity.to_string());

if source_type == SourceType::InTree {
let mut lint_flags = Vec::new();
// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
rustflags.arg("-Wrust_2018_idioms");
rustflags.arg("-Wunused_lifetimes");
lint_flags.push("-Wrust_2018_idioms");
lint_flags.push("-Wunused_lifetimes");

if self.config.deny_warnings {
rustflags.arg("-Dwarnings");
lint_flags.push("-Dwarnings");
}

// FIXME(#58633) hide "unused attribute" errors in incremental
// builds of the standard library, as the underlying checks are
// not yet properly integrated with incremental recompilation.
if mode == Mode::Std && compiler.stage == 0 && self.config.incremental {
rustflags.arg("-Aunused-attributes");
lint_flags.push("-Aunused-attributes");
}
// This does not use RUSTFLAGS due to caching issues with Cargo.
// Clippy is treated as an "in tree" tool, but shares the same
// cache as other "submodule" tools. With these options set in
// RUSTFLAGS, that causes *every* shared dependency to be rebuilt.
// By injecting this into the rustc wrapper, this circumvents
// Cargo's fingerprint detection. This is fine because lint flags
// are always ignored in dependencies. Eventually this should be
// fixed via better support from Cargo.
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));
}

if let Mode::Rustc | Mode::Codegen = mode {
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ E0669: include_str!("./error_codes/E0669.md"),
E0670: include_str!("./error_codes/E0670.md"),
E0671: include_str!("./error_codes/E0671.md"),
E0687: include_str!("./error_codes/E0687.md"),
E0688: include_str!("./error_codes/E0688.md"),
E0689: include_str!("./error_codes/E0689.md"),
E0690: include_str!("./error_codes/E0690.md"),
E0691: include_str!("./error_codes/E0691.md"),
Expand Down Expand Up @@ -450,6 +451,7 @@ E0765: include_str!("./error_codes/E0765.md"),
E0766: include_str!("./error_codes/E0766.md"),
E0767: include_str!("./error_codes/E0767.md"),
E0768: include_str!("./error_codes/E0768.md"),
E0769: include_str!("./error_codes/E0769.md"),
;
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard
Expand Down Expand Up @@ -616,7 +618,6 @@ E0768: include_str!("./error_codes/E0768.md"),
E0640, // infer outlives requirements
// E0645, // trait aliases not finished
E0667, // `impl Trait` in projections
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
// E0694, // an unknown tool name found in scoped attributes
// E0702, // replaced with a generic attribute input check
// E0707, // multiple elided lifetimes used in arguments of `async fn`
Expand Down
36 changes: 36 additions & 0 deletions src/librustc_error_codes/error_codes/E0688.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
In-band lifetimes were mixed with explicit lifetime binders.

Erroneous code example:

```compile_fail,E0688
#![feature(in_band_lifetimes)]

fn foo<'a>(x: &'a u32, y: &'b u32) {} // error!

struct Foo<'a> { x: &'a u32 }

impl Foo<'a> {
fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} // error!
}

impl<'b> Foo<'a> { // error!
fn baz() {}
}
```

In-band lifetimes cannot be mixed with explicit lifetime binders.
For example:

```
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) {} // ok!

struct Foo<'a> { x: &'a u32 }

impl<'a> Foo<'a> {
fn bar<'b,'c>(x: &'a u32, y: &'b u32, z: &'c u32) {} // ok!
}

impl<'a> Foo<'a> { // ok!
fn baz() {}
}
```
5 changes: 2 additions & 3 deletions src/librustc_error_codes/error_codes/E0718.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
This error indicates that a `#[lang = ".."]` attribute was placed
on the wrong type of item.
A `#[lang = ".."]` attribute was placed on the wrong item type.

Examples of erroneous code:
Erroneous code example:

```compile_fail,E0718
#![feature(lang_items)]
Expand Down
39 changes: 39 additions & 0 deletions src/librustc_error_codes/error_codes/E0769.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
A tuple struct or tuple variant was used in a pattern as if it were a
struct or struct variant.

Erroneous code example:

```compile_fail,E0769
enum E {
A(i32),
}
let e = E::A(42);
match e {
E::A { number } => println!("{}", x),
}
```

To fix this error, you can use the tuple pattern:

```
# enum E {
# A(i32),
# }
# let e = E::A(42);
match e {
E::A(number) => println!("{}", number),
}
```

Alternatively, you can also use the struct pattern by using the correct
field names and binding them to new identifiers:

```
# enum E {
# A(i32),
# }
# let e = E::A(42);
match e {
E::A { 0: number } => println!("{}", number),
}
```
1 change: 1 addition & 0 deletions src/librustc_typeck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rustc_attr = { path = "../librustc_attr" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_hir = { path = "../librustc_hir" }
rustc_hir_pretty = { path = "../librustc_hir_pretty" }
rustc_target = { path = "../librustc_target" }
rustc_session = { path = "../librustc_session" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3049,14 +3049,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let bare_fn_ty =
ty::Binder::bind(tcx.mk_fn_sig(input_tys, output_ty, decl.c_variadic, unsafety, abi));

if let (false, Some(ident_span)) = (self.allow_ty_infer(), ident_span) {
if !self.allow_ty_infer() {
// We always collect the spans for placeholder types when evaluating `fn`s, but we
// only want to emit an error complaining about them if infer types (`_`) are not
// allowed. `allow_ty_infer` gates this behavior. We check for the presence of
// `ident_span` to not emit an error twice when we have `fn foo(_: fn() -> _)`.
crate::collect::placeholder_type_error(
tcx,
ident_span.shrink_to_hi(),
ident_span.map(|sp| sp.shrink_to_hi()),
&generics.params[..],
visitor.0,
true,
Expand Down
Loading