mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #83225 - JohnTitor:rollup-4hnuhb8, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #82774 (Fix bad diagnostics for anon params with ref and/or qualified paths) - #82826 ((std::net::parser): Fix capitalization of IP version names) - #83092 (More precise spans for HIR paths) - #83124 (Do not insert impl_trait_in_bindings opaque definitions twice.) - #83202 (Show details in cfg version unstable book) - #83203 (Don't warn about old rustdoc lint names (temporarily)) - #83206 (Update books) - #83219 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
2c7490379d
@ -149,9 +149,17 @@ impl PathSegment {
|
||||
pub fn from_ident(ident: Ident) -> Self {
|
||||
PathSegment { ident, id: DUMMY_NODE_ID, args: None }
|
||||
}
|
||||
|
||||
pub fn path_root(span: Span) -> Self {
|
||||
PathSegment::from_ident(Ident::new(kw::PathRoot, span))
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
match &self.args {
|
||||
Some(args) => self.ident.span.to(args.span()),
|
||||
None => self.ident.span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The arguments of a path segment.
|
||||
|
@ -438,31 +438,6 @@ impl<'a> TokenStreamLowering<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
struct ImplTraitTypeIdVisitor<'a> {
|
||||
ids: &'a mut SmallVec<[NodeId; 1]>,
|
||||
}
|
||||
|
||||
impl Visitor<'_> for ImplTraitTypeIdVisitor<'_> {
|
||||
fn visit_ty(&mut self, ty: &Ty) {
|
||||
match ty.kind {
|
||||
TyKind::Typeof(_) | TyKind::BareFn(_) => return,
|
||||
|
||||
TyKind::ImplTrait(id, _) => self.ids.push(id),
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_ty(self, ty);
|
||||
}
|
||||
|
||||
fn visit_path_segment(&mut self, path_span: Span, path_segment: &PathSegment) {
|
||||
if let Some(ref p) = path_segment.args {
|
||||
if let GenericArgs::Parenthesized(_) = **p {
|
||||
return;
|
||||
}
|
||||
}
|
||||
visit::walk_path_segment(self, path_span, path_segment)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
fn lower_crate(mut self, c: &Crate) -> hir::Crate<'hir> {
|
||||
/// Full-crate AST visitor that inserts into a fresh
|
||||
@ -1789,14 +1764,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
)
|
||||
}
|
||||
|
||||
fn lower_local(&mut self, l: &Local) -> (hir::Local<'hir>, SmallVec<[NodeId; 1]>) {
|
||||
let mut ids = SmallVec::<[NodeId; 1]>::new();
|
||||
if self.sess.features_untracked().impl_trait_in_bindings {
|
||||
if let Some(ref ty) = l.ty {
|
||||
let mut visitor = ImplTraitTypeIdVisitor { ids: &mut ids };
|
||||
visitor.visit_ty(ty);
|
||||
}
|
||||
}
|
||||
fn lower_local(&mut self, l: &Local) -> hir::Local<'hir> {
|
||||
let ty = l.ty.as_ref().map(|t| {
|
||||
let mut capturable_lifetimes;
|
||||
self.lower_ty(
|
||||
@ -1815,17 +1783,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
let init = l.init.as_ref().map(|e| self.lower_expr(e));
|
||||
let hir_id = self.lower_node_id(l.id);
|
||||
self.lower_attrs(hir_id, &l.attrs);
|
||||
(
|
||||
hir::Local {
|
||||
hir_id,
|
||||
ty,
|
||||
pat: self.lower_pat(&l.pat),
|
||||
init,
|
||||
span: l.span,
|
||||
source: hir::LocalSource::Normal,
|
||||
},
|
||||
ids,
|
||||
)
|
||||
hir::Local {
|
||||
hir_id,
|
||||
ty,
|
||||
pat: self.lower_pat(&l.pat),
|
||||
init,
|
||||
span: l.span,
|
||||
source: hir::LocalSource::Normal,
|
||||
}
|
||||
}
|
||||
|
||||
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> &'hir [Ident] {
|
||||
@ -2445,27 +2410,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
fn lower_stmt(&mut self, s: &Stmt) -> SmallVec<[hir::Stmt<'hir>; 1]> {
|
||||
let (hir_id, kind) = match s.kind {
|
||||
StmtKind::Local(ref l) => {
|
||||
let (l, item_ids) = self.lower_local(l);
|
||||
let mut ids: SmallVec<[hir::Stmt<'hir>; 1]> = item_ids
|
||||
.into_iter()
|
||||
.map(|item_id| {
|
||||
let item_id = hir::ItemId {
|
||||
// All the items that `lower_local` finds are `impl Trait` types.
|
||||
def_id: self.lower_node_id(item_id).expect_owner(),
|
||||
};
|
||||
self.stmt(s.span, hir::StmtKind::Item(item_id))
|
||||
})
|
||||
.collect();
|
||||
let l = self.lower_local(l);
|
||||
let hir_id = self.lower_node_id(s.id);
|
||||
self.alias_attrs(hir_id, l.hir_id);
|
||||
ids.push({
|
||||
hir::Stmt {
|
||||
hir_id,
|
||||
kind: hir::StmtKind::Local(self.arena.alloc(l)),
|
||||
span: s.span,
|
||||
}
|
||||
});
|
||||
return ids;
|
||||
return smallvec![hir::Stmt {
|
||||
hir_id,
|
||||
kind: hir::StmtKind::Local(self.arena.alloc(l)),
|
||||
span: s.span,
|
||||
}];
|
||||
}
|
||||
StmtKind::Item(ref it) => {
|
||||
// Can only use the ID once.
|
||||
|
@ -30,6 +30,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
let partial_res =
|
||||
self.resolver.get_partial_res(id).unwrap_or_else(|| PartialRes::new(Res::Err));
|
||||
|
||||
let path_span_lo = p.span.shrink_to_lo();
|
||||
let proj_start = p.segments.len() - partial_res.unresolved_segments();
|
||||
let path = self.arena.alloc(hir::Path {
|
||||
res: self.lower_res(partial_res.base_res()),
|
||||
@ -108,7 +109,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
)
|
||||
},
|
||||
)),
|
||||
span: p.span,
|
||||
span: p.segments[..proj_start]
|
||||
.last()
|
||||
.map_or(path_span_lo, |segment| path_span_lo.to(segment.span())),
|
||||
});
|
||||
|
||||
// Simple case, either no projections, or only fully-qualified.
|
||||
@ -127,7 +130,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
// e.g., `Vec` in `Vec::new` or `<I as Iterator>::Item` in
|
||||
// `<I as Iterator>::Item::default`.
|
||||
let new_id = self.next_id();
|
||||
self.arena.alloc(self.ty_path(new_id, p.span, hir::QPath::Resolved(qself, path)))
|
||||
self.arena.alloc(self.ty_path(new_id, path.span, hir::QPath::Resolved(qself, path)))
|
||||
};
|
||||
|
||||
// Anything after the base path are associated "extensions",
|
||||
@ -141,7 +144,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
// 3. `<<std::vec::Vec<T>>::IntoIter>::Item`
|
||||
// * final path is `<<<std::vec::Vec<T>>::IntoIter>::Item>::clone`
|
||||
for (i, segment) in p.segments.iter().enumerate().skip(proj_start) {
|
||||
let segment = self.arena.alloc(self.lower_path_segment(
|
||||
let hir_segment = self.arena.alloc(self.lower_path_segment(
|
||||
p.span,
|
||||
segment,
|
||||
param_mode,
|
||||
@ -150,7 +153,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
itctx.reborrow(),
|
||||
None,
|
||||
));
|
||||
let qpath = hir::QPath::TypeRelative(ty, segment);
|
||||
let qpath = hir::QPath::TypeRelative(ty, hir_segment);
|
||||
|
||||
// It's finished, return the extension of the right node type.
|
||||
if i == p.segments.len() - 1 {
|
||||
@ -159,7 +162,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
|
||||
// Wrap the associated extension in another type node.
|
||||
let new_id = self.next_id();
|
||||
ty = self.arena.alloc(self.ty_path(new_id, p.span, qpath));
|
||||
ty = self.arena.alloc(self.ty_path(new_id, path_span_lo.to(segment.span()), qpath));
|
||||
}
|
||||
|
||||
// We should've returned in the for loop above.
|
||||
|
@ -1809,7 +1809,7 @@ impl<'hir> QPath<'hir> {
|
||||
pub fn span(&self) -> Span {
|
||||
match *self {
|
||||
QPath::Resolved(_, path) => path.span,
|
||||
QPath::TypeRelative(_, ps) => ps.ident.span,
|
||||
QPath::TypeRelative(qself, ps) => qself.span.to(ps.ident.span),
|
||||
QPath::LangItem(_, span) => span,
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ pub fn report_object_safety_error(
|
||||
<https://doc.rust-lang.org/reference/items/traits.html#object-safety>",
|
||||
);
|
||||
|
||||
if tcx.sess.trait_methods_not_found.borrow().contains(&span) {
|
||||
if tcx.sess.trait_methods_not_found.borrow().iter().any(|full_span| full_span.contains(span)) {
|
||||
// Avoid emitting error caused by non-existing method (#58734)
|
||||
err.cancel();
|
||||
}
|
||||
|
@ -100,6 +100,11 @@ enum TargetLint {
|
||||
/// Lint with this name existed previously, but has been removed/deprecated.
|
||||
/// The string argument is the reason for removal.
|
||||
Removed(String),
|
||||
|
||||
/// A lint name that should give no warnings and have no effect.
|
||||
///
|
||||
/// This is used by rustc to avoid warning about old rustdoc lints before rustdoc registers them as tool lints.
|
||||
Ignored,
|
||||
}
|
||||
|
||||
pub enum FindLintError {
|
||||
@ -266,6 +271,33 @@ impl LintStore {
|
||||
}
|
||||
}
|
||||
|
||||
/// This lint should be available with either the old or the new name.
|
||||
///
|
||||
/// Using the old name will not give a warning.
|
||||
/// You must register a lint with the new name before calling this function.
|
||||
#[track_caller]
|
||||
pub fn register_alias(&mut self, old_name: &str, new_name: &str) {
|
||||
let target = match self.by_name.get(new_name) {
|
||||
Some(&Id(lint_id)) => lint_id,
|
||||
_ => bug!("cannot add alias {} for lint {} that does not exist", old_name, new_name),
|
||||
};
|
||||
match self.by_name.insert(old_name.to_string(), Id(target)) {
|
||||
None | Some(Ignored) => {}
|
||||
Some(x) => bug!("duplicate specification of lint {} (was {:?})", old_name, x),
|
||||
}
|
||||
}
|
||||
|
||||
/// This lint should give no warning and have no effect.
|
||||
///
|
||||
/// This is used by rustc to avoid warning about old rustdoc lints before rustdoc registers them as tool lints.
|
||||
#[track_caller]
|
||||
pub fn register_ignored(&mut self, name: &str) {
|
||||
if self.by_name.insert(name.to_string(), Ignored).is_some() {
|
||||
bug!("duplicate specification of lint {}", name);
|
||||
}
|
||||
}
|
||||
|
||||
/// This lint has been renamed; warn about using the new name and apply the lint.
|
||||
#[track_caller]
|
||||
pub fn register_renamed(&mut self, old_name: &str, new_name: &str) {
|
||||
let target = match self.by_name.get(new_name) {
|
||||
@ -284,6 +316,7 @@ impl LintStore {
|
||||
Some(&Id(lint_id)) => Ok(vec![lint_id]),
|
||||
Some(&Renamed(_, lint_id)) => Ok(vec![lint_id]),
|
||||
Some(&Removed(_)) => Err(FindLintError::Removed),
|
||||
Some(&Ignored) => Ok(vec![]),
|
||||
None => loop {
|
||||
return match self.lint_groups.get(lint_name) {
|
||||
Some(LintGroup { lint_ids, depr, .. }) => {
|
||||
@ -427,6 +460,7 @@ impl LintStore {
|
||||
}
|
||||
},
|
||||
Some(&Id(ref id)) => CheckLintNameResult::Ok(slice::from_ref(id)),
|
||||
Some(&Ignored) => CheckLintNameResult::Ok(&[]),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||
"non_autolinks",
|
||||
];
|
||||
for rustdoc_lint in RUSTDOC_LINTS {
|
||||
store.register_removed(rustdoc_lint, &format!("use `rustdoc::{}` instead", rustdoc_lint));
|
||||
store.register_ignored(rustdoc_lint);
|
||||
}
|
||||
store.register_removed(
|
||||
"intra_doc_link_resolution_failure",
|
||||
|
@ -52,6 +52,7 @@ fn insert_vec_map<K: Idx, V: Clone>(map: &mut IndexVec<K, Option<V>>, k: K, v: V
|
||||
if i >= len {
|
||||
map.extend(repeat(None).take(i - len + 1));
|
||||
}
|
||||
debug_assert!(map[k].is_none());
|
||||
map[k] = Some(v);
|
||||
}
|
||||
|
||||
@ -216,9 +217,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
||||
// Overwrite the dummy hash with the real HIR owner hash.
|
||||
nodes.hash = hash;
|
||||
|
||||
// FIXME: feature(impl_trait_in_bindings) broken and trigger this assert
|
||||
//assert!(data.signature.is_none());
|
||||
|
||||
debug_assert!(data.signature.is_none());
|
||||
data.signature =
|
||||
Some(self.arena.alloc(Owner { parent: entry.parent, node: entry.node }));
|
||||
|
||||
|
@ -640,7 +640,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
Err(mut err) => {
|
||||
// We could't parse generic parameters, unlikely to be a turbofish. Rely on
|
||||
// We couldn't parse generic parameters, unlikely to be a turbofish. Rely on
|
||||
// generic parse error instead.
|
||||
err.cancel();
|
||||
*self = snapshot;
|
||||
@ -1242,7 +1242,7 @@ impl<'a> Parser<'a> {
|
||||
let is_question = self.eat(&token::Question); // Handle `await? <expr>`.
|
||||
let expr = if self.token == token::OpenDelim(token::Brace) {
|
||||
// Handle `await { <expr> }`.
|
||||
// This needs to be handled separatedly from the next arm to avoid
|
||||
// This needs to be handled separately from the next arm to avoid
|
||||
// interpreting `await { <expr> }?` as `<expr>?.await`.
|
||||
self.parse_block_expr(None, self.token.span, BlockCheckMode::Default, AttrVec::new())
|
||||
} else {
|
||||
@ -1613,42 +1613,82 @@ impl<'a> Parser<'a> {
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
return Some(ident);
|
||||
} else if let PatKind::Ident(_, ident, _) = pat.kind {
|
||||
if require_name
|
||||
&& (self.token == token::Comma
|
||||
|| self.token == token::Lt
|
||||
|| self.token == token::CloseDelim(token::Paren))
|
||||
{
|
||||
// `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}`
|
||||
if first_param {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"if this is a `self` type, give it a parameter name",
|
||||
format!("self: {}", ident),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else if require_name
|
||||
&& (self.token == token::Comma
|
||||
|| self.token == token::Lt
|
||||
|| self.token == token::CloseDelim(token::Paren))
|
||||
{
|
||||
let rfc_note = "anonymous parameters are removed in the 2018 edition (see RFC 1685)";
|
||||
|
||||
let (ident, self_sugg, param_sugg, type_sugg) = match pat.kind {
|
||||
PatKind::Ident(_, ident, _) => (
|
||||
ident,
|
||||
format!("self: {}", ident),
|
||||
format!("{}: TypeName", ident),
|
||||
format!("_: {}", ident),
|
||||
),
|
||||
// Also catches `fn foo(&a)`.
|
||||
PatKind::Ref(ref pat, mutab)
|
||||
if matches!(pat.clone().into_inner().kind, PatKind::Ident(..)) =>
|
||||
{
|
||||
match pat.clone().into_inner().kind {
|
||||
PatKind::Ident(_, ident, _) => {
|
||||
let mutab = mutab.prefix_str();
|
||||
(
|
||||
ident,
|
||||
format!("self: &{}{}", mutab, ident),
|
||||
format!("{}: &{}TypeName", ident, mutab),
|
||||
format!("_: &{}{}", mutab, ident),
|
||||
)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
// Avoid suggesting that `fn foo(HashMap<u32>)` is fixed with a change to
|
||||
// `fn foo(HashMap: TypeName<u32>)`.
|
||||
if self.token != token::Lt {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"if this is a parameter name, give it a type",
|
||||
format!("{}: TypeName", ident),
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
_ => {
|
||||
// Otherwise, try to get a type and emit a suggestion.
|
||||
if let Some(ty) = pat.to_ty() {
|
||||
err.span_suggestion_verbose(
|
||||
pat.span,
|
||||
"explicitly ignore the parameter name",
|
||||
format!("_: {}", pprust::ty_to_string(&ty)),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
err.note(rfc_note);
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
// `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}`
|
||||
if first_param {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"if this is a type, explicitly ignore the parameter name",
|
||||
format!("_: {}", ident),
|
||||
Applicability::MachineApplicable,
|
||||
"if this is a `self` type, give it a parameter name",
|
||||
self_sugg,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
err.note("anonymous parameters are removed in the 2018 edition (see RFC 1685)");
|
||||
|
||||
// Don't attempt to recover by using the `X` in `X<Y>` as the parameter name.
|
||||
return if self.token == token::Lt { None } else { Some(ident) };
|
||||
}
|
||||
// Avoid suggesting that `fn foo(HashMap<u32>)` is fixed with a change to
|
||||
// `fn foo(HashMap: TypeName<u32>)`.
|
||||
if self.token != token::Lt {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"if this is a parameter name, give it a type",
|
||||
param_sugg,
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
}
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"if this is a type, explicitly ignore the parameter name",
|
||||
type_sugg,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
err.note(rfc_note);
|
||||
|
||||
// Don't attempt to recover by using the `X` in `X<Y>` as the parameter name.
|
||||
return if self.token == token::Lt { None } else { Some(ident) };
|
||||
}
|
||||
None
|
||||
}
|
||||
|
@ -1414,8 +1414,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
name: Symbol,
|
||||
) {
|
||||
let mut err = struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type");
|
||||
if let (Some(_), Ok(snippet)) = (
|
||||
self.tcx().sess.confused_type_with_std_module.borrow().get(&span),
|
||||
if let (true, Ok(snippet)) = (
|
||||
self.tcx()
|
||||
.sess
|
||||
.confused_type_with_std_module
|
||||
.borrow()
|
||||
.keys()
|
||||
.any(|full_span| full_span.contains(span)),
|
||||
self.tcx().sess.source_map().span_to_snippet(span),
|
||||
) {
|
||||
err.span_suggestion(
|
||||
|
@ -439,7 +439,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
qpath: &QPath<'_>,
|
||||
hir_id: hir::HirId,
|
||||
) -> Option<(&'tcx ty::VariantDef, Ty<'tcx>)> {
|
||||
let path_span = qpath.qself_span();
|
||||
let path_span = qpath.span();
|
||||
let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, hir_id);
|
||||
let variant = match def {
|
||||
Res::Err => {
|
||||
|
@ -35,7 +35,7 @@ macro_rules! impl_helper {
|
||||
impl_helper! { u8 u16 u32 }
|
||||
|
||||
struct Parser<'a> {
|
||||
// parsing as ASCII, so can use byte array
|
||||
// Parsing as ASCII, so can use byte array.
|
||||
state: &'a [u8],
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ impl<'a> Parser<'a> {
|
||||
Parser { state: input.as_bytes() }
|
||||
}
|
||||
|
||||
/// Run a parser, and restore the pre-parse state if it fails
|
||||
/// Run a parser, and restore the pre-parse state if it fails.
|
||||
fn read_atomically<T, F>(&mut self, inner: F) -> Option<T>
|
||||
where
|
||||
F: FnOnce(&mut Parser<'_>) -> Option<T>,
|
||||
@ -126,7 +126,7 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read an IPv4 address
|
||||
/// Read an IPv4 address.
|
||||
fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr> {
|
||||
self.read_atomically(|p| {
|
||||
let mut groups = [0; 4];
|
||||
@ -139,18 +139,18 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read an IPV6 Address
|
||||
/// Read an IPv6 Address.
|
||||
fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr> {
|
||||
/// Read a chunk of an ipv6 address into `groups`. Returns the number
|
||||
/// Read a chunk of an IPv6 address into `groups`. Returns the number
|
||||
/// of groups read, along with a bool indicating if an embedded
|
||||
/// trailing ipv4 address was read. Specifically, read a series of
|
||||
/// colon-separated ipv6 groups (0x0000 - 0xFFFF), with an optional
|
||||
/// trailing embedded ipv4 address.
|
||||
/// trailing IPv4 address was read. Specifically, read a series of
|
||||
/// colon-separated IPv6 groups (0x0000 - 0xFFFF), with an optional
|
||||
/// trailing embedded IPv4 address.
|
||||
fn read_groups(p: &mut Parser<'_>, groups: &mut [u16]) -> (usize, bool) {
|
||||
let limit = groups.len();
|
||||
|
||||
for (i, slot) in groups.iter_mut().enumerate() {
|
||||
// Try to read a trailing embedded ipv4 address. There must be
|
||||
// Try to read a trailing embedded IPv4 address. There must be
|
||||
// at least two groups left.
|
||||
if i < limit - 1 {
|
||||
let ipv4 = p.read_separator(':', i, |p| p.read_ipv4_addr());
|
||||
@ -188,8 +188,8 @@ impl<'a> Parser<'a> {
|
||||
return None;
|
||||
}
|
||||
|
||||
// read `::` if previous code parsed less than 8 groups
|
||||
// `::` indicates one or more groups of 16 bits of zeros
|
||||
// Read `::` if previous code parsed less than 8 groups.
|
||||
// `::` indicates one or more groups of 16 bits of zeros.
|
||||
p.read_given_char(':')?;
|
||||
p.read_given_char(':')?;
|
||||
|
||||
@ -206,12 +206,12 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read an IP Address, either IPV4 or IPV6.
|
||||
/// Read an IP Address, either IPv4 or IPv6.
|
||||
fn read_ip_addr(&mut self) -> Option<IpAddr> {
|
||||
self.read_ipv4_addr().map(IpAddr::V4).or_else(move || self.read_ipv6_addr().map(IpAddr::V6))
|
||||
}
|
||||
|
||||
/// Read a : followed by a port in base 10.
|
||||
/// Read a `:` followed by a port in base 10.
|
||||
fn read_port(&mut self) -> Option<u16> {
|
||||
self.read_atomically(|p| {
|
||||
p.read_given_char(':')?;
|
||||
@ -219,7 +219,7 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read a % followed by a scope id in base 10.
|
||||
/// Read a `%` followed by a scope ID in base 10.
|
||||
fn read_scope_id(&mut self) -> Option<u32> {
|
||||
self.read_atomically(|p| {
|
||||
p.read_given_char('%')?;
|
||||
@ -227,7 +227,7 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read an IPV4 address with a port
|
||||
/// Read an IPv4 address with a port.
|
||||
fn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4> {
|
||||
self.read_atomically(|p| {
|
||||
let ip = p.read_ipv4_addr()?;
|
||||
@ -236,7 +236,7 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Read an IPV6 address with a port
|
||||
/// Read an IPv6 address with a port.
|
||||
fn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6> {
|
||||
self.read_atomically(|p| {
|
||||
p.read_given_char('[')?;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0f87daf683ae3de3cb725faecb11b7e7e89f0e5a
|
||||
Subproject commit fc2f690fc16592abbead2360cfc0a42f5df78052
|
@ -1 +1 @@
|
||||
Subproject commit a96d096cffe5fa2c84af1b4b61e1492f839bb2e1
|
||||
Subproject commit f61685755fad7d3b88b4645adfbf461d500563a2
|
@ -1 +1 @@
|
||||
Subproject commit adca786547d08fe676b2fc7a6f08c2ed5280ca38
|
||||
Subproject commit 6fe476943afd53a9a6e91f38a6ea7bb48811d8ff
|
@ -1 +1 @@
|
||||
Subproject commit 3b6fe80c205d2a2b5dc8a276192bbce9eeb9e9cf
|
||||
Subproject commit e32a2f928f8b78d534bca2b9e7736413314dc556
|
@ -1 +1 @@
|
||||
Subproject commit 3e0d98790c9126517fa1c604dc3678f396e92a27
|
||||
Subproject commit eead22c6c030fa4f3a167d1798658c341199e2ae
|
@ -1 +1 @@
|
||||
Subproject commit c431f8c29a41413dddcb3bfa0d71c9cabe366317
|
||||
Subproject commit 67ebd4b55dba44edfc351621cef6e5e758169c55
|
@ -7,19 +7,20 @@ The tracking issue for this feature is: [#64796]
|
||||
------------------------
|
||||
|
||||
The `cfg_version` feature makes it possible to execute different code
|
||||
depending on the compiler version.
|
||||
depending on the compiler version. It will return true if the compiler
|
||||
version is greater than or equal to the specified version.
|
||||
|
||||
## Examples
|
||||
|
||||
```rust
|
||||
#![feature(cfg_version)]
|
||||
|
||||
#[cfg(version("1.42"))]
|
||||
#[cfg(version("1.42"))] // 1.42 and above
|
||||
fn a() {
|
||||
// ...
|
||||
}
|
||||
|
||||
#[cfg(not(version("1.42")))]
|
||||
#[cfg(not(version("1.42")))] // 1.41 and below
|
||||
fn a() {
|
||||
// ...
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ crate fn register_lints(_sess: &Session, lint_store: &mut LintStore) {
|
||||
);
|
||||
for lint in &*RUSTDOC_LINTS {
|
||||
let name = lint.name_lower();
|
||||
lint_store.register_renamed(&name.replace("rustdoc::", ""), &name);
|
||||
lint_store.register_alias(&name.replace("rustdoc::", ""), &name);
|
||||
}
|
||||
lint_store
|
||||
.register_renamed("intra_doc_link_resolution_failure", "rustdoc::broken_intra_doc_links");
|
||||
|
@ -1,5 +1,6 @@
|
||||
// compile-args: --crate-type lib
|
||||
#![deny(broken_intra_doc_links)]
|
||||
//~^ WARNING renamed
|
||||
// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
|
||||
// stable channel.
|
||||
//! [x]
|
||||
//~^ ERROR unresolved link
|
||||
|
@ -1,13 +1,5 @@
|
||||
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
|
||||
--> $DIR/renamed-lint-still-applies.rs:2:9
|
||||
|
|
||||
LL | #![deny(broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
|
||||
|
|
||||
= note: `#[warn(renamed_and_removed_lints)]` on by default
|
||||
|
||||
error: unresolved link to `x`
|
||||
--> $DIR/renamed-lint-still-applies.rs:4:6
|
||||
--> $DIR/renamed-lint-still-applies.rs:5:6
|
||||
|
|
||||
LL | //! [x]
|
||||
| ^ no item named `x` in scope
|
||||
@ -17,7 +9,8 @@ note: the lint level is defined here
|
||||
|
|
||||
LL | #![deny(broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(broken_intra_doc_links)]`
|
||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
//~^ ERROR renamed to `rustdoc::broken_intra_doc_links`
|
||||
|
||||
#![deny(non_autolinks)]
|
||||
//~^ ERROR renamed to `rustdoc::non_autolinks`
|
||||
// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
|
||||
// stable channel.
|
||||
|
||||
#![deny(rustdoc)]
|
||||
//~^ ERROR removed: use `rustdoc::all` instead
|
||||
|
@ -28,25 +28,19 @@ note: the lint level is defined here
|
||||
LL | #![deny(renamed_and_removed_lints)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: lint `non_autolinks` has been renamed to `rustdoc::non_autolinks`
|
||||
--> $DIR/unknown-renamed-lints.rs:12:9
|
||||
|
|
||||
LL | #![deny(non_autolinks)]
|
||||
| ^^^^^^^^^^^^^ help: use the new name: `rustdoc::non_autolinks`
|
||||
|
||||
error: lint `rustdoc` has been removed: use `rustdoc::all` instead
|
||||
--> $DIR/unknown-renamed-lints.rs:15:9
|
||||
--> $DIR/unknown-renamed-lints.rs:16:9
|
||||
|
|
||||
LL | #![deny(rustdoc)]
|
||||
| ^^^^^^^
|
||||
|
||||
error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
|
||||
--> $DIR/unknown-renamed-lints.rs:19:9
|
||||
--> $DIR/unknown-renamed-lints.rs:20:9
|
||||
|
|
||||
LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Compilation failed, aborting rustdoc
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -5,6 +5,20 @@
|
||||
trait T {
|
||||
fn foo(i32); //~ expected one of `:`, `@`, or `|`, found `)`
|
||||
|
||||
// Also checks with `&`
|
||||
fn foo_with_ref(&mut i32);
|
||||
//~^ ERROR expected one of `:`, `@`, or `|`, found `)`
|
||||
|
||||
fn foo_with_qualified_path(<Bar as T>::Baz);
|
||||
//~^ ERROR expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
|
||||
fn foo_with_qualified_path_and_ref(&<Bar as T>::Baz);
|
||||
//~^ ERROR expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
|
||||
fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, <Bar as T>::Baz);
|
||||
//~^ ERROR expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `,`
|
||||
//~| ERROR expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
|
||||
fn bar_with_default_impl(String, String) {}
|
||||
//~^ ERROR expected one of `:`
|
||||
//~| ERROR expected one of `:`
|
||||
|
@ -18,8 +18,76 @@ help: if this is a type, explicitly ignore the parameter name
|
||||
LL | fn foo(_: i32);
|
||||
| ^^^^^^
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:9:29
|
||||
|
|
||||
LL | fn foo_with_ref(&mut i32);
|
||||
| ^ expected one of `:`, `@`, or `|`
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn foo_with_ref(self: &mut i32);
|
||||
| ^^^^^^^^^^^^^^
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn foo_with_ref(i32: &mut TypeName);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_ref(_: &mut i32);
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:12:47
|
||||
|
|
||||
LL | fn foo_with_qualified_path(<Bar as T>::Baz);
|
||||
| ^ expected one of 8 possible tokens
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_qualified_path(_: <Bar as T>::Baz);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:15:56
|
||||
|
|
||||
LL | fn foo_with_qualified_path_and_ref(&<Bar as T>::Baz);
|
||||
| ^ expected one of 8 possible tokens
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_qualified_path_and_ref(_: &<Bar as T>::Baz);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `,`
|
||||
--> $DIR/anon-params-denied-2018.rs:18:57
|
||||
|
|
||||
LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, <Bar as T>::Baz);
|
||||
| ^ expected one of 8 possible tokens
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_multiple_qualified_paths(_: <Bar as T>::Baz, <Bar as T>::Baz);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:18:74
|
||||
|
|
||||
LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, <Bar as T>::Baz);
|
||||
| ^ expected one of 8 possible tokens
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, _: <Bar as T>::Baz);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `,`
|
||||
--> $DIR/anon-params-denied-2018.rs:8:36
|
||||
--> $DIR/anon-params-denied-2018.rs:22:36
|
||||
|
|
||||
LL | fn bar_with_default_impl(String, String) {}
|
||||
| ^ expected one of `:`, `@`, or `|`
|
||||
@ -39,7 +107,7 @@ LL | fn bar_with_default_impl(_: String, String) {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:8:44
|
||||
--> $DIR/anon-params-denied-2018.rs:22:44
|
||||
|
|
||||
LL | fn bar_with_default_impl(String, String) {}
|
||||
| ^ expected one of `:`, `@`, or `|`
|
||||
@ -55,7 +123,7 @@ LL | fn bar_with_default_impl(String, _: String) {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `,`
|
||||
--> $DIR/anon-params-denied-2018.rs:13:22
|
||||
--> $DIR/anon-params-denied-2018.rs:27:22
|
||||
|
|
||||
LL | fn baz(a:usize, b, c: usize) -> usize {
|
||||
| ^ expected one of `:`, `@`, or `|`
|
||||
@ -70,5 +138,5 @@ help: if this is a type, explicitly ignore the parameter name
|
||||
LL | fn baz(a:usize, _: b, c: usize) -> usize {
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
@ -5,4 +5,5 @@ pub fn main() {
|
||||
//~^ ERROR only auto traits can be used as additional traits in a trait object
|
||||
//~| ERROR the size for values of type
|
||||
//~| ERROR the size for values of type
|
||||
//~| ERROR the size for values of type
|
||||
}
|
||||
|
@ -31,7 +31,20 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
|
||||
= help: the trait `Sized` is not implemented for `dyn Trait`
|
||||
= note: required by `Vec::<T>::new`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||
--> $DIR/bad-sized.rs:4:37
|
||||
|
|
||||
LL | let x: Vec<dyn Trait + Sized> = Vec::new();
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
|
||||
| - required by this bound in `Vec`
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `dyn Trait`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0225, E0277.
|
||||
For more information about an error, try `rustc --explain E0225`.
|
||||
|
@ -10,7 +10,7 @@ warning: use of deprecated struct `MustUseDeprecated`
|
||||
--> $DIR/cfg-attr-multi-true.rs:19:5
|
||||
|
|
||||
LL | MustUseDeprecated::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated struct `MustUseDeprecated`
|
||||
--> $DIR/cfg-attr-multi-true.rs:13:17
|
||||
|
@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
|
||||
--> $DIR/issue-78622.rs:5:5
|
||||
|
|
||||
LL | S::A::<f> {}
|
||||
| ^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
|
||||
| ^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -11,4 +11,5 @@
|
||||
#![deny(intra_doc_link_resolution_failure)]
|
||||
//~^ ERROR removed: use `rustdoc::broken_intra_doc_links`
|
||||
#![deny(non_autolinks)]
|
||||
//~^ ERROR removed: use `rustdoc::non_autolinks`
|
||||
// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
|
||||
// stable channel.
|
||||
|
@ -10,11 +10,5 @@ note: the lint level is defined here
|
||||
LL | #![deny(renamed_and_removed_lints)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: lint `non_autolinks` has been removed: use `rustdoc::non_autolinks` instead
|
||||
--> $DIR/rustdoc-renamed.rs:13:9
|
||||
|
|
||||
LL | #![deny(non_autolinks)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -56,7 +56,7 @@ LL | struct Inline<T>
|
||||
| - required by this bound in `Inline`
|
||||
...
|
||||
LL | let dst = Inline::<dyn Debug>::new(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `dyn Debug`
|
||||
help: consider relaxing the implicit `Sized` restriction
|
||||
|
@ -13,7 +13,7 @@ help: the lifetime requirements from the `impl` do not correspond to the require
|
||||
--> $DIR/issue-75361-mismatched-impl.rs:12:55
|
||||
|
|
||||
LL | fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType>>;
|
||||
| ^^^^^^^^^^^^^^ consider borrowing this type parameter in the trait
|
||||
| ^^^^ consider borrowing this type parameter in the trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,6 +9,20 @@ error: expected one of `:`, `@`, or `|`, found `)`
|
||||
|
|
||||
LL | fn test(&'a str) {
|
||||
| ^ expected one of `:`, `@`, or `|`
|
||||
|
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn test(self: &str) {
|
||||
| ^^^^^^^^^^
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn test(str: &TypeName) {
|
||||
| ^^^^^^^^^^^^^^
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn test(_: &str) {
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -222,7 +222,7 @@ error: type `priv_parent_substs::Priv` is private
|
||||
--> $DIR/associated-item-privacy-inherent.rs:101:9
|
||||
|
|
||||
LL | Pub::CONST;
|
||||
| ^^^^^^^^^^ private type
|
||||
| ^^^ private type
|
||||
...
|
||||
LL | priv_parent_substs::mac!();
|
||||
| --------------------------- in this macro invocation
|
||||
|
@ -56,7 +56,7 @@ error: type `Priv` is private
|
||||
--> $DIR/private-inferred-type.rs:104:5
|
||||
|
|
||||
LL | m::Pub::INHERENT_ASSOC_CONST;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type
|
||||
| ^^^^^^ private type
|
||||
|
||||
error: type `Priv` is private
|
||||
--> $DIR/private-inferred-type.rs:105:5
|
||||
|
@ -2,7 +2,7 @@ error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/issue-28848.rs:10:5
|
||||
|
|
||||
LL | Foo::<'a, 'b>::xmute(u)
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: lifetime parameter instantiated with the lifetime `'b` as defined on the function body at 9:16
|
||||
--> $DIR/issue-28848.rs:9:16
|
||||
|
@ -100,7 +100,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
|
||||
--> $DIR/generics-default-stability.rs:160:28
|
||||
|
|
||||
LL | let _: Alias4<isize> = Alias4::Some(1);
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
|
||||
--> $DIR/generics-default-stability.rs:160:12
|
||||
@ -124,7 +124,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
|
||||
--> $DIR/generics-default-stability.rs:166:28
|
||||
|
|
||||
LL | let _: Alias4<isize> = Alias4::Some(0);
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
|
||||
--> $DIR/generics-default-stability.rs:166:12
|
||||
@ -136,7 +136,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
|
||||
--> $DIR/generics-default-stability.rs:171:28
|
||||
|
|
||||
LL | let _: Alias5<isize> = Alias5::Some(1);
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
|
||||
--> $DIR/generics-default-stability.rs:171:12
|
||||
@ -160,7 +160,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
|
||||
--> $DIR/generics-default-stability.rs:178:28
|
||||
|
|
||||
LL | let _: Alias5<isize> = Alias5::Some(0);
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
|
||||
--> $DIR/generics-default-stability.rs:178:12
|
||||
|
@ -14,7 +14,7 @@ error[E0071]: expected struct, variant or union type, found associated type
|
||||
--> $DIR/struct-path-associated-type.rs:14:13
|
||||
|
|
||||
LL | let z = T::A::<u8> {};
|
||||
| ^^^^^^^^^^ not a struct
|
||||
| ^^^^ not a struct
|
||||
|
||||
error[E0071]: expected struct, variant or union type, found associated type
|
||||
--> $DIR/struct-path-associated-type.rs:18:9
|
||||
@ -38,7 +38,7 @@ error[E0223]: ambiguous associated type
|
||||
--> $DIR/struct-path-associated-type.rs:33:13
|
||||
|
|
||||
LL | let z = S::A::<u8> {};
|
||||
| ^^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
|
||||
| ^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/struct-path-associated-type.rs:35:9
|
||||
|
@ -11,7 +11,7 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
||||
|
|
||||
LL | let fp = BufWriter::new(fp);
|
||||
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
||||
| ^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
||||
|
|
||||
::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
|
||||
|
|
||||
|
@ -2,12 +2,12 @@ error[E0223]: ambiguous associated type
|
||||
--> $DIR/suggest-std-when-using-type.rs:2:14
|
||||
|
|
||||
LL | let pi = f32::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: you are looking for the module in `std`, not the primitive type
|
||||
|
|
||||
LL | let pi = std::f32::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0599]: no function or associated item named `from_utf8` found for type `str` in the current scope
|
||||
--> $DIR/suggest-std-when-using-type.rs:5:14
|
||||
|
@ -113,7 +113,7 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
|
||||
--> $DIR/item-privacy.rs:101:5
|
||||
|
|
||||
LL | C::A;
|
||||
| ^^^^ `assoc_const::C` cannot be made into an object
|
||||
| ^ `assoc_const::C` cannot be made into an object
|
||||
|
|
||||
= help: consider moving `C` to another trait
|
||||
= help: consider moving `B` to another trait
|
||||
|
@ -31,7 +31,7 @@ LL | | }
|
||||
| |_- type parameter `A` must be specified for this
|
||||
...
|
||||
LL | let e = Bar::<usize>::lol();
|
||||
| ^^^^^^^^^^^^^^^^^ missing reference to `A`
|
||||
| ^^^^^^^^^^^^ missing reference to `A`
|
||||
|
|
||||
= note: because of the default `Self` reference, type parameters must be specified on object types
|
||||
|
||||
|
@ -19,7 +19,7 @@ error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/wf-static-method.rs:26:18
|
||||
|
|
||||
LL | let me = Self::make_me();
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^^^^
|
||||
|
|
||||
note: lifetime parameter instantiated with the lifetime `'b` as defined on the impl at 23:10
|
||||
--> $DIR/wf-static-method.rs:23:10
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 32da9eaa5de5be241cf8096ca6b749a157194f77
|
||||
Subproject commit 90691f2bfe9a50291a98983b1ed2feab51d5ca55
|
@ -312,17 +312,18 @@ mod issue4140 {
|
||||
fn try_from(value: T) -> Result<Self, Error<Self::From, Self::To>>;
|
||||
}
|
||||
|
||||
impl<F, T> TryFrom<F> for T
|
||||
where
|
||||
T: From<F>,
|
||||
{
|
||||
type From = Self;
|
||||
type To = Self;
|
||||
// FIXME: Suggested fix results in infinite recursion.
|
||||
// impl<F, T> TryFrom<F> for T
|
||||
// where
|
||||
// T: From<F>,
|
||||
// {
|
||||
// type From = Self::From;
|
||||
// type To = Self::To;
|
||||
|
||||
fn try_from(value: F) -> Result<Self, Error<Self::From, Self::To>> {
|
||||
Ok(From::from(value))
|
||||
}
|
||||
}
|
||||
// fn try_from(value: F) -> Result<Self, Error<Self::From, Self::To>> {
|
||||
// Ok(From::from(value))
|
||||
// }
|
||||
// }
|
||||
|
||||
impl From<bool> for i64 {
|
||||
type From = bool;
|
||||
|
@ -312,17 +312,18 @@ mod issue4140 {
|
||||
fn try_from(value: T) -> Result<Self, Error<Self::From, Self::To>>;
|
||||
}
|
||||
|
||||
impl<F, T> TryFrom<F> for T
|
||||
where
|
||||
T: From<F>,
|
||||
{
|
||||
type From = T::From;
|
||||
type To = T::To;
|
||||
// FIXME: Suggested fix results in infinite recursion.
|
||||
// impl<F, T> TryFrom<F> for T
|
||||
// where
|
||||
// T: From<F>,
|
||||
// {
|
||||
// type From = Self::From;
|
||||
// type To = Self::To;
|
||||
|
||||
fn try_from(value: F) -> Result<Self, Error<Self::From, Self::To>> {
|
||||
Ok(From::from(value))
|
||||
}
|
||||
}
|
||||
// fn try_from(value: F) -> Result<Self, Error<Self::From, Self::To>> {
|
||||
// Ok(From::from(value))
|
||||
// }
|
||||
// }
|
||||
|
||||
impl From<bool> for i64 {
|
||||
type From = bool;
|
||||
|
@ -157,22 +157,10 @@ LL | Foo { value }
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/use_self.rs:319:21
|
||||
|
|
||||
LL | type From = T::From;
|
||||
| ^^^^^^^ help: use the applicable keyword: `Self`
|
||||
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/use_self.rs:320:19
|
||||
|
|
||||
LL | type To = T::To;
|
||||
| ^^^^^ help: use the applicable keyword: `Self`
|
||||
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/use_self.rs:453:13
|
||||
--> $DIR/use_self.rs:454:13
|
||||
|
|
||||
LL | A::new::<submod::B>(submod::B {})
|
||||
| ^ help: use the applicable keyword: `Self`
|
||||
|
||||
error: aborting due to 29 previous errors
|
||||
error: aborting due to 27 previous errors
|
||||
|
||||
|
@ -83,7 +83,7 @@ error: map with zero-sized value type
|
||||
--> $DIR/zero_sized_btreemap_values.rs:64:35
|
||||
|
|
||||
LL | let _: BTreeMap<String, ()> = BTreeMap::new();
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= help: consider using a set instead
|
||||
|
||||
|
@ -83,7 +83,7 @@ error: map with zero-sized value type
|
||||
--> $DIR/zero_sized_hashmap_values.rs:64:34
|
||||
|
|
||||
LL | let _: HashMap<String, ()> = HashMap::new();
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: consider using a set instead
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user