Skip to content

Commit 1ca578e

Browse files
committed
Auto merge of rust-lang#126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#126380 (Add std Xtensa targets support) - rust-lang#126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s ) - rust-lang#126659 (More status-quo tests for the `#[coverage(..)]` attribute) - rust-lang#126711 (Make Option::as_[mut_]slice const) - rust-lang#126717 (Clean up some comments near `use` declarations) - rust-lang#126719 (Fix assertion failure for some `Expect` diagnostics.) - rust-lang#126730 (Add opaque type corner case test) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1aaab8b + b099c05 commit 1ca578e

File tree

156 files changed

+1669
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1669
-602
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ dependencies = [
709709
"clippy_config",
710710
"itertools 0.12.1",
711711
"rustc-semver",
712+
"rustc_apfloat",
712713
]
713714

714715
[[package]]

compiler/rustc_builtin_macros/src/test.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
//! The expansion from a test function to the appropriate test struct for libtest
2+
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
3+
14
use crate::errors;
2-
/// The expansion from a test function to the appropriate test struct for libtest
3-
/// Ideally, this code would be in libtest but for efficiency and error messages it lives here.
45
use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
56
use rustc_ast::ptr::P;
67
use rustc_ast::{self as ast, attr, GenericParamKind};

compiler/rustc_codegen_gcc/tests/lang_tests_common.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! The common code for `tests/lang_tests_*.rs`
2+
23
use std::{
34
env::{self, current_dir},
45
path::{Path, PathBuf},

compiler/rustc_codegen_ssa/src/mir/locals.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Locals are in a private module as updating `LocalRef::Operand` has to
22
//! be careful wrt to subtyping. To deal with this we only allow updates by using
33
//! `FunctionCx::overwrite_local` which handles it automatically.
4+
45
use crate::mir::{FunctionCx, LocalRef};
56
use crate::traits::BuilderMethods;
67
use rustc_index::IndexVec;

compiler/rustc_data_structures/src/base_n.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// Converts unsigned integers into a string representation with some base.
2-
/// Bases up to and including 36 can be used for case-insensitive things.
1+
//! Converts unsigned integers into a string representation with some base.
2+
//! Bases up to and including 36 can be used for case-insensitive things.
3+
34
use std::ascii;
45
use std::fmt;
56

compiler/rustc_errors/src/lib.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,24 @@ impl DiagCtxtInner {
14371437

14381438
// Return value is only `Some` if the level is `Error` or `DelayedBug`.
14391439
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
1440+
match diagnostic.level {
1441+
Expect(expect_id) | ForceWarning(Some(expect_id)) => {
1442+
// The `LintExpectationId` can be stable or unstable depending on when it was
1443+
// created. Diagnostics created before the definition of `HirId`s are unstable and
1444+
// can not yet be stored. Instead, they are buffered until the `LintExpectationId`
1445+
// is replaced by a stable one by the `LintLevelsBuilder`.
1446+
if let LintExpectationId::Unstable { .. } = expect_id {
1447+
// We don't call TRACK_DIAGNOSTIC because we wait for the
1448+
// unstable ID to be updated, whereupon the diagnostic will be
1449+
// passed into this method again.
1450+
self.unstable_expect_diagnostics.push(diagnostic);
1451+
return None;
1452+
}
1453+
// Continue through to the `Expect`/`ForceWarning` case below.
1454+
}
1455+
_ => {}
1456+
}
1457+
14401458
if diagnostic.has_future_breakage() {
14411459
// Future breakages aren't emitted if they're `Level::Allow`,
14421460
// but they still need to be constructed and stashed below,
@@ -1512,16 +1530,8 @@ impl DiagCtxtInner {
15121530
return None;
15131531
}
15141532
Expect(expect_id) | ForceWarning(Some(expect_id)) => {
1515-
// Diagnostics created before the definition of `HirId`s are
1516-
// unstable and can not yet be stored. Instead, they are
1517-
// buffered until the `LintExpectationId` is replaced by a
1518-
// stable one by the `LintLevelsBuilder`.
15191533
if let LintExpectationId::Unstable { .. } = expect_id {
1520-
// We don't call TRACK_DIAGNOSTIC because we wait for the
1521-
// unstable ID to be updated, whereupon the diagnostic will
1522-
// be passed into this method again.
1523-
self.unstable_expect_diagnostics.push(diagnostic);
1524-
return None;
1534+
unreachable!(); // this case was handled at the top of this function
15251535
}
15261536
self.fulfilled_expectations.insert(expect_id.normalize());
15271537
if let Expect(_) = diagnostic.level {

compiler/rustc_errors/src/markdown/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! A simple markdown parser that can write formatted text to the terminal
22
//!
33
//! Entrypoint is `MdStream::parse_str(...)`
4+
45
use std::io;
56

67
use termcolor::{Buffer, BufferWriter, ColorChoice};

compiler/rustc_expand/src/mbe/macro_check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
//! Kleene operators under which a meta-variable is repeating is the concatenation of the stacks
105105
//! stored when entering a macro definition starting from the state in which the meta-variable is
106106
//! bound.
107+
107108
use crate::errors;
108109
use crate::mbe::{KleeneToken, TokenTree};
109110

compiler/rustc_fs_util/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// tidy-alphabetical-start
21
use std::ffi::CString;
32
use std::fs;
43
use std::io;
54
use std::path::{absolute, Path, PathBuf};
6-
// tidy-alphabetical-end
75

86
// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
97
// verbatim paths under the hood to non-verbatim paths! This manifests itself as

compiler/rustc_hir_analysis/src/check/dropck.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// FIXME(@lcnr): Move this module out of `rustc_hir_analysis`.
22
//
33
// We don't do any drop checking during hir typeck.
4+
45
use rustc_data_structures::fx::FxHashSet;
56
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
67
use rustc_infer::infer::outlives::env::OutlivesEnvironment;

compiler/rustc_hir_typeck/src/autoderef.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//! Some helper functions for `AutoDeref`
1+
//! Some helper functions for `AutoDeref`.
2+
23
use super::method::MethodCallee;
34
use super::{FnCtxt, PlaceOp};
45

compiler/rustc_hir_typeck/src/errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Errors emitted by `rustc_hir_typeck`.
2+
23
use std::borrow::Cow;
34

45
use crate::fluent_generated as fluent;

compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! A utility module to inspect currently ambiguous obligations in the current context.
2+
23
use crate::FnCtxt;
34
use rustc_infer::traits::{self, ObligationCause};
45
use rustc_middle::traits::solve::Goal;

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Error Reporting for Anonymous Region Lifetime Errors
22
//! where one region is named and the other is anonymous.
3+
34
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
45
use crate::{
56
errors::ExplicitLifetimeRequired,

compiler/rustc_infer/src/infer/freshen.rs

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
//! solving a set of constraints. In contrast, the type inferencer assigns a value to each type
3131
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
3232
//! inferencer knows "so far".
33+
3334
use super::InferCtxt;
3435
use rustc_data_structures::fx::FxHashMap;
3536
use rustc_middle::bug;

compiler/rustc_infer/src/infer/outlives/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Various code related to computing outlives relations.
2+
23
use self::env::OutlivesEnvironment;
34
use super::region_constraints::RegionConstraintData;
45
use super::{InferCtxt, RegionResolutionError, SubregionOrigin};

compiler/rustc_lint_defs/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// tidy-alphabetical-start
21
pub use self::Level::*;
32
use rustc_ast::node_id::NodeId;
43
use rustc_ast::{AttrId, Attribute};
@@ -15,7 +14,6 @@ use rustc_span::edition::Edition;
1514
use rustc_span::symbol::MacroRulesNormalizedIdent;
1615
use rustc_span::{sym, symbol::Ident, Span, Symbol};
1716
use rustc_target::spec::abi::Abi;
18-
// tidy-alphabetical-end
1917

2018
use serde::{Deserialize, Serialize};
2119

compiler/rustc_middle/src/middle/privacy.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! A pass that checks to make sure private fields and methods aren't used
22
//! outside their scopes. This pass will also generate a set of exported items
33
//! which are available for use externally when compiled as a library.
4+
45
use crate::ty::{TyCtxt, Visibility};
56
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
67
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};

compiler/rustc_middle/src/mir/statement.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/// Functionality for statements, operands, places, and things that appear in them.
1+
//! Functionality for statements, operands, places, and things that appear in them.
2+
23
use super::{interpret::GlobalAlloc, *};
34

45
///////////////////////////////////////////////////////////////////////////

compiler/rustc_middle/src/mir/terminator.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/// Functionality for terminators and helper types that appear in terminators.
1+
//! Functionality for terminators and helper types that appear in terminators.
2+
23
use rustc_hir::LangItem;
34
use smallvec::{smallvec, SmallVec};
45

compiler/rustc_middle/src/ty/abstract_const.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! A subset of a mir body used for const evaluability checking.
2+
23
use crate::ty::{
34
self, Const, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
45
TypeVisitableExt,

compiler/rustc_mir_transform/src/ctfe_limit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! A pass that inserts the `ConstEvalCounter` instruction into any blocks that have a back edge
22
//! (thus indicating there is a loop in the CFG), or whose terminator is a function call.
3+
34
use crate::MirPass;
45

56
use rustc_data_structures::graph::dominators::Dominators;

compiler/rustc_mir_transform/src/inline.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//! Inlining pass for MIR functions
1+
//! Inlining pass for MIR functions.
2+
23
use crate::deref_separator::deref_finder;
34
use rustc_attr::InlineAttr;
45
use rustc_hir::def::DefKind;

compiler/rustc_mir_transform/src/lint.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! This pass statically detects code which has undefined behaviour or is likely to be erroneous.
22
//! It can be used to locate problems in MIR building or optimizations. It assumes that all code
33
//! can be executed, so it has false positives.
4+
45
use rustc_data_structures::fx::FxHashSet;
56
use rustc_index::bit_set::BitSet;
67
use rustc_middle::mir::visit::{PlaceContext, Visitor};

compiler/rustc_parse/src/parser/expr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// ignore-tidy-filelength
2+
23
use super::diagnostics::SnapshotParser;
34
use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma};
45
use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};

compiler/rustc_pattern_analysis/src/pat.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! As explained in [`crate::usefulness`], values and patterns are made from constructors applied to
22
//! fields. This file defines types that represent patterns in this way.
3+
34
use std::fmt;
45

56
use smallvec::{smallvec, SmallVec};

compiler/rustc_pattern_analysis/tests/complexity.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Test the pattern complexity limit.
2+
23
use common::*;
34
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};
45

compiler/rustc_pattern_analysis/tests/exhaustiveness.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Test exhaustiveness checking.
2+
23
use common::*;
34
use rustc_pattern_analysis::{
45
pat::{DeconstructedPat, WitnessPat},

compiler/rustc_pattern_analysis/tests/intersection.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Test the computation of arm intersections.
2+
23
use common::*;
34
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};
45

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//!
55
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
66
//! see design document in the tracking issue #89653.
7+
78
use rustc_data_structures::base_n::ToBaseN;
89
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
910
use rustc_data_structures::base_n::CASE_INSENSITIVE;

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//!
44
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
55
//! see design document in the tracking issue #89653.
6+
67
use rustc_data_structures::fx::FxHashMap;
78
use rustc_middle::bug;
89
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable};

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//!
44
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
55
//! see design document in the tracking issue #89653.
6+
67
use rustc_hir as hir;
78
use rustc_hir::LangItem;
89
use rustc_middle::bug;

compiler/rustc_sanitizers/src/cfi/typeid/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//!
44
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
55
//! see design document in the tracking issue #89653.
6+
67
use bitflags::bitflags;
78
use rustc_middle::ty::{Instance, Ty, TyCtxt};
89
use rustc_target::abi::call::FnAbi;

compiler/rustc_sanitizers/src/kcfi/typeid/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//!
44
//! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler,
55
//! see the tracking issue #123479.
6+
67
use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt};
78
use rustc_target::abi::call::FnAbi;
89
use std::hash::Hasher;

compiler/rustc_session/src/output.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Related to out filenames of compilation (e.g. binaries).
2+
23
use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType};
34
use crate::errors::{
45
self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable,

compiler/rustc_smir/src/rustc_smir/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! We first retrieve and monomorphize the rustc body representation, i.e., we generate a
44
//! monomorphic body using internal representation.
55
//! After that, we convert the internal representation into a stable one.
6+
67
use crate::rustc_smir::{Stable, Tables};
78
use rustc_hir::def::DefKind;
89
use rustc_middle::mir;

compiler/rustc_smir/src/rustc_smir/convert/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Handle the conversion of different internal errors into a stable version.
22
//!
33
//! Currently we encode everything as [stable_mir::Error], which is represented as a string.
4+
45
use crate::rustc_smir::{Stable, Tables};
56
use rustc_middle::mir::interpret::AllocError;
67
use rustc_middle::ty::layout::LayoutError;

compiler/rustc_target/src/spec/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1768,8 +1768,11 @@ supported_targets! {
17681768
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
17691769

17701770
("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
1771+
("xtensa-esp32-espidf", xtensa_esp32_espidf),
17711772
("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf),
1773+
("xtensa-esp32s2-espidf", xtensa_esp32s2_espidf),
17721774
("xtensa-esp32s3-none-elf", xtensa_esp32s3_none_elf),
1775+
("xtensa-esp32s3-espidf", xtensa_esp32s3_espidf),
17731776

17741777
("i686-wrs-vxworks", i686_wrs_vxworks),
17751778
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),

compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/// A target tuple for OpenWrt MIPS64 targets
2-
///
1+
//! A target tuple for OpenWrt MIPS64 targets.
2+
33
use crate::abi::Endian;
44
use crate::spec::{base, Target, TargetOptions};
55

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use crate::abi::Endian;
2+
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
Target {
6+
llvm_target: "xtensa-none-elf".into(),
7+
pointer_width: 32,
8+
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
9+
arch: "xtensa".into(),
10+
metadata: crate::spec::TargetMetadata {
11+
description: None,
12+
tier: None,
13+
host_tools: None,
14+
std: None,
15+
},
16+
17+
options: TargetOptions {
18+
endian: Endian::Little,
19+
c_int_width: "32".into(),
20+
families: cvs!["unix"],
21+
os: "espidf".into(),
22+
env: "newlib".into(),
23+
vendor: "espressif".into(),
24+
25+
executables: true,
26+
cpu: "esp32".into(),
27+
linker: Some("xtensa-esp32-elf-gcc".into()),
28+
29+
// The esp32 only supports native 32bit atomics.
30+
max_atomic_width: Some(32),
31+
atomic_cas: true,
32+
33+
..xtensa::opts()
34+
},
35+
}
36+
}

0 commit comments

Comments
 (0)