Auto merge of #134687 - matthiaskrgr:rollup-m32tkax, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #134363 (Use `#[derive(Default)]` instead of manual `impl` when possible) - #134517 (Add tests for coverage attribute on trait functions) - #134528 (opt-dist: propagate channel info to bootstrap) - #134669 (Document the `--dev` flag for `src/ci/docker/run.sh`) - #134680 (Clean up a few rmake tests ) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
addbd001ec
31 changed files with 152 additions and 116 deletions
|
@ -31,7 +31,7 @@ use rustc_data_structures::sync::Lrc;
|
|||
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
||||
pub use rustc_span::AttrId;
|
||||
use rustc_span::source_map::{Spanned, respan};
|
||||
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
|
||||
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
pub use crate::format::*;
|
||||
|
@ -387,22 +387,15 @@ impl GenericParam {
|
|||
|
||||
/// Represents lifetime, type and const parameters attached to a declaration of
|
||||
/// a function, enum, trait, etc.
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
#[derive(Clone, Encodable, Decodable, Debug, Default)]
|
||||
pub struct Generics {
|
||||
pub params: ThinVec<GenericParam>,
|
||||
pub where_clause: WhereClause,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Default for Generics {
|
||||
/// Creates an instance of `Generics`.
|
||||
fn default() -> Generics {
|
||||
Generics { params: ThinVec::new(), where_clause: Default::default(), span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
/// A where-clause in a definition.
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
#[derive(Clone, Encodable, Decodable, Debug, Default)]
|
||||
pub struct WhereClause {
|
||||
/// `true` if we ate a `where` token.
|
||||
///
|
||||
|
@ -419,12 +412,6 @@ impl WhereClause {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for WhereClause {
|
||||
fn default() -> WhereClause {
|
||||
WhereClause { has_where_token: false, predicates: ThinVec::new(), span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
/// A single predicate in a where-clause.
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub struct WherePredicate {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use rustc_ast::Expr;
|
||||
use rustc_ast::util::{classify, parser};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
// The default amount of fixing is minimal fixing, so all fixups are set to `false` by `Default`.
|
||||
// Fixups should be turned on in a targeted fashion where needed.
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
pub(crate) struct FixupContext {
|
||||
/// Print expression such that it can be parsed back as a statement
|
||||
/// consisting of the original expression.
|
||||
|
@ -93,20 +95,6 @@ pub(crate) struct FixupContext {
|
|||
parenthesize_exterior_struct_lit: bool,
|
||||
}
|
||||
|
||||
/// The default amount of fixing is minimal fixing. Fixups should be turned on
|
||||
/// in a targeted fashion where needed.
|
||||
impl Default for FixupContext {
|
||||
fn default() -> Self {
|
||||
FixupContext {
|
||||
stmt: false,
|
||||
leftmost_subexpression_in_stmt: false,
|
||||
match_arm: false,
|
||||
leftmost_subexpression_in_match_arm: false,
|
||||
parenthesize_exterior_struct_lit: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FixupContext {
|
||||
/// Create the initial fixup for printing an expression in statement
|
||||
/// position.
|
||||
|
|
|
@ -1023,6 +1023,7 @@ declare_lint! {
|
|||
"`if`, `match`, `while` and `return` do not need parentheses"
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct UnusedParens {
|
||||
with_self_ty_parens: bool,
|
||||
/// `1 as (i32) < 2` parses to ExprKind::Lt
|
||||
|
@ -1030,12 +1031,6 @@ pub(crate) struct UnusedParens {
|
|||
parens_in_cast_in_lt: Vec<ast::NodeId>,
|
||||
}
|
||||
|
||||
impl Default for UnusedParens {
|
||||
fn default() -> Self {
|
||||
Self { with_self_ty_parens: false, parens_in_cast_in_lt: Vec::new() }
|
||||
}
|
||||
}
|
||||
|
||||
impl_lint_pass!(UnusedParens => [UNUSED_PARENS]);
|
||||
|
||||
impl UnusedDelimLint for UnusedParens {
|
||||
|
|
|
@ -168,9 +168,10 @@ pub struct CoverageOptions {
|
|||
}
|
||||
|
||||
/// Controls whether branch coverage or MC/DC coverage is enabled.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)]
|
||||
pub enum CoverageLevel {
|
||||
/// Instrument for coverage at the MIR block level.
|
||||
#[default]
|
||||
Block,
|
||||
/// Also instrument branch points (includes block coverage).
|
||||
Branch,
|
||||
|
@ -195,12 +196,6 @@ pub enum CoverageLevel {
|
|||
Mcdc,
|
||||
}
|
||||
|
||||
impl Default for CoverageLevel {
|
||||
fn default() -> Self {
|
||||
Self::Block
|
||||
}
|
||||
}
|
||||
|
||||
/// Settings for `-Z instrument-xray` flag.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct InstrumentXRay {
|
||||
|
|
|
@ -4,16 +4,11 @@ use std::hash::{BuildHasher, Hash, Hasher};
|
|||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Default)]
|
||||
struct MyHasher {
|
||||
hash: u64,
|
||||
}
|
||||
|
||||
impl Default for MyHasher {
|
||||
fn default() -> MyHasher {
|
||||
MyHasher { hash: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl Hasher for MyHasher {
|
||||
fn write(&mut self, buf: &[u8]) {
|
||||
for byte in buf {
|
||||
|
@ -107,6 +102,8 @@ fn test_writer_hasher() {
|
|||
struct Custom {
|
||||
hash: u64,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct CustomHasher {
|
||||
output: u64,
|
||||
}
|
||||
|
@ -123,12 +120,6 @@ impl Hasher for CustomHasher {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for CustomHasher {
|
||||
fn default() -> CustomHasher {
|
||||
CustomHasher { output: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Custom {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
state.write_u64(self.hash);
|
||||
|
|
|
@ -22,6 +22,7 @@ pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
|
|||
/// out-performs an FNV-based hash within rustc itself -- the collision rate is
|
||||
/// similar or slightly worse than FNV, but the speed of the hash function
|
||||
/// itself is much higher because it works on up to 8 bytes at a time.
|
||||
#[derive(Default)]
|
||||
pub struct FxHasher {
|
||||
hash: usize,
|
||||
}
|
||||
|
@ -31,13 +32,6 @@ const K: usize = 0x9e3779b9;
|
|||
#[cfg(target_pointer_width = "64")]
|
||||
const K: usize = 0x517cc1b727220a95;
|
||||
|
||||
impl Default for FxHasher {
|
||||
#[inline]
|
||||
fn default() -> FxHasher {
|
||||
FxHasher { hash: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl FxHasher {
|
||||
#[inline]
|
||||
fn add_to_hash(&mut self, i: usize) {
|
||||
|
|
|
@ -81,7 +81,9 @@ extern "C" fn __rust_foreign_exception() -> ! {
|
|||
rtabort!("Rust cannot catch foreign exceptions");
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
enum Hook {
|
||||
#[default]
|
||||
Default,
|
||||
Custom(Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send>),
|
||||
}
|
||||
|
@ -96,13 +98,6 @@ impl Hook {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Hook {
|
||||
#[inline]
|
||||
fn default() -> Hook {
|
||||
Hook::Default
|
||||
}
|
||||
}
|
||||
|
||||
static HOOK: RwLock<Hook> = RwLock::new(Hook::Default);
|
||||
|
||||
/// Registers a custom panic hook, replacing the previously registered hook.
|
||||
|
|
|
@ -8,19 +8,13 @@ use crate::sys::process::{EnvKey, ExitStatus, Process, StdioPipes};
|
|||
use crate::{env, fmt, io};
|
||||
|
||||
// Stores a set of changes to an environment
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct CommandEnv {
|
||||
clear: bool,
|
||||
saw_path: bool,
|
||||
vars: BTreeMap<EnvKey, Option<OsString>>,
|
||||
}
|
||||
|
||||
impl Default for CommandEnv {
|
||||
fn default() -> Self {
|
||||
CommandEnv { clear: false, saw_path: false, vars: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for CommandEnv {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut debug_command_env = f.debug_struct("CommandEnv");
|
||||
|
|
|
@ -26,6 +26,10 @@ DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu
|
|||
while locally, to the `obj/$image_name` directory. This is primarily to prevent
|
||||
strange linker errors when using multiple Docker images.
|
||||
|
||||
## Local Development
|
||||
|
||||
Refer to the [dev guide](https://rustc-dev-guide.rust-lang.org/tests/docker.html) for more information on testing locally.
|
||||
|
||||
## Filesystem layout
|
||||
|
||||
- Each host architecture has its own `host-{arch}` directory, and those
|
||||
|
|
|
@ -25,6 +25,8 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
|
|||
let host_triple = env.host_tuple();
|
||||
let version = find_dist_version(&dist_dir)?;
|
||||
|
||||
let channel = version_to_channel(&version);
|
||||
|
||||
// Extract rustc, libstd, cargo and src archives to create the optimized sysroot
|
||||
let rustc_dir = extract_dist_dir(&format!("rustc-{version}-{host_triple}"))?.join("rustc");
|
||||
let libstd_dir = extract_dist_dir(&format!("rust-std-{version}-{host_triple}"))?
|
||||
|
@ -61,9 +63,13 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
|
|||
assert!(llvm_config.is_file());
|
||||
|
||||
let config_content = format!(
|
||||
r#"profile = "user"
|
||||
r#"
|
||||
profile = "user"
|
||||
change-id = 115898
|
||||
|
||||
[rust]
|
||||
channel = "{channel}"
|
||||
|
||||
[build]
|
||||
rustc = "{rustc}"
|
||||
cargo = "{cargo}"
|
||||
|
@ -116,3 +122,13 @@ fn find_dist_version(directory: &Utf8Path) -> anyhow::Result<String> {
|
|||
archive.strip_prefix("reproducible-artifacts-").unwrap().split_once('-').unwrap();
|
||||
Ok(version.to_string())
|
||||
}
|
||||
|
||||
/// Roughly convert a version string (`nightly`, `beta`, or `1.XY.Z`) to channel string (`nightly`,
|
||||
/// `beta` or `stable`).
|
||||
fn version_to_channel(version_str: &str) -> &'static str {
|
||||
match version_str {
|
||||
"nightly" => "nightly",
|
||||
"beta" => "beta",
|
||||
_ => "stable",
|
||||
}
|
||||
}
|
||||
|
|
9
tests/coverage/attr/trait-impl-inherit.cov-map
Normal file
9
tests/coverage/attr/trait-impl-inherit.cov-map
Normal file
|
@ -0,0 +1,9 @@
|
|||
Function name: <trait_impl_inherit::S as trait_impl_inherit::T>::f
|
||||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 05, 02, 06]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 1
|
||||
- Code(Counter(0)) at (prev + 17, 5) to (start + 2, 6)
|
||||
Highest counter ID seen: c0
|
||||
|
26
tests/coverage/attr/trait-impl-inherit.coverage
Normal file
26
tests/coverage/attr/trait-impl-inherit.coverage
Normal file
|
@ -0,0 +1,26 @@
|
|||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |// Checks that `#[coverage(..)]` in a trait method is not inherited in an
|
||||
LL| |// implementation.
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ reference: attributes.coverage.trait-impl-inherit
|
||||
LL| |
|
||||
LL| |trait T {
|
||||
LL| | #[coverage(off)]
|
||||
LL| | fn f(&self) {
|
||||
LL| | println!("default");
|
||||
LL| | }
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |struct S;
|
||||
LL| |
|
||||
LL| |impl T for S {
|
||||
LL| 1| fn f(&self) {
|
||||
LL| 1| println!("impl S");
|
||||
LL| 1| }
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |#[coverage(off)]
|
||||
LL| |fn main() {
|
||||
LL| | S.f();
|
||||
LL| |}
|
||||
|
25
tests/coverage/attr/trait-impl-inherit.rs
Normal file
25
tests/coverage/attr/trait-impl-inherit.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
#![feature(coverage_attribute)]
|
||||
// Checks that `#[coverage(..)]` in a trait method is not inherited in an
|
||||
// implementation.
|
||||
//@ edition: 2021
|
||||
//@ reference: attributes.coverage.trait-impl-inherit
|
||||
|
||||
trait T {
|
||||
#[coverage(off)]
|
||||
fn f(&self) {
|
||||
println!("default");
|
||||
}
|
||||
}
|
||||
|
||||
struct S;
|
||||
|
||||
impl T for S {
|
||||
fn f(&self) {
|
||||
println!("impl S");
|
||||
}
|
||||
}
|
||||
|
||||
#[coverage(off)]
|
||||
fn main() {
|
||||
S.f();
|
||||
}
|
|
@ -83,7 +83,7 @@ fn extract_exactly_one_ice_file<P: AsRef<Path>>(name: &'static str, dir: P) -> I
|
|||
|
||||
fn main() {
|
||||
// Establish baseline ICE message.
|
||||
let mut default_ice_dump = OnceCell::new();
|
||||
let default_ice_dump = OnceCell::new();
|
||||
run_in_tmpdir(|| {
|
||||
rustc().env("RUSTC_ICE", cwd()).input("lib.rs").arg("-Ztreat-err-as-bug=1").run_fail();
|
||||
let dump = extract_exactly_one_ice_file("baseline", cwd());
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::collections::HashMap;
|
|||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian};
|
||||
use gimli::{EndianRcSlice, Reader, RunTimeEndian};
|
||||
use object::{Object, ObjectSection};
|
||||
use run_make_support::{gimli, object, rfs, rustc};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Include a file by concating the verbatim path using `/` instead of `\`
|
||||
//! Include a file by concatenating the verbatim path using `/` instead of `\`
|
||||
|
||||
include!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
|
||||
fn main() {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use run_make_support::object::Endianness;
|
||||
use run_make_support::object::read::archive::ArchiveFile;
|
||||
use run_make_support::object::read::elf::{FileHeader as _, SectionHeader as _};
|
||||
use run_make_support::rfs::{read, read_dir};
|
||||
use run_make_support::rfs::read;
|
||||
use run_make_support::{has_prefix, has_suffix, object, path, rustc, shallow_find_files, target};
|
||||
|
||||
type FileHeader = run_make_support::object::elf::FileHeader64<Endianness>;
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
// Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere
|
||||
// else that uses panic=abort.
|
||||
|
||||
use std::ffi::{self, CStr, CString};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use run_make_support::{libc, run, rustc};
|
||||
use run_make_support::{libc, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().input("test.rs").arg("--test").run();
|
||||
|
|
|
@ -9,8 +9,8 @@ fn main() {
|
|||
let mut path_ir = PathBuf::new();
|
||||
run_in_tmpdir(|| {
|
||||
let p = cwd();
|
||||
path_bc = p.join("nonexistant_dir_bc");
|
||||
path_ir = p.join("nonexistant_dir_ir");
|
||||
path_bc = p.join("nonexistent_dir_bc");
|
||||
path_ir = p.join("nonexistent_dir_ir");
|
||||
rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_bc).emit("llvm-bc").run();
|
||||
rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_ir).emit("llvm-ir").run();
|
||||
assert!(path_bc.exists());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue
|
||||
// mentioning the rest of the obligation chain.
|
||||
|
||||
use run_make_support::{diff, rust_lib_name, rustc};
|
||||
use run_make_support::{diff, rustc};
|
||||
|
||||
fn main() {
|
||||
let out = rustc()
|
||||
|
|
|
@ -48,7 +48,7 @@ fn main() {
|
|||
let default = &target_spec["crt-static-default"];
|
||||
|
||||
// If the value is `null`, then the default to dynamically link from
|
||||
// musl_base was not overriden.
|
||||
// musl_base was not overridden.
|
||||
if default.is_null() {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// Tracking issue: https://github.com/rust-lang/rust/issues/128602
|
||||
// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172
|
||||
|
||||
use run_make_support::{cc, cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
|
||||
use run_make_support::{cc, has_extension, has_prefix, run, rustc, shallow_find_files};
|
||||
|
||||
fn main() {
|
||||
rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// The rlib produced by a no_builtins crate should be explicitely linked
|
||||
// The rlib produced by a no_builtins crate should be explicitly linked
|
||||
// during compilation, and as a result be present in the linker arguments.
|
||||
// See the comments inside this file for more details.
|
||||
// See https://github.com/rust-lang/rust/pull/35637
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//@ ignore-windows
|
||||
|
||||
// This test attempts to make sure that running `remove_dir_all`
|
||||
// doesn't result in a NotFound error one of the files it
|
||||
// doesn't result in a NotFound error if one of the files it
|
||||
// is deleting is deleted concurrently.
|
||||
//
|
||||
// The windows implementation for `remove_dir_all` is significantly
|
||||
// more complicated, and has not yet been brought up to par with
|
||||
// the implementation on other platforms, so this test is marked as
|
||||
// `ignore-windows` until someone more expirenced with windows can
|
||||
// `ignore-windows` until someone more experienced with windows can
|
||||
// sort that out.
|
||||
|
||||
use std::fs::remove_dir_all;
|
||||
|
@ -27,13 +27,12 @@ fn main() {
|
|||
write("outer/inner.txt", b"sometext");
|
||||
|
||||
thread::scope(|scope| {
|
||||
let t1 = scope.spawn(|| {
|
||||
scope.spawn(|| {
|
||||
thread::sleep(Duration::from_nanos(i));
|
||||
remove_dir_all("outer").unwrap();
|
||||
});
|
||||
|
||||
let race_happened_ref = &race_happened;
|
||||
let t2 = scope.spawn(|| {
|
||||
scope.spawn(|| {
|
||||
let r1 = remove_dir_all("outer/inner");
|
||||
let r2 = remove_dir_all("outer/inner.txt");
|
||||
if r1.is_ok() && r2.is_err() {
|
||||
|
@ -44,10 +43,10 @@ fn main() {
|
|||
|
||||
assert!(!Path::new("outer").exists());
|
||||
|
||||
// trying to remove a nonexistant top-level directory should
|
||||
// trying to remove a nonexistent top-level directory should
|
||||
// still result in an error.
|
||||
let Err(err) = remove_dir_all("outer") else {
|
||||
panic!("removing nonexistant dir did not result in an error");
|
||||
panic!("removing nonexistent dir did not result in an error");
|
||||
};
|
||||
assert_eq!(err.kind(), std::io::ErrorKind::NotFound);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// This test ensures that all items from `foo` are correctly generated into the `redirect-map.json`
|
||||
// file with `--generate-redirect-map` rustdoc option.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use run_make_support::rfs::read_to_string;
|
||||
use run_make_support::{path, rustdoc, serde_json};
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
|
||||
// a JSON file.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
|
||||
use run_make_support::{rustdoc, serde_json};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Dynamic libraries on Rust used to export a very high amount of symbols,
|
||||
// going as far as filling the output with mangled names and generic function
|
||||
// names. After the rework of #38117, this test checks that no mangled Rust symbols
|
||||
// are exported, and that generics are only shown if explicitely requested.
|
||||
// are exported, and that generics are only shown if explicitly requested.
|
||||
// See https://github.com/rust-lang/rust/issues/37530
|
||||
|
||||
use run_make_support::object::read::Object;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Check `RUSTC_BOOTSTRAP`'s behavior in relation to feature stability and what rustc considers
|
||||
//! itself to be (stable vs non-stable ).
|
||||
//! Check the compiler's behavior when the perma-unstable env var `RUSTC_BOOTSTRAP` is set in the
|
||||
//! environment in relation to feature stability and which channel rustc considers itself to be.
|
||||
//!
|
||||
//! `RUSTC_BOOTSTRAP` accepts:
|
||||
//!
|
|
@ -15,6 +15,12 @@ trait Trait {
|
|||
type T;
|
||||
|
||||
type U;
|
||||
|
||||
#[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
|
||||
fn f(&self);
|
||||
|
||||
#[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
|
||||
fn g();
|
||||
}
|
||||
|
||||
#[coverage(off)]
|
||||
|
@ -26,6 +32,9 @@ impl Trait for () {
|
|||
|
||||
#[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
|
||||
type U = impl Trait; //~ ERROR unconstrained opaque type
|
||||
|
||||
fn f(&self) {}
|
||||
fn g() {}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -7,12 +7,12 @@ LL | / trait Trait {
|
|||
LL | | #[coverage(off)]
|
||||
LL | | const X: u32;
|
||||
... |
|
||||
LL | | type U;
|
||||
LL | | fn g();
|
||||
LL | | }
|
||||
| |_- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:41:5
|
||||
--> $DIR/no-coverage.rs:50:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -20,7 +20,7 @@ LL | let _ = ();
|
|||
| ----------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:45:9
|
||||
--> $DIR/no-coverage.rs:54:9
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -28,7 +28,7 @@ LL | () => (),
|
|||
| -------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:49:5
|
||||
--> $DIR/no-coverage.rs:58:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -52,7 +52,23 @@ LL | type T;
|
|||
| ------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:24:5
|
||||
--> $DIR/no-coverage.rs:19:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | fn f(&self);
|
||||
| ------------ not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:22:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | fn g();
|
||||
| ------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:30:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -60,7 +76,7 @@ LL | type T = Self;
|
|||
| -------------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:27:5
|
||||
--> $DIR/no-coverage.rs:33:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -68,7 +84,7 @@ LL | type U = impl Trait;
|
|||
| -------------------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:32:5
|
||||
--> $DIR/no-coverage.rs:41:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -76,7 +92,7 @@ LL | static X: u32;
|
|||
| -------------- not a function or closure
|
||||
|
||||
error[E0788]: attribute should be applied to a function definition or closure
|
||||
--> $DIR/no-coverage.rs:35:5
|
||||
--> $DIR/no-coverage.rs:44:5
|
||||
|
|
||||
LL | #[coverage(off)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -84,13 +100,13 @@ LL | type T;
|
|||
| ------- not a function or closure
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/no-coverage.rs:28:14
|
||||
--> $DIR/no-coverage.rs:34:14
|
||||
|
|
||||
LL | type U = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `U` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0788`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue