Auto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
Rollup of 16 pull requests Successful merges: - #76635 (Add [T]::as_chunks(_mut)) - #77703 (add system-llvm-libunwind config option) - #78219 (Prefer to use `print_def_path`) - #78298 (Add test for bad NLL higher-ranked subtype) - #78332 (Update description for error E0308) - #78342 (Use check-pass in single-use-lifetime ui tests) - #78347 (Add lexicographical comparison doc) - #78348 (Make some functions private that don't have to be public) - #78349 (Use its own `TypeckResults` to avoid ICE) - #78375 (Use ? in core/std macros) - #78377 (Fix typo in debug statement) - #78388 (Add some regression tests) - #78394 (fix(docs): typo in BufWriter documentation) - #78396 (Add compiler support for LLVM's x86_64 ERMSB feature) - #78405 (Fix typo in lint description) - #78412 (Improve formatting of hash collections docs) Failed merges: r? `@ghost`
This commit is contained in:
commit
28f03ac4c0
51 changed files with 558 additions and 262 deletions
|
@ -63,6 +63,7 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|||
("bmi1", None),
|
||||
("bmi2", None),
|
||||
("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)),
|
||||
("ermsb", Some(sym::ermsb_target_feature)),
|
||||
("f16c", Some(sym::f16c_target_feature)),
|
||||
("fma", None),
|
||||
("fxsr", None),
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
Expected type did not match the received type.
|
||||
|
||||
Erroneous code example:
|
||||
Erroneous code examples:
|
||||
|
||||
```compile_fail,E0308
|
||||
let x: i32 = "I am not a number!";
|
||||
// ~~~ ~~~~~~~~~~~~~~~~~~~~
|
||||
// | |
|
||||
// | initializing expression;
|
||||
// | compiler infers type `&str`
|
||||
// |
|
||||
// type `i32` assigned to variable `x`
|
||||
fn plus_one(x: i32) -> i32 {
|
||||
x + 1
|
||||
}
|
||||
|
||||
plus_one("Not a number");
|
||||
// ^^^^^^^^^^^^^^ expected `i32`, found `&str`
|
||||
|
||||
if "Not a bool" {
|
||||
// ^^^^^^^^^^^^ expected `bool`, found `&str`
|
||||
}
|
||||
|
||||
let x: f32 = "Not a float";
|
||||
// --- ^^^^^^^^^^^^^ expected `f32`, found `&str`
|
||||
// |
|
||||
// expected due to this
|
||||
```
|
||||
|
||||
This error occurs when the compiler is unable to infer the concrete type of a
|
||||
variable. It can occur in several cases, the most common being a mismatch
|
||||
between two types: the type the author explicitly assigned, and the type the
|
||||
compiler inferred.
|
||||
This error occurs when an expression was used in a place where the compiler
|
||||
expected an expression of a different type. It can occur in several cases, the
|
||||
most common being when calling a function and passing an argument which has a
|
||||
different type than the matching type in the function declaration.
|
||||
|
|
|
@ -243,6 +243,7 @@ declare_features! (
|
|||
(active, rtm_target_feature, "1.35.0", Some(44839), None),
|
||||
(active, f16c_target_feature, "1.36.0", Some(44839), None),
|
||||
(active, riscv_target_feature, "1.45.0", Some(44839), None),
|
||||
(active, ermsb_target_feature, "1.49.0", Some(44839), None),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// feature-group-end: actual feature gates (target features)
|
||||
|
|
|
@ -658,7 +658,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||
let span = self.tcx().hir().span(hir_id);
|
||||
p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
|
||||
} else {
|
||||
p!(write("@{}", self.tcx().def_path_str(did)));
|
||||
p!(write("@"), print_def_path(did, substs));
|
||||
}
|
||||
} else {
|
||||
p!(print_def_path(did, substs));
|
||||
|
@ -694,7 +694,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||
p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
|
||||
}
|
||||
} else {
|
||||
p!(write("@{}", self.tcx().def_path_str(did)));
|
||||
p!(write("@"), print_def_path(did, substs));
|
||||
}
|
||||
} else {
|
||||
p!(print_def_path(did, substs));
|
||||
|
|
|
@ -231,7 +231,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let arm_end_blocks: Vec<_> = arm_candidates
|
||||
.into_iter()
|
||||
.map(|(arm, candidate)| {
|
||||
debug!("lowering arm {:?}\ncanidate = {:?}", arm, candidate);
|
||||
debug!("lowering arm {:?}\ncandidate = {:?}", arm, candidate);
|
||||
|
||||
let arm_source_info = self.source_info(arm.span);
|
||||
let arm_scope = (arm.scope, arm_source_info);
|
||||
|
|
|
@ -630,9 +630,14 @@ impl<'tcx> SaveContext<'tcx> {
|
|||
})
|
||||
| Node::Ty(&hir::Ty { kind: hir::TyKind::Path(ref qpath), .. }) => match qpath {
|
||||
hir::QPath::Resolved(_, path) => path.res,
|
||||
hir::QPath::TypeRelative(..) | hir::QPath::LangItem(..) => self
|
||||
.maybe_typeck_results
|
||||
.map_or(Res::Err, |typeck_results| typeck_results.qpath_res(qpath, hir_id)),
|
||||
hir::QPath::TypeRelative(..) | hir::QPath::LangItem(..) => {
|
||||
// #75962: `self.typeck_results` may be different from the `hir_id`'s result.
|
||||
if self.tcx.has_typeck_results(hir_id.owner.to_def_id()) {
|
||||
self.tcx.typeck(hir_id.owner).qpath_res(qpath, hir_id)
|
||||
} else {
|
||||
Res::Err
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Node::Binding(&hir::Pat {
|
||||
|
|
|
@ -262,7 +262,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
|||
} else {
|
||||
let start = offset + prefix.len() + 5;
|
||||
let end = start + name.len();
|
||||
// FIXME should put the proper path in there, not elipses.
|
||||
// FIXME should put the proper path in there, not ellipsis.
|
||||
Ok(Signature {
|
||||
text: prefix + "...::" + &name,
|
||||
defs: vec![],
|
||||
|
@ -272,7 +272,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
|||
}
|
||||
hir::TyKind::Path(hir::QPath::TypeRelative(ty, segment)) => {
|
||||
let nested_ty = ty.make(offset + 1, id, scx)?;
|
||||
let prefix = format!("<{}>::", nested_ty.text,);
|
||||
let prefix = format!("<{}>::", nested_ty.text);
|
||||
|
||||
let name = path_segment_to_string(segment);
|
||||
let res = scx.get_path_res(id.ok_or("Missing id for Path")?);
|
||||
|
@ -551,7 +551,7 @@ impl<'hir> Sig for hir::Item<'hir> {
|
|||
// FIXME where clause
|
||||
}
|
||||
hir::ItemKind::ForeignMod(_) => Err("extern mod"),
|
||||
hir::ItemKind::GlobalAsm(_) => Err("glboal asm"),
|
||||
hir::ItemKind::GlobalAsm(_) => Err("global asm"),
|
||||
hir::ItemKind::ExternCrate(_) => Err("extern crate"),
|
||||
hir::ItemKind::OpaqueTy(..) => Err("opaque type"),
|
||||
// FIXME should implement this (e.g., pub use).
|
||||
|
|
|
@ -2648,7 +2648,7 @@ declare_lint! {
|
|||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `uninhabited_static` lint detects uninhbaited statics.
|
||||
/// The `uninhabited_static` lint detects uninhabited statics.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
|
|
|
@ -467,6 +467,7 @@ symbols! {
|
|||
encode,
|
||||
env,
|
||||
eq,
|
||||
ermsb_target_feature,
|
||||
err,
|
||||
exact_div,
|
||||
except,
|
||||
|
|
|
@ -2409,6 +2409,7 @@ fn from_target_feature(
|
|||
Some(sym::movbe_target_feature) => rust_features.movbe_target_feature,
|
||||
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature,
|
||||
Some(sym::f16c_target_feature) => rust_features.f16c_target_feature,
|
||||
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
|
||||
Some(name) => bug!("unknown target feature gate {}", name),
|
||||
None => true,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue