Auto merge of #140138 - ChrisDenton:rollup-zw7jibi, r=ChrisDenton
Rollup of 5 pull requests Successful merges: - #139981 (Don't compute name of associated item if it's an RPITIT) - #140077 (Construct OutputType using macro and print [=FILENAME] help info) - #140081 (Update `libc` to 0.2.172) - #140094 (Improve diagnostics for pointer arithmetic += and -= (fixes #137391)) - #140128 (Use correct annotation for CSS pseudo elements) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
9bfa31f632
20 changed files with 464 additions and 158 deletions
|
@ -486,15 +486,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
||||||
let items: &AssocItems = self.tcx.associated_items(self.def_id);
|
let items: &AssocItems = self.tcx.associated_items(self.def_id);
|
||||||
items
|
items
|
||||||
.in_definition_order()
|
.in_definition_order()
|
||||||
.filter(|item| item.is_type())
|
|
||||||
.filter(|item| {
|
.filter(|item| {
|
||||||
!self
|
item.is_type()
|
||||||
.gen_args
|
&& !item.is_impl_trait_in_trait()
|
||||||
.constraints
|
&& !self
|
||||||
.iter()
|
.gen_args
|
||||||
.any(|constraint| constraint.ident.name == item.name())
|
.constraints
|
||||||
|
.iter()
|
||||||
|
.any(|constraint| constraint.ident.name == item.name())
|
||||||
})
|
})
|
||||||
.filter(|item| !item.is_impl_trait_in_trait())
|
|
||||||
.map(|item| self.tcx.item_ident(item.def_id).to_string())
|
.map(|item| self.tcx.item_ident(item.def_id).to_string())
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use rustc_errors::codes::*;
|
||||||
use rustc_errors::{
|
use rustc_errors::{
|
||||||
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err,
|
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err,
|
||||||
};
|
};
|
||||||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
|
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_hir::{self as hir, AnonConst, GenericArg, GenericArgs, HirId};
|
use rustc_hir::{self as hir, AnonConst, GenericArg, GenericArgs, HirId};
|
||||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||||
|
@ -1731,9 +1731,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
tcx.associated_items(*trait_def_id)
|
tcx.associated_items(*trait_def_id)
|
||||||
.in_definition_order()
|
.in_definition_order()
|
||||||
.any(|i| {
|
.any(|i| {
|
||||||
i.namespace() == Namespace::TypeNS
|
i.is_type()
|
||||||
|
&& !i.is_impl_trait_in_trait()
|
||||||
&& i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
|
&& i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
|
||||||
&& i.is_type()
|
|
||||||
})
|
})
|
||||||
// Consider only accessible traits
|
// Consider only accessible traits
|
||||||
&& tcx.visibility(*trait_def_id)
|
&& tcx.visibility(*trait_def_id)
|
||||||
|
|
|
@ -234,7 +234,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// us do better coercions than we would be able to do otherwise,
|
// us do better coercions than we would be able to do otherwise,
|
||||||
// particularly for things like `String + &String`.
|
// particularly for things like `String + &String`.
|
||||||
let rhs_ty_var = self.next_ty_var(rhs_expr.span);
|
let rhs_ty_var = self.next_ty_var(rhs_expr.span);
|
||||||
|
|
||||||
let result = self.lookup_op_method(
|
let result = self.lookup_op_method(
|
||||||
(lhs_expr, lhs_ty),
|
(lhs_expr, lhs_ty),
|
||||||
Some((rhs_expr, rhs_ty_var)),
|
Some((rhs_expr, rhs_ty_var)),
|
||||||
|
@ -698,6 +697,57 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lhs_name_str = match lhs_expr.kind {
|
||||||
|
hir::ExprKind::Path(hir::QPath::Resolved(_, path)) => {
|
||||||
|
path.segments.last().map_or("_".to_string(), |s| s.ident.to_string())
|
||||||
|
}
|
||||||
|
_ => self
|
||||||
|
.tcx
|
||||||
|
.sess
|
||||||
|
.source_map()
|
||||||
|
.span_to_snippet(lhs_expr.span)
|
||||||
|
.unwrap_or("_".to_string()),
|
||||||
|
};
|
||||||
|
|
||||||
|
if op.span().can_be_used_for_suggestions() {
|
||||||
|
match op {
|
||||||
|
Op::AssignOp(Spanned { node: hir::AssignOpKind::AddAssign, .. })
|
||||||
|
if lhs_ty.is_raw_ptr() && rhs_ty.is_integral() =>
|
||||||
|
{
|
||||||
|
err.multipart_suggestion(
|
||||||
|
"consider using `add` or `wrapping_add` to do pointer arithmetic",
|
||||||
|
vec![
|
||||||
|
(lhs_expr.span.shrink_to_lo(), format!("{} = ", lhs_name_str)),
|
||||||
|
(
|
||||||
|
lhs_expr.span.between(rhs_expr.span),
|
||||||
|
".wrapping_add(".to_owned(),
|
||||||
|
),
|
||||||
|
(rhs_expr.span.shrink_to_hi(), ")".to_owned()),
|
||||||
|
],
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Op::AssignOp(Spanned { node: hir::AssignOpKind::SubAssign, .. }) => {
|
||||||
|
if lhs_ty.is_raw_ptr() && rhs_ty.is_integral() {
|
||||||
|
err.multipart_suggestion(
|
||||||
|
"consider using `sub` or `wrapping_sub` to do pointer arithmetic",
|
||||||
|
vec![
|
||||||
|
(lhs_expr.span.shrink_to_lo(), format!("{} = ", lhs_name_str)),
|
||||||
|
(
|
||||||
|
lhs_expr.span.between(rhs_expr.span),
|
||||||
|
".wrapping_sub(".to_owned(),
|
||||||
|
|
||||||
|
),
|
||||||
|
(rhs_expr.span.shrink_to_hi(), ")".to_owned()),
|
||||||
|
],
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let reported = err.emit();
|
let reported = err.emit();
|
||||||
Ty::new_error(self.tcx, reported)
|
Ty::new_error(self.tcx, reported)
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,122 +568,203 @@ impl FromStr for SplitDwarfKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable_Generic)]
|
macro_rules! define_output_types {
|
||||||
#[derive(Encodable, Decodable)]
|
(
|
||||||
pub enum OutputType {
|
$(
|
||||||
/// This is the optimized bitcode, which could be either pre-LTO or non-LTO bitcode,
|
$(#[doc = $doc:expr])*
|
||||||
/// depending on the specific request type.
|
$Variant:ident => {
|
||||||
Bitcode,
|
shorthand: $shorthand:expr,
|
||||||
/// This is the summary or index data part of the ThinLTO bitcode.
|
extension: $extension:expr,
|
||||||
ThinLinkBitcode,
|
description: $description:expr,
|
||||||
Assembly,
|
default_filename: $default_filename:expr,
|
||||||
LlvmAssembly,
|
is_text: $is_text:expr,
|
||||||
Mir,
|
compatible_with_cgus_and_single_output: $compatible:expr
|
||||||
Metadata,
|
}
|
||||||
Object,
|
),* $(,)?
|
||||||
Exe,
|
) => {
|
||||||
DepInfo,
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable_Generic)]
|
||||||
}
|
#[derive(Encodable, Decodable)]
|
||||||
|
pub enum OutputType {
|
||||||
|
$(
|
||||||
|
$(#[doc = $doc])*
|
||||||
|
$Variant,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
|
||||||
impl StableOrd for OutputType {
|
|
||||||
const CAN_USE_UNSTABLE_SORT: bool = true;
|
|
||||||
|
|
||||||
// Trivial C-Style enums have a stable sort order across compilation sessions.
|
impl StableOrd for OutputType {
|
||||||
const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = ();
|
const CAN_USE_UNSTABLE_SORT: bool = true;
|
||||||
}
|
|
||||||
|
|
||||||
impl<HCX: HashStableContext> ToStableHashKey<HCX> for OutputType {
|
// Trivial C-Style enums have a stable sort order across compilation sessions.
|
||||||
type KeyType = Self;
|
const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = ();
|
||||||
|
}
|
||||||
|
|
||||||
fn to_stable_hash_key(&self, _: &HCX) -> Self::KeyType {
|
impl<HCX: HashStableContext> ToStableHashKey<HCX> for OutputType {
|
||||||
*self
|
type KeyType = Self;
|
||||||
|
|
||||||
|
fn to_stable_hash_key(&self, _: &HCX) -> Self::KeyType {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
impl OutputType {
|
||||||
|
pub fn iter_all() -> impl Iterator<Item = OutputType> {
|
||||||
|
static ALL_VARIANTS: &[OutputType] = &[
|
||||||
|
$(
|
||||||
|
OutputType::$Variant,
|
||||||
|
)*
|
||||||
|
];
|
||||||
|
ALL_VARIANTS.iter().copied()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $compatible,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn shorthand(&self) -> &'static str {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $shorthand,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_shorthand(shorthand: &str) -> Option<Self> {
|
||||||
|
match shorthand {
|
||||||
|
$(
|
||||||
|
s if s == $shorthand => Some(OutputType::$Variant),
|
||||||
|
)*
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn shorthands_display() -> String {
|
||||||
|
let shorthands = vec![
|
||||||
|
$(
|
||||||
|
format!("`{}`", $shorthand),
|
||||||
|
)*
|
||||||
|
];
|
||||||
|
shorthands.join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn extension(&self) -> &'static str {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $extension,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_text_output(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $is_text,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn description(&self) -> &'static str {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $description,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn default_filename(&self) -> &'static str {
|
||||||
|
match *self {
|
||||||
|
$(
|
||||||
|
OutputType::$Variant => $default_filename,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OutputType {
|
define_output_types! {
|
||||||
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
|
Assembly => {
|
||||||
match *self {
|
shorthand: "asm",
|
||||||
OutputType::Exe | OutputType::DepInfo | OutputType::Metadata => true,
|
extension: "s",
|
||||||
OutputType::Bitcode
|
description: "Generates a file with the crate's assembly code",
|
||||||
| OutputType::ThinLinkBitcode
|
default_filename: "CRATE_NAME.s",
|
||||||
| OutputType::Assembly
|
is_text: true,
|
||||||
| OutputType::LlvmAssembly
|
compatible_with_cgus_and_single_output: false
|
||||||
| OutputType::Mir
|
},
|
||||||
| OutputType::Object => false,
|
#[doc = "This is the optimized bitcode, which could be either pre-LTO or non-LTO bitcode,"]
|
||||||
}
|
#[doc = "depending on the specific request type."]
|
||||||
}
|
Bitcode => {
|
||||||
|
shorthand: "llvm-bc",
|
||||||
pub fn shorthand(&self) -> &'static str {
|
extension: "bc",
|
||||||
match *self {
|
description: "Generates a binary file containing the LLVM bitcode",
|
||||||
OutputType::Bitcode => "llvm-bc",
|
default_filename: "CRATE_NAME.bc",
|
||||||
OutputType::ThinLinkBitcode => "thin-link-bitcode",
|
is_text: false,
|
||||||
OutputType::Assembly => "asm",
|
compatible_with_cgus_and_single_output: false
|
||||||
OutputType::LlvmAssembly => "llvm-ir",
|
},
|
||||||
OutputType::Mir => "mir",
|
DepInfo => {
|
||||||
OutputType::Object => "obj",
|
shorthand: "dep-info",
|
||||||
OutputType::Metadata => "metadata",
|
extension: "d",
|
||||||
OutputType::Exe => "link",
|
description: "Generates a file with Makefile syntax that indicates all the source files that were loaded to generate the crate",
|
||||||
OutputType::DepInfo => "dep-info",
|
default_filename: "CRATE_NAME.d",
|
||||||
}
|
is_text: true,
|
||||||
}
|
compatible_with_cgus_and_single_output: true
|
||||||
|
},
|
||||||
fn from_shorthand(shorthand: &str) -> Option<Self> {
|
Exe => {
|
||||||
Some(match shorthand {
|
shorthand: "link",
|
||||||
"asm" => OutputType::Assembly,
|
extension: "",
|
||||||
"llvm-ir" => OutputType::LlvmAssembly,
|
description: "Generates the crates specified by --crate-type. This is the default if --emit is not specified",
|
||||||
"mir" => OutputType::Mir,
|
default_filename: "(platform and crate-type dependent)",
|
||||||
"llvm-bc" => OutputType::Bitcode,
|
is_text: false,
|
||||||
"thin-link-bitcode" => OutputType::ThinLinkBitcode,
|
compatible_with_cgus_and_single_output: true
|
||||||
"obj" => OutputType::Object,
|
},
|
||||||
"metadata" => OutputType::Metadata,
|
LlvmAssembly => {
|
||||||
"link" => OutputType::Exe,
|
shorthand: "llvm-ir",
|
||||||
"dep-info" => OutputType::DepInfo,
|
extension: "ll",
|
||||||
_ => return None,
|
description: "Generates a file containing LLVM IR",
|
||||||
})
|
default_filename: "CRATE_NAME.ll",
|
||||||
}
|
is_text: true,
|
||||||
|
compatible_with_cgus_and_single_output: false
|
||||||
fn shorthands_display() -> String {
|
},
|
||||||
format!(
|
Metadata => {
|
||||||
"`{}`, `{}`, `{}`, `{}`, `{}`, `{}`, `{}`, `{}`, `{}`",
|
shorthand: "metadata",
|
||||||
OutputType::Bitcode.shorthand(),
|
extension: "rmeta",
|
||||||
OutputType::ThinLinkBitcode.shorthand(),
|
description: "Generates a file containing metadata about the crate",
|
||||||
OutputType::Assembly.shorthand(),
|
default_filename: "libCRATE_NAME.rmeta",
|
||||||
OutputType::LlvmAssembly.shorthand(),
|
is_text: false,
|
||||||
OutputType::Mir.shorthand(),
|
compatible_with_cgus_and_single_output: true
|
||||||
OutputType::Object.shorthand(),
|
},
|
||||||
OutputType::Metadata.shorthand(),
|
Mir => {
|
||||||
OutputType::Exe.shorthand(),
|
shorthand: "mir",
|
||||||
OutputType::DepInfo.shorthand(),
|
extension: "mir",
|
||||||
)
|
description: "Generates a file containing rustc's mid-level intermediate representation",
|
||||||
}
|
default_filename: "CRATE_NAME.mir",
|
||||||
|
is_text: true,
|
||||||
pub fn extension(&self) -> &'static str {
|
compatible_with_cgus_and_single_output: false
|
||||||
match *self {
|
},
|
||||||
OutputType::Bitcode => "bc",
|
Object => {
|
||||||
OutputType::ThinLinkBitcode => "indexing.o",
|
shorthand: "obj",
|
||||||
OutputType::Assembly => "s",
|
extension: "o",
|
||||||
OutputType::LlvmAssembly => "ll",
|
description: "Generates a native object file",
|
||||||
OutputType::Mir => "mir",
|
default_filename: "CRATE_NAME.o",
|
||||||
OutputType::Object => "o",
|
is_text: false,
|
||||||
OutputType::Metadata => "rmeta",
|
compatible_with_cgus_and_single_output: false
|
||||||
OutputType::DepInfo => "d",
|
},
|
||||||
OutputType::Exe => "",
|
#[doc = "This is the summary or index data part of the ThinLTO bitcode."]
|
||||||
}
|
ThinLinkBitcode => {
|
||||||
}
|
shorthand: "thin-link-bitcode",
|
||||||
|
extension: "indexing.o",
|
||||||
pub fn is_text_output(&self) -> bool {
|
description: "Generates the ThinLTO summary as bitcode",
|
||||||
match *self {
|
default_filename: "CRATE_NAME.indexing.o",
|
||||||
OutputType::Assembly
|
is_text: false,
|
||||||
| OutputType::LlvmAssembly
|
compatible_with_cgus_and_single_output: false
|
||||||
| OutputType::Mir
|
},
|
||||||
| OutputType::DepInfo => true,
|
|
||||||
OutputType::Bitcode
|
|
||||||
| OutputType::ThinLinkBitcode
|
|
||||||
| OutputType::Object
|
|
||||||
| OutputType::Metadata
|
|
||||||
| OutputType::Exe => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of diagnostics output to generate.
|
/// The type of diagnostics output to generate.
|
||||||
|
@ -1570,6 +1651,18 @@ static PRINT_HELP: LazyLock<String> = LazyLock::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static EMIT_HELP: LazyLock<String> = LazyLock::new(|| {
|
||||||
|
let mut result =
|
||||||
|
String::from("Comma separated list of types of output for the compiler to emit.\n");
|
||||||
|
result.push_str("Each TYPE has the default FILE name:\n");
|
||||||
|
|
||||||
|
for output in OutputType::iter_all() {
|
||||||
|
result.push_str(&format!("* {} - {}\n", output.shorthand(), output.default_filename()));
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
});
|
||||||
|
|
||||||
/// Returns all rustc command line options, including metadata for
|
/// Returns all rustc command line options, including metadata for
|
||||||
/// each option, such as whether the option is stable.
|
/// each option, such as whether the option is stable.
|
||||||
pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
||||||
|
@ -1616,14 +1709,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
||||||
make_crate_type_option(),
|
make_crate_type_option(),
|
||||||
opt(Stable, Opt, "", "crate-name", "Specify the name of the crate being built", "NAME"),
|
opt(Stable, Opt, "", "crate-name", "Specify the name of the crate being built", "NAME"),
|
||||||
opt(Stable, Opt, "", "edition", &EDITION_STRING, EDITION_NAME_LIST),
|
opt(Stable, Opt, "", "edition", &EDITION_STRING, EDITION_NAME_LIST),
|
||||||
opt(
|
opt(Stable, Multi, "", "emit", &EMIT_HELP, "TYPE[=FILE]"),
|
||||||
Stable,
|
|
||||||
Multi,
|
|
||||||
"",
|
|
||||||
"emit",
|
|
||||||
"Comma separated list of types of output for the compiler to emit",
|
|
||||||
"[asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]",
|
|
||||||
),
|
|
||||||
opt(Stable, Multi, "", "print", &PRINT_HELP, "INFO[=FILE]"),
|
opt(Stable, Multi, "", "print", &PRINT_HELP, "INFO[=FILE]"),
|
||||||
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
|
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
|
||||||
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
|
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
|
||||||
|
|
|
@ -157,9 +157,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.171"
|
version = "0.2.172"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
|
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc-std-workspace-core",
|
"rustc-std-workspace-core",
|
||||||
]
|
]
|
||||||
|
|
|
@ -35,7 +35,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
|
||||||
addr2line = { version = "0.24.0", optional = true, default-features = false }
|
addr2line = { version = "0.24.0", optional = true, default-features = false }
|
||||||
|
|
||||||
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
|
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
|
||||||
libc = { version = "0.2.171", default-features = false, features = [
|
libc = { version = "0.2.172", default-features = false, features = [
|
||||||
'rustc-dep-of-std',
|
'rustc-dep-of-std',
|
||||||
], public = true }
|
], public = true }
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,7 @@ img {
|
||||||
margin-left: -140px;
|
margin-left: -140px;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
}
|
}
|
||||||
.sidebar-resizer.active:before {
|
.sidebar-resizer.active::before {
|
||||||
border-left: solid 2px var(--sidebar-resizer-active);
|
border-left: solid 2px var(--sidebar-resizer-active);
|
||||||
display: block;
|
display: block;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -2044,7 +2044,7 @@ button#toggle-all-docs:hover, button#toggle-all-docs:focus-visible {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#settings-menu > a:before {
|
#settings-menu > a::before {
|
||||||
/* Wheel <https://www.svgrepo.com/svg/384069/settings-cog-gear> */
|
/* Wheel <https://www.svgrepo.com/svg/384069/settings-cog-gear> */
|
||||||
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
||||||
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
||||||
|
@ -2064,7 +2064,7 @@ button#toggle-all-docs:hover, button#toggle-all-docs:focus-visible {
|
||||||
filter: var(--settings-menu-filter);
|
filter: var(--settings-menu-filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
button#toggle-all-docs:before {
|
button#toggle-all-docs::before {
|
||||||
/* Custom arrow icon */
|
/* Custom arrow icon */
|
||||||
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
||||||
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
||||||
|
@ -2074,14 +2074,14 @@ button#toggle-all-docs:before {
|
||||||
filter: var(--settings-menu-filter);
|
filter: var(--settings-menu-filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
button#toggle-all-docs.will-expand:before {
|
button#toggle-all-docs.will-expand::before {
|
||||||
/* Custom arrow icon */
|
/* Custom arrow icon */
|
||||||
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
||||||
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
||||||
<path d="M2,5l4,-4l4,4M2,7l4,4l4,-4" stroke="black" fill="none" stroke-width="2px"/></svg>');
|
<path d="M2,5l4,-4l4,4M2,7l4,4l4,-4" stroke="black" fill="none" stroke-width="2px"/></svg>');
|
||||||
}
|
}
|
||||||
|
|
||||||
#help-button > a:before {
|
#help-button > a::before {
|
||||||
/* Question mark with circle */
|
/* Question mark with circle */
|
||||||
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
content: url('data:image/svg+xml,<svg width="18" height="18" viewBox="0 0 12 12" \
|
||||||
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg" fill="none">\
|
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg" fill="none">\
|
||||||
|
@ -2093,17 +2093,17 @@ button#toggle-all-docs.will-expand:before {
|
||||||
filter: var(--settings-menu-filter);
|
filter: var(--settings-menu-filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
button#toggle-all-docs:before,
|
button#toggle-all-docs::before,
|
||||||
#help-button > a:before,
|
#help-button > a::before,
|
||||||
#settings-menu > a:before {
|
#settings-menu > a::before {
|
||||||
filter: var(--settings-menu-filter);
|
filter: var(--settings-menu-filter);
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media not (pointer: coarse) {
|
@media not (pointer: coarse) {
|
||||||
button#toggle-all-docs:hover:before,
|
button#toggle-all-docs:hover::before,
|
||||||
#help-button > a:hover:before,
|
#help-button > a:hover::before,
|
||||||
#settings-menu > a:hover:before {
|
#settings-menu > a:hover::before {
|
||||||
filter: var(--settings-menu-hover-filter);
|
filter: var(--settings-menu-hover-filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2125,7 +2125,7 @@ rustdoc-toolbar span.label {
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-button > a:before {
|
#sidebar-button > a::before {
|
||||||
/* sidebar resizer image */
|
/* sidebar resizer image */
|
||||||
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" \
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" \
|
||||||
fill="none" stroke="black">\
|
fill="none" stroke="black">\
|
||||||
|
@ -2400,21 +2400,21 @@ However, it's not needed with smaller screen width because the doc/code block is
|
||||||
|
|
||||||
/* sidebar button opens modal
|
/* sidebar button opens modal
|
||||||
use hamburger button */
|
use hamburger button */
|
||||||
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
|
.src #sidebar-button > a::before, .sidebar-menu-toggle::before {
|
||||||
/* hamburger button image */
|
/* hamburger button image */
|
||||||
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
||||||
viewBox="0 0 22 22" fill="none" stroke="black">\
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
||||||
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
|
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
.sidebar-menu-toggle:hover:before,
|
.sidebar-menu-toggle:hover::before,
|
||||||
.sidebar-menu-toggle:active:before,
|
.sidebar-menu-toggle:active::before,
|
||||||
.sidebar-menu-toggle:focus:before {
|
.sidebar-menu-toggle:focus::before {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* src sidebar button opens a folder view */
|
/* src sidebar button opens a folder view */
|
||||||
.src #sidebar-button > a:before {
|
.src #sidebar-button > a::before {
|
||||||
/* folder image */
|
/* folder image */
|
||||||
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
||||||
viewBox="0 0 22 22" fill="none" stroke="black">\
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
||||||
|
@ -2599,7 +2599,7 @@ in src-script.js and main.js
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sidebar button becomes topbar button */
|
/* sidebar button becomes topbar button */
|
||||||
#sidebar-button > a:before {
|
#sidebar-button > a::before {
|
||||||
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
||||||
viewBox="0 0 22 22" fill="none" stroke="black">\
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
||||||
<rect x="1" y="1" width="20" height="20" ry="1.5" stroke-width="1.5" stroke="%23777"/>\
|
<rect x="1" y="1" width="20" height="20" ry="1.5" stroke-width="1.5" stroke="%23777"/>\
|
||||||
|
@ -2608,7 +2608,7 @@ in src-script.js and main.js
|
||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
}
|
}
|
||||||
.sidebar-menu-toggle:before {
|
.sidebar-menu-toggle::before {
|
||||||
filter: var(--mobile-sidebar-menu-filter);
|
filter: var(--mobile-sidebar-menu-filter);
|
||||||
}
|
}
|
||||||
.sidebar-menu-toggle:hover {
|
.sidebar-menu-toggle:hover {
|
||||||
|
@ -3287,7 +3287,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[data-theme="ayu"] #settings-menu > a img,
|
:root[data-theme="ayu"] #settings-menu > a img,
|
||||||
:root[data-theme="ayu"] #sidebar-button > a:before {
|
:root[data-theme="ayu"] #sidebar-button > a::before {
|
||||||
filter: invert(100);
|
filter: invert(100);
|
||||||
}
|
}
|
||||||
/* End theme: ayu */
|
/* End theme: ayu */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
libdash_separated_something-extra.rmeta: dash-separated.rs
|
|
||||||
|
|
||||||
dash-separated_something-extra.d: dash-separated.rs
|
dash-separated_something-extra.d: dash-separated.rs
|
||||||
|
|
||||||
|
libdash_separated_something-extra.rmeta: dash-separated.rs
|
||||||
|
|
||||||
dash-separated.rs:
|
dash-separated.rs:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@@ -53,10 +53,27 @@
|
@@ -63,10 +63,27 @@
|
||||||
Set a codegen option
|
Set a codegen option
|
||||||
-V, --version Print version info and exit
|
-V, --version Print version info and exit
|
||||||
-v, --verbose Use verbose output
|
-v, --verbose Use verbose output
|
||||||
|
|
|
@ -26,9 +26,19 @@ Options:
|
||||||
Specify which edition of the compiler to use when
|
Specify which edition of the compiler to use when
|
||||||
compiling code. The default is 2015 and the latest
|
compiling code. The default is 2015 and the latest
|
||||||
stable edition is 2024.
|
stable edition is 2024.
|
||||||
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
--emit TYPE[=FILE]
|
||||||
Comma separated list of types of output for the
|
Comma separated list of types of output for the
|
||||||
compiler to emit
|
compiler to emit.
|
||||||
|
Each TYPE has the default FILE name:
|
||||||
|
* asm - CRATE_NAME.s
|
||||||
|
* llvm-bc - CRATE_NAME.bc
|
||||||
|
* dep-info - CRATE_NAME.d
|
||||||
|
* link - (platform and crate-type dependent)
|
||||||
|
* llvm-ir - CRATE_NAME.ll
|
||||||
|
* metadata - libCRATE_NAME.rmeta
|
||||||
|
* mir - CRATE_NAME.mir
|
||||||
|
* obj - CRATE_NAME.o
|
||||||
|
* thin-link-bitcode - CRATE_NAME.indexing.o
|
||||||
--print INFO[=FILE]
|
--print INFO[=FILE]
|
||||||
Compiler information to print on stdout (or to a file)
|
Compiler information to print on stdout (or to a file)
|
||||||
INFO may be one of
|
INFO may be one of
|
||||||
|
|
|
@ -26,9 +26,19 @@ Options:
|
||||||
Specify which edition of the compiler to use when
|
Specify which edition of the compiler to use when
|
||||||
compiling code. The default is 2015 and the latest
|
compiling code. The default is 2015 and the latest
|
||||||
stable edition is 2024.
|
stable edition is 2024.
|
||||||
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
--emit TYPE[=FILE]
|
||||||
Comma separated list of types of output for the
|
Comma separated list of types of output for the
|
||||||
compiler to emit
|
compiler to emit.
|
||||||
|
Each TYPE has the default FILE name:
|
||||||
|
* asm - CRATE_NAME.s
|
||||||
|
* llvm-bc - CRATE_NAME.bc
|
||||||
|
* dep-info - CRATE_NAME.d
|
||||||
|
* link - (platform and crate-type dependent)
|
||||||
|
* llvm-ir - CRATE_NAME.ll
|
||||||
|
* metadata - libCRATE_NAME.rmeta
|
||||||
|
* mir - CRATE_NAME.mir
|
||||||
|
* obj - CRATE_NAME.o
|
||||||
|
* thin-link-bitcode - CRATE_NAME.indexing.o
|
||||||
--print INFO[=FILE]
|
--print INFO[=FILE]
|
||||||
Compiler information to print on stdout (or to a file)
|
Compiler information to print on stdout (or to a file)
|
||||||
INFO may be one of
|
INFO may be one of
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
trait Foo {
|
||||||
|
fn rpitit() -> impl Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure that we don't try to probe the name of the RPITIT when looking for
|
||||||
|
// fixes to suggest for the redundant generic below.
|
||||||
|
|
||||||
|
fn test<T: Foo<i32, Assoc = i32>>() {}
|
||||||
|
//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
//~| ERROR associated type `Assoc` not found for `Foo`
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,24 @@
|
||||||
|
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
--> $DIR/dont-probe-missing-item-name-2.rs:8:12
|
||||||
|
|
|
||||||
|
LL | fn test<T: Foo<i32, Assoc = i32>>() {}
|
||||||
|
| ^^^------------------ help: remove the unnecessary generics
|
||||||
|
| |
|
||||||
|
| expected 0 generic arguments
|
||||||
|
|
|
||||||
|
note: trait defined here, with 0 generic parameters
|
||||||
|
--> $DIR/dont-probe-missing-item-name-2.rs:1:7
|
||||||
|
|
|
||||||
|
LL | trait Foo {
|
||||||
|
| ^^^
|
||||||
|
|
||||||
|
error[E0220]: associated type `Assoc` not found for `Foo`
|
||||||
|
--> $DIR/dont-probe-missing-item-name-2.rs:8:21
|
||||||
|
|
|
||||||
|
LL | fn test<T: Foo<i32, Assoc = i32>>() {}
|
||||||
|
| ^^^^^ associated type `Assoc` not found
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0107, E0220.
|
||||||
|
For more information about an error, try `rustc --explain E0107`.
|
|
@ -0,0 +1,11 @@
|
||||||
|
trait Trait {
|
||||||
|
fn method() -> impl Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure that we don't try to probe the name of the RPITIT when looking for
|
||||||
|
// fixes to suggest for the missing associated type's trait path below.
|
||||||
|
|
||||||
|
fn foo() -> i32::Assoc {}
|
||||||
|
//~^ ERROR ambiguous associated type
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,15 @@
|
||||||
|
error[E0223]: ambiguous associated type
|
||||||
|
--> $DIR/dont-probe-missing-item-name-3.rs:8:13
|
||||||
|
|
|
||||||
|
LL | fn foo() -> i32::Assoc {}
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
help: if there were a trait named `Example` with associated type `Assoc` implemented for `i32`, you could use the fully-qualified path
|
||||||
|
|
|
||||||
|
LL - fn foo() -> i32::Assoc {}
|
||||||
|
LL + fn foo() -> <i32 as Example>::Assoc {}
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0223`.
|
|
@ -0,0 +1,2 @@
|
||||||
|
//@ compile-flags: --emit
|
||||||
|
//@ error-pattern: Argument to option 'emit' missing
|
|
@ -0,0 +1,15 @@
|
||||||
|
error: Argument to option 'emit' missing
|
||||||
|
Usage:
|
||||||
|
--emit TYPE[=FILE] Comma separated list of types of output for the
|
||||||
|
compiler to emit.
|
||||||
|
Each TYPE has the default FILE name:
|
||||||
|
* asm - CRATE_NAME.s
|
||||||
|
* llvm-bc - CRATE_NAME.bc
|
||||||
|
* dep-info - CRATE_NAME.d
|
||||||
|
* link - (platform and crate-type dependent)
|
||||||
|
* llvm-ir - CRATE_NAME.ll
|
||||||
|
* metadata - libCRATE_NAME.rmeta
|
||||||
|
* mir - CRATE_NAME.mir
|
||||||
|
* obj - CRATE_NAME.o
|
||||||
|
* thin-link-bitcode - CRATE_NAME.indexing.o
|
||||||
|
|
20
tests/ui/typeck/pointer-arith-assign.fixed
Normal file
20
tests/ui/typeck/pointer-arith-assign.fixed
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
//@ run-rustfix
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![allow(unused_variables)]
|
||||||
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
|
fn test_add_assign_raw_pointer() {
|
||||||
|
let mut arr = [0u8; 10];
|
||||||
|
let mut _ptr = arr.as_mut_ptr();
|
||||||
|
|
||||||
|
_ptr = _ptr.wrapping_add(2); //~ ERROR binary assignment operation `+=` cannot be applied to type `*mut u8` [E0368]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_sub_assign_raw_pointer() {
|
||||||
|
let mut arr = [0u8; 10];
|
||||||
|
let mut _ptr = arr.as_mut_ptr();
|
||||||
|
|
||||||
|
_ptr = _ptr.wrapping_sub(2); //~ ERROR binary assignment operation `-=` cannot be applied to type `*mut u8` [E0368]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
20
tests/ui/typeck/pointer-arith-assign.rs
Normal file
20
tests/ui/typeck/pointer-arith-assign.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
//@ run-rustfix
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![allow(unused_variables)]
|
||||||
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
|
fn test_add_assign_raw_pointer() {
|
||||||
|
let mut arr = [0u8; 10];
|
||||||
|
let mut _ptr = arr.as_mut_ptr();
|
||||||
|
|
||||||
|
_ptr += 2; //~ ERROR binary assignment operation `+=` cannot be applied to type `*mut u8` [E0368]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_sub_assign_raw_pointer() {
|
||||||
|
let mut arr = [0u8; 10];
|
||||||
|
let mut _ptr = arr.as_mut_ptr();
|
||||||
|
|
||||||
|
_ptr -= 2; //~ ERROR binary assignment operation `-=` cannot be applied to type `*mut u8` [E0368]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
31
tests/ui/typeck/pointer-arith-assign.stderr
Normal file
31
tests/ui/typeck/pointer-arith-assign.stderr
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
error[E0368]: binary assignment operation `+=` cannot be applied to type `*mut u8`
|
||||||
|
--> $DIR/pointer-arith-assign.rs:10:5
|
||||||
|
|
|
||||||
|
LL | _ptr += 2;
|
||||||
|
| ----^^^^^
|
||||||
|
| |
|
||||||
|
| cannot use `+=` on type `*mut u8`
|
||||||
|
|
|
||||||
|
help: consider using `add` or `wrapping_add` to do pointer arithmetic
|
||||||
|
|
|
||||||
|
LL - _ptr += 2;
|
||||||
|
LL + _ptr = _ptr.wrapping_add(2);
|
||||||
|
|
|
||||||
|
|
||||||
|
error[E0368]: binary assignment operation `-=` cannot be applied to type `*mut u8`
|
||||||
|
--> $DIR/pointer-arith-assign.rs:17:5
|
||||||
|
|
|
||||||
|
LL | _ptr -= 2;
|
||||||
|
| ----^^^^^
|
||||||
|
| |
|
||||||
|
| cannot use `-=` on type `*mut u8`
|
||||||
|
|
|
||||||
|
help: consider using `sub` or `wrapping_sub` to do pointer arithmetic
|
||||||
|
|
|
||||||
|
LL - _ptr -= 2;
|
||||||
|
LL + _ptr = _ptr.wrapping_sub(2);
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0368`.
|
Loading…
Add table
Add a link
Reference in a new issue