Auto merge of #123440 - jhpratt:rollup-yat6crk, r=jhpratt

Rollup of 4 pull requests

Successful merges:

 - #122356 (std::rand: fix dragonflybsd after #121942.)
 - #123093 (Add a nice header to our README.md)
 - #123307 (Fix f16 and f128 feature gating on different editions)
 - #123401 (Check `x86_64` size assertions on `aarch64`, too)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-04-04 02:11:23 +00:00
commit 0accf4ec4c
44 changed files with 220 additions and 67 deletions

View File

@ -1,27 +1,36 @@
# The Rust Programming Language
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-light.svg">
<img alt="The Rust Programming Language: A language empowering everyone to build reliable and efficient software"
src="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-light.svg"
width="50%">
</picture>
[![Rust Community](https://img.shields.io/badge/Rust_Community%20-Join_us-brightgreen?style=plastic&logo=rust)](https://www.rust-lang.org/community)
[Website][Rust] | [Getting started] | [Learn] | [Documentation] | [Contributing]
</div>
This is the main source code repository for [Rust]. It contains the compiler,
standard library, and documentation.
[Rust]: https://www.rust-lang.org/
[Getting Started]: https://www.rust-lang.org/learn/get-started
[Learn]: https://www.rust-lang.org/learn
[Documentation]: https://www.rust-lang.org/learn#learn-use
[Contributing]: CONTRIBUTING.md
**Note: this README is for _users_ rather than _contributors_.**
If you wish to _contribute_ to the compiler, you should read
[CONTRIBUTING.md](CONTRIBUTING.md) instead.
## Why Rust?
<details>
<summary>Table of Contents</summary>
- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrate with other languages.
- [Quick Start](#quick-start)
- [Installing from Source](#installing-from-source)
- [Getting Help](#getting-help)
- [Contributing](#contributing)
- [License](#license)
- [Trademark](#trademark)
- **Reliability:** Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
</details>
- **Productivity:** Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool ([Cargo]), auto-formatter ([rustfmt]), linter ([Clippy]) and editor support ([rust-analyzer]).
[Cargo]: https://github.com/rust-lang/cargo
[rustfmt]: https://github.com/rust-lang/rustfmt
[Clippy]: https://github.com/rust-lang/rust-clippy
[rust-analyzer]: https://github.com/rust-lang/rust-analyzer
## Quick Start

View File

@ -3342,7 +3342,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
pub type ForeignItem = Item<ForeignItemKind>;
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -1021,7 +1021,7 @@ where
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -768,7 +768,7 @@ impl DelimSpacing {
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -792,7 +792,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -1058,7 +1058,7 @@ where
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -102,9 +102,9 @@ pub type PResult<'a, T> = Result<T, PErr<'a>>;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
// `PResult` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(PResult<'_, ()>, 16);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(PResult<'_, bool>, 16);
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Encodable, Decodable)]

View File

@ -266,7 +266,7 @@ struct MatcherPos {
}
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(MatcherPos, 16);
impl MatcherPos {

View File

@ -3761,7 +3761,7 @@ impl<'hir> Node<'hir> {
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
// tidy-alphabetical-start

View File

@ -400,7 +400,7 @@ enum Chunk {
}
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
crate::static_assert_size!(Chunk, 16);
impl<T> ChunkedBitSet<T> {

View File

@ -483,7 +483,7 @@ pub enum SubregionOrigin<'tcx> {
}
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(SubregionOrigin<'_>, 32);
impl<'tcx> SubregionOrigin<'tcx> {

View File

@ -32,7 +32,7 @@
#[macro_use]
extern crate rustc_macros;
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
#[macro_use]
extern crate rustc_data_structures;
#[macro_use]

View File

@ -112,7 +112,7 @@ impl<'tcx> PolyTraitObligation<'tcx> {
}
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(PredicateObligation<'_>, 48);
pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;

View File

@ -70,7 +70,7 @@ pub enum ConstValue<'tcx> {
},
}
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(ConstValue<'_>, 24);
impl<'tcx> ConstValue<'tcx> {

View File

@ -88,7 +88,7 @@ pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
/// This is needed in `thir::pattern::lower_inline_const`.
pub type EvalToValTreeResult<'tcx> = Result<Option<ValTree<'tcx>>, ErrorHandled>;
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(InterpErrorInfo<'_>, 8);
/// Packages the kind of error we got from the const code interpreter

View File

@ -37,7 +37,7 @@ pub enum Scalar<Prov = CtfeProvenance> {
Ptr(Pointer<Prov>, u8),
}
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(Scalar, 24);
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for

View File

@ -1868,7 +1868,7 @@ impl DefLocation {
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -213,7 +213,7 @@ pub struct ClosureOutlivesRequirement<'tcx> {
}
// Make sure this enum doesn't unintentionally grow
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(ConstraintCategory<'_>, 16);
/// Outlives-constraints can be categorized to determine whether and why they

View File

@ -1453,7 +1453,7 @@ pub enum BinOp {
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
// tidy-alphabetical-start

View File

@ -14,7 +14,7 @@ pub struct PlaceTy<'tcx> {
}
// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(PlaceTy<'_>, 16);
impl<'tcx> PlaceTy<'tcx> {

View File

@ -339,7 +339,7 @@ macro_rules! define_callbacks {
pub type Storage<'tcx> = <$($K)* as keys::Key>::Cache<Erase<$V>>;
// Ensure that keys grow no larger than 64 bytes
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch="aarch64"), target_pointer_width = "64"))]
const _: () = {
if mem::size_of::<Key<'static>>() > 64 {
panic!("{}", concat!(
@ -353,7 +353,7 @@ macro_rules! define_callbacks {
};
// Ensure that values grow no larger than 64 bytes
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch="aarch64"), target_pointer_width = "64"))]
const _: () = {
if mem::size_of::<Value<'static>>() > 64 {
panic!("{}", concat!(

View File

@ -1206,7 +1206,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
// tidy-alphabetical-start

View File

@ -550,7 +550,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
}
// `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(ObligationCauseCode<'_>, 48);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]

View File

@ -59,7 +59,7 @@ pub struct ConstData<'tcx> {
pub kind: ConstKind<'tcx>,
}
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(ConstData<'_>, 40);
impl<'tcx> Const<'tcx> {

View File

@ -71,8 +71,8 @@ pub enum Expr<'tcx> {
Cast(CastKind, Const<'tcx>, Ty<'tcx>),
}
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(Expr<'_>, 24);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(super::ConstKind<'_>, 32);

View File

@ -2168,7 +2168,7 @@ pub struct DestructuredConst<'tcx> {
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -2685,7 +2685,7 @@ impl<'tcx> VarianceDiagInfo<'tcx> {
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -30,7 +30,7 @@ use unescape_error_reporting::{emit_unescape_error, escaped_char};
//
// This assertion is in this crate, rather than in `rustc_lexer`, because that
// crate cannot depend on `rustc_data_structures`.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(rustc_lexer::Token, 12);
#[derive(Clone, Debug)]

View File

@ -454,7 +454,7 @@ fn make_token_stream(
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -179,7 +179,7 @@ pub struct Parser<'a> {
// This type is used a lot, e.g. it's cloned when matching many declarative macro rules with nonterminals. Make sure
// it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(Parser<'_>, 264);
/// Stores span information about a closure.

View File

@ -1087,7 +1087,7 @@ fn unescape_string(string: &str) -> Option<string::String> {
}
// Assert a reasonable size for `Piece`
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
rustc_index::static_assert_size!(Piece<'_>, 16);
#[cfg(test)]

View File

@ -605,6 +605,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
&& !this.tcx.features().f16
&& !ident.span.allows_unstable(sym::f16)
&& finalize.is_some()
&& innermost_result.is_none()
{
feature_err(
this.tcx.sess,
@ -618,6 +619,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
&& !this.tcx.features().f128
&& !ident.span.allows_unstable(sym::f128)
&& finalize.is_some()
&& innermost_result.is_none()
{
feature_err(
this.tcx.sess,

View File

@ -930,7 +930,7 @@ impl FromStr for Conv {
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;

View File

@ -30,7 +30,7 @@
#[macro_use]
extern crate rustc_macros;
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
#[macro_use]
extern crate rustc_data_structures;
#[macro_use]

View File

@ -72,7 +72,7 @@ pub struct PendingPredicateObligation<'tcx> {
}
// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))]
static_assert_size!(PendingPredicateObligation<'_>, 72);
impl<'tcx> FulfillmentContext<'tcx> {

View File

@ -62,17 +62,23 @@ mod imp {
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
}
#[cfg(any(
target_os = "espidf",
target_os = "horizon",
target_os = "freebsd",
target_os = "dragonfly",
netbsd10
))]
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd", netbsd10))]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}
#[cfg(target_os = "dragonfly")]
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
extern "C" {
fn getrandom(
buf: *mut libc::c_void,
buflen: libc::size_t,
flags: libc::c_uint,
) -> libc::ssize_t;
}
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
}
#[cfg(not(any(
target_os = "linux",
target_os = "android",

View File

@ -1,5 +1,5 @@
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:3:10
--> $DIR/feature-gate-f128.rs:7:10
|
LL | const A: f128 = 10.0;
| ^^^^
@ -9,7 +9,7 @@ LL | const A: f128 = 10.0;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:6:12
--> $DIR/feature-gate-f128.rs:10:12
|
LL | let a: f128 = 100.0;
| ^^^^
@ -19,7 +19,7 @@ LL | let a: f128 = 100.0;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:11:11
--> $DIR/feature-gate-f128.rs:15:11
|
LL | fn foo(a: f128) {}
| ^^^^
@ -29,7 +29,7 @@ LL | fn foo(a: f128) {}
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:14:8
--> $DIR/feature-gate-f128.rs:18:8
|
LL | a: f128,
| ^^^^
@ -39,7 +39,7 @@ LL | a: f128,
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:7:13
--> $DIR/feature-gate-f128.rs:11:13
|
LL | let b = 0.0f128;
| ^^^^^^^

View File

@ -0,0 +1,53 @@
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:7:10
|
LL | const A: f128 = 10.0;
| ^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:10:12
|
LL | let a: f128 = 100.0;
| ^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:15:11
|
LL | fn foo(a: f128) {}
| ^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:18:8
|
LL | a: f128,
| ^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f128` is unstable
--> $DIR/feature-gate-f128.rs:11:13
|
LL | let b = 0.0f128;
| ^^^^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,3 +1,7 @@
//@ revisions: e2015 e2018
//
//@[e2018] edition:2018
#![allow(unused)]
const A: f128 = 10.0; //~ ERROR the type `f128` is unstable

View File

@ -1,5 +1,5 @@
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:3:10
--> $DIR/feature-gate-f16.rs:7:10
|
LL | const A: f16 = 10.0;
| ^^^
@ -9,7 +9,7 @@ LL | const A: f16 = 10.0;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:6:12
--> $DIR/feature-gate-f16.rs:10:12
|
LL | let a: f16 = 100.0;
| ^^^
@ -19,7 +19,7 @@ LL | let a: f16 = 100.0;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:11:11
--> $DIR/feature-gate-f16.rs:15:11
|
LL | fn foo(a: f16) {}
| ^^^
@ -29,7 +29,7 @@ LL | fn foo(a: f16) {}
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:14:8
--> $DIR/feature-gate-f16.rs:18:8
|
LL | a: f16,
| ^^^
@ -39,7 +39,7 @@ LL | a: f16,
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:7:13
--> $DIR/feature-gate-f16.rs:11:13
|
LL | let b = 0.0f16;
| ^^^^^^

View File

@ -0,0 +1,53 @@
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:7:10
|
LL | const A: f16 = 10.0;
| ^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f16)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:10:12
|
LL | let a: f16 = 100.0;
| ^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f16)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:15:11
|
LL | fn foo(a: f16) {}
| ^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f16)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:18:8
|
LL | a: f16,
| ^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f16)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the type `f16` is unstable
--> $DIR/feature-gate-f16.rs:11:13
|
LL | let b = 0.0f16;
| ^^^^^^
|
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
= help: add `#![feature(f16)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,3 +1,7 @@
//@ revisions: e2015 e2018
//
//@[e2018] edition:2018
#![allow(unused)]
const A: f16 = 10.0; //~ ERROR the type `f16` is unstable

View File

@ -0,0 +1,19 @@
//@ compile-flags: --crate-type=lib
//@ check-pass
//@ revisions: e2015 e2018
//
//@[e2018] edition:2018
// Verify that gates for the `f16` and `f128` features do not apply to user modules
// See <https://github.com/rust-lang/rust/issues/123282>
mod f16 {
pub fn a16() {}
}
mod f128 {
pub fn a128() {}
}
pub use f128::a128;
pub use f16::a16;

View File

@ -1,5 +1,8 @@
//@ compile-flags: --crate-type=lib
//@ check-pass
//@ revisions: e2015 e2018
//
//@[e2018] edition:2018
// Verify that gates for the `f16` and `f128` features do not apply to user types