Auto merge of #112013 - matthiaskrgr:rollup-a4pg2p8, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #111714 (Stop confusing specification levels when computing expectations.) - #111927 (Migrate `item_static` to Askama) - #111954 (improve error message for calling a method on a raw pointer with an unknown pointee) - #111973 (Update current implementation comments for `select_nth_unstable`) - #111976 (Generate docs for bootstrap itself) - #111977 (Make errors from `x doc` less verbose) - #111987 (do not prefer substs relate during coherence) - #111991 (Change ty and const error's pretty printing to be in braces) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
19ed0aade6
23 changed files with 142 additions and 46 deletions
|
@ -1159,7 +1159,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
// those that do.
|
// those that do.
|
||||||
self.one_bound_for_assoc_type(
|
self.one_bound_for_assoc_type(
|
||||||
|| traits::supertraits(tcx, trait_ref),
|
|| traits::supertraits(tcx, trait_ref),
|
||||||
trait_ref.print_only_trait_path(),
|
trait_ref.skip_binder().print_only_trait_name(),
|
||||||
binding.item_name,
|
binding.item_name,
|
||||||
path_span,
|
path_span,
|
||||||
match binding.kind {
|
match binding.kind {
|
||||||
|
|
|
@ -59,8 +59,8 @@ hir_typeck_lang_start_incorrect_param = parameter {$param_num} of the `start` la
|
||||||
hir_typeck_lang_start_incorrect_ret_ty = the return type of the `start` lang item is incorrect
|
hir_typeck_lang_start_incorrect_ret_ty = the return type of the `start` lang item is incorrect
|
||||||
.suggestion = change the type from `{$found_ty}` to `{$expected_ty}`
|
.suggestion = change the type from `{$found_ty}` to `{$expected_ty}`
|
||||||
|
|
||||||
hir_typeck_method_call_on_unknown_type =
|
hir_typeck_method_call_on_unknown_raw_pointee =
|
||||||
the type of this value must be known to call a method on a raw pointer on it
|
cannot call a method on a raw pointer with an unknown pointee type
|
||||||
|
|
||||||
hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}`
|
hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}`
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ pub struct StructExprNonExhaustive {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(hir_typeck_method_call_on_unknown_type, code = "E0699")]
|
#[diag(hir_typeck_method_call_on_unknown_raw_pointee, code = "E0699")]
|
||||||
pub struct MethodCallOnUnknownType {
|
pub struct MethodCallOnUnknownRawPointee {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ use super::CandidateSource;
|
||||||
use super::MethodError;
|
use super::MethodError;
|
||||||
use super::NoMatchData;
|
use super::NoMatchData;
|
||||||
|
|
||||||
use crate::errors::MethodCallOnUnknownType;
|
use crate::errors::MethodCallOnUnknownRawPointee;
|
||||||
use crate::FnCtxt;
|
use crate::FnCtxt;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
|
@ -438,7 +438,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// so we do a future-compat lint here for the 2015 edition
|
// so we do a future-compat lint here for the 2015 edition
|
||||||
// (see https://github.com/rust-lang/rust/issues/46906)
|
// (see https://github.com/rust-lang/rust/issues/46906)
|
||||||
if self.tcx.sess.rust_2018() {
|
if self.tcx.sess.rust_2018() {
|
||||||
self.tcx.sess.emit_err(MethodCallOnUnknownType { span });
|
self.tcx.sess.emit_err(MethodCallOnUnknownRawPointee { span });
|
||||||
} else {
|
} else {
|
||||||
self.tcx.struct_span_lint_hir(
|
self.tcx.struct_span_lint_hir(
|
||||||
lint::builtin::TYVAR_BEHIND_RAW_POINTER,
|
lint::builtin::TYVAR_BEHIND_RAW_POINTER,
|
||||||
|
|
|
@ -242,7 +242,9 @@ impl LintLevelsProvider for LintLevelQueryMap<'_> {
|
||||||
|
|
||||||
struct QueryMapExpectationsWrapper<'tcx> {
|
struct QueryMapExpectationsWrapper<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
/// HirId of the currently investigated element.
|
||||||
cur: HirId,
|
cur: HirId,
|
||||||
|
/// Level map for `cur`.
|
||||||
specs: ShallowLintLevelMap,
|
specs: ShallowLintLevelMap,
|
||||||
expectations: Vec<(LintExpectationId, LintExpectation)>,
|
expectations: Vec<(LintExpectationId, LintExpectation)>,
|
||||||
unstable_to_stable_ids: FxHashMap<LintExpectationId, LintExpectationId>,
|
unstable_to_stable_ids: FxHashMap<LintExpectationId, LintExpectationId>,
|
||||||
|
@ -255,11 +257,11 @@ impl LintLevelsProvider for QueryMapExpectationsWrapper<'_> {
|
||||||
self.specs.specs.get(&self.cur.local_id).unwrap_or(&self.empty)
|
self.specs.specs.get(&self.cur.local_id).unwrap_or(&self.empty)
|
||||||
}
|
}
|
||||||
fn insert(&mut self, id: LintId, lvl: LevelAndSource) {
|
fn insert(&mut self, id: LintId, lvl: LevelAndSource) {
|
||||||
let specs = self.specs.specs.get_mut_or_insert_default(self.cur.local_id);
|
self.specs.specs.get_mut_or_insert_default(self.cur.local_id).insert(id, lvl);
|
||||||
specs.clear();
|
|
||||||
specs.insert(id, lvl);
|
|
||||||
}
|
}
|
||||||
fn get_lint_level(&self, lint: &'static Lint, _: &Session) -> LevelAndSource {
|
fn get_lint_level(&self, lint: &'static Lint, _: &Session) -> LevelAndSource {
|
||||||
|
// We cannot use `tcx.lint_level_at_node` because we want to know in which order the
|
||||||
|
// attributes have been inserted, in particular whether an `expect` follows a `forbid`.
|
||||||
self.specs.lint_level_id_at_node(self.tcx, LintId::of(lint), self.cur)
|
self.specs.lint_level_id_at_node(self.tcx, LintId::of(lint), self.cur)
|
||||||
}
|
}
|
||||||
fn push_expectation(&mut self, id: LintExpectationId, expectation: LintExpectation) {
|
fn push_expectation(&mut self, id: LintExpectationId, expectation: LintExpectation) {
|
||||||
|
@ -355,7 +357,9 @@ impl<'tcx> Visitor<'tcx> for LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> {
|
||||||
|
|
||||||
impl<'tcx> LintLevelsBuilder<'_, QueryMapExpectationsWrapper<'tcx>> {
|
impl<'tcx> LintLevelsBuilder<'_, QueryMapExpectationsWrapper<'tcx>> {
|
||||||
fn add_id(&mut self, hir_id: HirId) {
|
fn add_id(&mut self, hir_id: HirId) {
|
||||||
|
// Change both the `HirId` and the associated specs.
|
||||||
self.provider.cur = hir_id;
|
self.provider.cur = hir_id;
|
||||||
|
self.provider.specs.specs.clear();
|
||||||
self.add(self.provider.tcx.hir().attrs(hir_id), hir_id == hir::CRATE_HIR_ID, Some(hir_id));
|
self.add(self.provider.tcx.hir().attrs(hir_id), hir_id == hir::CRATE_HIR_ID, Some(hir_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,7 +700,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||||
if verbose { p!(write("{:?}", infer_ty)) } else { p!(write("{}", infer_ty)) }
|
if verbose { p!(write("{:?}", infer_ty)) } else { p!(write("{}", infer_ty)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::Error(_) => p!("[type error]"),
|
ty::Error(_) => p!("{{type error}}"),
|
||||||
ty::Param(ref param_ty) => p!(print(param_ty)),
|
ty::Param(ref param_ty) => p!(print(param_ty)),
|
||||||
ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
|
ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
|
||||||
ty::BoundTyKind::Anon => debug_bound_var(&mut self, debruijn, bound_ty.var)?,
|
ty::BoundTyKind::Anon => debug_bound_var(&mut self, debruijn, bound_ty.var)?,
|
||||||
|
@ -1379,8 +1379,8 @@ pub trait PrettyPrinter<'tcx>:
|
||||||
},
|
},
|
||||||
// FIXME(generic_const_exprs):
|
// FIXME(generic_const_exprs):
|
||||||
// write out some legible representation of an abstract const?
|
// write out some legible representation of an abstract const?
|
||||||
ty::ConstKind::Expr(_) => p!("[const expr]"),
|
ty::ConstKind::Expr(_) => p!("{{const expr}}"),
|
||||||
ty::ConstKind::Error(_) => p!("[const error]"),
|
ty::ConstKind::Error(_) => p!("{{const error}}"),
|
||||||
};
|
};
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,13 +231,21 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let mut candidates = Vec::new();
|
let mut candidates = Vec::new();
|
||||||
// LHS normalizes-to RHS
|
// LHS normalizes-to RHS
|
||||||
candidates.extend(
|
candidates.extend(evaluate_normalizes_to(
|
||||||
evaluate_normalizes_to(self, alias_lhs, rhs, direction, Invert::No).ok(),
|
self,
|
||||||
);
|
alias_lhs,
|
||||||
|
rhs,
|
||||||
|
direction,
|
||||||
|
Invert::No,
|
||||||
|
));
|
||||||
// RHS normalizes-to RHS
|
// RHS normalizes-to RHS
|
||||||
candidates.extend(
|
candidates.extend(evaluate_normalizes_to(
|
||||||
evaluate_normalizes_to(self, alias_rhs, lhs, direction, Invert::Yes).ok(),
|
self,
|
||||||
);
|
alias_rhs,
|
||||||
|
lhs,
|
||||||
|
direction,
|
||||||
|
Invert::Yes,
|
||||||
|
));
|
||||||
// Relate via substs
|
// Relate via substs
|
||||||
let subst_relate_response = self.probe(|ecx| {
|
let subst_relate_response = self.probe(|ecx| {
|
||||||
let span = tracing::span!(
|
let span = tracing::span!(
|
||||||
|
@ -265,10 +273,18 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
if let Some(merged) = self.try_merge_responses(&candidates) {
|
if let Some(merged) = self.try_merge_responses(&candidates) {
|
||||||
Ok(merged)
|
Ok(merged)
|
||||||
} else if let Ok(subst_relate_response) = subst_relate_response {
|
|
||||||
Ok(subst_relate_response)
|
|
||||||
} else {
|
} else {
|
||||||
self.flounder(&candidates)
|
// When relating two aliases and we have ambiguity, we prefer
|
||||||
|
// relating the generic arguments of the aliases over normalizing
|
||||||
|
// them. This is necessary for inference during typeck.
|
||||||
|
//
|
||||||
|
// As this is incomplete, we must not do so during coherence.
|
||||||
|
match (self.solver_mode(), subst_relate_response) {
|
||||||
|
(SolverMode::Normal, Ok(response)) => Ok(response),
|
||||||
|
(SolverMode::Normal, Err(NoSolution)) | (SolverMode::Coherence, _) => {
|
||||||
|
self.flounder(&candidates)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3005,8 +3005,9 @@ impl<T> [T] {
|
||||||
///
|
///
|
||||||
/// # Current implementation
|
/// # Current implementation
|
||||||
///
|
///
|
||||||
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
|
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
|
||||||
/// used for [`sort_unstable`].
|
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
|
||||||
|
/// pivot selection, which guarantees linear runtime for all inputs.
|
||||||
///
|
///
|
||||||
/// [`sort_unstable`]: slice::sort_unstable
|
/// [`sort_unstable`]: slice::sort_unstable
|
||||||
///
|
///
|
||||||
|
@ -3056,8 +3057,9 @@ impl<T> [T] {
|
||||||
///
|
///
|
||||||
/// # Current implementation
|
/// # Current implementation
|
||||||
///
|
///
|
||||||
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
|
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
|
||||||
/// used for [`sort_unstable`].
|
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
|
||||||
|
/// pivot selection, which guarantees linear runtime for all inputs.
|
||||||
///
|
///
|
||||||
/// [`sort_unstable`]: slice::sort_unstable
|
/// [`sort_unstable`]: slice::sort_unstable
|
||||||
///
|
///
|
||||||
|
|
|
@ -264,7 +264,7 @@ impl PathSet {
|
||||||
|
|
||||||
/// A convenience wrapper for Steps which know they have no aliases and all their sets contain only a single path.
|
/// A convenience wrapper for Steps which know they have no aliases and all their sets contain only a single path.
|
||||||
///
|
///
|
||||||
/// This can be used with [`ShouldRun::krate`], [`ShouldRun::path`], or [`ShouldRun::alias`].
|
/// This can be used with [`ShouldRun::crate_or_deps`], [`ShouldRun::path`], or [`ShouldRun::alias`].
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn assert_single_path(&self) -> &TaskPath {
|
pub fn assert_single_path(&self) -> &TaskPath {
|
||||||
match self {
|
match self {
|
||||||
|
@ -787,6 +787,7 @@ impl<'a> Builder<'a> {
|
||||||
doc::EditionGuide,
|
doc::EditionGuide,
|
||||||
doc::StyleGuide,
|
doc::StyleGuide,
|
||||||
doc::Tidy,
|
doc::Tidy,
|
||||||
|
doc::Bootstrap,
|
||||||
),
|
),
|
||||||
Kind::Dist => describe!(
|
Kind::Dist => describe!(
|
||||||
dist::Docs,
|
dist::Docs,
|
||||||
|
@ -1915,10 +1916,10 @@ impl<'a> Builder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
||||||
// This replaces spaces with newlines because RUSTDOCFLAGS does not
|
// This replaces spaces with tabs because RUSTDOCFLAGS does not
|
||||||
// support arguments with regular spaces. Hopefully someday Cargo will
|
// support arguments with regular spaces. Hopefully someday Cargo will
|
||||||
// have space support.
|
// have space support.
|
||||||
let rust_version = self.rust_version().replace(' ', "\n");
|
let rust_version = self.rust_version().replace(' ', "\t");
|
||||||
rustdocflags.arg("--crate-version").arg(&rust_version);
|
rustdocflags.arg("--crate-version").arg(&rust_version);
|
||||||
|
|
||||||
// Environment variables *required* throughout the build
|
// Environment variables *required* throughout the build
|
||||||
|
|
|
@ -839,6 +839,8 @@ macro_rules! tool_doc {
|
||||||
)+
|
)+
|
||||||
|
|
||||||
cargo.rustdocflag("--document-private-items");
|
cargo.rustdocflag("--document-private-items");
|
||||||
|
// Since we always pass --document-private-items, there's no need to warn about linking to private items.
|
||||||
|
cargo.rustdocflag("-Arustdoc::private-intra-doc-links");
|
||||||
cargo.rustdocflag("--enable-index-page");
|
cargo.rustdocflag("--enable-index-page");
|
||||||
cargo.rustdocflag("--show-type-layout");
|
cargo.rustdocflag("--show-type-layout");
|
||||||
cargo.rustdocflag("--generate-link-to-definition");
|
cargo.rustdocflag("--generate-link-to-definition");
|
||||||
|
@ -882,7 +884,8 @@ tool_doc!(
|
||||||
// "cargo-credential-wincred",
|
// "cargo-credential-wincred",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
tool_doc!(Tidy, "tidy", "src/tools/tidy", ["tidy"]);
|
tool_doc!(Tidy, "tidy", "src/tools/tidy", rustc_tool = false, ["tidy"]);
|
||||||
|
tool_doc!(Bootstrap, "bootstrap", "src/bootstrap", rustc_tool = false, ["bootstrap"]);
|
||||||
|
|
||||||
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
pub struct ErrorIndex {
|
pub struct ErrorIndex {
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl Config {
|
||||||
/// This is only required on NixOS and uses the PatchELF utility to
|
/// This is only required on NixOS and uses the PatchELF utility to
|
||||||
/// change the interpreter/RPATH of ELF executables.
|
/// change the interpreter/RPATH of ELF executables.
|
||||||
///
|
///
|
||||||
/// Please see https://nixos.org/patchelf.html for more information
|
/// Please see <https://nixos.org/patchelf.html> for more information
|
||||||
fn fix_bin_or_dylib(&self, fname: &Path) {
|
fn fix_bin_or_dylib(&self, fname: &Path) {
|
||||||
assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true));
|
assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true));
|
||||||
println!("attempting to patch {}", fname.display());
|
println!("attempting to patch {}", fname.display());
|
||||||
|
|
|
@ -1011,6 +1011,8 @@ impl Build {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
|
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
|
||||||
|
///
|
||||||
|
/// [`Step`]: crate::builder::Step
|
||||||
fn msg(
|
fn msg(
|
||||||
&self,
|
&self,
|
||||||
action: impl Into<Kind>,
|
action: impl Into<Kind>,
|
||||||
|
@ -1035,6 +1037,8 @@ impl Build {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
|
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
|
||||||
|
///
|
||||||
|
/// [`Step`]: crate::builder::Step
|
||||||
fn msg_unstaged(
|
fn msg_unstaged(
|
||||||
&self,
|
&self,
|
||||||
action: impl Into<Kind>,
|
action: impl Into<Kind>,
|
||||||
|
|
|
@ -488,7 +488,7 @@ fn absolute_windows(path: &std::path::Path) -> std::io::Result<std::path::PathBu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adapted from https://github.com/llvm/llvm-project/blob/782e91224601e461c019e0a4573bbccc6094fbcd/llvm/cmake/modules/HandleLLVMOptions.cmake#L1058-L1079
|
/// Adapted from <https://github.com/llvm/llvm-project/blob/782e91224601e461c019e0a4573bbccc6094fbcd/llvm/cmake/modules/HandleLLVMOptions.cmake#L1058-L1079>
|
||||||
///
|
///
|
||||||
/// When `clang-cl` is used with instrumentation, we need to add clang's runtime library resource
|
/// When `clang-cl` is used with instrumentation, we need to add clang's runtime library resource
|
||||||
/// directory to the linker flags, otherwise there will be linker errors about the profiler runtime
|
/// directory to the linker flags, otherwise there will be linker errors about the profiler runtime
|
||||||
|
|
|
@ -1541,11 +1541,12 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
|
||||||
write!(w, "{}", document_type_layout(cx, def_id));
|
write!(w, "{}", document_type_layout(cx, def_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Static) {
|
fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Static) {
|
||||||
wrap_item(w, |w| {
|
let mut buffer = Buffer::new();
|
||||||
render_attributes_in_code(w, it, cx.tcx());
|
wrap_item(&mut buffer, |buffer| {
|
||||||
|
render_attributes_in_code(buffer, it, cx.tcx());
|
||||||
write!(
|
write!(
|
||||||
w,
|
buffer,
|
||||||
"{vis}static {mutability}{name}: {typ}",
|
"{vis}static {mutability}{name}: {typ}",
|
||||||
vis = visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
|
vis = visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
|
||||||
mutability = s.mutability.print_with_space(),
|
mutability = s.mutability.print_with_space(),
|
||||||
|
@ -1553,7 +1554,10 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
|
||||||
typ = s.type_.print(cx)
|
typ = s.type_.print(cx)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))
|
|
||||||
|
write!(w, "{}", buffer.into_inner()).unwrap();
|
||||||
|
|
||||||
|
write!(w, "{}", document(cx, it, None, HeadingOffset::H2)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
|
fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
|
||||||
LL | std::mem::transmute(v)
|
LL | std::mem::transmute(v)
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: source type: `[[u32; H+1]; W]` (generic size [const expr])
|
= note: source type: `[[u32; H+1]; W]` (generic size {const expr})
|
||||||
= note: target type: `[[u32; W+1]; H]` (generic size [const expr])
|
= note: target type: `[[u32; W+1]; H]` (generic size {const expr})
|
||||||
|
|
||||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
--> $DIR/transmute-fail.rs:16:5
|
--> $DIR/transmute-fail.rs:16:5
|
||||||
|
@ -34,8 +34,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
|
||||||
LL | std::mem::transmute(v)
|
LL | std::mem::transmute(v)
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: source type: `[[u32; H]; W]` (generic size [const expr])
|
= note: source type: `[[u32; H]; W]` (generic size {const expr})
|
||||||
= note: target type: `[u32; W * H * H]` (generic size [const expr])
|
= note: target type: `[u32; W * H * H]` (generic size {const expr})
|
||||||
|
|
||||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||||
--> $DIR/transmute-fail.rs:30:5
|
--> $DIR/transmute-fail.rs:30:5
|
||||||
|
|
|
@ -7,5 +7,5 @@ fn main() {
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let y = &x as *const _;
|
let y = &x as *const _;
|
||||||
let _ = y.is_null();
|
let _ = y.is_null();
|
||||||
//~^ error: the type of this value must be known to call a method on a raw pointer on it [E0699]
|
//~^ error: cannot call a method on a raw pointer with an unknown pointee type [E0699]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0699]: the type of this value must be known to call a method on a raw pointer on it
|
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
|
||||||
--> $DIR/edition-raw-pointer-method-2018.rs:9:15
|
--> $DIR/edition-raw-pointer-method-2018.rs:9:15
|
||||||
|
|
|
|
||||||
LL | let _ = y.is_null();
|
LL | let _ = y.is_null();
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// check-pass
|
||||||
|
// compile-flags: -Dunused_attributes
|
||||||
|
|
||||||
|
#![deny(unused_crate_dependencies)]
|
||||||
|
#![feature(lint_reasons)]
|
||||||
|
|
||||||
|
fn main() {}
|
28
tests/ui/methods/call_method_unknown_pointee.rs
Normal file
28
tests/ui/methods/call_method_unknown_pointee.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// edition: 2018
|
||||||
|
|
||||||
|
// tests that the pointee type of a raw pointer must be known to call methods on it
|
||||||
|
// see also: `tests/ui/editions/edition-raw-pointer-method-2018.rs`
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let val = 1_u32;
|
||||||
|
let ptr = &val as *const u32;
|
||||||
|
unsafe {
|
||||||
|
let _a: i32 = (ptr as *const _).read();
|
||||||
|
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
|
||||||
|
let b = ptr as *const _;
|
||||||
|
let _b: u8 = b.read();
|
||||||
|
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
|
||||||
|
let _c = (ptr as *const u8).read(); // we know the type here
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut val = 2_u32;
|
||||||
|
let ptr = &mut val as *mut u32;
|
||||||
|
unsafe {
|
||||||
|
let _a: i32 = (ptr as *mut _).read();
|
||||||
|
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
|
||||||
|
let b = ptr as *mut _;
|
||||||
|
b.write(10);
|
||||||
|
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
|
||||||
|
(ptr as *mut i32).write(1000); // we know the type here
|
||||||
|
}
|
||||||
|
}
|
27
tests/ui/methods/call_method_unknown_pointee.stderr
Normal file
27
tests/ui/methods/call_method_unknown_pointee.stderr
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
|
||||||
|
--> $DIR/call_method_unknown_pointee.rs:10:41
|
||||||
|
|
|
||||||
|
LL | let _a: i32 = (ptr as *const _).read();
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
|
||||||
|
--> $DIR/call_method_unknown_pointee.rs:13:24
|
||||||
|
|
|
||||||
|
LL | let _b: u8 = b.read();
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
|
||||||
|
--> $DIR/call_method_unknown_pointee.rs:21:39
|
||||||
|
|
|
||||||
|
LL | let _a: i32 = (ptr as *mut _).read();
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
|
||||||
|
--> $DIR/call_method_unknown_pointee.rs:24:11
|
||||||
|
|
|
||||||
|
LL | b.write(10);
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0699`.
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
trait One<A> { fn foo(&self) -> A; }
|
trait One<A> { fn foo(&self) -> A; }
|
||||||
|
|
||||||
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One<()>`
|
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One`
|
||||||
{}
|
{}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0220]: associated type `Output` not found for `One<()>`
|
error[E0220]: associated type `Output` not found for `One`
|
||||||
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:16
|
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:16
|
||||||
|
|
|
|
||||||
LL | fn foo(_: &dyn One())
|
LL | fn foo(_: &dyn One())
|
||||||
|
|
|
@ -12,7 +12,7 @@ note: trait defined here, with 3 generic parameters: `A`, `B`, `C`
|
||||||
LL | trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
|
LL | trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
|
||||||
| ^^^^^ - - -
|
| ^^^^^ - - -
|
||||||
|
|
||||||
error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
|
error[E0220]: associated type `Output` not found for `Three`
|
||||||
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
||||||
|
|
|
|
||||||
LL | fn foo(_: &dyn Three())
|
LL | fn foo(_: &dyn Three())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue