Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #126380 (Add std Xtensa targets support) - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s ) - #126659 (More status-quo tests for the `#[coverage(..)]` attribute) - #126711 (Make Option::as_[mut_]slice const) - #126717 (Clean up some comments near `use` declarations) - #126719 (Fix assertion failure for some `Expect` diagnostics.) - #126730 (Add opaque type corner case test) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
1ca578e68e
156 changed files with 1731 additions and 664 deletions
|
@ -1,6 +1,7 @@
|
|||
//! The expansion from a test function to the appropriate test struct for libtest
|
||||
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
|
||||
|
||||
use crate::errors;
|
||||
/// The expansion from a test function to the appropriate test struct for libtest
|
||||
/// Ideally, this code would be in libtest but for efficiency and error messages it lives here.
|
||||
use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::{self as ast, attr, GenericParamKind};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! The common code for `tests/lang_tests_*.rs`
|
||||
|
||||
use std::{
|
||||
env::{self, current_dir},
|
||||
path::{Path, PathBuf},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! Locals are in a private module as updating `LocalRef::Operand` has to
|
||||
//! be careful wrt to subtyping. To deal with this we only allow updates by using
|
||||
//! `FunctionCx::overwrite_local` which handles it automatically.
|
||||
|
||||
use crate::mir::{FunctionCx, LocalRef};
|
||||
use crate::traits::BuilderMethods;
|
||||
use rustc_index::IndexVec;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/// Converts unsigned integers into a string representation with some base.
|
||||
/// Bases up to and including 36 can be used for case-insensitive things.
|
||||
//! Converts unsigned integers into a string representation with some base.
|
||||
//! Bases up to and including 36 can be used for case-insensitive things.
|
||||
|
||||
use std::ascii;
|
||||
use std::fmt;
|
||||
|
||||
|
|
|
@ -1437,6 +1437,24 @@ impl DiagCtxtInner {
|
|||
|
||||
// Return value is only `Some` if the level is `Error` or `DelayedBug`.
|
||||
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
|
||||
match diagnostic.level {
|
||||
Expect(expect_id) | ForceWarning(Some(expect_id)) => {
|
||||
// The `LintExpectationId` can be stable or unstable depending on when it was
|
||||
// created. Diagnostics created before the definition of `HirId`s are unstable and
|
||||
// can not yet be stored. Instead, they are buffered until the `LintExpectationId`
|
||||
// is replaced by a stable one by the `LintLevelsBuilder`.
|
||||
if let LintExpectationId::Unstable { .. } = expect_id {
|
||||
// We don't call TRACK_DIAGNOSTIC because we wait for the
|
||||
// unstable ID to be updated, whereupon the diagnostic will be
|
||||
// passed into this method again.
|
||||
self.unstable_expect_diagnostics.push(diagnostic);
|
||||
return None;
|
||||
}
|
||||
// Continue through to the `Expect`/`ForceWarning` case below.
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if diagnostic.has_future_breakage() {
|
||||
// Future breakages aren't emitted if they're `Level::Allow`,
|
||||
// but they still need to be constructed and stashed below,
|
||||
|
@ -1512,16 +1530,8 @@ impl DiagCtxtInner {
|
|||
return None;
|
||||
}
|
||||
Expect(expect_id) | ForceWarning(Some(expect_id)) => {
|
||||
// Diagnostics created before the definition of `HirId`s are
|
||||
// unstable and can not yet be stored. Instead, they are
|
||||
// buffered until the `LintExpectationId` is replaced by a
|
||||
// stable one by the `LintLevelsBuilder`.
|
||||
if let LintExpectationId::Unstable { .. } = expect_id {
|
||||
// We don't call TRACK_DIAGNOSTIC because we wait for the
|
||||
// unstable ID to be updated, whereupon the diagnostic will
|
||||
// be passed into this method again.
|
||||
self.unstable_expect_diagnostics.push(diagnostic);
|
||||
return None;
|
||||
unreachable!(); // this case was handled at the top of this function
|
||||
}
|
||||
self.fulfilled_expectations.insert(expect_id.normalize());
|
||||
if let Expect(_) = diagnostic.level {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! A simple markdown parser that can write formatted text to the terminal
|
||||
//!
|
||||
//! Entrypoint is `MdStream::parse_str(...)`
|
||||
|
||||
use std::io;
|
||||
|
||||
use termcolor::{Buffer, BufferWriter, ColorChoice};
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
//! Kleene operators under which a meta-variable is repeating is the concatenation of the stacks
|
||||
//! stored when entering a macro definition starting from the state in which the meta-variable is
|
||||
//! bound.
|
||||
|
||||
use crate::errors;
|
||||
use crate::mbe::{KleeneToken, TokenTree};
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
// tidy-alphabetical-start
|
||||
use std::ffi::CString;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::{absolute, Path, PathBuf};
|
||||
// tidy-alphabetical-end
|
||||
|
||||
// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
|
||||
// verbatim paths under the hood to non-verbatim paths! This manifests itself as
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// FIXME(@lcnr): Move this module out of `rustc_hir_analysis`.
|
||||
//
|
||||
// We don't do any drop checking during hir typeck.
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Some helper functions for `AutoDeref`
|
||||
//! Some helper functions for `AutoDeref`.
|
||||
|
||||
use super::method::MethodCallee;
|
||||
use super::{FnCtxt, PlaceOp};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Errors emitted by `rustc_hir_typeck`.
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! A utility module to inspect currently ambiguous obligations in the current context.
|
||||
|
||||
use crate::FnCtxt;
|
||||
use rustc_infer::traits::{self, ObligationCause};
|
||||
use rustc_middle::traits::solve::Goal;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! Error Reporting for Anonymous Region Lifetime Errors
|
||||
//! where one region is named and the other is anonymous.
|
||||
|
||||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||
use crate::{
|
||||
errors::ExplicitLifetimeRequired,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
//! solving a set of constraints. In contrast, the type inferencer assigns a value to each type
|
||||
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
|
||||
//! inferencer knows "so far".
|
||||
|
||||
use super::InferCtxt;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_middle::bug;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Various code related to computing outlives relations.
|
||||
|
||||
use self::env::OutlivesEnvironment;
|
||||
use super::region_constraints::RegionConstraintData;
|
||||
use super::{InferCtxt, RegionResolutionError, SubregionOrigin};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// tidy-alphabetical-start
|
||||
pub use self::Level::*;
|
||||
use rustc_ast::node_id::NodeId;
|
||||
use rustc_ast::{AttrId, Attribute};
|
||||
|
@ -15,7 +14,6 @@ use rustc_span::edition::Edition;
|
|||
use rustc_span::symbol::MacroRulesNormalizedIdent;
|
||||
use rustc_span::{sym, symbol::Ident, Span, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
// tidy-alphabetical-end
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! A pass that checks to make sure private fields and methods aren't used
|
||||
//! outside their scopes. This pass will also generate a set of exported items
|
||||
//! which are available for use externally when compiled as a library.
|
||||
|
||||
use crate::ty::{TyCtxt, Visibility};
|
||||
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// Functionality for statements, operands, places, and things that appear in them.
|
||||
//! Functionality for statements, operands, places, and things that appear in them.
|
||||
|
||||
use super::{interpret::GlobalAlloc, *};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// Functionality for terminators and helper types that appear in terminators.
|
||||
//! Functionality for terminators and helper types that appear in terminators.
|
||||
|
||||
use rustc_hir::LangItem;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! A subset of a mir body used for const evaluability checking.
|
||||
|
||||
use crate::ty::{
|
||||
self, Const, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
TypeVisitableExt,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! A pass that inserts the `ConstEvalCounter` instruction into any blocks that have a back edge
|
||||
//! (thus indicating there is a loop in the CFG), or whose terminator is a function call.
|
||||
|
||||
use crate::MirPass;
|
||||
|
||||
use rustc_data_structures::graph::dominators::Dominators;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Inlining pass for MIR functions
|
||||
//! Inlining pass for MIR functions.
|
||||
|
||||
use crate::deref_separator::deref_finder;
|
||||
use rustc_attr::InlineAttr;
|
||||
use rustc_hir::def::DefKind;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! This pass statically detects code which has undefined behaviour or is likely to be erroneous.
|
||||
//! It can be used to locate problems in MIR building or optimizations. It assumes that all code
|
||||
//! can be executed, so it has false positives.
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// ignore-tidy-filelength
|
||||
|
||||
use super::diagnostics::SnapshotParser;
|
||||
use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma};
|
||||
use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! As explained in [`crate::usefulness`], values and patterns are made from constructors applied to
|
||||
//! fields. This file defines types that represent patterns in this way.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Test the pattern complexity limit.
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Test exhaustiveness checking.
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::{
|
||||
pat::{DeconstructedPat, WitnessPat},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Test the computation of arm intersections.
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//!
|
||||
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
|
||||
//! see design document in the tracking issue #89653.
|
||||
|
||||
use rustc_data_structures::base_n::ToBaseN;
|
||||
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
|
||||
use rustc_data_structures::base_n::CASE_INSENSITIVE;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//!
|
||||
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
|
||||
//! see design document in the tracking issue #89653.
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//!
|
||||
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
|
||||
//! see design document in the tracking issue #89653.
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//!
|
||||
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
|
||||
//! see design document in the tracking issue #89653.
|
||||
|
||||
use bitflags::bitflags;
|
||||
use rustc_middle::ty::{Instance, Ty, TyCtxt};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//!
|
||||
//! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler,
|
||||
//! see the tracking issue #123479.
|
||||
|
||||
use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use std::hash::Hasher;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! Related to out filenames of compilation (e.g. binaries).
|
||||
|
||||
use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType};
|
||||
use crate::errors::{
|
||||
self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//! We first retrieve and monomorphize the rustc body representation, i.e., we generate a
|
||||
//! monomorphic body using internal representation.
|
||||
//! After that, we convert the internal representation into a stable one.
|
||||
|
||||
use crate::rustc_smir::{Stable, Tables};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::mir;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! Handle the conversion of different internal errors into a stable version.
|
||||
//!
|
||||
//! Currently we encode everything as [stable_mir::Error], which is represented as a string.
|
||||
|
||||
use crate::rustc_smir::{Stable, Tables};
|
||||
use rustc_middle::mir::interpret::AllocError;
|
||||
use rustc_middle::ty::layout::LayoutError;
|
||||
|
|
|
@ -1768,8 +1768,11 @@ supported_targets! {
|
|||
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
|
||||
|
||||
("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
|
||||
("xtensa-esp32-espidf", xtensa_esp32_espidf),
|
||||
("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf),
|
||||
("xtensa-esp32s2-espidf", xtensa_esp32s2_espidf),
|
||||
("xtensa-esp32s3-none-elf", xtensa_esp32s3_none_elf),
|
||||
("xtensa-esp32s3-espidf", xtensa_esp32s3_espidf),
|
||||
|
||||
("i686-wrs-vxworks", i686_wrs_vxworks),
|
||||
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// A target tuple for OpenWrt MIPS64 targets
|
||||
///
|
||||
//! A target tuple for OpenWrt MIPS64 targets.
|
||||
|
||||
use crate::abi::Endian;
|
||||
use crate::spec::{base, Target, TargetOptions};
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
use crate::abi::Endian;
|
||||
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "xtensa-none-elf".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
|
||||
arch: "xtensa".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: None,
|
||||
tier: None,
|
||||
host_tools: None,
|
||||
std: None,
|
||||
},
|
||||
|
||||
options: TargetOptions {
|
||||
endian: Endian::Little,
|
||||
c_int_width: "32".into(),
|
||||
families: cvs!["unix"],
|
||||
os: "espidf".into(),
|
||||
env: "newlib".into(),
|
||||
vendor: "espressif".into(),
|
||||
|
||||
executables: true,
|
||||
cpu: "esp32".into(),
|
||||
linker: Some("xtensa-esp32-elf-gcc".into()),
|
||||
|
||||
// The esp32 only supports native 32bit atomics.
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: true,
|
||||
|
||||
..xtensa::opts()
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
use crate::abi::Endian;
|
||||
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "xtensa-none-elf".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
|
||||
arch: "xtensa".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: None,
|
||||
tier: None,
|
||||
host_tools: None,
|
||||
std: None,
|
||||
},
|
||||
|
||||
options: TargetOptions {
|
||||
endian: Endian::Little,
|
||||
c_int_width: "32".into(),
|
||||
families: cvs!["unix"],
|
||||
os: "espidf".into(),
|
||||
env: "newlib".into(),
|
||||
vendor: "espressif".into(),
|
||||
|
||||
executables: true,
|
||||
cpu: "esp32-s2".into(),
|
||||
linker: Some("xtensa-esp32s2-elf-gcc".into()),
|
||||
|
||||
// See https://github.com/espressif/rust-esp32-example/issues/3#issuecomment-861054477
|
||||
//
|
||||
// While the ESP32-S2 chip does not natively support atomics, ESP-IDF does support
|
||||
// the __atomic* and __sync* compiler builtins. Setting `max_atomic_width` and `atomic_cas`
|
||||
// and `atomic_cas: true` will cause the compiler to emit libcalls to these builtins. On the
|
||||
// ESP32-S2, these are guaranteed to be lock-free.
|
||||
//
|
||||
// Support for atomics is necessary for the Rust STD library, which is supported by ESP-IDF.
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: true,
|
||||
|
||||
..xtensa::opts()
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
use crate::abi::Endian;
|
||||
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "xtensa-none-elf".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
|
||||
arch: "xtensa".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: None,
|
||||
tier: None,
|
||||
host_tools: None,
|
||||
std: None,
|
||||
},
|
||||
|
||||
options: TargetOptions {
|
||||
endian: Endian::Little,
|
||||
c_int_width: "32".into(),
|
||||
families: cvs!["unix"],
|
||||
os: "espidf".into(),
|
||||
env: "newlib".into(),
|
||||
vendor: "espressif".into(),
|
||||
|
||||
executables: true,
|
||||
cpu: "esp32-s3".into(),
|
||||
linker: Some("xtensa-esp32s3-elf-gcc".into()),
|
||||
|
||||
// The esp32s3 only supports native 32bit atomics.
|
||||
max_atomic_width: Some(32),
|
||||
atomic_cas: true,
|
||||
|
||||
..xtensa::opts()
|
||||
},
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
//! Deeply normalize types using the old trait solver.
|
||||
|
||||
use super::error_reporting::OverflowCause;
|
||||
use super::error_reporting::TypeErrCtxtExt;
|
||||
use super::SelectionContext;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//!
|
||||
//! [rustc dev guide]:
|
||||
//! https://rustc-dev-guide.rust-lang.org/traits/resolution.html#confirmation
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//! This module provides methods to retrieve allocation information, such as static variables.
|
||||
|
||||
use crate::mir::mono::{Instance, StaticDef};
|
||||
use crate::target::{Endian, MachineInfo};
|
||||
use crate::ty::{Allocation, Binder, ExistentialTraitRef, IndexedVal, Ty};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue