Skip to content

Commit

Permalink
Auto merge of #71180 - Dylan-DPC:rollup-pscpg6q, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #69903 (Do not ICE in the face of invalid enum discriminant)
 - #70354 (Update RELEASES.md for 1.43.0)
 - #70774 (End cleanup on rustdoc-js tools)
 - #70990 (Improve rustdoc source code a bit)
 - #71145 (Add illumos triple)
 - #71166 (Clean up E0518 explanation)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Apr 15, 2020
2 parents d223029 + 41dc51e commit ce1ab35
Show file tree
Hide file tree
Showing 41 changed files with 1,123 additions and 478 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1808,9 +1808,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"

[[package]]
name = "libc"
version = "0.2.66"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -4683,9 +4683,9 @@ checksum = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86"

[[package]]
name = "socket2"
version = "0.3.11"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
dependencies = [
"cfg-if",
"libc",
Expand Down
149 changes: 149 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,152 @@
Version 1.43.0 (2020-04-23)
==========================

Language
--------
- [Fixed using binary operations with `&{number}` (e.g. `&1.0`) not having
the type inferred correctly.][68129]
- [Attributes such as `#[cfg()]` can now be used on `if` expressions.][69201]

**Syntax only changes**
- [Allow `type Foo: Ord` syntactically.][69361]
- [Fuse associated and extern items up to defaultness.][69194]
- [Syntactically allow `self` in all `fn` contexts.][68764]
- [Merge `fn` syntax + cleanup item parsing.][68728]
- [`item` macro fragments can be interpolated into `trait`s, `impl`s, and `extern` blocks.][69366]
For example, you may now write:
```rust
macro_rules! mac_trait {
($i:item) => {
trait T { $i }
}
}
mac_trait! {
fn foo() {}
}
```

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
--------
- [You can now pass multiple lint flags to rustc to override the previous
flags.][67885] For example; `rustc -D unused -A unused-variables` denies
everything in the `unused` lint group except `unused-variables` which
is explicitly allowed. However, passing `rustc -A unused-variables -D unused` denies
everything in the `unused` lint group **including** `unused-variables` since
the allow flag is specified before the deny flag (and therefore overridden).
- [rustc will now prefer your system MinGW libraries over its bundled libraries
if they are available on `windows-gnu`.][67429]
- [rustc now buffers errors/warnings printed in JSON.][69227]

Libraries
---------
- [`Arc<[T; N]>`, `Box<[T; N]>`, and `Rc<[T; N]>`, now implement
`TryFrom<Arc<[T]>>`,`TryFrom<Box<[T]>>`, and `TryFrom<Rc<[T]>>`
respectively.][69538] **Note** These conversions are only available when `N`
is `0..=32`.
- [You can now use associated constants on floats and integers directly, rather
than having to import the module.][68952] e.g. You can now write `u32::MAX` or
`f32::NAN` with no imports.
- [`u8::is_ascii` is now `const`.][68984]
- [`String` now implements `AsMut<str>`.][68742]
- [Added the `primitive` module to `std` and `core`.][67637] This module
reexports Rust's primitive types. This is mainly useful in macros
where you want avoid these types being shadowed.
- [Relaxed some of the trait bounds on `HashMap` and `HashSet`.][67642]
- [`string::FromUtf8Error` now implements `Clone + Eq`.][68738]

Stabilized APIs
---------------
- [`Once::is_completed`]
- [`f32::LOG10_2`]
- [`f32::LOG2_10`]
- [`f64::LOG10_2`]
- [`f64::LOG2_10`]
- [`iter::once_with`]

Cargo
-----
- [You can now set config `[profile]`s in your `.cargo/config`, or through
your environment.][cargo/7823]
- [Cargo will now set `CARGO_BIN_EXE_<name>` pointing to a binary's
executable path when running integration tests or benchmarks.][cargo/7697]
`<name>` is the name of your binary as-is e.g. If you wanted the executable
path for a binary named `my-program`you would use `env!("CARGO_BIN_EXE_my-program")`.

Misc
----
- [Certain checks in the `const_err` lint were deemed unrelated to const
evaluation][69185], and have been moved to the `unconditional_panic` and
`arithmetic_overflow` lints.

Compatibility Notes
-------------------

- [Having trailing syntax in the `assert!` macro is now a hard error.][69548] This
has been a warning since 1.36.0.
- [Fixed `Self` not having the correctly inferred type.][69340] This incorrectly
led to some instances being accepted, and now correctly emits a hard error.

[69340]: https://github.com/rust-lang/rust/pull/69340

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.

- [All components are now built with `opt-level=3` instead of `2`.][67878]
- [Improved how rustc generates drop code.][67332]
- [Improved performance from `#[inline]`-ing certain hot functions.][69256]
- [traits: preallocate 2 Vecs of known initial size][69022]
- [Avoid exponential behaviour when relating types][68772]
- [Skip `Drop` terminators for enum variants without drop glue][68943]
- [Improve performance of coherence checks][68966]
- [Deduplicate types in the generator witness][68672]
- [Invert control in struct_lint_level.][68725]

[67332]: https://github.com/rust-lang/rust/pull/67332/
[67429]: https://github.com/rust-lang/rust/pull/67429/
[67637]: https://github.com/rust-lang/rust/pull/67637/
[67642]: https://github.com/rust-lang/rust/pull/67642/
[67878]: https://github.com/rust-lang/rust/pull/67878/
[67885]: https://github.com/rust-lang/rust/pull/67885/
[68129]: https://github.com/rust-lang/rust/pull/68129/
[68672]: https://github.com/rust-lang/rust/pull/68672/
[68725]: https://github.com/rust-lang/rust/pull/68725/
[68728]: https://github.com/rust-lang/rust/pull/68728/
[68738]: https://github.com/rust-lang/rust/pull/68738/
[68742]: https://github.com/rust-lang/rust/pull/68742/
[68764]: https://github.com/rust-lang/rust/pull/68764/
[68772]: https://github.com/rust-lang/rust/pull/68772/
[68943]: https://github.com/rust-lang/rust/pull/68943/
[68952]: https://github.com/rust-lang/rust/pull/68952/
[68966]: https://github.com/rust-lang/rust/pull/68966/
[68984]: https://github.com/rust-lang/rust/pull/68984/
[69022]: https://github.com/rust-lang/rust/pull/69022/
[69185]: https://github.com/rust-lang/rust/pull/69185/
[69194]: https://github.com/rust-lang/rust/pull/69194/
[69201]: https://github.com/rust-lang/rust/pull/69201/
[69227]: https://github.com/rust-lang/rust/pull/69227/
[69548]: https://github.com/rust-lang/rust/pull/69548/
[69256]: https://github.com/rust-lang/rust/pull/69256/
[69361]: https://github.com/rust-lang/rust/pull/69361/
[69366]: https://github.com/rust-lang/rust/pull/69366/
[69538]: https://github.com/rust-lang/rust/pull/69538/
[cargo/7823]: https://github.com/rust-lang/cargo/pull/7823
[cargo/7697]: https://github.com/rust-lang/cargo/pull/7697
[`Once::is_completed`]: https://doc.rust-lang.org/std/sync/struct.Once.html#method.is_completed
[`f32::LOG10_2`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG10_2.html
[`f32::LOG2_10`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG2_10.html
[`f64::LOG10_2`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG10_2.html
[`f64::LOG2_10`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG2_10.html
[`iter::once_with`]: https://doc.rust-lang.org/std/iter/fn.once_with.html


Version 1.42.0 (2020-03-12)
==========================

Expand Down
8 changes: 7 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,14 @@ impl Step for RustdocJSStd {
if let Some(ref nodejs) = builder.config.nodejs {
let mut command = Command::new(nodejs);
command
.arg(builder.src.join("src/tools/rustdoc-js-std/tester.js"))
.arg(builder.src.join("src/tools/rustdoc-js/tester.js"))
.arg("--crate-name")
.arg("std")
.arg("--resource-suffix")
.arg(crate::channel::CFG_RELEASE_NUM)
.arg("--doc-folder")
.arg(builder.doc_out(self.target))
.arg("--test-folder")
.arg(builder.src.join("src/test/rustdoc-js-std"));
builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage });
builder.run(&mut command);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cc = "1.0.1"
num_cpus = "1.0"
memmap = "0.7"
log = "0.4.5"
libc = "0.2.44"
libc = "0.2.50"
jobserver = "0.1.11"
tempfile = "3.1"

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
}
}
LinkerFlavor::Gcc => {
if cfg!(target_os = "solaris") {
if cfg!(any(target_os = "solaris", target_os = "illumos")) {
// On historical Solaris systems, "cc" may have
// been Sun Studio, which is not flag-compatible
// with "gcc". This history casts a long shadow,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_error_codes/error_codes/E0518.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This error indicates that an `#[inline(..)]` attribute was incorrectly placed
on something other than a function or method.
An `#[inline(..)]` attribute was incorrectly placed on something other than a
function or method.

Examples of erroneous code:
Example of erroneous code:

```compile_fail,E0518
#[inline(always)]
Expand Down
6 changes: 5 additions & 1 deletion src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2399,7 +2399,11 @@ impl<'tcx> AdtDef {
None
}
Err(ErrorHandled::TooGeneric) => {
span_bug!(tcx.def_span(expr_did), "enum discriminant depends on generic arguments",)
tcx.sess.delay_span_bug(
tcx.def_span(expr_did),
"enum discriminant depends on generic arguments",
);
None
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/librustc_mir_build/hair/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_middle::ty::adjustment::{
Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast,
};
use rustc_middle::ty::subst::{InternalSubsts, SubstsRef};
use rustc_middle::ty::{self, AdtKind, Ty};
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
use rustc_span::Span;

impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr<'tcx> {
Expand Down Expand Up @@ -718,8 +718,7 @@ fn convert_path_expr<'a, 'tcx>(

Res::Def(DefKind::Ctor(_, CtorKind::Const), def_id) => {
let user_provided_types = cx.tables.user_provided_types();
let user_provided_type = user_provided_types.get(expr.hir_id).copied();
debug!("convert_path_expr: user_provided_type={:?}", user_provided_type);
let user_ty = user_provided_types.get(expr.hir_id).copied();
let ty = cx.tables().node_type(expr.hir_id);
match ty.kind {
// A unit struct/variant which is used as a value.
Expand All @@ -728,10 +727,17 @@ fn convert_path_expr<'a, 'tcx>(
adt_def,
variant_index: adt_def.variant_index_with_ctor_id(def_id),
substs,
user_ty: user_provided_type,
user_ty,
fields: vec![],
base: None,
},
_ if ty.references_error() => {
// Handle degenerate input without ICE (#67377).
ExprKind::Literal {
literal: ty::Const::zero_sized(cx.tcx, cx.tcx.types.err),
user_ty: None,
}
}
_ => bug!("unexpected ty: {:?}", ty),
}
}
Expand Down
48 changes: 48 additions & 0 deletions src/librustc_target/spec/illumos_base.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
use std::default::Default;

pub fn opts() -> TargetOptions {
let mut late_link_args = LinkArgs::new();
late_link_args.insert(
LinkerFlavor::Gcc,
vec![
// LLVM will insert calls to the stack protector functions
// "__stack_chk_fail" and "__stack_chk_guard" into code in native
// object files. Some platforms include these symbols directly in
// libc, but at least historically these have been provided in
// libssp.so on illumos and Solaris systems.
"-lssp".to_string(),
],
);

TargetOptions {
dynamic_linking: true,
executables: true,
has_rpath: true,
target_family: Some("unix".to_string()),
is_like_solaris: true,
limit_rdylib_exports: false, // Linker doesn't support this
eliminate_frame_pointer: false,
late_link_args,

// While we support ELF TLS, rust requires a way to register
// cleanup handlers (in C, this would be something along the lines of:
// void register_callback(void (*fn)(void *), void *arg);
// (see src/libstd/sys/unix/fast_thread_local.rs) that is currently
// missing in illumos. For now at least, we must fallback to using
// pthread_{get,set}specific.
//has_elf_tls: true,

// FIXME: Currently, rust is invoking cc to link, which ends up
// causing these to get included twice. We should eventually transition
// to having rustc invoke ld directly, in which case these will need to
// be uncommented.
//
// We want XPG6 behavior from libc and libm. See standards(5)
//pre_link_objects_exe: vec![
// "/usr/lib/amd64/values-Xc.o".to_string(),
// "/usr/lib/amd64/values-xpg6.o".to_string(),
//],
..Default::default()
}
}
3 changes: 3 additions & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ mod fuchsia_base;
mod haiku_base;
mod hermit_base;
mod hermit_kernel_base;
mod illumos_base;
mod l4re_base;
mod linux_base;
mod linux_kernel_base;
Expand Down Expand Up @@ -438,6 +439,8 @@ supported_targets! {
("x86_64-sun-solaris", "x86_64-pc-solaris", x86_64_sun_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),

("x86_64-unknown-illumos", x86_64_unknown_illumos),

("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
("i686-pc-windows-gnu", i686_pc_windows_gnu),
("i686-uwp-windows-gnu", i686_uwp_windows_gnu),
Expand Down
24 changes: 24 additions & 0 deletions src/librustc_target/spec/x86_64_unknown_illumos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::spec::{LinkerFlavor, Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::illumos_base::opts();
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string(), "-std=c99".to_string()]);
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);

Ok(Target {
// LLVM does not currently have a separate illumos target,
// so we still pass Solaris to it
llvm_target: "x86_64-pc-solaris".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(),
target_os: "illumos".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
})
}
1 change: 1 addition & 0 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ impl<'a> fmt::Display for Html<'a> {
"fuchsia" => "Fuchsia",
"haiku" => "Haiku",
"hermit" => "HermitCore",
"illumos" => "illumos",
"ios" => "iOS",
"l4re" => "L4Re",
"linux" => "Linux",
Expand Down
Loading

0 comments on commit ce1ab35

Please sign in to comment.