| author | bors <bors@rust-lang.org> 2026-05-30 03:49:29 UTC |
| committer | bors <bors@rust-lang.org> 2026-05-30 03:49:29 UTC |
| log | 6eda7419e71fdbc1185ed5be7e6bff1a474ab5cd |
| tree | 51bc79b6fb3c3694555cd2b2eb52fb60ad17b13d |
| parent | 6368fd52cb9f230dfb156097625993e7a8891800 |
| parent | 82471b6b2ab22cdbc896232076b40cc6907da571 |
Rollup of 16 pull requests
Successful merges:
- rust-lang/rust#149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
- rust-lang/rust#156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
- rust-lang/rust#156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
- rust-lang/rust#157053 (Eagerly resolve delegations in late resolution)
- rust-lang/rust#157068 (NVPTX: Remove the unstable ptx linker flavor)
- rust-lang/rust#157076 (Various proc-macro related code cleanups)
- rust-lang/rust#157106 (add ABI check logic for wasm)
- rust-lang/rust#154835 (std::offload sharedmem)
- rust-lang/rust#157065 (Stabilize `Path::is_empty`)
- rust-lang/rust#157088 (Improve suggestions for malformed deprecated attribute)
- rust-lang/rust#157098 (Add the `clflushopt` x86 target feature)
- rust-lang/rust#157103 (Add reproducibly failing tests for parallel frontend)
- rust-lang/rust#157111 (Update target maintainer for x86_64-unknown-linux-none)
- rust-lang/rust#157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
- rust-lang/rust#157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
- rust-lang/rust#157120 (Cleanups around attribute target checking)
Failed merges:
- rust-lang/rust#157100 (Some more per owner things)120 files changed, 1335 insertions(+), 2034 deletions(-)
compiler/rustc_ast_lowering/src/delegation.rs+6-16| ... | ... | @@ -124,7 +124,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 124 | 124 | // Delegation can be unresolved in illegal places such as function bodies in extern blocks (see #151356) |
| 125 | 125 | let sig_id = if let Some(delegation_info) = self.resolver.delegation_info(self.owner.def_id) |
| 126 | 126 | { |
| 127 | self.get_sig_id(delegation_info.resolution_node, span) | |
| 127 | self.get_sig_id(delegation_info.resolution_id, span) | |
| 128 | 128 | } else { |
| 129 | 129 | self.dcx().span_delayed_bug( |
| 130 | 130 | span, |
| ... | ... | @@ -230,22 +230,12 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 230 | 230 | .collect::<Vec<_>>() |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | fn get_sig_id(&self, mut node_id: NodeId, span: Span) -> Result<DefId, ErrorGuaranteed> { | |
| 234 | let mut visited: FxHashSet<NodeId> = Default::default(); | |
| 233 | fn get_sig_id(&self, mut def_id: DefId, span: Span) -> Result<DefId, ErrorGuaranteed> { | |
| 234 | let mut visited: FxHashSet<DefId> = Default::default(); | |
| 235 | 235 | let mut path: SmallVec<[DefId; 1]> = Default::default(); |
| 236 | 236 | |
| 237 | 237 | loop { |
| 238 | visited.insert(node_id); | |
| 239 | ||
| 240 | let Some(def_id) = self.get_resolution_id(node_id) else { | |
| 241 | return Err(self.tcx.dcx().span_delayed_bug( | |
| 242 | span, | |
| 243 | format!( | |
| 244 | "LoweringContext: couldn't resolve node {:?} in delegation item", | |
| 245 | node_id | |
| 246 | ), | |
| 247 | )); | |
| 248 | }; | |
| 238 | visited.insert(def_id); | |
| 249 | 239 | |
| 250 | 240 | path.push(def_id); |
| 251 | 241 | |
| ... | ... | @@ -255,8 +245,8 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 255 | 245 | if let Some(local_id) = def_id.as_local() |
| 256 | 246 | && let Some(delegation_info) = self.resolver.delegation_info(local_id) |
| 257 | 247 | { |
| 258 | node_id = delegation_info.resolution_node; | |
| 259 | if visited.contains(&node_id) { | |
| 248 | def_id = delegation_info.resolution_id; | |
| 249 | if visited.contains(&def_id) { | |
| 260 | 250 | // We encountered a cycle in the resolution, or delegation callee refers to non-existent |
| 261 | 251 | // entity, in this case emit an error. |
| 262 | 252 | return Err(match visited.len() { |
compiler/rustc_ast_lowering/src/item.rs+33-43| ... | ... | @@ -1192,50 +1192,34 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1192 | 1192 | }) |
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | fn resolve_pin_drop_sugar_impl_item( | |
| 1195 | fn check_pin_drop_sugar_impl_item( | |
| 1196 | 1196 | &self, |
| 1197 | 1197 | i: &AssocItem, |
| 1198 | 1198 | ident: Ident, |
| 1199 | span: Span, | |
| 1200 | ) -> (Ident, Result<DefId, ErrorGuaranteed>) { | |
| 1201 | let trait_item_def_id = self | |
| 1202 | .get_partial_res(i.id) | |
| 1203 | .and_then(|r| r.expect_full_res().opt_def_id()) | |
| 1204 | .ok_or_else(|| { | |
| 1205 | self.dcx().span_delayed_bug(span, "could not resolve trait item being implemented") | |
| 1206 | }); | |
| 1207 | ||
| 1208 | let is_pin_drop_sugar = match &i.kind { | |
| 1209 | AssocItemKind::Fn(fn_kind) => fn_kind.is_pin_drop_sugar(), | |
| 1210 | _ => false, | |
| 1211 | }; | |
| 1212 | let def_id = match trait_item_def_id { | |
| 1213 | Ok(def_id) => def_id, | |
| 1214 | Err(guar) => return (ident, Err(guar)), | |
| 1215 | }; | |
| 1216 | if !is_pin_drop_sugar { | |
| 1217 | return (ident, Ok(def_id)); | |
| 1218 | } | |
| 1219 | ||
| 1220 | let is_drop_pin_drop = self | |
| 1221 | .tcx | |
| 1222 | .lang_items() | |
| 1223 | .drop_trait() | |
| 1224 | .is_some_and(|drop_trait| self.tcx.parent(def_id) == drop_trait); | |
| 1225 | if is_drop_pin_drop { | |
| 1226 | // Associated item collection still derives the impl item's name from HIR. | |
| 1227 | return (Ident::new(sym::pin_drop, ident.span), Ok(def_id)); | |
| 1199 | trait_item: Result<DefId, ErrorGuaranteed>, | |
| 1200 | ) -> Ident { | |
| 1201 | if let AssocItemKind::Fn(fn_kind) = &i.kind | |
| 1202 | && fn_kind.is_pin_drop_sugar() | |
| 1203 | { | |
| 1204 | if let Ok(trait_item) = trait_item | |
| 1205 | && self | |
| 1206 | .tcx | |
| 1207 | .lang_items() | |
| 1208 | .drop_trait() | |
| 1209 | .is_none_or(|drop_trait| self.tcx.parent(trait_item) != drop_trait) | |
| 1210 | { | |
| 1211 | self.dcx() | |
| 1212 | .struct_span_err( | |
| 1213 | i.span, | |
| 1214 | "method `drop` with `&pin mut self` is only supported for the `Drop` trait", | |
| 1215 | ) | |
| 1216 | .with_span_label(i.span, "not a `Drop::pin_drop` implementation") | |
| 1217 | .emit(); | |
| 1218 | } | |
| 1219 | return Ident::new(sym::pin_drop, ident.span); | |
| 1228 | 1220 | } |
| 1229 | 1221 | |
| 1230 | let guar = self | |
| 1231 | .dcx() | |
| 1232 | .struct_span_err( | |
| 1233 | i.span, | |
| 1234 | "method `drop` with `&pin mut self` is only supported for the `Drop` trait", | |
| 1235 | ) | |
| 1236 | .with_span_label(i.span, "not a `Drop::pin_drop` implementation") | |
| 1237 | .emit(); | |
| 1238 | (ident, Err(guar)) | |
| 1222 | ident | |
| 1239 | 1223 | } |
| 1240 | 1224 | |
| 1241 | 1225 | fn lower_impl_item( |
| ... | ... | @@ -1356,8 +1340,14 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1356 | 1340 | |
| 1357 | 1341 | let span = self.lower_span(i.span); |
| 1358 | 1342 | let (effective_ident, impl_kind) = if is_in_trait_impl { |
| 1359 | let (effective_ident, trait_item_def_id) = | |
| 1360 | self.resolve_pin_drop_sugar_impl_item(i, ident, span); | |
| 1343 | let trait_item_def_id = self | |
| 1344 | .get_partial_res(i.id) | |
| 1345 | .and_then(|r| r.expect_full_res().opt_def_id()) | |
| 1346 | .ok_or_else(|| { | |
| 1347 | self.dcx() | |
| 1348 | .span_delayed_bug(span, "could not resolve trait item being implemented") | |
| 1349 | }); | |
| 1350 | let effective_ident = self.check_pin_drop_sugar_impl_item(i, ident, trait_item_def_id); | |
| 1361 | 1351 | (effective_ident, ImplItemImplKind::Trait { defaultness, trait_item_def_id }) |
| 1362 | 1352 | } else { |
| 1363 | 1353 | (ident, ImplItemImplKind::Inherent { vis_span: self.lower_span(i.vis.span) }) |
| ... | ... | @@ -1928,11 +1918,11 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1928 | 1918 | |
| 1929 | 1919 | // Introduce extra lifetimes if late resolution tells us to. |
| 1930 | 1920 | let extra_lifetimes = self.resolver.extra_lifetime_params(parent_node_id); |
| 1931 | params.extend(extra_lifetimes.into_iter().filter_map(|&(ident, node_id, res)| { | |
| 1921 | params.extend(extra_lifetimes.into_iter().map(|&(ident, node_id, kind)| { | |
| 1932 | 1922 | self.lifetime_res_to_generic_param( |
| 1933 | 1923 | ident, |
| 1934 | 1924 | node_id, |
| 1935 | res, | |
| 1925 | kind, | |
| 1936 | 1926 | hir::GenericParamSource::Generics, |
| 1937 | 1927 | ) |
| 1938 | 1928 | })); |
compiler/rustc_ast_lowering/src/lib.rs+18-31| ... | ... | @@ -55,7 +55,7 @@ use rustc_hir::definitions::PerParentDisambiguatorState; |
| 55 | 55 | use rustc_hir::lints::DelayedLint; |
| 56 | 56 | use rustc_hir::{ |
| 57 | 57 | self as hir, AngleBrackets, ConstArg, GenericArg, HirId, ItemLocalMap, LifetimeSource, |
| 58 | LifetimeSyntax, ParamName, Target, TraitCandidate, find_attr, | |
| 58 | LifetimeSyntax, MissingLifetimeKind, ParamName, Target, TraitCandidate, find_attr, | |
| 59 | 59 | }; |
| 60 | 60 | use rustc_index::{Idx, IndexSlice, IndexVec}; |
| 61 | 61 | use rustc_macros::extension; |
| ... | ... | @@ -310,7 +310,7 @@ impl<'tcx> ResolverAstLowering<'tcx> { |
| 310 | 310 | /// |
| 311 | 311 | /// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring |
| 312 | 312 | /// should appear at the enclosing `PolyTraitRef`. |
| 313 | fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, LifetimeRes)] { | |
| 313 | fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, MissingLifetimeKind)] { | |
| 314 | 314 | self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..]) |
| 315 | 315 | } |
| 316 | 316 | |
| ... | ... | @@ -542,7 +542,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> { |
| 542 | 542 | let ast_index = index_crate(&resolver, &krate); |
| 543 | 543 | let mut owners = IndexVec::from_fn_n( |
| 544 | 544 | |_| hir::MaybeOwner::Phantom, |
| 545 | tcx.definitions_untracked().def_index_count(), | |
| 545 | tcx.definitions_untracked().num_definitions(), | |
| 546 | 546 | ); |
| 547 | 547 | |
| 548 | 548 | let mut lowerer = item::ItemLowerer { |
| ... | ... | @@ -948,43 +948,30 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 948 | 948 | &mut self, |
| 949 | 949 | ident: Ident, |
| 950 | 950 | node_id: NodeId, |
| 951 | res: LifetimeRes, | |
| 951 | kind: MissingLifetimeKind, | |
| 952 | 952 | source: hir::GenericParamSource, |
| 953 | ) -> Option<hir::GenericParam<'hir>> { | |
| 954 | let (name, kind) = match res { | |
| 955 | LifetimeRes::Param { .. } => { | |
| 956 | (hir::ParamName::Plain(ident), hir::LifetimeParamKind::Explicit) | |
| 957 | } | |
| 958 | LifetimeRes::Fresh { param, kind, .. } => { | |
| 959 | // Late resolution delegates to us the creation of the `LocalDefId`. | |
| 960 | let _def_id = self.create_def( | |
| 961 | param, | |
| 962 | Some(kw::UnderscoreLifetime), | |
| 963 | DefKind::LifetimeParam, | |
| 964 | ident.span, | |
| 965 | ); | |
| 966 | debug!(?_def_id); | |
| 953 | ) -> hir::GenericParam<'hir> { | |
| 954 | // Late resolution delegates to us the creation of the `LocalDefId`. | |
| 955 | let _def_id = self.create_def( | |
| 956 | node_id, | |
| 957 | Some(kw::UnderscoreLifetime), | |
| 958 | DefKind::LifetimeParam, | |
| 959 | ident.span, | |
| 960 | ); | |
| 961 | debug!(?_def_id); | |
| 967 | 962 | |
| 968 | (hir::ParamName::Fresh, hir::LifetimeParamKind::Elided(kind)) | |
| 969 | } | |
| 970 | LifetimeRes::Static { .. } | LifetimeRes::Error(..) => return None, | |
| 971 | res => panic!( | |
| 972 | "Unexpected lifetime resolution {:?} for {:?} at {:?}", | |
| 973 | res, ident, ident.span | |
| 974 | ), | |
| 975 | }; | |
| 976 | 963 | let hir_id = self.lower_node_id(node_id); |
| 977 | 964 | let def_id = self.local_def_id(node_id); |
| 978 | Some(hir::GenericParam { | |
| 965 | hir::GenericParam { | |
| 979 | 966 | hir_id, |
| 980 | 967 | def_id, |
| 981 | name, | |
| 968 | name: hir::ParamName::Fresh, | |
| 982 | 969 | span: self.lower_span(ident.span), |
| 983 | 970 | pure_wrt_drop: false, |
| 984 | kind: hir::GenericParamKind::Lifetime { kind }, | |
| 971 | kind: hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Elided(kind) }, | |
| 985 | 972 | colon_span: None, |
| 986 | 973 | source, |
| 987 | }) | |
| 974 | } | |
| 988 | 975 | } |
| 989 | 976 | |
| 990 | 977 | /// Lowers a lifetime binder that defines `generic_params`, returning the corresponding HIR |
| ... | ... | @@ -1005,7 +992,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1005 | 992 | debug!(?extra_lifetimes); |
| 1006 | 993 | let extra_lifetimes: Vec<_> = extra_lifetimes |
| 1007 | 994 | .iter() |
| 1008 | .filter_map(|&(ident, node_id, res)| { | |
| 995 | .map(|&(ident, node_id, res)| { | |
| 1009 | 996 | self.lifetime_res_to_generic_param( |
| 1010 | 997 | ident, |
| 1011 | 998 | node_id, |
compiler/rustc_attr_parsing/src/attributes/deprecation.rs+50-10| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use rustc_ast::LitKind; | |
| 1 | 2 | use rustc_hir::attrs::{DeprecatedSince, Deprecation}; |
| 2 | 3 | use rustc_hir::{RustcVersion, VERSION_PLACEHOLDER}; |
| 3 | 4 | |
| ... | ... | @@ -76,6 +77,38 @@ impl SingleAttributeParser for DeprecatedParser { |
| 76 | 77 | // ok |
| 77 | 78 | } |
| 78 | 79 | ArgParser::List(list) => { |
| 80 | // If the argument list contains a single string literal: | |
| 81 | // check whether it may be a version and suggest since field | |
| 82 | // otherwise, suggest using NameValue syntax | |
| 83 | if let Some(elem) = list.as_single() | |
| 84 | && let Some(lit) = elem.as_lit() | |
| 85 | && let LitKind::Str(text, _) = lit.kind | |
| 86 | { | |
| 87 | let mut adcx = cx.adcx(); | |
| 88 | ||
| 89 | match parse_since(text, true) { | |
| 90 | DeprecatedSince::Future | DeprecatedSince::RustcVersion(_) => { | |
| 91 | adcx.push_suggestion( | |
| 92 | String::from("try specifying a deprecated since version"), | |
| 93 | elem.span(), | |
| 94 | format!("since = {}", lit.kind), | |
| 95 | ); | |
| 96 | } | |
| 97 | _ => { | |
| 98 | if let Some(span) = args.span() { | |
| 99 | adcx.push_suggestion( | |
| 100 | String::from("try using `=` instead"), | |
| 101 | span, | |
| 102 | format!(" = {}", lit.kind), | |
| 103 | ); | |
| 104 | } | |
| 105 | } | |
| 106 | }; | |
| 107 | ||
| 108 | adcx.expected_not_literal(elem.span()); | |
| 109 | return None; | |
| 110 | } | |
| 111 | ||
| 79 | 112 | for param in list.mixed() { |
| 80 | 113 | let Some(param) = param.meta_item() else { |
| 81 | 114 | cx.adcx().expected_not_literal(param.span()); |
| ... | ... | @@ -133,18 +166,11 @@ impl SingleAttributeParser for DeprecatedParser { |
| 133 | 166 | } |
| 134 | 167 | |
| 135 | 168 | let since = if let Some(since) = since { |
| 136 | if since.as_str() == "TBD" { | |
| 137 | DeprecatedSince::Future | |
| 138 | } else if !is_rustc { | |
| 139 | DeprecatedSince::NonStandard(since) | |
| 140 | } else if since.as_str() == VERSION_PLACEHOLDER { | |
| 141 | DeprecatedSince::RustcVersion(RustcVersion::CURRENT) | |
| 142 | } else if let Some(version) = parse_version(since) { | |
| 143 | DeprecatedSince::RustcVersion(version) | |
| 144 | } else { | |
| 169 | let since = parse_since(since, is_rustc); | |
| 170 | if matches!(since, DeprecatedSince::Err) { | |
| 145 | 171 | cx.emit_err(InvalidSince { span: cx.attr_span }); |
| 146 | DeprecatedSince::Err | |
| 147 | 172 | } |
| 173 | since | |
| 148 | 174 | } else if is_rustc { |
| 149 | 175 | cx.emit_err(MissingSince { span: cx.attr_span }); |
| 150 | 176 | DeprecatedSince::Err |
| ... | ... | @@ -163,3 +189,17 @@ impl SingleAttributeParser for DeprecatedParser { |
| 163 | 189 | }) |
| 164 | 190 | } |
| 165 | 191 | } |
| 192 | ||
| 193 | fn parse_since(since: Symbol, is_rustc: bool) -> DeprecatedSince { | |
| 194 | if since.as_str() == "TBD" { | |
| 195 | DeprecatedSince::Future | |
| 196 | } else if !is_rustc { | |
| 197 | DeprecatedSince::NonStandard(since) | |
| 198 | } else if since.as_str() == VERSION_PLACEHOLDER { | |
| 199 | DeprecatedSince::RustcVersion(RustcVersion::CURRENT) | |
| 200 | } else if let Some(version) = parse_version(since) { | |
| 201 | DeprecatedSince::RustcVersion(version) | |
| 202 | } else { | |
| 203 | DeprecatedSince::Err | |
| 204 | } | |
| 205 | } |
compiler/rustc_attr_parsing/src/interface.rs+1-3| ... | ... | @@ -412,9 +412,7 @@ impl<'sess> AttributeParser<'sess> { |
| 412 | 412 | (accept.accept_fn)(&mut cx, &args); |
| 413 | 413 | finalizers.push(accept.finalizer); |
| 414 | 414 | |
| 415 | if !matches!(cx.should_emit, ShouldEmit::Nothing) { | |
| 416 | Self::check_target(&accept.allowed_targets, target, &mut cx); | |
| 417 | } | |
| 415 | Self::check_target(&accept.allowed_targets, &mut cx); | |
| 418 | 416 | } else { |
| 419 | 417 | let attr = AttrItem { |
| 420 | 418 | path: attr_path.clone(), |
compiler/rustc_attr_parsing/src/target_checking.rs+18-11| ... | ... | @@ -7,7 +7,6 @@ use rustc_hir::attrs::AttributeKind; |
| 7 | 7 | use rustc_hir::{AttrItem, Attribute, MethodKind, Target}; |
| 8 | 8 | use rustc_span::{BytePos, FileName, RemapPathScopeComponents, Span, Symbol, sym}; |
| 9 | 9 | |
| 10 | use crate::AttributeParser; | |
| 11 | 10 | use crate::context::AcceptContext; |
| 12 | 11 | use crate::errors::{ |
| 13 | 12 | InvalidAttrAtCrateLevel, InvalidTargetLint, ItemFollowingInnerAttr, |
| ... | ... | @@ -15,6 +14,7 @@ use crate::errors::{ |
| 15 | 14 | }; |
| 16 | 15 | use crate::session_diagnostics::InvalidTarget; |
| 17 | 16 | use crate::target_checking::Policy::Allow; |
| 17 | use crate::{AttributeParser, ShouldEmit}; | |
| 18 | 18 | |
| 19 | 19 | #[derive(Debug)] |
| 20 | 20 | pub(crate) enum AllowedTargets { |
| ... | ... | @@ -90,17 +90,20 @@ pub(crate) enum Policy { |
| 90 | 90 | impl<'sess> AttributeParser<'sess> { |
| 91 | 91 | pub(crate) fn check_target( |
| 92 | 92 | allowed_targets: &AllowedTargets, |
| 93 | target: Target, | |
| 94 | 93 | cx: &mut AcceptContext<'_, 'sess>, |
| 95 | 94 | ) { |
| 95 | if matches!(cx.should_emit, ShouldEmit::Nothing) { | |
| 96 | return; | |
| 97 | } | |
| 98 | ||
| 96 | 99 | // For crate-level attributes we emit a specific set of lints to warn |
| 97 | 100 | // people about accidentally not using them on the crate. |
| 98 | 101 | if let &AllowedTargets::AllowList(&[Allow(Target::Crate)]) = allowed_targets { |
| 99 | Self::check_crate_level(target, cx); | |
| 102 | Self::check_crate_level(cx); | |
| 100 | 103 | return; |
| 101 | 104 | } |
| 102 | 105 | |
| 103 | if matches!(cx.attr_path.segments.as_ref(), [sym::repr]) && target == Target::Crate { | |
| 106 | if matches!(cx.attr_path.segments.as_ref(), [sym::repr]) && cx.target == Target::Crate { | |
| 104 | 107 | // The allowed targets of `repr` depend on its arguments. They can't be checked using |
| 105 | 108 | // the `AttributeParser` code. |
| 106 | 109 | let span = cx.attr_span; |
| ... | ... | @@ -119,11 +122,12 @@ impl<'sess> AttributeParser<'sess> { |
| 119 | 122 | .emit(); |
| 120 | 123 | } |
| 121 | 124 | |
| 122 | match allowed_targets.is_allowed(target) { | |
| 125 | match allowed_targets.is_allowed(cx.target) { | |
| 123 | 126 | AllowedResult::Allowed => {} |
| 124 | 127 | AllowedResult::Warn => { |
| 125 | 128 | let allowed_targets = allowed_targets.allowed_targets(); |
| 126 | let (applied, only) = allowed_targets_applied(allowed_targets, target, cx.features); | |
| 129 | let (applied, only) = | |
| 130 | allowed_targets_applied(allowed_targets, cx.target, cx.features); | |
| 127 | 131 | let name = cx.attr_path.clone(); |
| 128 | 132 | |
| 129 | 133 | let lint = if name.segments[0] == sym::deprecated |
| ... | ... | @@ -134,7 +138,7 @@ impl<'sess> AttributeParser<'sess> { |
| 134 | 138 | Target::Arm, |
| 135 | 139 | Target::MacroCall, |
| 136 | 140 | ] |
| 137 | .contains(&target) | |
| 141 | .contains(&cx.target) | |
| 138 | 142 | { |
| 139 | 143 | rustc_session::lint::builtin::USELESS_DEPRECATED |
| 140 | 144 | } else { |
| ... | ... | @@ -142,6 +146,7 @@ impl<'sess> AttributeParser<'sess> { |
| 142 | 146 | }; |
| 143 | 147 | |
| 144 | 148 | let attr_span = cx.attr_span; |
| 149 | let target = cx.target; | |
| 145 | 150 | cx.emit_lint_with_sess( |
| 146 | 151 | lint, |
| 147 | 152 | move |dcx, level, _| { |
| ... | ... | @@ -161,12 +166,13 @@ impl<'sess> AttributeParser<'sess> { |
| 161 | 166 | } |
| 162 | 167 | AllowedResult::Error => { |
| 163 | 168 | let allowed_targets = allowed_targets.allowed_targets(); |
| 164 | let (applied, only) = allowed_targets_applied(allowed_targets, target, cx.features); | |
| 169 | let (applied, only) = | |
| 170 | allowed_targets_applied(allowed_targets, cx.target, cx.features); | |
| 165 | 171 | let name = cx.attr_path.clone(); |
| 166 | 172 | cx.dcx().emit_err(InvalidTarget { |
| 167 | 173 | span: cx.attr_span.clone(), |
| 168 | 174 | name, |
| 169 | target: target.plural_name(), | |
| 175 | target: cx.target.plural_name(), | |
| 170 | 176 | only: if only { "only " } else { "" }, |
| 171 | 177 | applied: DiagArgValue::StrListSepByAnd( |
| 172 | 178 | applied.into_iter().map(Cow::Owned).collect(), |
| ... | ... | @@ -176,8 +182,8 @@ impl<'sess> AttributeParser<'sess> { |
| 176 | 182 | } |
| 177 | 183 | } |
| 178 | 184 | |
| 179 | pub(crate) fn check_crate_level(target: Target, cx: &mut AcceptContext<'_, 'sess>) { | |
| 180 | if target == Target::Crate { | |
| 185 | pub(crate) fn check_crate_level(cx: &mut AcceptContext<'_, 'sess>) { | |
| 186 | if cx.target == Target::Crate { | |
| 181 | 187 | return; |
| 182 | 188 | } |
| 183 | 189 | |
| ... | ... | @@ -200,6 +206,7 @@ impl<'sess> AttributeParser<'sess> { |
| 200 | 206 | }) |
| 201 | 207 | .unwrap_or_default(); |
| 202 | 208 | |
| 209 | let target = cx.target; | |
| 203 | 210 | cx.emit_lint( |
| 204 | 211 | rustc_session::lint::builtin::UNUSED_ATTRIBUTES, |
| 205 | 212 | crate::errors::InvalidAttrStyle { |
compiler/rustc_codegen_gcc/build_system/src/test.rs-2| ... | ... | @@ -886,8 +886,6 @@ fn valid_ui_error_pattern_test(file: &str) -> bool { |
| 886 | 886 | "type-alias-impl-trait/auxiliary/cross_crate_ice.rs", |
| 887 | 887 | "type-alias-impl-trait/auxiliary/cross_crate_ice2.rs", |
| 888 | 888 | "macros/rfc-2011-nicer-assert-messages/auxiliary/common.rs", |
| 889 | "imports/ambiguous-1.rs", | |
| 890 | "imports/ambiguous-4-extern.rs", | |
| 891 | 889 | "entry-point/auxiliary/bad_main_functions.rs", |
| 892 | 890 | ] |
| 893 | 891 | .iter() |
compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs+29-17| ... | ... | @@ -319,25 +319,26 @@ impl KernelArgsTy { |
| 319 | 319 | geps: [&'ll Value; 3], |
| 320 | 320 | workgroup_dims: &'ll Value, |
| 321 | 321 | thread_dims: &'ll Value, |
| 322 | ) -> [(Align, &'ll Value); 13] { | |
| 322 | dyn_cache: &'ll Value, | |
| 323 | ) -> [(Align, &'ll str, &'ll Value); 13] { | |
| 323 | 324 | let four = Align::from_bytes(4).expect("4 Byte alignment should work"); |
| 324 | 325 | let eight = Align::EIGHT; |
| 325 | 326 | |
| 326 | 327 | [ |
| 327 | (four, cx.get_const_i32(KernelArgsTy::OFFLOAD_VERSION)), | |
| 328 | (four, cx.get_const_i32(num_args)), | |
| 329 | (eight, geps[0]), | |
| 330 | (eight, geps[1]), | |
| 331 | (eight, geps[2]), | |
| 332 | (eight, memtransfer_types), | |
| 328 | (four, "Version", cx.get_const_i32(KernelArgsTy::OFFLOAD_VERSION)), | |
| 329 | (four, "NumArgs", cx.get_const_i32(num_args)), | |
| 330 | (eight, "ArgBasePtrs", geps[0]), | |
| 331 | (eight, "ArgPtrs", geps[1]), | |
| 332 | (eight, "ArgSizes", geps[2]), | |
| 333 | (eight, "ArgTypes", memtransfer_types), | |
| 333 | 334 | // The next two are debug infos. FIXME(offload): set them |
| 334 | (eight, cx.const_null(cx.type_ptr())), // dbg | |
| 335 | (eight, cx.const_null(cx.type_ptr())), // dbg | |
| 336 | (eight, cx.get_const_i64(KernelArgsTy::TRIPCOUNT)), | |
| 337 | (eight, cx.get_const_i64(KernelArgsTy::FLAGS)), | |
| 338 | (four, workgroup_dims), | |
| 339 | (four, thread_dims), | |
| 340 | (four, cx.get_const_i32(0)), | |
| 335 | (eight, "ArgNames", cx.const_null(cx.type_ptr())), // dbg | |
| 336 | (eight, "ArgMappers", cx.const_null(cx.type_ptr())), // dbg | |
| 337 | (eight, "Tripcount", cx.get_const_i64(KernelArgsTy::TRIPCOUNT)), | |
| 338 | (eight, "Flags", cx.get_const_i64(KernelArgsTy::FLAGS)), | |
| 339 | (four, "NumTeams", workgroup_dims), | |
| 340 | (four, "ThreadLimit", thread_dims), | |
| 341 | (four, "DynCGroupMem", dyn_cache), | |
| 341 | 342 | ] |
| 342 | 343 | } |
| 343 | 344 | } |
| ... | ... | @@ -589,6 +590,7 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>( |
| 589 | 590 | metadata: &[OffloadMetadata], |
| 590 | 591 | offload_globals: &OffloadGlobals<'ll>, |
| 591 | 592 | offload_dims: &OffloadKernelDims<'ll>, |
| 593 | dyn_cache: &'ll Value, | |
| 592 | 594 | ) { |
| 593 | 595 | let cx = builder.cx; |
| 594 | 596 | let OffloadKernelGlobals { |
| ... | ... | @@ -753,14 +755,24 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>( |
| 753 | 755 | num_args, |
| 754 | 756 | s_ident_t, |
| 755 | 757 | ); |
| 756 | let values = | |
| 757 | KernelArgsTy::new(&cx, num_args, memtransfer_kernel, geps, workgroup_dims, thread_dims); | |
| 758 | let values = KernelArgsTy::new( | |
| 759 | &cx, | |
| 760 | num_args, | |
| 761 | memtransfer_kernel, | |
| 762 | geps, | |
| 763 | workgroup_dims, | |
| 764 | thread_dims, | |
| 765 | dyn_cache, | |
| 766 | ); | |
| 758 | 767 | |
| 759 | 768 | // Step 3) |
| 760 | 769 | // Here we fill the KernelArgsTy, see the documentation above |
| 761 | 770 | for (i, value) in values.iter().enumerate() { |
| 762 | 771 | let ptr = builder.inbounds_gep(tgt_kernel_decl, a5, &[i32_0, cx.get_const_i32(i as u64)]); |
| 763 | builder.store(value.1, ptr, value.0); | |
| 772 | let name = std::ffi::CString::new(value.1).unwrap(); | |
| 773 | llvm::set_value_name(ptr, &name.as_bytes()); | |
| 774 | ||
| 775 | builder.store(value.2, ptr, value.0); | |
| 764 | 776 | } |
| 765 | 777 | |
| 766 | 778 | let args = vec![ |
compiler/rustc_codegen_llvm/src/intrinsic.rs+15-2| ... | ... | @@ -1926,7 +1926,11 @@ fn codegen_offload<'ll, 'tcx>( |
| 1926 | 1926 | }; |
| 1927 | 1927 | |
| 1928 | 1928 | let offload_dims = OffloadKernelDims::from_operands(bx, &args[1], &args[2]); |
| 1929 | let args = get_args_from_tuple(bx, args[3], fn_target); | |
| 1929 | let dyn_cache = match args[3].val { | |
| 1930 | OperandValue::Immediate(val) => val, | |
| 1931 | _ => panic!("unparsable"), | |
| 1932 | }; | |
| 1933 | let args = get_args_from_tuple(bx, args[4], fn_target); | |
| 1930 | 1934 | let target_symbol = symbol_name_for_instance_in_crate(tcx, fn_target, LOCAL_CRATE); |
| 1931 | 1935 | |
| 1932 | 1936 | let sig = tcx.fn_sig(fn_target.def_id()).skip_binder(); |
| ... | ... | @@ -1958,7 +1962,16 @@ fn codegen_offload<'ll, 'tcx>( |
| 1958 | 1962 | }; |
| 1959 | 1963 | register_offload(cx); |
| 1960 | 1964 | let offload_data = gen_define_handling(&cx, &metadata, target_symbol, offload_globals); |
| 1961 | gen_call_handling(bx, &offload_data, &args, &types, &metadata, offload_globals, &offload_dims); | |
| 1965 | gen_call_handling( | |
| 1966 | bx, | |
| 1967 | &offload_data, | |
| 1968 | &args, | |
| 1969 | &types, | |
| 1970 | &metadata, | |
| 1971 | offload_globals, | |
| 1972 | &offload_dims, | |
| 1973 | &dyn_cache, | |
| 1974 | ); | |
| 1962 | 1975 | } |
| 1963 | 1976 | |
| 1964 | 1977 | fn get_args_from_tuple<'ll, 'tcx>( |
compiler/rustc_codegen_ssa/src/back/link.rs-4| ... | ... | @@ -1530,7 +1530,6 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { |
| 1530 | 1530 | } |
| 1531 | 1531 | LinkerFlavor::Bpf => "bpf-linker", |
| 1532 | 1532 | LinkerFlavor::Llbc => "llvm-bitcode-linker", |
| 1533 | LinkerFlavor::Ptx => "rust-ptx-linker", | |
| 1534 | 1533 | }), |
| 1535 | 1534 | flavor, |
| 1536 | 1535 | )), |
| ... | ... | @@ -1571,7 +1570,6 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { |
| 1571 | 1570 | let linker_flavor = match sess.opts.cg.linker_flavor { |
| 1572 | 1571 | // The linker flavors that are non-target specific can be directly translated to LinkerFlavor |
| 1573 | 1572 | Some(LinkerFlavorCli::Llbc) => Some(LinkerFlavor::Llbc), |
| 1574 | Some(LinkerFlavorCli::Ptx) => Some(LinkerFlavor::Ptx), | |
| 1575 | 1573 | // The linker flavors that corresponds to targets needs logic that keeps the base LinkerFlavor |
| 1576 | 1574 | linker_flavor => { |
| 1577 | 1575 | linker_flavor.map(|flavor| sess.target.linker_flavor.with_cli_hints(flavor)) |
| ... | ... | @@ -2764,8 +2762,6 @@ fn add_order_independent_options( |
| 2764 | 2762 | if crate_info.target_features.len() > 0 { |
| 2765 | 2763 | cmd.link_arg(&format!("--target-feature={}", &crate_info.target_features.join(","))); |
| 2766 | 2764 | } |
| 2767 | } else if flavor == LinkerFlavor::Ptx { | |
| 2768 | cmd.link_args(&["--fallback-arch", &crate_info.target_cpu]); | |
| 2769 | 2765 | } else if flavor == LinkerFlavor::Bpf { |
| 2770 | 2766 | cmd.link_args(&["--cpu", &crate_info.target_cpu]); |
| 2771 | 2767 | if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features] |
compiler/rustc_codegen_ssa/src/back/linker.rs-79| ... | ... | @@ -161,7 +161,6 @@ pub(crate) fn get_linker<'a>( |
| 161 | 161 | LinkerFlavor::EmCc => Box::new(EmLinker { cmd, sess }) as Box<dyn Linker>, |
| 162 | 162 | LinkerFlavor::Bpf => Box::new(BpfLinker { cmd, sess }) as Box<dyn Linker>, |
| 163 | 163 | LinkerFlavor::Llbc => Box::new(LlbcLinker { cmd, sess }) as Box<dyn Linker>, |
| 164 | LinkerFlavor::Ptx => Box::new(PtxLinker { cmd, sess }) as Box<dyn Linker>, | |
| 165 | 164 | } |
| 166 | 165 | } |
| 167 | 166 | |
| ... | ... | @@ -283,7 +282,6 @@ generate_arg_methods! { |
| 283 | 282 | L4Bender<'_> |
| 284 | 283 | AixLinker<'_> |
| 285 | 284 | LlbcLinker<'_> |
| 286 | PtxLinker<'_> | |
| 287 | 285 | BpfLinker<'_> |
| 288 | 286 | dyn Linker + '_ |
| 289 | 287 | } |
| ... | ... | @@ -1920,83 +1918,6 @@ pub(crate) fn linked_symbols( |
| 1920 | 1918 | symbols |
| 1921 | 1919 | } |
| 1922 | 1920 | |
| 1923 | /// Much simplified and explicit CLI for the NVPTX linker. The linker operates | |
| 1924 | /// with bitcode and uses LLVM backend to generate a PTX assembly. | |
| 1925 | struct PtxLinker<'a> { | |
| 1926 | cmd: Command, | |
| 1927 | sess: &'a Session, | |
| 1928 | } | |
| 1929 | ||
| 1930 | impl<'a> Linker for PtxLinker<'a> { | |
| 1931 | fn cmd(&mut self) -> &mut Command { | |
| 1932 | &mut self.cmd | |
| 1933 | } | |
| 1934 | ||
| 1935 | fn set_output_kind( | |
| 1936 | &mut self, | |
| 1937 | _output_kind: LinkOutputKind, | |
| 1938 | _crate_type: CrateType, | |
| 1939 | _out_filename: &Path, | |
| 1940 | ) { | |
| 1941 | } | |
| 1942 | ||
| 1943 | fn link_staticlib_by_name(&mut self, _name: &str, _verbatim: bool, _whole_archive: bool) { | |
| 1944 | panic!("staticlibs not supported") | |
| 1945 | } | |
| 1946 | ||
| 1947 | fn link_staticlib_by_path(&mut self, path: &Path, _whole_archive: bool) { | |
| 1948 | self.link_arg("--rlib").link_arg(path); | |
| 1949 | } | |
| 1950 | ||
| 1951 | fn debuginfo(&mut self, _strip: Strip, _: &[PathBuf]) { | |
| 1952 | self.link_arg("--debug"); | |
| 1953 | } | |
| 1954 | ||
| 1955 | fn add_object(&mut self, path: &Path) { | |
| 1956 | self.link_arg("--bitcode").link_arg(path); | |
| 1957 | } | |
| 1958 | ||
| 1959 | fn optimize(&mut self) { | |
| 1960 | match self.sess.lto() { | |
| 1961 | Lto::Thin | Lto::Fat | Lto::ThinLocal => { | |
| 1962 | self.link_arg("-Olto"); | |
| 1963 | } | |
| 1964 | ||
| 1965 | Lto::No => {} | |
| 1966 | } | |
| 1967 | } | |
| 1968 | ||
| 1969 | fn full_relro(&mut self) {} | |
| 1970 | ||
| 1971 | fn partial_relro(&mut self) {} | |
| 1972 | ||
| 1973 | fn no_relro(&mut self) {} | |
| 1974 | ||
| 1975 | fn gc_sections(&mut self, _keep_metadata: bool) {} | |
| 1976 | ||
| 1977 | fn pgo_gen(&mut self) {} | |
| 1978 | ||
| 1979 | fn no_crt_objects(&mut self) {} | |
| 1980 | ||
| 1981 | fn no_default_libraries(&mut self) {} | |
| 1982 | ||
| 1983 | fn control_flow_guard(&mut self) {} | |
| 1984 | ||
| 1985 | fn ehcont_guard(&mut self) {} | |
| 1986 | ||
| 1987 | fn export_symbols( | |
| 1988 | &mut self, | |
| 1989 | _tmpdir: &Path, | |
| 1990 | _crate_type: CrateType, | |
| 1991 | _symbols: &[(String, SymbolExportKind)], | |
| 1992 | ) { | |
| 1993 | } | |
| 1994 | ||
| 1995 | fn windows_subsystem(&mut self, _subsystem: WindowsSubsystemKind) {} | |
| 1996 | ||
| 1997 | fn linker_plugin_lto(&mut self) {} | |
| 1998 | } | |
| 1999 | ||
| 2000 | 1921 | /// The `self-contained` LLVM bitcode linker |
| 2001 | 1922 | struct LlbcLinker<'a> { |
| 2002 | 1923 | cmd: Command, |
compiler/rustc_feature/src/unstable.rs+2| ... | ... | @@ -454,6 +454,8 @@ declare_features! ( |
| 454 | 454 | (unstable, cfg_version, "1.45.0", Some(64796)), |
| 455 | 455 | /// Allows to use the `#[cfi_encoding = ""]` attribute. |
| 456 | 456 | (unstable, cfi_encoding, "1.71.0", Some(89653)), |
| 457 | /// The `clflushopt` target feature on x86. | |
| 458 | (unstable, clflushopt_target_feature, "CURRENT_RUSTC_VERSION", Some(157096)), | |
| 457 | 459 | /// Allows `for<...>` on closures and coroutines. |
| 458 | 460 | (unstable, closure_lifetime_binder, "1.64.0", Some(97362)), |
| 459 | 461 | /// Allows `#[track_caller]` on closures and coroutines. |
compiler/rustc_hir/src/def.rs-2| ... | ... | @@ -991,8 +991,6 @@ pub enum LifetimeRes { |
| 991 | 991 | /// |
| 992 | 992 | /// Creating the associated `LocalDefId` is the responsibility of lowering. |
| 993 | 993 | param: NodeId, |
| 994 | /// Id of the introducing place. See `Param`. | |
| 995 | binder: NodeId, | |
| 996 | 994 | /// Kind of elided lifetime |
| 997 | 995 | kind: hir::MissingLifetimeKind, |
| 998 | 996 | }, |
compiler/rustc_hir/src/definitions.rs+70-105| ... | ... | @@ -20,84 +20,6 @@ pub use crate::def_id::DefPathHash; |
| 20 | 20 | use crate::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId}; |
| 21 | 21 | use crate::def_path_hash_map::DefPathHashMap; |
| 22 | 22 | |
| 23 | /// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa. | |
| 24 | /// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey` | |
| 25 | /// stores the `DefIndex` of its parent. | |
| 26 | /// There is one `DefPathTable` for each crate. | |
| 27 | #[derive(Debug)] | |
| 28 | pub struct DefPathTable { | |
| 29 | stable_crate_id: StableCrateId, | |
| 30 | index_to_key: IndexVec<DefIndex, DefKey>, | |
| 31 | // We do only store the local hash, as all the definitions are from the current crate. | |
| 32 | def_path_hashes: IndexVec<DefIndex, Hash64>, | |
| 33 | def_path_hash_to_index: DefPathHashMap, | |
| 34 | } | |
| 35 | ||
| 36 | impl DefPathTable { | |
| 37 | fn new(stable_crate_id: StableCrateId) -> DefPathTable { | |
| 38 | DefPathTable { | |
| 39 | stable_crate_id, | |
| 40 | index_to_key: Default::default(), | |
| 41 | def_path_hashes: Default::default(), | |
| 42 | def_path_hash_to_index: Default::default(), | |
| 43 | } | |
| 44 | } | |
| 45 | ||
| 46 | fn allocate(&mut self, key: DefKey, def_path_hash: DefPathHash) -> DefIndex { | |
| 47 | // Assert that all DefPathHashes correctly contain the local crate's StableCrateId. | |
| 48 | debug_assert_eq!(self.stable_crate_id, def_path_hash.stable_crate_id()); | |
| 49 | let local_hash = def_path_hash.local_hash(); | |
| 50 | ||
| 51 | let index = self.index_to_key.push(key); | |
| 52 | debug!("DefPathTable::insert() - {key:?} <-> {index:?}"); | |
| 53 | ||
| 54 | self.def_path_hashes.push(local_hash); | |
| 55 | debug_assert!(self.def_path_hashes.len() == self.index_to_key.len()); | |
| 56 | ||
| 57 | // Check for hash collisions of DefPathHashes. These should be | |
| 58 | // exceedingly rare. | |
| 59 | if let Some(existing) = self.def_path_hash_to_index.insert(&local_hash, &index) { | |
| 60 | let def_path1 = DefPath::make(LOCAL_CRATE, existing, |idx| self.def_key(idx)); | |
| 61 | let def_path2 = DefPath::make(LOCAL_CRATE, index, |idx| self.def_key(idx)); | |
| 62 | ||
| 63 | // Continuing with colliding DefPathHashes can lead to correctness | |
| 64 | // issues. We must abort compilation. | |
| 65 | // | |
| 66 | // The likelihood of such a collision is very small, so actually | |
| 67 | // running into one could be indicative of a poor hash function | |
| 68 | // being used. | |
| 69 | // | |
| 70 | // See the documentation for DefPathHash for more information. | |
| 71 | panic!( | |
| 72 | "found DefPathHash collision between {def_path1:#?} and {def_path2:#?}. \ | |
| 73 | Compilation cannot continue." | |
| 74 | ); | |
| 75 | } | |
| 76 | ||
| 77 | index | |
| 78 | } | |
| 79 | ||
| 80 | #[inline(always)] | |
| 81 | pub fn def_key(&self, index: DefIndex) -> DefKey { | |
| 82 | self.index_to_key[index] | |
| 83 | } | |
| 84 | ||
| 85 | #[instrument(level = "trace", skip(self), ret)] | |
| 86 | #[inline(always)] | |
| 87 | pub fn def_path_hash(&self, index: DefIndex) -> DefPathHash { | |
| 88 | let hash = self.def_path_hashes[index]; | |
| 89 | DefPathHash::new(self.stable_crate_id, hash) | |
| 90 | } | |
| 91 | ||
| 92 | pub fn enumerated_keys_and_path_hashes( | |
| 93 | &self, | |
| 94 | ) -> impl Iterator<Item = (DefIndex, &DefKey, DefPathHash)> + ExactSizeIterator { | |
| 95 | self.index_to_key | |
| 96 | .iter_enumerated() | |
| 97 | .map(move |(index, key)| (index, key, self.def_path_hash(index))) | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | 23 | #[derive(Debug, Default, Clone)] |
| 102 | 24 | pub struct PerParentDisambiguatorState { |
| 103 | 25 | #[cfg(debug_assertions)] |
| ... | ... | @@ -123,12 +45,13 @@ impl LocalDefIdMap<PerParentDisambiguatorState> { |
| 123 | 45 | } |
| 124 | 46 | } |
| 125 | 47 | |
| 126 | /// The definition table containing node definitions. | |
| 127 | /// It holds the `DefPathTable` for `LocalDefId`s/`DefPath`s. | |
| 128 | /// It also stores mappings to convert `LocalDefId`s to/from `HirId`s. | |
| 129 | 48 | #[derive(Debug)] |
| 130 | 49 | pub struct Definitions { |
| 131 | table: DefPathTable, | |
| 50 | stable_crate_id: StableCrateId, | |
| 51 | def_id_to_key: IndexVec<LocalDefId, DefKey>, | |
| 52 | // We do only store the local hash, as all the definitions are from the current crate. | |
| 53 | def_path_hashes: IndexVec<LocalDefId, Hash64>, | |
| 54 | def_path_hash_to_index: DefPathHashMap, | |
| 132 | 55 | } |
| 133 | 56 | |
| 134 | 57 | /// A unique identifier that we can use to lookup a definition |
| ... | ... | @@ -167,7 +90,7 @@ impl DefKey { |
| 167 | 90 | // Construct the new DefPathHash, making sure that the `crate_id` |
| 168 | 91 | // portion of the hash is properly copied from the parent. This way the |
| 169 | 92 | // `crate_id` part will be recursively propagated from the root to all |
| 170 | // DefPathHashes in this DefPathTable. | |
| 93 | // DefPathHashes in this Definitions. | |
| 171 | 94 | DefPathHash::new(parent.stable_crate_id(), local_hash) |
| 172 | 95 | } |
| 173 | 96 | |
| ... | ... | @@ -324,23 +247,15 @@ pub enum DefPathData { |
| 324 | 247 | } |
| 325 | 248 | |
| 326 | 249 | impl Definitions { |
| 327 | pub fn def_path_table(&self) -> &DefPathTable { | |
| 328 | &self.table | |
| 329 | } | |
| 330 | ||
| 331 | /// Gets the number of definitions. | |
| 332 | pub fn def_index_count(&self) -> usize { | |
| 333 | self.table.index_to_key.len() | |
| 334 | } | |
| 335 | ||
| 336 | #[inline] | |
| 250 | #[inline(always)] | |
| 337 | 251 | pub fn def_key(&self, id: LocalDefId) -> DefKey { |
| 338 | self.table.def_key(id.local_def_index) | |
| 252 | self.def_id_to_key[id] | |
| 339 | 253 | } |
| 340 | 254 | |
| 255 | #[instrument(level = "trace", skip(self), ret)] | |
| 341 | 256 | #[inline(always)] |
| 342 | 257 | pub fn def_path_hash(&self, id: LocalDefId) -> DefPathHash { |
| 343 | self.table.def_path_hash(id.local_def_index) | |
| 258 | DefPathHash::new(self.stable_crate_id, self.def_path_hashes[id]) | |
| 344 | 259 | } |
| 345 | 260 | |
| 346 | 261 | /// Returns the path from the crate root to `index`. The root |
| ... | ... | @@ -348,6 +263,7 @@ impl Definitions { |
| 348 | 263 | /// empty vector for the crate root). For an inlined item, this |
| 349 | 264 | /// will be the path of the item in the external crate (but the |
| 350 | 265 | /// path will begin with the path to the external crate). |
| 266 | #[inline] | |
| 351 | 267 | pub fn def_path(&self, id: LocalDefId) -> DefPath { |
| 352 | 268 | DefPath::make(LOCAL_CRATE, id.local_def_index, |index| { |
| 353 | 269 | self.def_key(LocalDefId { local_def_index: index }) |
| ... | ... | @@ -375,12 +291,62 @@ impl Definitions { |
| 375 | 291 | let def_path_hash = |
| 376 | 292 | DefPathHash::new(stable_crate_id, Hash64::new(stable_crate_id.as_u64())); |
| 377 | 293 | |
| 294 | let mut defs = Definitions { | |
| 295 | stable_crate_id, | |
| 296 | def_path_hashes: Default::default(), | |
| 297 | def_id_to_key: Default::default(), | |
| 298 | def_path_hash_to_index: Default::default(), | |
| 299 | }; | |
| 300 | ||
| 378 | 301 | // Create the root definition. |
| 379 | let mut table = DefPathTable::new(stable_crate_id); | |
| 380 | let root = LocalDefId { local_def_index: table.allocate(key, def_path_hash) }; | |
| 302 | let root = defs.allocate(key, def_path_hash); | |
| 381 | 303 | assert_eq!(root.local_def_index, CRATE_DEF_INDEX); |
| 382 | 304 | |
| 383 | Definitions { table } | |
| 305 | defs | |
| 306 | } | |
| 307 | ||
| 308 | fn allocate(&mut self, key: DefKey, def_path_hash: DefPathHash) -> LocalDefId { | |
| 309 | // Assert that all DefPathHashes correctly contain the local crate's StableCrateId. | |
| 310 | debug_assert_eq!(self.stable_crate_id, def_path_hash.stable_crate_id()); | |
| 311 | let local_hash = def_path_hash.local_hash(); | |
| 312 | ||
| 313 | let def_id = self.def_id_to_key.push(key); | |
| 314 | debug!("def_id_to_key.push() - {key:?} <-> {:?}", def_id.local_def_index); | |
| 315 | ||
| 316 | self.def_path_hashes.push(local_hash); | |
| 317 | debug_assert!(self.def_path_hashes.len() == self.def_id_to_key.len()); | |
| 318 | ||
| 319 | // Check for hash collisions of DefPathHashes. These should be | |
| 320 | // exceedingly rare. | |
| 321 | if let Some(existing) = | |
| 322 | self.def_path_hash_to_index.insert(&local_hash, &def_id.local_def_index) | |
| 323 | { | |
| 324 | let def_path1 = self.def_path(LocalDefId { local_def_index: existing }); | |
| 325 | let def_path2 = self.def_path(def_id); | |
| 326 | ||
| 327 | // Continuing with colliding DefPathHashes can lead to correctness | |
| 328 | // issues. We must abort compilation. | |
| 329 | // | |
| 330 | // The likelihood of such a collision is very small, so actually | |
| 331 | // running into one could be indicative of a poor hash function | |
| 332 | // being used. | |
| 333 | // | |
| 334 | // See the documentation for DefPathHash for more information. | |
| 335 | panic!( | |
| 336 | "found DefPathHash collision between {def_path1:#?} and {def_path2:#?}. \ | |
| 337 | Compilation cannot continue." | |
| 338 | ); | |
| 339 | } | |
| 340 | ||
| 341 | def_id | |
| 342 | } | |
| 343 | ||
| 344 | pub fn enumerated_keys_and_path_hashes( | |
| 345 | &self, | |
| 346 | ) -> impl Iterator<Item = (DefIndex, &DefKey, DefPathHash)> + ExactSizeIterator { | |
| 347 | self.def_id_to_key | |
| 348 | .iter_enumerated() | |
| 349 | .map(move |(def_id, key)| (def_id.local_def_index, key, self.def_path_hash(def_id))) | |
| 384 | 350 | } |
| 385 | 351 | |
| 386 | 352 | /// Creates a definition with a parent definition. |
| ... | ... | @@ -423,13 +389,13 @@ impl Definitions { |
| 423 | 389 | disambiguated_data: DisambiguatedDefPathData { data, disambiguator }, |
| 424 | 390 | }; |
| 425 | 391 | |
| 426 | let parent_hash = self.table.def_path_hash(parent.local_def_index); | |
| 392 | let parent_hash = self.def_path_hash(parent); | |
| 427 | 393 | let def_path_hash = key.compute_stable_hash(parent_hash); |
| 428 | 394 | |
| 429 | 395 | debug!("create_def: after disambiguation, key = {:?}", key); |
| 430 | 396 | |
| 431 | 397 | // Create the definition. |
| 432 | LocalDefId { local_def_index: self.table.allocate(key, def_path_hash) } | |
| 398 | self.allocate(key, def_path_hash) | |
| 433 | 399 | } |
| 434 | 400 | |
| 435 | 401 | #[inline(always)] |
| ... | ... | @@ -439,19 +405,18 @@ impl Definitions { |
| 439 | 405 | /// if the `DefPathHash` is from a previous compilation session and |
| 440 | 406 | /// the def-path does not exist anymore. |
| 441 | 407 | pub fn local_def_path_hash_to_def_id(&self, hash: DefPathHash) -> Option<LocalDefId> { |
| 442 | debug_assert!(hash.stable_crate_id() == self.table.stable_crate_id); | |
| 443 | self.table | |
| 444 | .def_path_hash_to_index | |
| 408 | debug_assert!(hash.stable_crate_id() == self.stable_crate_id); | |
| 409 | self.def_path_hash_to_index | |
| 445 | 410 | .get(&hash.local_hash()) |
| 446 | 411 | .map(|local_def_index| LocalDefId { local_def_index }) |
| 447 | 412 | } |
| 448 | 413 | |
| 449 | 414 | pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap { |
| 450 | &self.table.def_path_hash_to_index | |
| 415 | &self.def_path_hash_to_index | |
| 451 | 416 | } |
| 452 | 417 | |
| 453 | 418 | pub fn num_definitions(&self) -> usize { |
| 454 | self.table.def_path_hashes.len() | |
| 419 | self.def_path_hashes.len() | |
| 455 | 420 | } |
| 456 | 421 | } |
| 457 | 422 |
compiler/rustc_hir_analysis/src/check/intrinsic.rs+1| ... | ... | @@ -356,6 +356,7 @@ pub(crate) fn check_intrinsic_type( |
| 356 | 356 | param(0), |
| 357 | 357 | Ty::new_array_with_const_len(tcx, tcx.types.u32, Const::from_target_usize(tcx, 3)), |
| 358 | 358 | Ty::new_array_with_const_len(tcx, tcx.types.u32, Const::from_target_usize(tcx, 3)), |
| 359 | tcx.types.u32, | |
| 359 | 360 | param(1), |
| 360 | 361 | ], |
| 361 | 362 | param(2), |
compiler/rustc_lint_defs/src/builtin.rs+10-17| ... | ... | @@ -4529,28 +4529,21 @@ declare_lint! { |
| 4529 | 4529 | /// |
| 4530 | 4530 | /// ### Example |
| 4531 | 4531 | /// |
| 4532 | /// ```rust,compile_fail | |
| 4533 | /// #![deny(ambiguous_glob_imports)] | |
| 4534 | /// pub fn foo() -> u32 { | |
| 4535 | /// use sub::*; | |
| 4536 | /// C | |
| 4537 | /// } | |
| 4538 | /// | |
| 4539 | /// mod sub { | |
| 4540 | /// mod mod1 { pub const C: u32 = 1; } | |
| 4541 | /// mod mod2 { pub const C: u32 = 2; } | |
| 4532 | /// ```rust,ignore (needs extern crate) | |
| 4533 | /// // library crate `my_library` | |
| 4534 | /// mod mod1 { pub const C: u32 = 1; } | |
| 4535 | /// mod mod2 { pub const C: u32 = 2; } | |
| 4536 | /// pub use mod1::*; | |
| 4537 | /// pub use mod2::*; | |
| 4542 | 4538 | /// |
| 4543 | /// pub use mod1::*; | |
| 4544 | /// pub use mod2::*; | |
| 4545 | /// } | |
| 4539 | /// // another crate using `my_library` | |
| 4540 | /// let c = my_library::C; // `C` is ambiguous | |
| 4546 | 4541 | /// ``` |
| 4547 | 4542 | /// |
| 4548 | /// {{produces}} | |
| 4549 | /// | |
| 4550 | 4543 | /// ### Explanation |
| 4551 | 4544 | /// |
| 4552 | /// Previous versions of Rust compile it successfully because it | |
| 4553 | /// had lost the ambiguity error when resolve `use sub::mod2::*`. | |
| 4545 | /// Previous versions of Rust compile it successfully because | |
| 4546 | /// ambiguous glob imports weren't preserved correctly over crate boundaries. | |
| 4554 | 4547 | /// |
| 4555 | 4548 | /// This is a [future-incompatible] lint to transition this to a |
| 4556 | 4549 | /// hard error in the future. |
compiler/rustc_metadata/src/rmeta/encoder.rs+11-10| ... | ... | @@ -12,7 +12,7 @@ use rustc_data_structures::temp_dir::MaybeTempDir; |
| 12 | 12 | use rustc_data_structures::thousands::usize_with_underscores; |
| 13 | 13 | use rustc_hir as hir; |
| 14 | 14 | use rustc_hir::attrs::{AttributeKind, EncodeCrossCrate}; |
| 15 | use rustc_hir::def_id::{CRATE_DEF_ID, CRATE_DEF_INDEX, LOCAL_CRATE, LocalDefId, LocalDefIdSet}; | |
| 15 | use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalDefIdSet}; | |
| 16 | 16 | use rustc_hir::definitions::DefPathData; |
| 17 | 17 | use rustc_hir::find_attr; |
| 18 | 18 | use rustc_hir_pretty::id_to_string; |
| ... | ... | @@ -510,18 +510,20 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | fn encode_def_path_table(&mut self) { |
| 513 | let table = self.tcx.def_path_table(); | |
| 513 | let defs = self.tcx.definitions(); | |
| 514 | 514 | if self.is_proc_macro { |
| 515 | for def_index in std::iter::once(CRATE_DEF_INDEX) | |
| 516 | .chain(self.tcx.resolutions(()).proc_macros.iter().map(|p| p.local_def_index)) | |
| 515 | for def_id in std::iter::once(CRATE_DEF_ID) | |
| 516 | .chain(self.tcx.resolutions(()).proc_macros.iter().copied()) | |
| 517 | 517 | { |
| 518 | let def_key = self.lazy(table.def_key(def_index)); | |
| 519 | let def_path_hash = table.def_path_hash(def_index); | |
| 520 | self.tables.def_keys.set_some(def_index, def_key); | |
| 521 | self.tables.def_path_hashes.set(def_index, def_path_hash.local_hash().as_u64()); | |
| 518 | let def_key = self.lazy(defs.def_key(def_id)); | |
| 519 | let def_path_hash = defs.def_path_hash(def_id); | |
| 520 | self.tables.def_keys.set_some(def_id.local_def_index, def_key); | |
| 521 | self.tables | |
| 522 | .def_path_hashes | |
| 523 | .set(def_id.local_def_index, def_path_hash.local_hash().as_u64()); | |
| 522 | 524 | } |
| 523 | 525 | } else { |
| 524 | for (def_index, def_key, def_path_hash) in table.enumerated_keys_and_path_hashes() { | |
| 526 | for (def_index, def_key, def_path_hash) in defs.enumerated_keys_and_path_hashes() { | |
| 525 | 527 | let def_key = self.lazy(def_key); |
| 526 | 528 | self.tables.def_keys.set_some(def_index, def_key); |
| 527 | 529 | self.tables.def_path_hashes.set(def_index, def_path_hash.local_hash().as_u64()); |
| ... | ... | @@ -2034,7 +2036,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { |
| 2034 | 2036 | |
| 2035 | 2037 | let def_id = id.to_def_id(); |
| 2036 | 2038 | self.tables.def_kind.set_some(def_id.index, DefKind::Macro(macro_kind.into())); |
| 2037 | self.tables.proc_macro.set_some(def_id.index, macro_kind); | |
| 2038 | 2039 | self.encode_attrs(id); |
| 2039 | 2040 | record!(self.tables.def_keys[def_id] <- def_key); |
| 2040 | 2041 | record!(self.tables.def_ident_span[def_id] <- span); |
compiler/rustc_metadata/src/rmeta/mod.rs-1| ... | ... | @@ -464,7 +464,6 @@ define_tables! { |
| 464 | 464 | variant_data: Table<DefIndex, LazyValue<VariantData>>, |
| 465 | 465 | assoc_container: Table<DefIndex, LazyValue<ty::AssocContainer>>, |
| 466 | 466 | macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>, |
| 467 | proc_macro: Table<DefIndex, MacroKind>, | |
| 468 | 467 | deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>, |
| 469 | 468 | collect_return_position_impl_trait_in_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>, |
| 470 | 469 | doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>, |
compiler/rustc_middle/src/ty/context.rs+2-2| ... | ... | @@ -1349,13 +1349,13 @@ impl<'tcx> TyCtxt<'tcx> { |
| 1349 | 1349 | } |
| 1350 | 1350 | } |
| 1351 | 1351 | |
| 1352 | pub fn def_path_table(self) -> &'tcx rustc_hir::definitions::DefPathTable { | |
| 1352 | pub fn definitions(self) -> &'tcx rustc_hir::definitions::Definitions { | |
| 1353 | 1353 | // Depend on the `analysis` query to ensure compilation if finished. |
| 1354 | 1354 | self.ensure_ok().analysis(()); |
| 1355 | 1355 | |
| 1356 | 1356 | // Freeze definitions once we start iterating on them, to prevent adding new ones |
| 1357 | 1357 | // while iterating. If some query needs to add definitions, it should be `ensure`d above. |
| 1358 | self.untracked.definitions.freeze().def_path_table() | |
| 1358 | self.untracked.definitions.freeze() | |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | pub fn def_path_hash_to_def_index_map( |
compiler/rustc_middle/src/ty/mod.rs+7-5| ... | ... | @@ -37,12 +37,11 @@ use rustc_data_structures::stable_hash::{StableHash, StableHashCtxt, StableHashe |
| 37 | 37 | use rustc_data_structures::steal::Steal; |
| 38 | 38 | use rustc_data_structures::unord::{UnordMap, UnordSet}; |
| 39 | 39 | use rustc_errors::{Diag, ErrorGuaranteed, LintBuffer}; |
| 40 | use rustc_hir as hir; | |
| 41 | 40 | use rustc_hir::attrs::StrippedCfgItem; |
| 42 | 41 | use rustc_hir::def::{CtorKind, CtorOf, DefKind, DocLinkResMap, LifetimeRes, Res}; |
| 43 | 42 | use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap}; |
| 44 | 43 | use rustc_hir::definitions::PerParentDisambiguatorState; |
| 45 | use rustc_hir::{LangItem, attrs as attr, find_attr}; | |
| 44 | use rustc_hir::{self as hir, LangItem, MissingLifetimeKind, attrs as attr, find_attr}; | |
| 46 | 45 | use rustc_index::IndexVec; |
| 47 | 46 | use rustc_index::bit_set::BitMatrix; |
| 48 | 47 | use rustc_macros::{ |
| ... | ... | @@ -232,7 +231,7 @@ pub struct ResolverAstLowering<'tcx> { |
| 232 | 231 | /// Resolutions for lifetimes. |
| 233 | 232 | pub lifetimes_res_map: NodeMap<LifetimeRes>, |
| 234 | 233 | /// Lifetime parameters that lowering will have to introduce. |
| 235 | pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, LifetimeRes)>>, | |
| 234 | pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, MissingLifetimeKind)>>, | |
| 236 | 235 | |
| 237 | 236 | pub next_node_id: ast::NodeId, |
| 238 | 237 | |
| ... | ... | @@ -253,9 +252,12 @@ pub struct ResolverAstLowering<'tcx> { |
| 253 | 252 | |
| 254 | 253 | #[derive(Debug)] |
| 255 | 254 | pub struct DelegationInfo { |
| 256 | // NodeId (either delegation.id or item_id in case of a trait impl) for signature resolution, | |
| 255 | // `DefId` (either the resolution at delegation.id or item_id in case of a trait impl) for signature resolution, | |
| 257 | 256 | // for details see https://github.com/rust-lang/rust/issues/118212#issuecomment-2160686914 |
| 258 | pub resolution_node: ast::NodeId, | |
| 257 | /// Refers to the next element in a delegation resolution chain. | |
| 258 | /// Usually points to the final resolution, as most "chains" are just | |
| 259 | /// one step to a trait or an impl. | |
| 260 | pub resolution_id: DefId, | |
| 259 | 261 | } |
| 260 | 262 | |
| 261 | 263 | #[derive(Clone, Copy, Debug, StableHash)] |
compiler/rustc_public/src/compiler_interface.rs+373-407| ... | ... | @@ -79,183 +79,191 @@ pub(crate) struct CompilerInterface<'tcx> { |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | impl<'tcx> CompilerInterface<'tcx> { |
| 82 | pub(crate) fn entry_fn(&self) -> Option<CrateItem> { | |
| 82 | fn with_cx<R>( | |
| 83 | &self, | |
| 84 | f: impl FnOnce(&mut Tables<'tcx, BridgeTys>, &CompilerCtxt<'tcx, BridgeTys>) -> R, | |
| 85 | ) -> R { | |
| 83 | 86 | let mut tables = self.tables.borrow_mut(); |
| 84 | let cx = &*self.cx.borrow(); | |
| 85 | let did = cx.entry_fn(); | |
| 86 | Some(tables.crate_item(did?)) | |
| 87 | let cx = self.cx.borrow(); | |
| 88 | f(&mut *tables, &*cx) | |
| 89 | } | |
| 90 | ||
| 91 | pub(crate) fn entry_fn(&self) -> Option<CrateItem> { | |
| 92 | self.with_cx(|tables, cx| { | |
| 93 | let did = cx.entry_fn(); | |
| 94 | Some(tables.crate_item(did?)) | |
| 95 | }) | |
| 87 | 96 | } |
| 88 | 97 | |
| 89 | 98 | /// Retrieve all items of the local crate that have a MIR associated with them. |
| 90 | 99 | pub(crate) fn all_local_items(&self) -> CrateItems { |
| 91 | let mut tables = self.tables.borrow_mut(); | |
| 92 | let cx = &*self.cx.borrow(); | |
| 93 | cx.all_local_items().iter().map(|did| tables.crate_item(*did)).collect() | |
| 100 | self.with_cx(|tables, cx| { | |
| 101 | cx.all_local_items().iter().map(|did| tables.crate_item(*did)).collect() | |
| 102 | }) | |
| 94 | 103 | } |
| 95 | 104 | |
| 96 | 105 | /// Retrieve the body of a function. |
| 97 | 106 | /// This function will panic if the body is not available. |
| 98 | 107 | pub(crate) fn mir_body(&self, item: DefId) -> mir::Body { |
| 99 | let mut tables = self.tables.borrow_mut(); | |
| 100 | let cx = &*self.cx.borrow(); | |
| 101 | let did = tables[item]; | |
| 102 | cx.mir_body(did).stable(&mut *tables, cx) | |
| 108 | self.with_cx(|tables, cx| { | |
| 109 | let did = tables[item]; | |
| 110 | cx.mir_body(did).stable(tables, cx) | |
| 111 | }) | |
| 103 | 112 | } |
| 104 | 113 | |
| 105 | 114 | /// Check whether the body of a function is available. |
| 106 | 115 | pub(crate) fn has_body(&self, item: DefId) -> bool { |
| 107 | let mut tables = self.tables.borrow_mut(); | |
| 108 | let cx = &*self.cx.borrow(); | |
| 109 | let def = item.internal(&mut *tables, cx.tcx); | |
| 110 | cx.has_body(def) | |
| 116 | self.with_cx(|tables, cx| { | |
| 117 | let def = item.internal(tables, cx.tcx); | |
| 118 | cx.has_body(def) | |
| 119 | }) | |
| 111 | 120 | } |
| 112 | 121 | |
| 113 | 122 | pub(crate) fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef> { |
| 114 | let mut tables = self.tables.borrow_mut(); | |
| 115 | let cx = &*self.cx.borrow(); | |
| 116 | cx.foreign_modules(crate_num.internal(&mut *tables, cx.tcx)) | |
| 117 | .iter() | |
| 118 | .map(|did| tables.foreign_module_def(*did)) | |
| 119 | .collect() | |
| 123 | self.with_cx(|tables, cx| { | |
| 124 | cx.foreign_modules(crate_num.internal(tables, cx.tcx)) | |
| 125 | .iter() | |
| 126 | .map(|did| tables.foreign_module_def(*did)) | |
| 127 | .collect() | |
| 128 | }) | |
| 120 | 129 | } |
| 121 | 130 | |
| 122 | 131 | /// Retrieve all functions defined in this crate. |
| 123 | 132 | pub(crate) fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef> { |
| 124 | let mut tables = self.tables.borrow_mut(); | |
| 125 | let cx = &*self.cx.borrow(); | |
| 126 | let krate = crate_num.internal(&mut *tables, cx.tcx); | |
| 127 | cx.crate_functions(krate).iter().map(|did| tables.fn_def(*did)).collect() | |
| 133 | self.with_cx(|tables, cx| { | |
| 134 | let krate = crate_num.internal(tables, cx.tcx); | |
| 135 | cx.crate_functions(krate).iter().map(|did| tables.fn_def(*did)).collect() | |
| 136 | }) | |
| 128 | 137 | } |
| 129 | 138 | |
| 130 | 139 | /// Retrieve all static items defined in this crate. |
| 131 | 140 | pub(crate) fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef> { |
| 132 | let mut tables = self.tables.borrow_mut(); | |
| 133 | let cx = &*self.cx.borrow(); | |
| 134 | let krate = crate_num.internal(&mut *tables, cx.tcx); | |
| 135 | cx.crate_statics(krate).iter().map(|did| tables.static_def(*did)).collect() | |
| 141 | self.with_cx(|tables, cx| { | |
| 142 | let krate = crate_num.internal(tables, cx.tcx); | |
| 143 | cx.crate_statics(krate).iter().map(|did| tables.static_def(*did)).collect() | |
| 144 | }) | |
| 136 | 145 | } |
| 137 | 146 | |
| 138 | 147 | pub(crate) fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule { |
| 139 | let mut tables = self.tables.borrow_mut(); | |
| 140 | let cx = &*self.cx.borrow(); | |
| 141 | let did = tables[mod_def.def_id()]; | |
| 142 | cx.foreign_module(did).stable(&mut *tables, cx) | |
| 148 | self.with_cx(|tables, cx| { | |
| 149 | let did = tables[mod_def.def_id()]; | |
| 150 | cx.foreign_module(did).stable(tables, cx) | |
| 151 | }) | |
| 143 | 152 | } |
| 144 | 153 | |
| 145 | 154 | pub(crate) fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef> { |
| 146 | let mut tables = self.tables.borrow_mut(); | |
| 147 | let cx = &*self.cx.borrow(); | |
| 148 | let did = tables[mod_def.def_id()]; | |
| 149 | cx.foreign_items(did).iter().map(|did| tables.foreign_def(*did)).collect() | |
| 155 | self.with_cx(|tables, cx| { | |
| 156 | let did = tables[mod_def.def_id()]; | |
| 157 | cx.foreign_items(did).iter().map(|did| tables.foreign_def(*did)).collect() | |
| 158 | }) | |
| 150 | 159 | } |
| 151 | 160 | |
| 152 | 161 | pub(crate) fn all_trait_decls(&self) -> TraitDecls { |
| 153 | let mut tables = self.tables.borrow_mut(); | |
| 154 | let cx = &*self.cx.borrow(); | |
| 155 | cx.all_trait_decls().map(|did| tables.trait_def(did)).collect() | |
| 162 | self.with_cx(|tables, cx| cx.all_trait_decls().map(|did| tables.trait_def(did)).collect()) | |
| 156 | 163 | } |
| 157 | 164 | |
| 158 | 165 | pub(crate) fn trait_decls(&self, crate_num: CrateNum) -> TraitDecls { |
| 159 | let mut tables = self.tables.borrow_mut(); | |
| 160 | let cx = &*self.cx.borrow(); | |
| 161 | let krate = crate_num.internal(&mut *tables, cx.tcx); | |
| 162 | cx.trait_decls(krate).iter().map(|did| tables.trait_def(*did)).collect() | |
| 166 | self.with_cx(|tables, cx| { | |
| 167 | let krate = crate_num.internal(tables, cx.tcx); | |
| 168 | cx.trait_decls(krate).iter().map(|did| tables.trait_def(*did)).collect() | |
| 169 | }) | |
| 163 | 170 | } |
| 164 | 171 | |
| 165 | 172 | pub(crate) fn trait_decl(&self, trait_def: &TraitDef) -> TraitDecl { |
| 166 | let mut tables = self.tables.borrow_mut(); | |
| 167 | let cx = &*self.cx.borrow(); | |
| 168 | let did = tables[trait_def.0]; | |
| 169 | cx.trait_decl(did).stable(&mut *tables, cx) | |
| 173 | self.with_cx(|tables, cx| { | |
| 174 | let did = tables[trait_def.0]; | |
| 175 | cx.trait_decl(did).stable(tables, cx) | |
| 176 | }) | |
| 170 | 177 | } |
| 171 | 178 | |
| 172 | 179 | pub(crate) fn all_trait_impls(&self) -> ImplTraitDecls { |
| 173 | let mut tables = self.tables.borrow_mut(); | |
| 174 | let cx = &*self.cx.borrow(); | |
| 175 | cx.all_trait_impls().iter().map(|did| tables.impl_def(*did)).collect() | |
| 180 | self.with_cx(|tables, cx| { | |
| 181 | cx.all_trait_impls().iter().map(|did| tables.impl_def(*did)).collect() | |
| 182 | }) | |
| 176 | 183 | } |
| 177 | 184 | |
| 178 | 185 | pub(crate) fn trait_impls(&self, crate_num: CrateNum) -> ImplTraitDecls { |
| 179 | let mut tables = self.tables.borrow_mut(); | |
| 180 | let cx = &*self.cx.borrow(); | |
| 181 | let krate = crate_num.internal(&mut *tables, cx.tcx); | |
| 182 | cx.trait_impls(krate).iter().map(|did| tables.impl_def(*did)).collect() | |
| 186 | self.with_cx(|tables, cx| { | |
| 187 | let krate = crate_num.internal(tables, cx.tcx); | |
| 188 | cx.trait_impls(krate).iter().map(|did| tables.impl_def(*did)).collect() | |
| 189 | }) | |
| 183 | 190 | } |
| 184 | 191 | |
| 185 | 192 | pub(crate) fn trait_impl(&self, trait_impl: &ImplDef) -> ImplTrait { |
| 186 | let mut tables = self.tables.borrow_mut(); | |
| 187 | let cx = &*self.cx.borrow(); | |
| 188 | let did = tables[trait_impl.0]; | |
| 189 | cx.trait_impl(did).stable(&mut *tables, cx) | |
| 193 | self.with_cx(|tables, cx| { | |
| 194 | let did = tables[trait_impl.0]; | |
| 195 | cx.trait_impl(did).stable(tables, cx) | |
| 196 | }) | |
| 190 | 197 | } |
| 191 | 198 | |
| 192 | 199 | pub(crate) fn generics_of(&self, def_id: DefId) -> Generics { |
| 193 | let mut tables = self.tables.borrow_mut(); | |
| 194 | let cx = &*self.cx.borrow(); | |
| 195 | let did = tables[def_id]; | |
| 196 | cx.generics_of(did).stable(&mut *tables, cx) | |
| 200 | self.with_cx(|tables, cx| { | |
| 201 | let did = tables[def_id]; | |
| 202 | cx.generics_of(did).stable(tables, cx) | |
| 203 | }) | |
| 197 | 204 | } |
| 198 | 205 | |
| 199 | 206 | pub(crate) fn predicates_of(&self, def_id: DefId) -> GenericPredicates { |
| 200 | let mut tables = self.tables.borrow_mut(); | |
| 201 | let cx = &*self.cx.borrow(); | |
| 202 | let did = tables[def_id]; | |
| 203 | let (parent, kinds) = cx.predicates_of(did); | |
| 204 | crate::ty::GenericPredicates { | |
| 205 | parent: parent.map(|did| tables.trait_def(did)), | |
| 206 | predicates: kinds | |
| 207 | .iter() | |
| 208 | .map(|(kind, span)| (kind.stable(&mut *tables, cx), span.stable(&mut *tables, cx))) | |
| 209 | .collect(), | |
| 210 | } | |
| 207 | self.with_cx(|tables, cx| { | |
| 208 | let did = tables[def_id]; | |
| 209 | let (parent, kinds) = cx.predicates_of(did); | |
| 210 | crate::ty::GenericPredicates { | |
| 211 | parent: parent.map(|did| tables.trait_def(did)), | |
| 212 | predicates: kinds | |
| 213 | .iter() | |
| 214 | .map(|(kind, span)| (kind.stable(tables, cx), span.stable(tables, cx))) | |
| 215 | .collect(), | |
| 216 | } | |
| 217 | }) | |
| 211 | 218 | } |
| 212 | 219 | |
| 213 | 220 | pub(crate) fn explicit_predicates_of(&self, def_id: DefId) -> GenericPredicates { |
| 214 | let mut tables = self.tables.borrow_mut(); | |
| 215 | let cx = &*self.cx.borrow(); | |
| 216 | let did = tables[def_id]; | |
| 217 | let (parent, kinds) = cx.explicit_predicates_of(did); | |
| 218 | crate::ty::GenericPredicates { | |
| 219 | parent: parent.map(|did| tables.trait_def(did)), | |
| 220 | predicates: kinds | |
| 221 | .iter() | |
| 222 | .map(|(kind, span)| (kind.stable(&mut *tables, cx), span.stable(&mut *tables, cx))) | |
| 223 | .collect(), | |
| 224 | } | |
| 221 | self.with_cx(|tables, cx| { | |
| 222 | let did = tables[def_id]; | |
| 223 | let (parent, kinds) = cx.explicit_predicates_of(did); | |
| 224 | crate::ty::GenericPredicates { | |
| 225 | parent: parent.map(|did| tables.trait_def(did)), | |
| 226 | predicates: kinds | |
| 227 | .iter() | |
| 228 | .map(|(kind, span)| (kind.stable(tables, cx), span.stable(tables, cx))) | |
| 229 | .collect(), | |
| 230 | } | |
| 231 | }) | |
| 225 | 232 | } |
| 226 | 233 | |
| 227 | 234 | /// Get information about the local crate. |
| 228 | 235 | pub(crate) fn local_crate(&self) -> Crate { |
| 229 | let cx = &*self.cx.borrow(); | |
| 230 | smir_crate(cx, cx.local_crate_num()) | |
| 236 | self.with_cx(|_, cx| smir_crate(cx, cx.local_crate_num())) | |
| 231 | 237 | } |
| 232 | 238 | |
| 233 | 239 | /// Retrieve a list of all external crates. |
| 234 | 240 | pub(crate) fn external_crates(&self) -> Vec<Crate> { |
| 235 | let cx = &*self.cx.borrow(); | |
| 236 | cx.external_crates().iter().map(|crate_num| smir_crate(cx, *crate_num)).collect() | |
| 241 | self.with_cx(|_, cx| { | |
| 242 | cx.external_crates().iter().map(|crate_num| smir_crate(cx, *crate_num)).collect() | |
| 243 | }) | |
| 237 | 244 | } |
| 238 | 245 | |
| 239 | 246 | /// Find a crate with the given name. |
| 240 | 247 | pub(crate) fn find_crates(&self, name: &str) -> Vec<Crate> { |
| 241 | let cx = &*self.cx.borrow(); | |
| 242 | cx.find_crates(name).iter().map(|crate_num| smir_crate(cx, *crate_num)).collect() | |
| 248 | self.with_cx(|_, cx| { | |
| 249 | cx.find_crates(name).iter().map(|crate_num| smir_crate(cx, *crate_num)).collect() | |
| 250 | }) | |
| 243 | 251 | } |
| 244 | 252 | |
| 245 | 253 | /// Returns the name of given `DefId`. |
| 246 | 254 | pub(crate) fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol { |
| 247 | let tables = self.tables.borrow(); | |
| 248 | let cx = &*self.cx.borrow(); | |
| 249 | let did = tables[def_id]; | |
| 250 | cx.def_name(did, trimmed) | |
| 255 | self.with_cx(|tables, cx| { | |
| 256 | let did = tables[def_id]; | |
| 257 | cx.def_name(did, trimmed) | |
| 258 | }) | |
| 251 | 259 | } |
| 252 | 260 | |
| 253 | 261 | /// Returns the parent of the given `DefId`. |
| 254 | 262 | pub(crate) fn def_parent(&self, def_id: DefId) -> Option<DefId> { |
| 255 | let mut tables = self.tables.borrow_mut(); | |
| 256 | let cx = &*self.cx.borrow(); | |
| 257 | let did = tables[def_id]; | |
| 258 | cx.def_parent(did).map(|did| tables.create_def_id(did)) | |
| 263 | self.with_cx(|tables, cx| { | |
| 264 | let did = tables[def_id]; | |
| 265 | cx.def_parent(did).map(|did| tables.create_def_id(did)) | |
| 266 | }) | |
| 259 | 267 | } |
| 260 | 268 | |
| 261 | 269 | /// Return registered tool attributes with the given attribute name. |
| ... | ... | @@ -266,184 +274,169 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 266 | 274 | /// Single segmented name like `#[clippy]` is specified as `&["clippy".to_string()]`. |
| 267 | 275 | /// Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`. |
| 268 | 276 | pub(crate) fn tool_attrs(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute> { |
| 269 | let mut tables = self.tables.borrow_mut(); | |
| 270 | let cx = &*self.cx.borrow(); | |
| 271 | let did = tables[def_id]; | |
| 272 | cx.tool_attrs(did, attr) | |
| 273 | .into_iter() | |
| 274 | .map(|(attr_str, span)| Attribute::new(attr_str, span.stable(&mut *tables, cx))) | |
| 275 | .collect() | |
| 277 | self.with_cx(|tables, cx| { | |
| 278 | let did = tables[def_id]; | |
| 279 | cx.tool_attrs(did, attr) | |
| 280 | .into_iter() | |
| 281 | .map(|(attr_str, span)| Attribute::new(attr_str, span.stable(tables, cx))) | |
| 282 | .collect() | |
| 283 | }) | |
| 276 | 284 | } |
| 277 | 285 | |
| 278 | 286 | /// Get all tool attributes of a definition. |
| 279 | 287 | pub(crate) fn all_tool_attrs(&self, def_id: DefId) -> Vec<Attribute> { |
| 280 | let mut tables = self.tables.borrow_mut(); | |
| 281 | let cx = &*self.cx.borrow(); | |
| 282 | let did = tables[def_id]; | |
| 283 | cx.all_tool_attrs(did) | |
| 284 | .into_iter() | |
| 285 | .map(|(attr_str, span)| Attribute::new(attr_str, span.stable(&mut *tables, cx))) | |
| 286 | .collect() | |
| 288 | self.with_cx(|tables, cx| { | |
| 289 | let did = tables[def_id]; | |
| 290 | cx.all_tool_attrs(did) | |
| 291 | .into_iter() | |
| 292 | .map(|(attr_str, span)| Attribute::new(attr_str, span.stable(tables, cx))) | |
| 293 | .collect() | |
| 294 | }) | |
| 287 | 295 | } |
| 288 | 296 | |
| 289 | 297 | /// Returns printable, human readable form of `Span`. |
| 290 | 298 | pub(crate) fn span_to_string(&self, span: Span) -> String { |
| 291 | let tables = self.tables.borrow_mut(); | |
| 292 | let cx = &*self.cx.borrow(); | |
| 293 | let sp = tables.spans[span]; | |
| 294 | cx.span_to_string(sp) | |
| 299 | self.with_cx(|tables, cx| { | |
| 300 | let sp = tables.spans[span]; | |
| 301 | cx.span_to_string(sp) | |
| 302 | }) | |
| 295 | 303 | } |
| 296 | 304 | |
| 297 | 305 | /// Return filename from given `Span`, for diagnostic purposes. |
| 298 | 306 | pub(crate) fn get_filename(&self, span: &Span) -> Filename { |
| 299 | let tables = self.tables.borrow_mut(); | |
| 300 | let cx = &*self.cx.borrow(); | |
| 301 | let sp = tables.spans[*span]; | |
| 302 | cx.get_filename(sp) | |
| 307 | self.with_cx(|tables, cx| { | |
| 308 | let sp = tables.spans[*span]; | |
| 309 | cx.get_filename(sp) | |
| 310 | }) | |
| 303 | 311 | } |
| 304 | 312 | |
| 305 | 313 | /// Return lines corresponding to this `Span`. |
| 306 | 314 | pub(crate) fn get_lines(&self, span: &Span) -> LineInfo { |
| 307 | let tables = self.tables.borrow_mut(); | |
| 308 | let cx = &*self.cx.borrow(); | |
| 309 | let sp = tables.spans[*span]; | |
| 310 | let lines = cx.get_lines(sp); | |
| 311 | LineInfo::from(lines) | |
| 315 | self.with_cx(|tables, cx| { | |
| 316 | let sp = tables.spans[*span]; | |
| 317 | let lines = cx.get_lines(sp); | |
| 318 | LineInfo::from(lines) | |
| 319 | }) | |
| 312 | 320 | } |
| 313 | 321 | |
| 314 | 322 | /// Returns the `kind` of given `DefId`. |
| 315 | 323 | pub(crate) fn item_kind(&self, item: CrateItem) -> ItemKind { |
| 316 | let tables = self.tables.borrow(); | |
| 317 | let cx = &*self.cx.borrow(); | |
| 318 | let did = tables[item.0]; | |
| 319 | new_item_kind(cx.def_kind(did)) | |
| 324 | self.with_cx(|tables, cx| { | |
| 325 | let did = tables[item.0]; | |
| 326 | new_item_kind(cx.def_kind(did)) | |
| 327 | }) | |
| 320 | 328 | } |
| 321 | 329 | |
| 322 | 330 | /// Returns whether this is a foreign item. |
| 323 | 331 | pub(crate) fn is_foreign_item(&self, item: DefId) -> bool { |
| 324 | let tables = self.tables.borrow(); | |
| 325 | let cx = &*self.cx.borrow(); | |
| 326 | let did = tables[item]; | |
| 327 | cx.is_foreign_item(did) | |
| 332 | self.with_cx(|tables, cx| { | |
| 333 | let did = tables[item]; | |
| 334 | cx.is_foreign_item(did) | |
| 335 | }) | |
| 328 | 336 | } |
| 329 | 337 | |
| 330 | 338 | /// Returns the kind of a given foreign item. |
| 331 | 339 | pub(crate) fn foreign_item_kind(&self, def: ForeignDef) -> ForeignItemKind { |
| 332 | let mut tables = self.tables.borrow_mut(); | |
| 333 | let cx = &*self.cx.borrow(); | |
| 334 | let def_id = tables[def.def_id()]; | |
| 335 | let def_kind = cx.foreign_item_kind(def_id); | |
| 336 | match def_kind { | |
| 337 | DefKind::Fn => ForeignItemKind::Fn(tables.fn_def(def_id)), | |
| 338 | DefKind::Static { .. } => ForeignItemKind::Static(tables.static_def(def_id)), | |
| 339 | DefKind::ForeignTy => { | |
| 340 | use rustc_public_bridge::context::TyHelpers; | |
| 341 | ForeignItemKind::Type(tables.intern_ty(cx.new_foreign(def_id))) | |
| 340 | self.with_cx(|tables, cx| { | |
| 341 | let def_id = tables[def.def_id()]; | |
| 342 | let def_kind = cx.foreign_item_kind(def_id); | |
| 343 | match def_kind { | |
| 344 | DefKind::Fn => ForeignItemKind::Fn(tables.fn_def(def_id)), | |
| 345 | DefKind::Static { .. } => ForeignItemKind::Static(tables.static_def(def_id)), | |
| 346 | DefKind::ForeignTy => { | |
| 347 | use rustc_public_bridge::context::TyHelpers; | |
| 348 | ForeignItemKind::Type(tables.intern_ty(cx.new_foreign(def_id))) | |
| 349 | } | |
| 350 | def_kind => unreachable!("Unexpected kind for a foreign item: {:?}", def_kind), | |
| 342 | 351 | } |
| 343 | def_kind => unreachable!("Unexpected kind for a foreign item: {:?}", def_kind), | |
| 344 | } | |
| 352 | }) | |
| 345 | 353 | } |
| 346 | 354 | |
| 347 | 355 | /// Returns the kind of a given algebraic data type. |
| 348 | 356 | pub(crate) fn adt_kind(&self, def: AdtDef) -> AdtKind { |
| 349 | let mut tables = self.tables.borrow_mut(); | |
| 350 | let cx = &*self.cx.borrow(); | |
| 351 | cx.adt_kind(def.internal(&mut *tables, cx.tcx)).stable(&mut *tables, cx) | |
| 357 | self.with_cx(|tables, cx| cx.adt_kind(def.internal(tables, cx.tcx)).stable(tables, cx)) | |
| 352 | 358 | } |
| 353 | 359 | |
| 354 | 360 | /// Returns if the ADT is a box. |
| 355 | 361 | pub(crate) fn adt_is_box(&self, def: AdtDef) -> bool { |
| 356 | let mut tables = self.tables.borrow_mut(); | |
| 357 | let cx = &*self.cx.borrow(); | |
| 358 | cx.adt_is_box(def.internal(&mut *tables, cx.tcx)) | |
| 362 | self.with_cx(|tables, cx| cx.adt_is_box(def.internal(tables, cx.tcx))) | |
| 359 | 363 | } |
| 360 | 364 | |
| 361 | 365 | /// Returns whether this ADT is simd. |
| 362 | 366 | pub(crate) fn adt_is_simd(&self, def: AdtDef) -> bool { |
| 363 | let mut tables = self.tables.borrow_mut(); | |
| 364 | let cx = &*self.cx.borrow(); | |
| 365 | cx.adt_is_simd(def.internal(&mut *tables, cx.tcx)) | |
| 367 | self.with_cx(|tables, cx| cx.adt_is_simd(def.internal(tables, cx.tcx))) | |
| 366 | 368 | } |
| 367 | 369 | |
| 368 | 370 | /// Returns whether this definition is a C string. |
| 369 | 371 | pub(crate) fn adt_is_cstr(&self, def: AdtDef) -> bool { |
| 370 | let mut tables = self.tables.borrow_mut(); | |
| 371 | let cx = &*self.cx.borrow(); | |
| 372 | cx.adt_is_cstr(def.0.internal(&mut *tables, cx.tcx)) | |
| 372 | self.with_cx(|tables, cx| cx.adt_is_cstr(def.0.internal(tables, cx.tcx))) | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /// Returns the representation options for this ADT |
| 376 | 376 | pub(crate) fn adt_repr(&self, def: AdtDef) -> ReprOptions { |
| 377 | let mut tables = self.tables.borrow_mut(); | |
| 378 | let cx = &*self.cx.borrow(); | |
| 379 | cx.adt_repr(def.internal(&mut *tables, cx.tcx)).stable(&mut *tables, cx) | |
| 377 | self.with_cx(|tables, cx| cx.adt_repr(def.internal(tables, cx.tcx)).stable(tables, cx)) | |
| 380 | 378 | } |
| 381 | 379 | |
| 382 | 380 | /// Retrieve the function signature for the given generic arguments. |
| 383 | 381 | pub(crate) fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig { |
| 384 | let mut tables = self.tables.borrow_mut(); | |
| 385 | let cx = &*self.cx.borrow(); | |
| 386 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 387 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 388 | cx.fn_sig(def_id, args_ref).stable(&mut *tables, cx) | |
| 382 | self.with_cx(|tables, cx| { | |
| 383 | let def_id = def.0.internal(tables, cx.tcx); | |
| 384 | let args_ref = args.internal(tables, cx.tcx); | |
| 385 | cx.fn_sig(def_id, args_ref).stable(tables, cx) | |
| 386 | }) | |
| 389 | 387 | } |
| 390 | 388 | |
| 391 | 389 | /// Retrieve the constness for the given function definition. |
| 392 | 390 | pub(crate) fn constness(&self, def: FnDef) -> Constness { |
| 393 | let mut tables = self.tables.borrow_mut(); | |
| 394 | let cx = &*self.cx.borrow(); | |
| 395 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 396 | cx.constness(def_id).stable(&mut *tables, cx) | |
| 391 | self.with_cx(|tables, cx| { | |
| 392 | let def_id = def.0.internal(tables, cx.tcx); | |
| 393 | cx.constness(def_id).stable(tables, cx) | |
| 394 | }) | |
| 397 | 395 | } |
| 398 | 396 | |
| 399 | 397 | /// Retrieve the asyncness for the given function definition. |
| 400 | 398 | pub(crate) fn asyncness(&self, def: FnDef) -> Asyncness { |
| 401 | let mut tables = self.tables.borrow_mut(); | |
| 402 | let cx = &*self.cx.borrow(); | |
| 403 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 404 | cx.asyncness(def_id).stable(&mut *tables, cx) | |
| 399 | self.with_cx(|tables, cx| { | |
| 400 | let def_id = def.0.internal(tables, cx.tcx); | |
| 401 | cx.asyncness(def_id).stable(tables, cx) | |
| 402 | }) | |
| 405 | 403 | } |
| 406 | 404 | |
| 407 | 405 | /// Retrieve the intrinsic definition if the item corresponds one. |
| 408 | 406 | pub(crate) fn intrinsic(&self, item: DefId) -> Option<IntrinsicDef> { |
| 409 | let mut tables = self.tables.borrow_mut(); | |
| 410 | let cx = &*self.cx.borrow(); | |
| 411 | let def_id = item.internal(&mut *tables, cx.tcx); | |
| 412 | cx.intrinsic(def_id).map(|_| IntrinsicDef(item)) | |
| 407 | self.with_cx(|tables, cx| { | |
| 408 | let def_id = item.internal(tables, cx.tcx); | |
| 409 | cx.intrinsic(def_id).map(|_| IntrinsicDef(item)) | |
| 410 | }) | |
| 413 | 411 | } |
| 414 | 412 | |
| 415 | 413 | /// Retrieve the plain function name of an intrinsic. |
| 416 | 414 | pub(crate) fn intrinsic_name(&self, def: IntrinsicDef) -> Symbol { |
| 417 | let mut tables = self.tables.borrow_mut(); | |
| 418 | let cx = &*self.cx.borrow(); | |
| 419 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 420 | cx.intrinsic_name(def_id) | |
| 415 | self.with_cx(|tables, cx| { | |
| 416 | let def_id = def.0.internal(tables, cx.tcx); | |
| 417 | cx.intrinsic_name(def_id) | |
| 418 | }) | |
| 421 | 419 | } |
| 422 | 420 | |
| 423 | 421 | /// Retrieve the closure signature for the given generic arguments. |
| 424 | 422 | pub(crate) fn closure_sig(&self, args: &GenericArgs) -> PolyFnSig { |
| 425 | let mut tables = self.tables.borrow_mut(); | |
| 426 | let cx = &*self.cx.borrow(); | |
| 427 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 428 | cx.closure_sig(args_ref).stable(&mut *tables, cx) | |
| 423 | self.with_cx(|tables, cx| { | |
| 424 | let args_ref = args.internal(tables, cx.tcx); | |
| 425 | cx.closure_sig(args_ref).stable(tables, cx) | |
| 426 | }) | |
| 429 | 427 | } |
| 430 | 428 | |
| 431 | 429 | /// The number of variants in this ADT. |
| 432 | 430 | pub(crate) fn adt_variants_len(&self, def: AdtDef) -> usize { |
| 433 | let mut tables = self.tables.borrow_mut(); | |
| 434 | let cx = &*self.cx.borrow(); | |
| 435 | cx.adt_variants_len(def.internal(&mut *tables, cx.tcx)) | |
| 431 | self.with_cx(|tables, cx| cx.adt_variants_len(def.internal(tables, cx.tcx))) | |
| 436 | 432 | } |
| 437 | 433 | |
| 438 | 434 | /// Discriminant for a given variant index of AdtDef. |
| 439 | 435 | pub(crate) fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr { |
| 440 | let mut tables = self.tables.borrow_mut(); | |
| 441 | let cx = &*self.cx.borrow(); | |
| 442 | cx.adt_discr_for_variant( | |
| 443 | adt.internal(&mut *tables, cx.tcx), | |
| 444 | variant.internal(&mut *tables, cx.tcx), | |
| 445 | ) | |
| 446 | .stable(&mut *tables, cx) | |
| 436 | self.with_cx(|tables, cx| { | |
| 437 | cx.adt_discr_for_variant(adt.internal(tables, cx.tcx), variant.internal(tables, cx.tcx)) | |
| 438 | .stable(tables, cx) | |
| 439 | }) | |
| 447 | 440 | } |
| 448 | 441 | |
| 449 | 442 | /// Discriminant for a given variand index and args of a coroutine. |
| ... | ... | @@ -453,67 +446,57 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 453 | 446 | args: &GenericArgs, |
| 454 | 447 | variant: VariantIdx, |
| 455 | 448 | ) -> Discr { |
| 456 | let mut tables = self.tables.borrow_mut(); | |
| 457 | let cx = &*self.cx.borrow(); | |
| 458 | let tcx = cx.tcx; | |
| 459 | let def = coroutine.def_id().internal(&mut *tables, tcx); | |
| 460 | let args_ref = args.internal(&mut *tables, tcx); | |
| 461 | cx.coroutine_discr_for_variant(def, args_ref, variant.internal(&mut *tables, tcx)) | |
| 462 | .stable(&mut *tables, cx) | |
| 449 | self.with_cx(|tables, cx| { | |
| 450 | let tcx = cx.tcx; | |
| 451 | let def = coroutine.def_id().internal(tables, tcx); | |
| 452 | let args_ref = args.internal(tables, tcx); | |
| 453 | cx.coroutine_discr_for_variant(def, args_ref, variant.internal(tables, tcx)) | |
| 454 | .stable(tables, cx) | |
| 455 | }) | |
| 463 | 456 | } |
| 464 | 457 | |
| 465 | 458 | /// The name of a variant. |
| 466 | 459 | pub(crate) fn variant_name(&self, def: VariantDef) -> Symbol { |
| 467 | let mut tables = self.tables.borrow_mut(); | |
| 468 | let cx = &*self.cx.borrow(); | |
| 469 | cx.variant_name(def.internal(&mut *tables, cx.tcx)) | |
| 460 | self.with_cx(|tables, cx| cx.variant_name(def.internal(tables, cx.tcx))) | |
| 470 | 461 | } |
| 471 | 462 | |
| 472 | 463 | pub(crate) fn variant_fields(&self, def: VariantDef) -> Vec<FieldDef> { |
| 473 | let mut tables = self.tables.borrow_mut(); | |
| 474 | let cx = &*self.cx.borrow(); | |
| 475 | def.internal(&mut *tables, cx.tcx) | |
| 476 | .fields | |
| 477 | .iter() | |
| 478 | .map(|f| f.stable(&mut *tables, cx)) | |
| 479 | .collect() | |
| 464 | self.with_cx(|tables, cx| { | |
| 465 | def.internal(tables, cx.tcx).fields.iter().map(|f| f.stable(tables, cx)).collect() | |
| 466 | }) | |
| 480 | 467 | } |
| 481 | 468 | |
| 482 | 469 | /// Evaluate constant as a target usize. |
| 483 | 470 | pub(crate) fn eval_target_usize(&self, mir_const: &MirConst) -> Result<u64, Error> { |
| 484 | let mut tables = self.tables.borrow_mut(); | |
| 485 | let cx = &*self.cx.borrow(); | |
| 486 | let cnst = mir_const.internal(&mut *tables, cx.tcx); | |
| 487 | cx.eval_target_usize(cnst) | |
| 471 | self.with_cx(|tables, cx| { | |
| 472 | let cnst = mir_const.internal(tables, cx.tcx); | |
| 473 | cx.eval_target_usize(cnst) | |
| 474 | }) | |
| 488 | 475 | } |
| 489 | 476 | |
| 490 | 477 | pub(crate) fn eval_target_usize_ty(&self, ty_const: &TyConst) -> Result<u64, Error> { |
| 491 | let mut tables = self.tables.borrow_mut(); | |
| 492 | let cx = &*self.cx.borrow(); | |
| 493 | let cnst = ty_const.internal(&mut *tables, cx.tcx); | |
| 494 | cx.eval_target_usize_ty(cnst) | |
| 478 | self.with_cx(|tables, cx| { | |
| 479 | let cnst = ty_const.internal(tables, cx.tcx); | |
| 480 | cx.eval_target_usize_ty(cnst) | |
| 481 | }) | |
| 495 | 482 | } |
| 496 | 483 | |
| 497 | 484 | /// Create a new zero-sized constant. |
| 498 | 485 | pub(crate) fn try_new_const_zst(&self, ty: Ty) -> Result<MirConst, Error> { |
| 499 | let mut tables = self.tables.borrow_mut(); | |
| 500 | let cx = &*self.cx.borrow(); | |
| 501 | let ty_internal = ty.internal(&mut *tables, cx.tcx); | |
| 502 | cx.try_new_const_zst(ty_internal).map(|cnst| cnst.stable(&mut *tables, cx)) | |
| 486 | self.with_cx(|tables, cx| { | |
| 487 | let ty_internal = ty.internal(tables, cx.tcx); | |
| 488 | cx.try_new_const_zst(ty_internal).map(|cnst| cnst.stable(tables, cx)) | |
| 489 | }) | |
| 503 | 490 | } |
| 504 | 491 | |
| 505 | 492 | /// Create a new constant that represents the given string value. |
| 506 | 493 | pub(crate) fn new_const_str(&self, value: &str) -> MirConst { |
| 507 | let mut tables = self.tables.borrow_mut(); | |
| 508 | let cx = &*self.cx.borrow(); | |
| 509 | cx.new_const_str(value).stable(&mut *tables, cx) | |
| 494 | self.with_cx(|tables, cx| cx.new_const_str(value).stable(tables, cx)) | |
| 510 | 495 | } |
| 511 | 496 | |
| 512 | 497 | /// Create a new constant that represents the given boolean value. |
| 513 | 498 | pub(crate) fn new_const_bool(&self, value: bool) -> MirConst { |
| 514 | let mut tables = self.tables.borrow_mut(); | |
| 515 | let cx = &*self.cx.borrow(); | |
| 516 | cx.new_const_bool(value).stable(&mut *tables, cx) | |
| 499 | self.with_cx(|tables, cx| cx.new_const_bool(value).stable(tables, cx)) | |
| 517 | 500 | } |
| 518 | 501 | |
| 519 | 502 | /// Create a new constant that represents the given value. |
| ... | ... | @@ -522,10 +505,10 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 522 | 505 | value: u128, |
| 523 | 506 | uint_ty: UintTy, |
| 524 | 507 | ) -> Result<MirConst, Error> { |
| 525 | let mut tables = self.tables.borrow_mut(); | |
| 526 | let cx = &*self.cx.borrow(); | |
| 527 | let ty = cx.ty_new_uint(uint_ty.internal(&mut *tables, cx.tcx)); | |
| 528 | cx.try_new_const_uint(value, ty).map(|cnst| cnst.stable(&mut *tables, cx)) | |
| 508 | self.with_cx(|tables, cx| { | |
| 509 | let ty = cx.ty_new_uint(uint_ty.internal(tables, cx.tcx)); | |
| 510 | cx.try_new_const_uint(value, ty).map(|cnst| cnst.stable(tables, cx)) | |
| 511 | }) | |
| 529 | 512 | } |
| 530 | 513 | |
| 531 | 514 | pub(crate) fn try_new_ty_const_uint( |
| ... | ... | @@ -533,178 +516,170 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 533 | 516 | value: u128, |
| 534 | 517 | uint_ty: UintTy, |
| 535 | 518 | ) -> Result<TyConst, Error> { |
| 536 | let mut tables = self.tables.borrow_mut(); | |
| 537 | let cx = &*self.cx.borrow(); | |
| 538 | let ty = cx.ty_new_uint(uint_ty.internal(&mut *tables, cx.tcx)); | |
| 539 | cx.try_new_ty_const_uint(value, ty).map(|cnst| cnst.stable(&mut *tables, cx)) | |
| 519 | self.with_cx(|tables, cx| { | |
| 520 | let ty = cx.ty_new_uint(uint_ty.internal(tables, cx.tcx)); | |
| 521 | cx.try_new_ty_const_uint(value, ty).map(|cnst| cnst.stable(tables, cx)) | |
| 522 | }) | |
| 540 | 523 | } |
| 541 | 524 | |
| 542 | 525 | /// Create a new type from the given kind. |
| 543 | 526 | pub(crate) fn new_rigid_ty(&self, kind: RigidTy) -> Ty { |
| 544 | let mut tables = self.tables.borrow_mut(); | |
| 545 | let cx = &*self.cx.borrow(); | |
| 546 | let internal_kind = kind.internal(&mut *tables, cx.tcx); | |
| 547 | cx.new_rigid_ty(internal_kind).stable(&mut *tables, cx) | |
| 527 | self.with_cx(|tables, cx| { | |
| 528 | let internal_kind = kind.internal(tables, cx.tcx); | |
| 529 | cx.new_rigid_ty(internal_kind).stable(tables, cx) | |
| 530 | }) | |
| 548 | 531 | } |
| 549 | 532 | |
| 550 | 533 | /// Create a new box type, `Box<T>`, for the given inner type `T`. |
| 551 | 534 | pub(crate) fn new_box_ty(&self, ty: Ty) -> Ty { |
| 552 | let mut tables = self.tables.borrow_mut(); | |
| 553 | let cx = &*self.cx.borrow(); | |
| 554 | let inner = ty.internal(&mut *tables, cx.tcx); | |
| 555 | cx.new_box_ty(inner).stable(&mut *tables, cx) | |
| 535 | self.with_cx(|tables, cx| { | |
| 536 | let inner = ty.internal(tables, cx.tcx); | |
| 537 | cx.new_box_ty(inner).stable(tables, cx) | |
| 538 | }) | |
| 556 | 539 | } |
| 557 | 540 | |
| 558 | 541 | /// Returns the type of given crate item. |
| 559 | 542 | pub(crate) fn def_ty(&self, item: DefId) -> Ty { |
| 560 | let mut tables = self.tables.borrow_mut(); | |
| 561 | let cx = &*self.cx.borrow(); | |
| 562 | let inner = item.internal(&mut *tables, cx.tcx); | |
| 563 | cx.def_ty(inner).stable(&mut *tables, cx) | |
| 543 | self.with_cx(|tables, cx| { | |
| 544 | let inner = item.internal(tables, cx.tcx); | |
| 545 | cx.def_ty(inner).stable(tables, cx) | |
| 546 | }) | |
| 564 | 547 | } |
| 565 | 548 | |
| 566 | 549 | /// Returns the type of given definition instantiated with the given arguments. |
| 567 | 550 | pub(crate) fn def_ty_with_args(&self, item: DefId, args: &GenericArgs) -> Ty { |
| 568 | let mut tables = self.tables.borrow_mut(); | |
| 569 | let cx = &*self.cx.borrow(); | |
| 570 | let inner = item.internal(&mut *tables, cx.tcx); | |
| 571 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 572 | cx.def_ty_with_args(inner, args_ref).stable(&mut *tables, cx) | |
| 551 | self.with_cx(|tables, cx| { | |
| 552 | let inner = item.internal(tables, cx.tcx); | |
| 553 | let args_ref = args.internal(tables, cx.tcx); | |
| 554 | cx.def_ty_with_args(inner, args_ref).stable(tables, cx) | |
| 555 | }) | |
| 573 | 556 | } |
| 574 | 557 | |
| 575 | 558 | /// Returns literal value of a const as a string. |
| 576 | 559 | pub(crate) fn mir_const_pretty(&self, cnst: &MirConst) -> String { |
| 577 | let mut tables = self.tables.borrow_mut(); | |
| 578 | let cx = &*self.cx.borrow(); | |
| 579 | cnst.internal(&mut *tables, cx.tcx).to_string() | |
| 560 | self.with_cx(|tables, cx| cnst.internal(tables, cx.tcx).to_string()) | |
| 580 | 561 | } |
| 581 | 562 | |
| 582 | 563 | /// `Span` of a `DefId`. |
| 583 | 564 | pub(crate) fn span_of_a_def(&self, def_id: DefId) -> Span { |
| 584 | let mut tables = self.tables.borrow_mut(); | |
| 585 | let cx = &*self.cx.borrow(); | |
| 586 | let did = tables[def_id]; | |
| 587 | cx.span_of_a_def(did).stable(&mut *tables, cx) | |
| 565 | self.with_cx(|tables, cx| { | |
| 566 | let did = tables[def_id]; | |
| 567 | cx.span_of_a_def(did).stable(tables, cx) | |
| 568 | }) | |
| 588 | 569 | } |
| 589 | 570 | |
| 590 | 571 | pub(crate) fn ty_const_pretty(&self, ct: TyConstId) -> String { |
| 591 | let tables = self.tables.borrow_mut(); | |
| 592 | let cx = &*self.cx.borrow(); | |
| 593 | cx.ty_const_pretty(tables.ty_consts[ct]) | |
| 572 | self.with_cx(|tables, cx| cx.ty_const_pretty(tables.ty_consts[ct])) | |
| 594 | 573 | } |
| 595 | 574 | |
| 596 | 575 | /// Obtain the representation of a type. |
| 597 | 576 | pub(crate) fn ty_pretty(&self, ty: Ty) -> String { |
| 598 | let tables = self.tables.borrow_mut(); | |
| 599 | let cx = &*self.cx.borrow(); | |
| 600 | cx.ty_pretty(tables.types[ty]) | |
| 577 | self.with_cx(|tables, cx| cx.ty_pretty(tables.types[ty])) | |
| 601 | 578 | } |
| 602 | 579 | |
| 603 | 580 | /// Obtain the kind of a type. |
| 604 | 581 | pub(crate) fn ty_kind(&self, ty: Ty) -> TyKind { |
| 605 | let mut tables = self.tables.borrow_mut(); | |
| 606 | let cx = &*self.cx.borrow(); | |
| 607 | cx.ty_kind(tables.types[ty]).stable(&mut *tables, cx) | |
| 582 | self.with_cx(|tables, cx| cx.ty_kind(tables.types[ty]).stable(tables, cx)) | |
| 608 | 583 | } |
| 609 | 584 | |
| 610 | 585 | /// Get the discriminant Ty for this Ty if there's one. |
| 611 | 586 | pub(crate) fn rigid_ty_discriminant_ty(&self, ty: &RigidTy) -> Ty { |
| 612 | let mut tables = self.tables.borrow_mut(); | |
| 613 | let cx = &*self.cx.borrow(); | |
| 614 | let internal_kind = ty.internal(&mut *tables, cx.tcx); | |
| 615 | cx.rigid_ty_discriminant_ty(internal_kind).stable(&mut *tables, cx) | |
| 587 | self.with_cx(|tables, cx| { | |
| 588 | let internal_kind = ty.internal(tables, cx.tcx); | |
| 589 | cx.rigid_ty_discriminant_ty(internal_kind).stable(tables, cx) | |
| 590 | }) | |
| 616 | 591 | } |
| 617 | 592 | |
| 618 | 593 | /// Get the body of an Instance which is already monomorphized. |
| 619 | 594 | pub(crate) fn instance_body(&self, instance: InstanceDef) -> Option<Body> { |
| 620 | let mut tables = self.tables.borrow_mut(); | |
| 621 | let cx = &*self.cx.borrow(); | |
| 622 | let instance = tables.instances[instance]; | |
| 623 | cx.instance_body(instance).map(|body| body.stable(&mut *tables, cx)) | |
| 595 | self.with_cx(|tables, cx| { | |
| 596 | let instance = tables.instances[instance]; | |
| 597 | cx.instance_body(instance).map(|body| body.stable(tables, cx)) | |
| 598 | }) | |
| 624 | 599 | } |
| 625 | 600 | |
| 626 | 601 | /// Get the instance type with generic instantiations applied and lifetimes erased. |
| 627 | 602 | pub(crate) fn instance_ty(&self, instance: InstanceDef) -> Ty { |
| 628 | let mut tables = self.tables.borrow_mut(); | |
| 629 | let cx = &*self.cx.borrow(); | |
| 630 | let instance = tables.instances[instance]; | |
| 631 | cx.instance_ty(instance).stable(&mut *tables, cx) | |
| 603 | self.with_cx(|tables, cx| { | |
| 604 | let instance = tables.instances[instance]; | |
| 605 | cx.instance_ty(instance).stable(tables, cx) | |
| 606 | }) | |
| 632 | 607 | } |
| 633 | 608 | |
| 634 | 609 | /// Get the instantiation types. |
| 635 | 610 | pub(crate) fn instance_args(&self, def: InstanceDef) -> GenericArgs { |
| 636 | let mut tables = self.tables.borrow_mut(); | |
| 637 | let cx = &*self.cx.borrow(); | |
| 638 | let instance = tables.instances[def]; | |
| 639 | cx.instance_args(instance).stable(&mut *tables, cx) | |
| 611 | self.with_cx(|tables, cx| { | |
| 612 | let instance = tables.instances[def]; | |
| 613 | cx.instance_args(instance).stable(tables, cx) | |
| 614 | }) | |
| 640 | 615 | } |
| 641 | 616 | |
| 642 | 617 | /// Get the instance. |
| 643 | 618 | pub(crate) fn instance_def_id(&self, instance: InstanceDef) -> DefId { |
| 644 | let mut tables = self.tables.borrow_mut(); | |
| 645 | let cx = &*self.cx.borrow(); | |
| 646 | let instance = tables.instances[instance]; | |
| 647 | cx.instance_def_id(instance, &mut *tables) | |
| 619 | self.with_cx(|tables, cx| { | |
| 620 | let instance = tables.instances[instance]; | |
| 621 | cx.instance_def_id(instance, tables) | |
| 622 | }) | |
| 648 | 623 | } |
| 649 | 624 | |
| 650 | 625 | /// Get the instance mangled name. |
| 651 | 626 | pub(crate) fn instance_mangled_name(&self, instance: InstanceDef) -> Symbol { |
| 652 | let tables = self.tables.borrow_mut(); | |
| 653 | let cx = &*self.cx.borrow(); | |
| 654 | let instance = tables.instances[instance]; | |
| 655 | cx.instance_mangled_name(instance) | |
| 627 | self.with_cx(|tables, cx| { | |
| 628 | let instance = tables.instances[instance]; | |
| 629 | cx.instance_mangled_name(instance) | |
| 630 | }) | |
| 656 | 631 | } |
| 657 | 632 | |
| 658 | 633 | /// Check if this is an empty DropGlue shim. |
| 659 | 634 | pub(crate) fn is_empty_drop_shim(&self, def: InstanceDef) -> bool { |
| 660 | let tables = self.tables.borrow_mut(); | |
| 661 | let cx = &*self.cx.borrow(); | |
| 662 | let instance = tables.instances[def]; | |
| 663 | cx.is_empty_drop_shim(instance) | |
| 635 | self.with_cx(|tables, cx| { | |
| 636 | let instance = tables.instances[def]; | |
| 637 | cx.is_empty_drop_shim(instance) | |
| 638 | }) | |
| 664 | 639 | } |
| 665 | 640 | |
| 666 | 641 | /// Convert a non-generic crate item into an instance. |
| 667 | 642 | /// This function will panic if the item is generic. |
| 668 | 643 | pub(crate) fn mono_instance(&self, def_id: DefId) -> Instance { |
| 669 | let mut tables = self.tables.borrow_mut(); | |
| 670 | let cx = &*self.cx.borrow(); | |
| 671 | let did = tables[def_id]; | |
| 672 | cx.mono_instance(did).stable(&mut *tables, cx) | |
| 644 | self.with_cx(|tables, cx| { | |
| 645 | let did = tables[def_id]; | |
| 646 | cx.mono_instance(did).stable(tables, cx) | |
| 647 | }) | |
| 673 | 648 | } |
| 674 | 649 | |
| 675 | 650 | /// Item requires monomorphization. |
| 676 | 651 | pub(crate) fn requires_monomorphization(&self, def_id: DefId) -> bool { |
| 677 | let tables = self.tables.borrow(); | |
| 678 | let cx = &*self.cx.borrow(); | |
| 679 | let did = tables[def_id]; | |
| 680 | cx.requires_monomorphization(did) | |
| 652 | self.with_cx(|tables, cx| { | |
| 653 | let did = tables[def_id]; | |
| 654 | cx.requires_monomorphization(did) | |
| 655 | }) | |
| 681 | 656 | } |
| 682 | 657 | |
| 683 | 658 | /// Resolve an instance from the given function definition and generic arguments. |
| 684 | 659 | pub(crate) fn resolve_instance(&self, def: FnDef, args: &GenericArgs) -> Option<Instance> { |
| 685 | let mut tables = self.tables.borrow_mut(); | |
| 686 | let cx = &*self.cx.borrow(); | |
| 687 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 688 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 689 | cx.resolve_instance(def_id, args_ref).map(|inst| inst.stable(&mut *tables, cx)) | |
| 660 | self.with_cx(|tables, cx| { | |
| 661 | let def_id = def.0.internal(tables, cx.tcx); | |
| 662 | let args_ref = args.internal(tables, cx.tcx); | |
| 663 | cx.resolve_instance(def_id, args_ref).map(|inst| inst.stable(tables, cx)) | |
| 664 | }) | |
| 690 | 665 | } |
| 691 | 666 | |
| 692 | 667 | /// Resolve an instance for drop_in_place for the given type. |
| 693 | 668 | pub(crate) fn resolve_drop_in_place(&self, ty: Ty) -> Instance { |
| 694 | let mut tables = self.tables.borrow_mut(); | |
| 695 | let cx = &*self.cx.borrow(); | |
| 696 | let internal_ty = ty.internal(&mut *tables, cx.tcx); | |
| 669 | self.with_cx(|tables, cx| { | |
| 670 | let internal_ty = ty.internal(tables, cx.tcx); | |
| 697 | 671 | |
| 698 | cx.resolve_drop_in_place(internal_ty).stable(&mut *tables, cx) | |
| 672 | cx.resolve_drop_in_place(internal_ty).stable(tables, cx) | |
| 673 | }) | |
| 699 | 674 | } |
| 700 | 675 | |
| 701 | 676 | /// Resolve instance for a function pointer. |
| 702 | 677 | pub(crate) fn resolve_for_fn_ptr(&self, def: FnDef, args: &GenericArgs) -> Option<Instance> { |
| 703 | let mut tables = self.tables.borrow_mut(); | |
| 704 | let cx = &*self.cx.borrow(); | |
| 705 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 706 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 707 | cx.resolve_for_fn_ptr(def_id, args_ref).stable(&mut *tables, cx) | |
| 678 | self.with_cx(|tables, cx| { | |
| 679 | let def_id = def.0.internal(tables, cx.tcx); | |
| 680 | let args_ref = args.internal(tables, cx.tcx); | |
| 681 | cx.resolve_for_fn_ptr(def_id, args_ref).stable(tables, cx) | |
| 682 | }) | |
| 708 | 683 | } |
| 709 | 684 | |
| 710 | 685 | /// Resolve instance for a closure with the requested type. |
| ... | ... | @@ -714,21 +689,21 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 714 | 689 | args: &GenericArgs, |
| 715 | 690 | kind: ClosureKind, |
| 716 | 691 | ) -> Option<Instance> { |
| 717 | let mut tables = self.tables.borrow_mut(); | |
| 718 | let cx = &*self.cx.borrow(); | |
| 719 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 720 | let args_ref = args.internal(&mut *tables, cx.tcx); | |
| 721 | let closure_kind = kind.internal(&mut *tables, cx.tcx); | |
| 722 | cx.resolve_closure(def_id, args_ref, closure_kind).map(|inst| inst.stable(&mut *tables, cx)) | |
| 692 | self.with_cx(|tables, cx| { | |
| 693 | let def_id = def.0.internal(tables, cx.tcx); | |
| 694 | let args_ref = args.internal(tables, cx.tcx); | |
| 695 | let closure_kind = kind.internal(tables, cx.tcx); | |
| 696 | cx.resolve_closure(def_id, args_ref, closure_kind).map(|inst| inst.stable(tables, cx)) | |
| 697 | }) | |
| 723 | 698 | } |
| 724 | 699 | |
| 725 | 700 | /// Evaluate a static's initializer. |
| 726 | 701 | pub(crate) fn eval_static_initializer(&self, def: StaticDef) -> Result<Allocation, Error> { |
| 727 | let mut tables = self.tables.borrow_mut(); | |
| 728 | let cx = &*self.cx.borrow(); | |
| 729 | let def_id = def.0.internal(&mut *tables, cx.tcx); | |
| 702 | self.with_cx(|tables, cx| { | |
| 703 | let def_id = def.0.internal(tables, cx.tcx); | |
| 730 | 704 | |
| 731 | cx.eval_static_initializer(def_id).stable(&mut *tables, cx) | |
| 705 | cx.eval_static_initializer(def_id).stable(tables, cx) | |
| 706 | }) | |
| 732 | 707 | } |
| 733 | 708 | |
| 734 | 709 | /// Try to evaluate an instance into a constant. |
| ... | ... | @@ -737,142 +712,133 @@ impl<'tcx> CompilerInterface<'tcx> { |
| 737 | 712 | def: InstanceDef, |
| 738 | 713 | const_ty: Ty, |
| 739 | 714 | ) -> Result<Allocation, Error> { |
| 740 | let mut tables = self.tables.borrow_mut(); | |
| 741 | let instance = tables.instances[def]; | |
| 742 | let cx = &*self.cx.borrow(); | |
| 743 | let const_ty = const_ty.internal(&mut *tables, cx.tcx); | |
| 744 | cx.eval_instance(instance) | |
| 745 | .map(|const_val| alloc::try_new_allocation(const_ty, const_val, &mut *tables, cx)) | |
| 746 | .map_err(|e| e.stable(&mut *tables, cx))? | |
| 715 | self.with_cx(|tables, cx| { | |
| 716 | let instance = tables.instances[def]; | |
| 717 | let const_ty = const_ty.internal(tables, cx.tcx); | |
| 718 | cx.eval_instance(instance) | |
| 719 | .map(|const_val| alloc::try_new_allocation(const_ty, const_val, tables, cx)) | |
| 720 | .map_err(|e| e.stable(tables, cx))? | |
| 721 | }) | |
| 747 | 722 | } |
| 748 | 723 | |
| 749 | 724 | /// Retrieve global allocation for the given allocation ID. |
| 750 | 725 | pub(crate) fn global_alloc(&self, id: AllocId) -> GlobalAlloc { |
| 751 | let mut tables = self.tables.borrow_mut(); | |
| 752 | let cx = &*self.cx.borrow(); | |
| 753 | let alloc_id = id.internal(&mut *tables, cx.tcx); | |
| 754 | cx.global_alloc(alloc_id).stable(&mut *tables, cx) | |
| 726 | self.with_cx(|tables, cx| { | |
| 727 | let alloc_id = id.internal(tables, cx.tcx); | |
| 728 | cx.global_alloc(alloc_id).stable(tables, cx) | |
| 729 | }) | |
| 755 | 730 | } |
| 756 | 731 | |
| 757 | 732 | /// Retrieve the id for the virtual table. |
| 758 | 733 | pub(crate) fn vtable_allocation(&self, global_alloc: &GlobalAlloc) -> Option<AllocId> { |
| 759 | let mut tables = self.tables.borrow_mut(); | |
| 760 | let GlobalAlloc::VTable(ty, trait_ref) = global_alloc else { | |
| 761 | return None; | |
| 762 | }; | |
| 763 | let cx = &*self.cx.borrow(); | |
| 764 | let ty = ty.internal(&mut *tables, cx.tcx); | |
| 765 | let trait_ref = trait_ref.internal(&mut *tables, cx.tcx); | |
| 766 | let alloc_id = cx.vtable_allocation(ty, trait_ref); | |
| 767 | Some(alloc_id.stable(&mut *tables, cx)) | |
| 734 | self.with_cx(|tables, cx| { | |
| 735 | let GlobalAlloc::VTable(ty, trait_ref) = global_alloc else { | |
| 736 | return None; | |
| 737 | }; | |
| 738 | let ty = ty.internal(tables, cx.tcx); | |
| 739 | let trait_ref = trait_ref.internal(tables, cx.tcx); | |
| 740 | let alloc_id = cx.vtable_allocation(ty, trait_ref); | |
| 741 | Some(alloc_id.stable(tables, cx)) | |
| 742 | }) | |
| 768 | 743 | } |
| 769 | 744 | |
| 770 | 745 | pub(crate) fn krate(&self, def_id: DefId) -> Crate { |
| 771 | let tables = self.tables.borrow(); | |
| 772 | let cx = &*self.cx.borrow(); | |
| 773 | smir_crate(cx, tables[def_id].krate) | |
| 746 | self.with_cx(|tables, cx| smir_crate(cx, tables[def_id].krate)) | |
| 774 | 747 | } |
| 775 | 748 | |
| 776 | 749 | pub(crate) fn instance_name(&self, def: InstanceDef, trimmed: bool) -> Symbol { |
| 777 | let tables = self.tables.borrow_mut(); | |
| 778 | let cx = &*self.cx.borrow(); | |
| 779 | let instance = tables.instances[def]; | |
| 780 | cx.instance_name(instance, trimmed) | |
| 750 | self.with_cx(|tables, cx| { | |
| 751 | let instance = tables.instances[def]; | |
| 752 | cx.instance_name(instance, trimmed) | |
| 753 | }) | |
| 781 | 754 | } |
| 782 | 755 | |
| 783 | 756 | /// Return information about the target machine. |
| 784 | 757 | pub(crate) fn target_info(&self) -> MachineInfo { |
| 785 | let mut tables = self.tables.borrow_mut(); | |
| 786 | let cx = &*self.cx.borrow(); | |
| 787 | MachineInfo { | |
| 788 | endian: cx.target_endian().stable(&mut *tables, cx), | |
| 758 | self.with_cx(|tables, cx| MachineInfo { | |
| 759 | endian: cx.target_endian().stable(tables, cx), | |
| 789 | 760 | pointer_width: MachineSize::from_bits(cx.target_pointer_size()), |
| 790 | } | |
| 761 | }) | |
| 791 | 762 | } |
| 792 | 763 | |
| 793 | 764 | /// Get an instance ABI. |
| 794 | 765 | pub(crate) fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error> { |
| 795 | let mut tables = self.tables.borrow_mut(); | |
| 796 | let cx = &*self.cx.borrow(); | |
| 797 | let instance = tables.instances[def]; | |
| 798 | cx.instance_abi(instance).map(|fn_abi| fn_abi.stable(&mut *tables, cx)) | |
| 766 | self.with_cx(|tables, cx| { | |
| 767 | let instance = tables.instances[def]; | |
| 768 | cx.instance_abi(instance).map(|fn_abi| fn_abi.stable(tables, cx)) | |
| 769 | }) | |
| 799 | 770 | } |
| 800 | 771 | |
| 801 | 772 | /// Get the ABI of a function pointer. |
| 802 | 773 | pub(crate) fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error> { |
| 803 | let mut tables = self.tables.borrow_mut(); | |
| 804 | let cx = &*self.cx.borrow(); | |
| 805 | let sig = fn_ptr.internal(&mut *tables, cx.tcx); | |
| 806 | cx.fn_ptr_abi(sig).map(|fn_abi| fn_abi.stable(&mut *tables, cx)) | |
| 774 | self.with_cx(|tables, cx| { | |
| 775 | let sig = fn_ptr.internal(tables, cx.tcx); | |
| 776 | cx.fn_ptr_abi(sig).map(|fn_abi| fn_abi.stable(tables, cx)) | |
| 777 | }) | |
| 807 | 778 | } |
| 808 | 779 | |
| 809 | 780 | /// Get the layout of a type. |
| 810 | 781 | pub(crate) fn ty_layout(&self, ty: Ty) -> Result<Layout, Error> { |
| 811 | let mut tables = self.tables.borrow_mut(); | |
| 812 | let cx = &*self.cx.borrow(); | |
| 813 | let internal_ty = ty.internal(&mut *tables, cx.tcx); | |
| 814 | cx.ty_layout(internal_ty).map(|layout| layout.stable(&mut *tables, cx)) | |
| 782 | self.with_cx(|tables, cx| { | |
| 783 | let internal_ty = ty.internal(tables, cx.tcx); | |
| 784 | cx.ty_layout(internal_ty).map(|layout| layout.stable(tables, cx)) | |
| 785 | }) | |
| 815 | 786 | } |
| 816 | 787 | |
| 817 | 788 | /// Get the layout shape. |
| 818 | 789 | pub(crate) fn layout_shape(&self, id: Layout) -> LayoutShape { |
| 819 | let mut tables = self.tables.borrow_mut(); | |
| 820 | let cx = &*self.cx.borrow(); | |
| 821 | id.internal(&mut *tables, cx.tcx).0.stable(&mut *tables, cx) | |
| 790 | self.with_cx(|tables, cx| id.internal(tables, cx.tcx).0.stable(tables, cx)) | |
| 822 | 791 | } |
| 823 | 792 | |
| 824 | 793 | /// Get a debug string representation of a place. |
| 825 | 794 | pub(crate) fn place_pretty(&self, place: &Place) -> String { |
| 826 | let mut tables = self.tables.borrow_mut(); | |
| 827 | let cx = &*self.cx.borrow(); | |
| 828 | ||
| 829 | format!("{:?}", place.internal(&mut *tables, cx.tcx)) | |
| 795 | self.with_cx(|tables, cx| format!("{:?}", place.internal(tables, cx.tcx))) | |
| 830 | 796 | } |
| 831 | 797 | |
| 832 | 798 | /// Get the resulting type of binary operation. |
| 833 | 799 | pub(crate) fn binop_ty(&self, bin_op: BinOp, rhs: Ty, lhs: Ty) -> Ty { |
| 834 | let mut tables = self.tables.borrow_mut(); | |
| 835 | let cx = &*self.cx.borrow(); | |
| 836 | let rhs_internal = rhs.internal(&mut *tables, cx.tcx); | |
| 837 | let lhs_internal = lhs.internal(&mut *tables, cx.tcx); | |
| 838 | let bin_op_internal = bin_op.internal(&mut *tables, cx.tcx); | |
| 839 | cx.binop_ty(bin_op_internal, rhs_internal, lhs_internal).stable(&mut *tables, cx) | |
| 800 | self.with_cx(|tables, cx| { | |
| 801 | let rhs_internal = rhs.internal(tables, cx.tcx); | |
| 802 | let lhs_internal = lhs.internal(tables, cx.tcx); | |
| 803 | let bin_op_internal = bin_op.internal(tables, cx.tcx); | |
| 804 | cx.binop_ty(bin_op_internal, rhs_internal, lhs_internal).stable(tables, cx) | |
| 805 | }) | |
| 840 | 806 | } |
| 841 | 807 | |
| 842 | 808 | /// Get the resulting type of unary operation. |
| 843 | 809 | pub(crate) fn unop_ty(&self, un_op: UnOp, arg: Ty) -> Ty { |
| 844 | let mut tables = self.tables.borrow_mut(); | |
| 845 | let cx = &*self.cx.borrow(); | |
| 846 | let un_op = un_op.internal(&mut *tables, cx.tcx); | |
| 847 | let arg = arg.internal(&mut *tables, cx.tcx); | |
| 848 | cx.unop_ty(un_op, arg).stable(&mut *tables, cx) | |
| 810 | self.with_cx(|tables, cx| { | |
| 811 | let un_op = un_op.internal(tables, cx.tcx); | |
| 812 | let arg = arg.internal(tables, cx.tcx); | |
| 813 | cx.unop_ty(un_op, arg).stable(tables, cx) | |
| 814 | }) | |
| 849 | 815 | } |
| 850 | 816 | |
| 851 | 817 | /// Get all associated items of a definition. |
| 852 | 818 | pub(crate) fn associated_items(&self, def_id: DefId) -> AssocItems { |
| 853 | let mut tables = self.tables.borrow_mut(); | |
| 854 | let cx = &*self.cx.borrow(); | |
| 855 | let did = tables[def_id]; | |
| 856 | cx.associated_items(did).iter().map(|assoc| assoc.stable(&mut *tables, cx)).collect() | |
| 819 | self.with_cx(|tables, cx| { | |
| 820 | let did = tables[def_id]; | |
| 821 | cx.associated_items(did).iter().map(|assoc| assoc.stable(tables, cx)).collect() | |
| 822 | }) | |
| 857 | 823 | } |
| 858 | 824 | |
| 859 | 825 | /// Get all vtable entries of a trait. |
| 860 | 826 | pub(crate) fn vtable_entries(&self, trait_ref: &TraitRef) -> Vec<VtblEntry> { |
| 861 | let mut tables = self.tables.borrow_mut(); | |
| 862 | let cx = &*self.cx.borrow(); | |
| 863 | cx.vtable_entries(trait_ref.internal(&mut *tables, cx.tcx)) | |
| 864 | .iter() | |
| 865 | .map(|v| v.stable(&mut *tables, cx)) | |
| 866 | .collect() | |
| 827 | self.with_cx(|tables, cx| { | |
| 828 | cx.vtable_entries(trait_ref.internal(tables, cx.tcx)) | |
| 829 | .iter() | |
| 830 | .map(|v| v.stable(tables, cx)) | |
| 831 | .collect() | |
| 832 | }) | |
| 867 | 833 | } |
| 868 | 834 | |
| 869 | 835 | /// Returns the vtable entry at the given index. |
| 870 | 836 | /// |
| 871 | 837 | /// Returns `None` if the index is out of bounds. |
| 872 | 838 | pub(crate) fn vtable_entry(&self, trait_ref: &TraitRef, idx: usize) -> Option<VtblEntry> { |
| 873 | let mut tables = self.tables.borrow_mut(); | |
| 874 | let cx = &*self.cx.borrow(); | |
| 875 | cx.vtable_entry(trait_ref.internal(&mut *tables, cx.tcx), idx).stable(&mut *tables, cx) | |
| 839 | self.with_cx(|tables, cx| { | |
| 840 | cx.vtable_entry(trait_ref.internal(tables, cx.tcx), idx).stable(tables, cx) | |
| 841 | }) | |
| 876 | 842 | } |
| 877 | 843 | } |
| 878 | 844 |
compiler/rustc_resolve/src/build_reduced_graph.rs+4-5| ... | ... | @@ -52,7 +52,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 52 | 52 | decl: Decl<'ra>, |
| 53 | 53 | ) { |
| 54 | 54 | if let Err(old_decl) = |
| 55 | self.try_plant_decl_into_local_module(ident, orig_ident_span, ns, decl, false) | |
| 55 | self.try_plant_decl_into_local_module(ident, orig_ident_span, ns, decl) | |
| 56 | 56 | { |
| 57 | 57 | self.report_conflict(ident, ns, old_decl, decl); |
| 58 | 58 | } |
| ... | ... | @@ -87,13 +87,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 87 | 87 | vis: Visibility<DefId>, |
| 88 | 88 | span: Span, |
| 89 | 89 | expansion: LocalExpnId, |
| 90 | ambiguity: Option<Decl<'ra>>, | |
| 90 | ambiguity: Option<(Decl<'ra>, bool)>, | |
| 91 | 91 | ) { |
| 92 | 92 | let decl = self.arenas.alloc_decl(DeclData { |
| 93 | 93 | kind: DeclKind::Def(res), |
| 94 | 94 | ambiguity: CmCell::new(ambiguity), |
| 95 | // External ambiguities always report the `AMBIGUOUS_GLOB_IMPORTS` lint at the moment. | |
| 96 | warn_ambiguity: CmCell::new(true), | |
| 97 | 95 | initial_vis: vis, |
| 98 | 96 | ambiguity_vis_max: CmCell::new(None), |
| 99 | 97 | ambiguity_vis_min: CmCell::new(None), |
| ... | ... | @@ -392,7 +390,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 392 | 390 | let ModChild { ident: _, res, vis, ref reexport_chain } = *ambig_child; |
| 393 | 391 | let span = child_span(self, reexport_chain, res); |
| 394 | 392 | let res = res.expect_non_local(); |
| 395 | self.arenas.new_def_decl(res, vis, span, expansion, Some(parent.to_module())) | |
| 393 | // External ambiguities always report the `AMBIGUOUS_GLOB_IMPORTS` lint at the moment. | |
| 394 | (self.arenas.new_def_decl(res, vis, span, expansion, Some(parent.to_module())), true) | |
| 396 | 395 | }); |
| 397 | 396 | |
| 398 | 397 | // Record primary definitions. |
compiler/rustc_resolve/src/diagnostics.rs+1-1| ... | ... | @@ -1188,7 +1188,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1188 | 1188 | .emit() |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | fn def_path_str(&self, mut def_id: DefId) -> String { | |
| 1191 | pub(crate) fn def_path_str(&self, mut def_id: DefId) -> String { | |
| 1192 | 1192 | // We can't use `def_path_str` in resolve. |
| 1193 | 1193 | let mut path = vec![def_id]; |
| 1194 | 1194 | while let Some(parent) = self.tcx.opt_parent(def_id) { |
compiler/rustc_resolve/src/imports.rs+108-84| ... | ... | @@ -382,11 +382,9 @@ fn remove_same_import<'ra>(d1: Decl<'ra>, d2: Decl<'ra>) -> (Decl<'ra>, Decl<'ra |
| 382 | 382 | assert_eq!(d1.span, d2.span); |
| 383 | 383 | if d1.ambiguity.get() != d2.ambiguity.get() { |
| 384 | 384 | assert!(d1.ambiguity.get().is_some()); |
| 385 | assert!(d2.ambiguity.get().is_none()); | |
| 386 | 385 | } |
| 387 | 386 | // Visibility of the new import declaration may be different, |
| 388 | 387 | // because it already incorporates the visibility of the source binding. |
| 389 | // `warn_ambiguity` of a re-fetched glob can also change in both directions. | |
| 390 | 388 | remove_same_import(d1_next, d2_next) |
| 391 | 389 | } else { |
| 392 | 390 | (d1, d2) |
| ... | ... | @@ -450,7 +448,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 450 | 448 | self.arenas.alloc_decl(DeclData { |
| 451 | 449 | kind: DeclKind::Import { source_decl: decl, import }, |
| 452 | 450 | ambiguity: CmCell::new(None), |
| 453 | warn_ambiguity: CmCell::new(false), | |
| 454 | 451 | span: import.span, |
| 455 | 452 | initial_vis: vis.to_def_id(), |
| 456 | 453 | ambiguity_vis_max: CmCell::new(None), |
| ... | ... | @@ -460,14 +457,85 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 460 | 457 | }) |
| 461 | 458 | } |
| 462 | 459 | |
| 460 | fn is_noise_0_7_0(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { | |
| 461 | let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; | |
| 462 | let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; | |
| 463 | let [seg1, seg2] = &i1.module_path[..] else { return false }; | |
| 464 | if seg1.ident.name != kw::SelfLower || seg2.ident.name.as_str() != "perlin_surflet" { | |
| 465 | return false; | |
| 466 | } | |
| 467 | let [seg1, seg2] = &i2.module_path[..] else { return false }; | |
| 468 | if seg1.ident.name != kw::SelfLower || seg2.ident.name.as_str() != "perlin" { | |
| 469 | return false; | |
| 470 | } | |
| 471 | let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; | |
| 472 | let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; | |
| 473 | self.def_path_str(def_id1).ends_with("noise_fns::generators::perlin_surflet::Perlin") | |
| 474 | && self.def_path_str(def_id2).ends_with("noise_fns::generators::perlin::Perlin") | |
| 475 | } | |
| 476 | ||
| 477 | fn is_rustybuzz_0_4_0(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { | |
| 478 | let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; | |
| 479 | let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; | |
| 480 | let [seg1, seg2] = &i1.module_path[..] else { return false }; | |
| 481 | if seg1.ident.name != kw::Super || seg2.ident.name.as_str() != "gsubgpos" { | |
| 482 | return false; | |
| 483 | } | |
| 484 | let [seg1] = &i2.module_path[..] else { return false }; | |
| 485 | if seg1.ident.name != kw::Super { | |
| 486 | return false; | |
| 487 | } | |
| 488 | let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; | |
| 489 | let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; | |
| 490 | self.def_path_str(def_id1).ends_with("tables::gsubgpos::Class") | |
| 491 | && self.def_path_str(def_id2).ends_with("ggg::Class") | |
| 492 | } | |
| 493 | ||
| 494 | fn is_pdf_0_9_0(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { | |
| 495 | let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; | |
| 496 | let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; | |
| 497 | let [seg1, seg2] = &i1.module_path[..] else { return false }; | |
| 498 | if seg1.ident.name != kw::Crate || seg2.ident.name.as_str() != "content" { | |
| 499 | return false; | |
| 500 | } | |
| 501 | let [seg1, seg2] = &i2.module_path[..] else { return false }; | |
| 502 | if seg1.ident.name != kw::Crate || seg2.ident.name.as_str() != "object" { | |
| 503 | return false; | |
| 504 | } | |
| 505 | let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; | |
| 506 | let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; | |
| 507 | self.def_path_str(def_id1).ends_with("crate::content::Rect") | |
| 508 | && self.def_path_str(def_id2).ends_with("crate::object::types::Rect") | |
| 509 | } | |
| 510 | ||
| 511 | fn is_net2_0_2_39(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> bool { | |
| 512 | let DeclKind::Import { import: i1, .. } = glob_decl.kind else { unreachable!() }; | |
| 513 | let DeclKind::Import { import: i2, .. } = old_glob_decl.kind else { unreachable!() }; | |
| 514 | let [seg1, seg2, seg3, seg4] = &i1.module_path[..] else { return false }; | |
| 515 | if seg1.ident.name != kw::PathRoot | |
| 516 | || seg2.ident.name.as_str() != "winapi" | |
| 517 | || seg3.ident.name.as_str() != "shared" | |
| 518 | || seg4.ident.name.as_str() != "ws2def" | |
| 519 | { | |
| 520 | return false; | |
| 521 | } | |
| 522 | let [seg1, seg2, seg3, seg4] = &i2.module_path[..] else { return false }; | |
| 523 | if seg1.ident.name != kw::PathRoot | |
| 524 | || seg2.ident.name.as_str() != "winapi" | |
| 525 | || seg3.ident.name.as_str() != "um" | |
| 526 | || seg4.ident.name.as_str() != "winsock2" | |
| 527 | { | |
| 528 | return false; | |
| 529 | } | |
| 530 | let Some(def_id1) = glob_decl.res().opt_def_id() else { return false }; | |
| 531 | let Some(def_id2) = old_glob_decl.res().opt_def_id() else { return false }; | |
| 532 | self.def_path_str(def_id1).starts_with("winapi::shared::ws2def::") | |
| 533 | && self.def_path_str(def_id2).starts_with("winapi::um::winsock2::") | |
| 534 | } | |
| 535 | ||
| 463 | 536 | /// If `glob_decl` attempts to overwrite `old_glob_decl` in a module, |
| 464 | 537 | /// decide which one to keep. |
| 465 | fn select_glob_decl( | |
| 466 | &self, | |
| 467 | old_glob_decl: Decl<'ra>, | |
| 468 | glob_decl: Decl<'ra>, | |
| 469 | warn_ambiguity: bool, | |
| 470 | ) -> Decl<'ra> { | |
| 538 | fn select_glob_decl(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> Decl<'ra> { | |
| 471 | 539 | assert!(glob_decl.is_glob_import()); |
| 472 | 540 | assert!(old_glob_decl.is_glob_import()); |
| 473 | 541 | assert_ne!(glob_decl, old_glob_decl); |
| ... | ... | @@ -476,9 +544,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 476 | 544 | // all these overwrites will be re-fetched by glob imports importing |
| 477 | 545 | // from that module without generating new ambiguities. |
| 478 | 546 | // - A glob decl is overwritten by a non-glob decl arriving later. |
| 479 | // - A glob decl is overwritten by its clone after setting ambiguity in it. | |
| 480 | // FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch | |
| 481 | // with the same decl in some way. | |
| 482 | 547 | // - A glob decl is overwritten by a glob decl re-fetching an |
| 483 | 548 | // overwritten decl from other module (the recursive case). |
| 484 | 549 | // Here we are detecting all such re-fetches and overwrite old decls |
| ... | ... | @@ -489,29 +554,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 489 | 554 | if deep_decl != glob_decl { |
| 490 | 555 | // Some import layers have been removed, need to overwrite. |
| 491 | 556 | assert_ne!(old_deep_decl, old_glob_decl); |
| 492 | // FIXME: reenable the asserts when `warn_ambiguity` is removed (#149195). | |
| 493 | // assert_ne!(old_deep_decl, deep_decl); | |
| 494 | // assert!(old_deep_decl.is_glob_import()); | |
| 495 | 557 | assert!(!deep_decl.is_glob_import()); |
| 496 | if old_glob_decl.ambiguity.get().is_some() && glob_decl.ambiguity.get().is_none() { | |
| 558 | if let Some((old_ambig, _)) = old_glob_decl.ambiguity.get() | |
| 559 | && glob_decl.ambiguity.get().is_none() | |
| 560 | { | |
| 497 | 561 | // Do not lose glob ambiguities when re-fetching the glob. |
| 498 | glob_decl.ambiguity.set_unchecked(old_glob_decl.ambiguity.get()); | |
| 499 | } | |
| 500 | if glob_decl.is_ambiguity_recursive() { | |
| 501 | glob_decl.warn_ambiguity.set_unchecked(true); | |
| 562 | glob_decl.ambiguity.set_unchecked(Some((old_ambig, true))); | |
| 502 | 563 | } |
| 503 | 564 | glob_decl |
| 504 | 565 | } else if glob_decl.res() != old_glob_decl.res() { |
| 505 | old_glob_decl.ambiguity.set_unchecked(Some(glob_decl)); | |
| 506 | old_glob_decl.warn_ambiguity.set_unchecked(warn_ambiguity); | |
| 507 | if warn_ambiguity { | |
| 508 | old_glob_decl | |
| 509 | } else { | |
| 510 | // Need a fresh decl so other glob imports importing it could re-fetch it | |
| 511 | // and set their own `warn_ambiguity` to true. | |
| 512 | // FIXME: remove this when `warn_ambiguity` is removed (#149195). | |
| 513 | self.arenas.alloc_decl((*old_glob_decl).clone()) | |
| 514 | } | |
| 566 | let warning = self.is_noise_0_7_0(old_glob_decl, glob_decl) | |
| 567 | || self.is_rustybuzz_0_4_0(old_glob_decl, glob_decl) | |
| 568 | || self.is_pdf_0_9_0(old_glob_decl, glob_decl) | |
| 569 | || self.is_net2_0_2_39(old_glob_decl, glob_decl); | |
| 570 | old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, warning))); | |
| 571 | old_glob_decl | |
| 515 | 572 | } else if let old_vis = old_glob_decl.vis() |
| 516 | 573 | && let vis = glob_decl.vis() |
| 517 | 574 | && old_vis != vis |
| ... | ... | @@ -529,8 +586,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 529 | 586 | old_glob_decl |
| 530 | 587 | } else if glob_decl.is_ambiguity_recursive() && !old_glob_decl.is_ambiguity_recursive() { |
| 531 | 588 | // Overwriting a non-ambiguous glob import with an ambiguous glob import. |
| 532 | old_glob_decl.ambiguity.set_unchecked(Some(glob_decl)); | |
| 533 | old_glob_decl.warn_ambiguity.set_unchecked(true); | |
| 589 | old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, true))); | |
| 534 | 590 | old_glob_decl |
| 535 | 591 | } else { |
| 536 | 592 | old_glob_decl |
| ... | ... | @@ -545,9 +601,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 545 | 601 | orig_ident_span: Span, |
| 546 | 602 | ns: Namespace, |
| 547 | 603 | decl: Decl<'ra>, |
| 548 | warn_ambiguity: bool, | |
| 549 | 604 | ) -> Result<(), Decl<'ra>> { |
| 550 | assert!(!decl.warn_ambiguity.get()); | |
| 551 | 605 | assert!(decl.ambiguity.get().is_none()); |
| 552 | 606 | assert!(decl.ambiguity_vis_max.get().is_none()); |
| 553 | 607 | assert!(decl.ambiguity_vis_min.get().is_none()); |
| ... | ... | @@ -562,31 +616,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 562 | 616 | module.underscore_disambiguator.update_unchecked(|d| d + 1); |
| 563 | 617 | module.underscore_disambiguator.get() |
| 564 | 618 | }); |
| 565 | self.update_local_resolution( | |
| 566 | module, | |
| 567 | key, | |
| 568 | orig_ident_span, | |
| 569 | warn_ambiguity, | |
| 570 | |this, resolution| { | |
| 571 | if decl.is_glob_import() { | |
| 572 | resolution.glob_decl = Some(match resolution.glob_decl { | |
| 573 | Some(old_decl) => this.select_glob_decl( | |
| 574 | old_decl, | |
| 575 | decl, | |
| 576 | warn_ambiguity && resolution.non_glob_decl.is_none(), | |
| 577 | ), | |
| 578 | None => decl, | |
| 579 | }) | |
| 580 | } else { | |
| 581 | resolution.non_glob_decl = Some(match resolution.non_glob_decl { | |
| 582 | Some(old_decl) => return Err(old_decl), | |
| 583 | None => decl, | |
| 584 | }) | |
| 585 | } | |
| 619 | self.update_local_resolution(module, key, orig_ident_span, |this, resolution| { | |
| 620 | if decl.is_glob_import() { | |
| 621 | resolution.glob_decl = Some(match resolution.glob_decl { | |
| 622 | Some(old_decl) => this.select_glob_decl(old_decl, decl), | |
| 623 | None => decl, | |
| 624 | }); | |
| 625 | } else { | |
| 626 | resolution.non_glob_decl = Some(match resolution.non_glob_decl { | |
| 627 | Some(old_decl) => return Err(old_decl), | |
| 628 | None => decl, | |
| 629 | }) | |
| 630 | } | |
| 586 | 631 | |
| 587 | Ok(()) | |
| 588 | }, | |
| 589 | ) | |
| 632 | Ok(()) | |
| 633 | }) | |
| 590 | 634 | } |
| 591 | 635 | |
| 592 | 636 | // Use `f` to mutate the resolution of the name in the module. |
| ... | ... | @@ -596,7 +640,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 596 | 640 | module: LocalModule<'ra>, |
| 597 | 641 | key: BindingKey, |
| 598 | 642 | orig_ident_span: Span, |
| 599 | warn_ambiguity: bool, | |
| 600 | 643 | f: F, |
| 601 | 644 | ) -> T |
| 602 | 645 | where |
| ... | ... | @@ -604,7 +647,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 604 | 647 | { |
| 605 | 648 | // Ensure that `resolution` isn't borrowed when defining in the module's glob importers, |
| 606 | 649 | // during which the resolution might end up getting re-defined via a glob cycle. |
| 607 | let (binding, t, warn_ambiguity) = { | |
| 650 | let (binding, t) = { | |
| 608 | 651 | let resolution = &mut *self |
| 609 | 652 | .resolution_or_default(module.to_module(), key, orig_ident_span) |
| 610 | 653 | .borrow_mut_unchecked(); |
| ... | ... | @@ -616,7 +659,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 616 | 659 | if let Some(binding) = resolution.determined_decl() |
| 617 | 660 | && (old_decl != Some(binding) || old_vis != Some(binding.vis())) |
| 618 | 661 | { |
| 619 | (binding, t, warn_ambiguity || old_decl.is_some()) | |
| 662 | (binding, t) | |
| 620 | 663 | } else { |
| 621 | 664 | return t; |
| 622 | 665 | } |
| ... | ... | @@ -639,14 +682,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 639 | 682 | }; |
| 640 | 683 | if self.is_accessible_from(binding.vis(), scope) { |
| 641 | 684 | let import_decl = self.new_import_decl(binding, *import); |
| 642 | self.try_plant_decl_into_local_module( | |
| 643 | ident, | |
| 644 | orig_ident_span, | |
| 645 | key.ns, | |
| 646 | import_decl, | |
| 647 | warn_ambiguity, | |
| 648 | ) | |
| 649 | .expect("planting a glob cannot fail"); | |
| 685 | self.try_plant_decl_into_local_module(ident, orig_ident_span, key.ns, import_decl) | |
| 686 | .expect("planting a glob cannot fail"); | |
| 650 | 687 | } |
| 651 | 688 | } |
| 652 | 689 | |
| ... | ... | @@ -665,13 +702,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 665 | 702 | self.per_ns(|this, ns| { |
| 666 | 703 | let ident = IdentKey::new(target); |
| 667 | 704 | // This can fail, dummies are inserted only in non-occupied slots. |
| 668 | let _ = this.try_plant_decl_into_local_module( | |
| 669 | ident, | |
| 670 | target.span, | |
| 671 | ns, | |
| 672 | dummy_decl, | |
| 673 | false, | |
| 674 | ); | |
| 705 | let _ = this.try_plant_decl_into_local_module(ident, target.span, ns, dummy_decl); | |
| 675 | 706 | // Don't remove underscores from `single_imports`, they were never added. |
| 676 | 707 | if target.name != kw::Underscore { |
| 677 | 708 | let key = BindingKey::new(ident, ns); |
| ... | ... | @@ -679,7 +710,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 679 | 710 | import.parent_scope.module.expect_local(), |
| 680 | 711 | key, |
| 681 | 712 | target.span, |
| 682 | false, | |
| 683 | 713 | |_, resolution| { |
| 684 | 714 | resolution.single_imports.swap_remove(&import); |
| 685 | 715 | }, |
| ... | ... | @@ -846,7 +876,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 846 | 876 | } |
| 847 | 877 | |
| 848 | 878 | if let DeclKind::Import { import, .. } = binding.kind |
| 849 | && let Some(amb_binding) = binding.ambiguity.get() | |
| 879 | && let Some((amb_binding, _)) = binding.ambiguity.get() | |
| 850 | 880 | && binding.res() != Res::Err |
| 851 | 881 | && exported_ambiguities.contains(&binding) |
| 852 | 882 | { |
| ... | ... | @@ -1134,7 +1164,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1134 | 1164 | parent.expect_local(), |
| 1135 | 1165 | key, |
| 1136 | 1166 | target.span, |
| 1137 | false, | |
| 1138 | 1167 | |_, resolution| { |
| 1139 | 1168 | resolution.single_imports.swap_remove(&import); |
| 1140 | 1169 | }, |
| ... | ... | @@ -1820,16 +1849,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1820 | 1849 | }; |
| 1821 | 1850 | if self.is_accessible_from(binding.vis(), scope) { |
| 1822 | 1851 | let import_decl = self.new_import_decl(binding, import); |
| 1823 | let warn_ambiguity = self | |
| 1824 | .resolution(import.parent_scope.module, key) | |
| 1825 | .and_then(|r| r.determined_decl()) | |
| 1826 | .is_some_and(|binding| binding.warn_ambiguity_recursive()); | |
| 1827 | 1852 | self.try_plant_decl_into_local_module( |
| 1828 | 1853 | key.ident, |
| 1829 | 1854 | orig_ident_span, |
| 1830 | 1855 | key.ns, |
| 1831 | 1856 | import_decl, |
| 1832 | warn_ambiguity, | |
| 1833 | 1857 | ) |
| 1834 | 1858 | .expect("planting a glob cannot fail"); |
| 1835 | 1859 | } |
compiler/rustc_resolve/src/late.rs+79-95| ... | ... | @@ -27,7 +27,7 @@ use rustc_errors::{ |
| 27 | 27 | use rustc_hir::def::Namespace::{self, *}; |
| 28 | 28 | use rustc_hir::def::{CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS}; |
| 29 | 29 | use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LOCAL_CRATE, LocalDefId}; |
| 30 | use rustc_hir::{MissingLifetimeKind, PrimTy, TraitCandidate}; | |
| 30 | use rustc_hir::{MissingLifetimeKind, PrimTy}; | |
| 31 | 31 | use rustc_middle::middle::resolve_bound_vars::Set1; |
| 32 | 32 | use rustc_middle::ty::{AssocTag, DelegationInfo, Visibility}; |
| 33 | 33 | use rustc_middle::{bug, span_bug}; |
| ... | ... | @@ -781,8 +781,7 @@ pub(crate) struct DiagMetadata<'ast> { |
| 781 | 781 | |
| 782 | 782 | /// Accumulate the errors due to missed lifetime elision, |
| 783 | 783 | /// and report them all at once for each function. |
| 784 | current_elision_failures: | |
| 785 | Vec<(MissingLifetime, LifetimeElisionCandidate, Either<NodeId, Range<NodeId>>)>, | |
| 784 | current_elision_failures: Vec<(MissingLifetime, Either<NodeId, Range<NodeId>>)>, | |
| 786 | 785 | } |
| 787 | 786 | |
| 788 | 787 | struct LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| ... | ... | @@ -1749,10 +1748,10 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1749 | 1748 | let ident = lifetime.ident; |
| 1750 | 1749 | |
| 1751 | 1750 | if ident.name == kw::StaticLifetime { |
| 1752 | self.record_lifetime_res( | |
| 1751 | self.record_lifetime_use( | |
| 1753 | 1752 | lifetime.id, |
| 1754 | 1753 | LifetimeRes::Static, |
| 1755 | LifetimeElisionCandidate::Named, | |
| 1754 | LifetimeElisionCandidate::Ignore, | |
| 1756 | 1755 | ); |
| 1757 | 1756 | return; |
| 1758 | 1757 | } |
| ... | ... | @@ -1765,7 +1764,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1765 | 1764 | while let Some(rib) = lifetime_rib_iter.next() { |
| 1766 | 1765 | let normalized_ident = ident.normalize_to_macros_2_0(); |
| 1767 | 1766 | if let Some(&(_, res)) = rib.bindings.get(&normalized_ident) { |
| 1768 | self.record_lifetime_res(lifetime.id, res, LifetimeElisionCandidate::Named); | |
| 1767 | self.record_lifetime_use(lifetime.id, res, LifetimeElisionCandidate::Ignore); | |
| 1769 | 1768 | |
| 1770 | 1769 | if let LifetimeRes::Param { param, binder } = res { |
| 1771 | 1770 | match self.lifetime_uses.entry(param) { |
| ... | ... | @@ -1831,20 +1830,12 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1831 | 1830 | LifetimeRibKind::Item => break, |
| 1832 | 1831 | LifetimeRibKind::ConstParamTy => { |
| 1833 | 1832 | let guar = self.emit_non_static_lt_in_const_param_ty_error(lifetime); |
| 1834 | self.record_lifetime_res( | |
| 1835 | lifetime.id, | |
| 1836 | LifetimeRes::Error(guar), | |
| 1837 | LifetimeElisionCandidate::Ignore, | |
| 1838 | ); | |
| 1833 | self.record_lifetime_err(lifetime.id, guar); | |
| 1839 | 1834 | return; |
| 1840 | 1835 | } |
| 1841 | 1836 | LifetimeRibKind::ConcreteAnonConst(cause) => { |
| 1842 | 1837 | let guar = self.emit_forbidden_non_static_lifetime_error(cause, lifetime); |
| 1843 | self.record_lifetime_res( | |
| 1844 | lifetime.id, | |
| 1845 | LifetimeRes::Error(guar), | |
| 1846 | LifetimeElisionCandidate::Ignore, | |
| 1847 | ); | |
| 1838 | self.record_lifetime_err(lifetime.id, guar); | |
| 1848 | 1839 | return; |
| 1849 | 1840 | } |
| 1850 | 1841 | LifetimeRibKind::AnonymousCreateParameter { .. } |
| ... | ... | @@ -1862,11 +1853,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1862 | 1853 | .find_map(|rib| rib.bindings.get_key_value(&normalized_ident).map(|(&outer, _)| outer)); |
| 1863 | 1854 | |
| 1864 | 1855 | let guar = self.emit_undeclared_lifetime_error(lifetime, outer_res); |
| 1865 | self.record_lifetime_res( | |
| 1866 | lifetime.id, | |
| 1867 | LifetimeRes::Error(guar), | |
| 1868 | LifetimeElisionCandidate::Named, | |
| 1869 | ); | |
| 1856 | self.record_lifetime_err(lifetime.id, guar); | |
| 1870 | 1857 | } |
| 1871 | 1858 | |
| 1872 | 1859 | #[instrument(level = "debug", skip(self))] |
| ... | ... | @@ -1893,7 +1880,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1893 | 1880 | match rib.kind { |
| 1894 | 1881 | LifetimeRibKind::AnonymousCreateParameter { binder, .. } => { |
| 1895 | 1882 | let res = self.create_fresh_lifetime(lifetime.ident, binder, kind); |
| 1896 | self.record_lifetime_res(lifetime.id, res, elision_candidate); | |
| 1883 | self.record_lifetime_use(lifetime.id, res, elision_candidate); | |
| 1897 | 1884 | return; |
| 1898 | 1885 | } |
| 1899 | 1886 | LifetimeRibKind::StaticIfNoLifetimeInScope { lint_id: node_id, emit_lint } => { |
| ... | ... | @@ -1911,7 +1898,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1911 | 1898 | } |
| 1912 | 1899 | } |
| 1913 | 1900 | if lifetimes_in_scope.is_empty() { |
| 1914 | self.record_lifetime_res( | |
| 1901 | self.record_lifetime_use( | |
| 1915 | 1902 | lifetime.id, |
| 1916 | 1903 | LifetimeRes::Static, |
| 1917 | 1904 | elision_candidate, |
| ... | ... | @@ -2015,23 +2002,17 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2015 | 2002 | span: lifetime.ident.span, |
| 2016 | 2003 | }) |
| 2017 | 2004 | }; |
| 2018 | self.record_lifetime_res( | |
| 2019 | lifetime.id, | |
| 2020 | LifetimeRes::Error(guar), | |
| 2021 | elision_candidate, | |
| 2022 | ); | |
| 2005 | self.record_lifetime_err(lifetime.id, guar); | |
| 2023 | 2006 | return; |
| 2024 | 2007 | } |
| 2025 | 2008 | LifetimeRibKind::Elided(res) => { |
| 2026 | self.record_lifetime_res(lifetime.id, res, elision_candidate); | |
| 2009 | self.record_lifetime_use(lifetime.id, res, elision_candidate); | |
| 2027 | 2010 | return; |
| 2028 | 2011 | } |
| 2029 | 2012 | LifetimeRibKind::ElisionFailure => { |
| 2030 | self.diag_metadata.current_elision_failures.push(( | |
| 2031 | missing_lifetime, | |
| 2032 | elision_candidate, | |
| 2033 | Either::Left(lifetime.id), | |
| 2034 | )); | |
| 2013 | self.diag_metadata | |
| 2014 | .current_elision_failures | |
| 2015 | .push((missing_lifetime, Either::Left(lifetime.id))); | |
| 2035 | 2016 | return; |
| 2036 | 2017 | } |
| 2037 | 2018 | LifetimeRibKind::Item => break, |
| ... | ... | @@ -2045,7 +2026,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2045 | 2026 | } |
| 2046 | 2027 | } |
| 2047 | 2028 | let guar = self.report_missing_lifetime_specifiers([&missing_lifetime], None); |
| 2048 | self.record_lifetime_res(lifetime.id, LifetimeRes::Error(guar), elision_candidate); | |
| 2029 | self.record_lifetime_err(lifetime.id, guar); | |
| 2049 | 2030 | } |
| 2050 | 2031 | |
| 2051 | 2032 | fn point_at_impl_lifetimes(&mut self, err: &mut Diag<'_>, i: usize, lifetime: Span) { |
| ... | ... | @@ -2142,7 +2123,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2142 | 2123 | let id = self.r.next_node_id(); |
| 2143 | 2124 | let lt = Lifetime { id, ident: Ident::new(kw::UnderscoreLifetime, span) }; |
| 2144 | 2125 | |
| 2145 | self.record_lifetime_res( | |
| 2126 | self.record_lifetime_use( | |
| 2146 | 2127 | anchor_id, |
| 2147 | 2128 | LifetimeRes::ElidedAnchor { start: id, end: id + 1 }, |
| 2148 | 2129 | LifetimeElisionCandidate::Ignore, |
| ... | ... | @@ -2162,15 +2143,15 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2162 | 2143 | |
| 2163 | 2144 | // Leave the responsibility to create the `LocalDefId` to lowering. |
| 2164 | 2145 | let param = self.r.next_node_id(); |
| 2165 | let res = LifetimeRes::Fresh { param, binder, kind }; | |
| 2166 | self.record_lifetime_param(param, res); | |
| 2146 | let res = LifetimeRes::Fresh { param, kind }; | |
| 2147 | self.record_lifetime_def(param, res); | |
| 2167 | 2148 | |
| 2168 | 2149 | // Record the created lifetime parameter so lowering can pick it up and add it to HIR. |
| 2169 | 2150 | self.r |
| 2170 | 2151 | .extra_lifetime_params_map |
| 2171 | 2152 | .entry(binder) |
| 2172 | 2153 | .or_insert_with(Vec::new) |
| 2173 | .push((ident, param, res)); | |
| 2154 | .push((ident, param, kind)); | |
| 2174 | 2155 | res |
| 2175 | 2156 | } |
| 2176 | 2157 | |
| ... | ... | @@ -2226,7 +2207,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2226 | 2207 | } |
| 2227 | 2208 | |
| 2228 | 2209 | let node_ids = self.r.next_node_ids(expected_lifetimes); |
| 2229 | self.record_lifetime_res( | |
| 2210 | self.record_lifetime_use( | |
| 2230 | 2211 | segment_id, |
| 2231 | 2212 | LifetimeRes::ElidedAnchor { start: node_ids.start, end: node_ids.end }, |
| 2232 | 2213 | LifetimeElisionCandidate::Ignore, |
| ... | ... | @@ -2252,10 +2233,10 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2252 | 2233 | // Do not create a parameter for patterns and expressions: type checking can infer |
| 2253 | 2234 | // the appropriate lifetime for us. |
| 2254 | 2235 | for id in node_ids { |
| 2255 | self.record_lifetime_res( | |
| 2236 | self.record_lifetime_use( | |
| 2256 | 2237 | id, |
| 2257 | 2238 | LifetimeRes::Infer, |
| 2258 | LifetimeElisionCandidate::Named, | |
| 2239 | LifetimeElisionCandidate::Ignore, | |
| 2259 | 2240 | ); |
| 2260 | 2241 | } |
| 2261 | 2242 | continue; |
| ... | ... | @@ -2311,11 +2292,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2311 | 2292 | should_lint = false; |
| 2312 | 2293 | |
| 2313 | 2294 | for id in node_ids { |
| 2314 | self.record_lifetime_res( | |
| 2315 | id, | |
| 2316 | LifetimeRes::Error(guar), | |
| 2317 | LifetimeElisionCandidate::Named, | |
| 2318 | ); | |
| 2295 | self.record_lifetime_err(id, guar); | |
| 2319 | 2296 | } |
| 2320 | 2297 | break; |
| 2321 | 2298 | } |
| ... | ... | @@ -2325,10 +2302,10 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2325 | 2302 | let mut candidate = LifetimeElisionCandidate::Missing(missing_lifetime); |
| 2326 | 2303 | for id in node_ids { |
| 2327 | 2304 | let res = self.create_fresh_lifetime(ident, binder, kind); |
| 2328 | self.record_lifetime_res( | |
| 2305 | self.record_lifetime_use( | |
| 2329 | 2306 | id, |
| 2330 | 2307 | res, |
| 2331 | replace(&mut candidate, LifetimeElisionCandidate::Named), | |
| 2308 | replace(&mut candidate, LifetimeElisionCandidate::Ignore), | |
| 2332 | 2309 | ); |
| 2333 | 2310 | } |
| 2334 | 2311 | break; |
| ... | ... | @@ -2336,7 +2313,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2336 | 2313 | LifetimeRibKind::Elided(res) => { |
| 2337 | 2314 | let mut candidate = LifetimeElisionCandidate::Missing(missing_lifetime); |
| 2338 | 2315 | for id in node_ids { |
| 2339 | self.record_lifetime_res( | |
| 2316 | self.record_lifetime_use( | |
| 2340 | 2317 | id, |
| 2341 | 2318 | res, |
| 2342 | 2319 | replace(&mut candidate, LifetimeElisionCandidate::Ignore), |
| ... | ... | @@ -2345,11 +2322,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2345 | 2322 | break; |
| 2346 | 2323 | } |
| 2347 | 2324 | LifetimeRibKind::ElisionFailure => { |
| 2348 | self.diag_metadata.current_elision_failures.push(( | |
| 2349 | missing_lifetime, | |
| 2350 | LifetimeElisionCandidate::Ignore, | |
| 2351 | Either::Right(node_ids), | |
| 2352 | )); | |
| 2325 | self.diag_metadata | |
| 2326 | .current_elision_failures | |
| 2327 | .push((missing_lifetime, Either::Right(node_ids))); | |
| 2353 | 2328 | break; |
| 2354 | 2329 | } |
| 2355 | 2330 | // `LifetimeRes::Error`, which would usually be used in the case of |
| ... | ... | @@ -2360,11 +2335,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2360 | 2335 | let guar = |
| 2361 | 2336 | self.report_missing_lifetime_specifiers([&missing_lifetime], None); |
| 2362 | 2337 | for id in node_ids { |
| 2363 | self.record_lifetime_res( | |
| 2364 | id, | |
| 2365 | LifetimeRes::Error(guar), | |
| 2366 | LifetimeElisionCandidate::Ignore, | |
| 2367 | ); | |
| 2338 | self.record_lifetime_err(id, guar); | |
| 2368 | 2339 | } |
| 2369 | 2340 | break; |
| 2370 | 2341 | } |
| ... | ... | @@ -2405,16 +2376,15 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2405 | 2376 | } |
| 2406 | 2377 | } |
| 2407 | 2378 | |
| 2379 | /// Register a use of an already defined lifetime. | |
| 2408 | 2380 | #[instrument(level = "debug", skip(self))] |
| 2409 | fn record_lifetime_res( | |
| 2381 | fn record_lifetime_use( | |
| 2410 | 2382 | &mut self, |
| 2411 | 2383 | id: NodeId, |
| 2412 | 2384 | res: LifetimeRes, |
| 2413 | 2385 | candidate: LifetimeElisionCandidate, |
| 2414 | 2386 | ) { |
| 2415 | if let Some(prev_res) = self.r.lifetimes_res_map.insert(id, res) { | |
| 2416 | panic!("lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)") | |
| 2417 | } | |
| 2387 | self.record_lifetime_def(id, res); | |
| 2418 | 2388 | |
| 2419 | 2389 | match res { |
| 2420 | 2390 | LifetimeRes::Param { .. } | LifetimeRes::Fresh { .. } | LifetimeRes::Static { .. } => { |
| ... | ... | @@ -2426,8 +2396,16 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2426 | 2396 | } |
| 2427 | 2397 | } |
| 2428 | 2398 | |
| 2399 | /// Can be used for both definitions and uses of lifetimes, as an error | |
| 2400 | /// has already been reported. | |
| 2429 | 2401 | #[instrument(level = "debug", skip(self))] |
| 2430 | fn record_lifetime_param(&mut self, id: NodeId, res: LifetimeRes) { | |
| 2402 | fn record_lifetime_err(&mut self, id: NodeId, guar: ErrorGuaranteed) { | |
| 2403 | self.record_lifetime_def(id, LifetimeRes::Error(guar)); | |
| 2404 | } | |
| 2405 | ||
| 2406 | /// Define a new lifetime (e.g. in generics) | |
| 2407 | #[instrument(level = "debug", skip(self))] | |
| 2408 | fn record_lifetime_def(&mut self, id: NodeId, res: LifetimeRes) { | |
| 2431 | 2409 | if let Some(prev_res) = self.r.lifetimes_res_map.insert(id, res) { |
| 2432 | 2410 | panic!( |
| 2433 | 2411 | "lifetime parameter {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" |
| ... | ... | @@ -2470,15 +2448,13 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2470 | 2448 | elision_failures.iter().map(|(missing_lifetime, ..)| missing_lifetime), |
| 2471 | 2449 | Some(failure_info), |
| 2472 | 2450 | ); |
| 2473 | let mut record_res = |lifetime, candidate| { | |
| 2474 | this.record_lifetime_res(lifetime, LifetimeRes::Error(guar), candidate) | |
| 2475 | }; | |
| 2476 | for (_, candidate, nodes) in elision_failures { | |
| 2451 | let mut record_res = |lifetime| this.record_lifetime_err(lifetime, guar); | |
| 2452 | for (_, nodes) in elision_failures { | |
| 2477 | 2453 | match nodes { |
| 2478 | Either::Left(node_id) => record_res(node_id, candidate), | |
| 2454 | Either::Left(node_id) => record_res(node_id), | |
| 2479 | 2455 | Either::Right(node_ids) => { |
| 2480 | 2456 | for lifetime in node_ids { |
| 2481 | record_res(lifetime, candidate) | |
| 2457 | record_res(lifetime) | |
| 2482 | 2458 | } |
| 2483 | 2459 | } |
| 2484 | 2460 | } |
| ... | ... | @@ -2553,9 +2529,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2553 | 2529 | }); |
| 2554 | 2530 | all_candidates.extend(candidates.into_iter().filter_map(|(_, candidate)| { |
| 2555 | 2531 | match candidate { |
| 2556 | LifetimeElisionCandidate::Ignore | LifetimeElisionCandidate::Named => { | |
| 2557 | None | |
| 2558 | } | |
| 2532 | LifetimeElisionCandidate::Ignore => None, | |
| 2559 | 2533 | LifetimeElisionCandidate::Missing(missing) => Some(missing), |
| 2560 | 2534 | } |
| 2561 | 2535 | })); |
| ... | ... | @@ -3146,7 +3120,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3146 | 3120 | param.ident, |
| 3147 | 3121 | ); |
| 3148 | 3122 | // Record lifetime res, so lowering knows there is something fishy. |
| 3149 | self.record_lifetime_param(param.id, LifetimeRes::Error(guar)); | |
| 3123 | self.record_lifetime_err(param.id, guar); | |
| 3150 | 3124 | continue; |
| 3151 | 3125 | } |
| 3152 | 3126 | |
| ... | ... | @@ -3158,7 +3132,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3158 | 3132 | let rib = match param.kind { |
| 3159 | 3133 | GenericParamKind::Lifetime => { |
| 3160 | 3134 | // Record lifetime res, so lowering knows there is something fishy. |
| 3161 | self.record_lifetime_param(param.id, LifetimeRes::Error(guar)); | |
| 3135 | self.record_lifetime_err(param.id, guar); | |
| 3162 | 3136 | continue; |
| 3163 | 3137 | } |
| 3164 | 3138 | GenericParamKind::Type { .. } => &mut function_type_rib, |
| ... | ... | @@ -3193,7 +3167,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3193 | 3167 | .create_err(errors::UnderscoreLifetimeIsReserved { span: param.ident.span }) |
| 3194 | 3168 | .emit_unless_delay(is_raw_underscore_lifetime); |
| 3195 | 3169 | // Record lifetime res, so lowering knows there is something fishy. |
| 3196 | self.record_lifetime_param(param.id, LifetimeRes::Error(guar)); | |
| 3170 | self.record_lifetime_err(param.id, guar); | |
| 3197 | 3171 | continue; |
| 3198 | 3172 | } |
| 3199 | 3173 | |
| ... | ... | @@ -3203,7 +3177,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3203 | 3177 | lifetime: param.ident, |
| 3204 | 3178 | }); |
| 3205 | 3179 | // Record lifetime res, so lowering knows there is something fishy. |
| 3206 | self.record_lifetime_param(param.id, LifetimeRes::Error(guar)); | |
| 3180 | self.record_lifetime_err(param.id, guar); | |
| 3207 | 3181 | continue; |
| 3208 | 3182 | } |
| 3209 | 3183 | |
| ... | ... | @@ -3217,7 +3191,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3217 | 3191 | } |
| 3218 | 3192 | GenericParamKind::Lifetime => { |
| 3219 | 3193 | let res = LifetimeRes::Param { param: def_id, binder }; |
| 3220 | self.record_lifetime_param(param.id, res); | |
| 3194 | self.record_lifetime_def(param.id, res); | |
| 3221 | 3195 | function_lifetime_rib.bindings.insert(ident, (param.id, res)); |
| 3222 | 3196 | continue; |
| 3223 | 3197 | } |
| ... | ... | @@ -3923,12 +3897,24 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 3923 | 3897 | this.visit_path(&delegation.path); |
| 3924 | 3898 | }); |
| 3925 | 3899 | |
| 3926 | self.r.delegation_infos.insert( | |
| 3927 | self.r.current_owner.def_id, | |
| 3928 | DelegationInfo { | |
| 3929 | resolution_node: if is_in_trait_impl { item_id } else { delegation.id }, | |
| 3930 | }, | |
| 3931 | ); | |
| 3900 | let resolution_id = if is_in_trait_impl { item_id } else { delegation.id }; | |
| 3901 | let def_id = self | |
| 3902 | .r | |
| 3903 | .partial_res_map | |
| 3904 | .get(&resolution_id) | |
| 3905 | .and_then(|r| r.expect_full_res().opt_def_id()); | |
| 3906 | if let Some(resolution_id) = def_id { | |
| 3907 | self.r | |
| 3908 | .delegation_infos | |
| 3909 | .insert(self.r.current_owner.def_id, DelegationInfo { resolution_id }); | |
| 3910 | } else { | |
| 3911 | self.r.tcx.dcx().span_delayed_bug( | |
| 3912 | delegation.path.span, | |
| 3913 | format!( | |
| 3914 | "LoweringContext: couldn't resolve node {resolution_id:?} in delegation item", | |
| 3915 | ), | |
| 3916 | ); | |
| 3917 | }; | |
| 3932 | 3918 | |
| 3933 | 3919 | let Some(body) = &delegation.body else { return }; |
| 3934 | 3920 | self.with_rib(ValueNS, RibKind::FnOrCoroutine, |this| { |
| ... | ... | @@ -4780,8 +4766,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 4780 | 4766 | // it needs to be added to the trait map. |
| 4781 | 4767 | if ns == ValueNS { |
| 4782 | 4768 | let item_name = path.last().unwrap().ident; |
| 4783 | let traits = self.traits_in_scope(item_name, ns); | |
| 4784 | self.r.trait_map.insert(node_id, traits); | |
| 4769 | self.record_traits_in_scope(node_id, item_name); | |
| 4785 | 4770 | } |
| 4786 | 4771 | |
| 4787 | 4772 | if PrimTy::from_name(path[0].ident.name).is_some() { |
| ... | ... | @@ -5382,13 +5367,11 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 5382 | 5367 | // we need to add any trait methods we find that match the |
| 5383 | 5368 | // field name so that we can do some nice error reporting |
| 5384 | 5369 | // later on in typeck. |
| 5385 | let traits = self.traits_in_scope(ident, ValueNS); | |
| 5386 | self.r.trait_map.insert(expr.id, traits); | |
| 5370 | self.record_traits_in_scope(expr.id, ident); | |
| 5387 | 5371 | } |
| 5388 | 5372 | ExprKind::MethodCall(ref call) => { |
| 5389 | 5373 | debug!("(recording candidate traits for expr) recording traits for {}", expr.id); |
| 5390 | let traits = self.traits_in_scope(call.seg.ident, ValueNS); | |
| 5391 | self.r.trait_map.insert(expr.id, traits); | |
| 5374 | self.record_traits_in_scope(expr.id, call.seg.ident); | |
| 5392 | 5375 | } |
| 5393 | 5376 | _ => { |
| 5394 | 5377 | // Nothing to do. |
| ... | ... | @@ -5396,13 +5379,14 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 5396 | 5379 | } |
| 5397 | 5380 | } |
| 5398 | 5381 | |
| 5399 | fn traits_in_scope(&mut self, ident: Ident, ns: Namespace) -> &'tcx [TraitCandidate<'tcx>] { | |
| 5400 | self.r.traits_in_scope( | |
| 5382 | fn record_traits_in_scope(&mut self, node_id: NodeId, ident: Ident) { | |
| 5383 | let traits = self.r.traits_in_scope( | |
| 5401 | 5384 | self.current_trait_ref.as_ref().map(|(module, _)| *module), |
| 5402 | 5385 | &self.parent_scope, |
| 5403 | 5386 | ident.span, |
| 5404 | Some((ident.name, ns)), | |
| 5405 | ) | |
| 5387 | Some((ident.name, ValueNS)), | |
| 5388 | ); | |
| 5389 | self.r.trait_map.insert(node_id, traits); | |
| 5406 | 5390 | } |
| 5407 | 5391 | |
| 5408 | 5392 | fn resolve_and_cache_rustdoc_path(&mut self, path_str: &str, ns: Namespace) -> Option<Res> { |
compiler/rustc_resolve/src/late/diagnostics.rs+1-3| ... | ... | @@ -149,10 +149,8 @@ pub(super) struct ElisionFnParameter { |
| 149 | 149 | /// This is used to suggest introducing an explicit lifetime. |
| 150 | 150 | #[derive(Clone, Copy, Debug)] |
| 151 | 151 | pub(super) enum LifetimeElisionCandidate { |
| 152 | /// This is not a real lifetime. | |
| 152 | /// This is not a real lifetime, or it is a named lifetime, in which case we won't suggest anything. | |
| 153 | 153 | Ignore, |
| 154 | /// There is a named lifetime, we won't suggest anything. | |
| 155 | Named, | |
| 156 | 154 | Missing(MissingLifetime), |
| 157 | 155 | } |
| 158 | 156 |
compiler/rustc_resolve/src/lib.rs+8-35| ... | ... | @@ -58,7 +58,7 @@ use rustc_hir::def::{ |
| 58 | 58 | }; |
| 59 | 59 | use rustc_hir::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap}; |
| 60 | 60 | use rustc_hir::definitions::{PerParentDisambiguatorState, PerParentDisambiguatorsMap}; |
| 61 | use rustc_hir::{PrimTy, TraitCandidate, find_attr}; | |
| 61 | use rustc_hir::{MissingLifetimeKind, PrimTy, TraitCandidate, find_attr}; | |
| 62 | 62 | use rustc_index::bit_set::DenseBitSet; |
| 63 | 63 | use rustc_metadata::creader::CStore; |
| 64 | 64 | use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport}; |
| ... | ... | @@ -822,7 +822,7 @@ impl<'ra> Module<'ra> { |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | /// This modifies `self` in place. The traits will be stored in `self.traits`. |
| 825 | fn ensure_traits<'tcx>(self, resolver: &impl AsRef<Resolver<'ra, 'tcx>>) { | |
| 825 | fn ensure_traits<'tcx>(self, resolver: &Resolver<'ra, 'tcx>) { | |
| 826 | 826 | let mut traits = self.traits.borrow_mut(resolver.as_ref()); |
| 827 | 827 | if traits.is_none() { |
| 828 | 828 | let mut collected_traits = Vec::new(); |
| ... | ... | @@ -996,10 +996,7 @@ impl<'ra> fmt::Debug for LocalModule<'ra> { |
| 996 | 996 | #[derive(Clone, Debug)] |
| 997 | 997 | struct DeclData<'ra> { |
| 998 | 998 | kind: DeclKind<'ra>, |
| 999 | ambiguity: CmCell<Option<Decl<'ra>>>, | |
| 1000 | /// Produce a warning instead of an error when reporting ambiguities inside this binding. | |
| 1001 | /// May apply to indirect ambiguities under imports, so `ambiguity.is_some()` is not required. | |
| 1002 | warn_ambiguity: CmCell<bool>, | |
| 999 | ambiguity: CmCell<Option<(Decl<'ra>, bool /*warning*/)>>, | |
| 1003 | 1000 | expansion: LocalExpnId, |
| 1004 | 1001 | span: Span, |
| 1005 | 1002 | initial_vis: Visibility<DefId>, |
| ... | ... | @@ -1160,7 +1157,7 @@ impl<'ra> DeclData<'ra> { |
| 1160 | 1157 | |
| 1161 | 1158 | fn descent_to_ambiguity(self: Decl<'ra>) -> Option<(Decl<'ra>, Decl<'ra>)> { |
| 1162 | 1159 | match self.ambiguity.get() { |
| 1163 | Some(ambig_binding) => Some((self, ambig_binding)), | |
| 1160 | Some((ambig_binding, _)) => Some((self, ambig_binding)), | |
| 1164 | 1161 | None => match self.kind { |
| 1165 | 1162 | DeclKind::Import { source_decl, .. } => source_decl.descent_to_ambiguity(), |
| 1166 | 1163 | _ => None, |
| ... | ... | @@ -1176,14 +1173,6 @@ impl<'ra> DeclData<'ra> { |
| 1176 | 1173 | } |
| 1177 | 1174 | } |
| 1178 | 1175 | |
| 1179 | fn warn_ambiguity_recursive(&self) -> bool { | |
| 1180 | self.warn_ambiguity.get() | |
| 1181 | || match self.kind { | |
| 1182 | DeclKind::Import { source_decl, .. } => source_decl.warn_ambiguity_recursive(), | |
| 1183 | _ => false, | |
| 1184 | } | |
| 1185 | } | |
| 1186 | ||
| 1187 | 1176 | fn is_possibly_imported_variant(&self) -> bool { |
| 1188 | 1177 | match self.kind { |
| 1189 | 1178 | DeclKind::Import { source_decl, .. } => source_decl.is_possibly_imported_variant(), |
| ... | ... | @@ -1385,7 +1374,7 @@ pub struct Resolver<'ra, 'tcx> { |
| 1385 | 1374 | /// Resolutions for lifetimes. |
| 1386 | 1375 | lifetimes_res_map: NodeMap<LifetimeRes> = Default::default(), |
| 1387 | 1376 | /// Lifetime parameters that lowering will have to introduce. |
| 1388 | extra_lifetime_params_map: NodeMap<Vec<(Ident, NodeId, LifetimeRes)>> = Default::default(), | |
| 1377 | extra_lifetime_params_map: NodeMap<Vec<(Ident, NodeId, MissingLifetimeKind)>> = Default::default(), | |
| 1389 | 1378 | |
| 1390 | 1379 | /// `CrateNum` resolutions of `extern crate` items. |
| 1391 | 1380 | extern_crate_map: UnordMap<LocalDefId, CrateNum> = Default::default(), |
| ... | ... | @@ -1595,7 +1584,6 @@ impl<'ra> ResolverArenas<'ra> { |
| 1595 | 1584 | self.alloc_decl(DeclData { |
| 1596 | 1585 | kind: DeclKind::Def(res), |
| 1597 | 1586 | ambiguity: CmCell::new(None), |
| 1598 | warn_ambiguity: CmCell::new(false), | |
| 1599 | 1587 | initial_vis: vis, |
| 1600 | 1588 | ambiguity_vis_max: CmCell::new(None), |
| 1601 | 1589 | ambiguity_vis_min: CmCell::new(None), |
| ... | ... | @@ -2261,17 +2249,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2261 | 2249 | } |
| 2262 | 2250 | |
| 2263 | 2251 | fn record_use(&mut self, ident: Ident, used_decl: Decl<'ra>, used: Used) { |
| 2264 | self.record_use_inner(ident, used_decl, used, used_decl.warn_ambiguity.get()); | |
| 2265 | } | |
| 2266 | ||
| 2267 | fn record_use_inner( | |
| 2268 | &mut self, | |
| 2269 | ident: Ident, | |
| 2270 | used_decl: Decl<'ra>, | |
| 2271 | used: Used, | |
| 2272 | warn_ambiguity: bool, | |
| 2273 | ) { | |
| 2274 | if let Some(b2) = used_decl.ambiguity.get() { | |
| 2252 | if let Some((b2, warning)) = used_decl.ambiguity.get() { | |
| 2275 | 2253 | let ambiguity_error = AmbiguityError { |
| 2276 | 2254 | kind: AmbiguityKind::GlobVsGlob, |
| 2277 | 2255 | ambig_vis: None, |
| ... | ... | @@ -2280,7 +2258,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2280 | 2258 | b2, |
| 2281 | 2259 | scope1: Scope::ModuleGlobs(used_decl.parent_module.unwrap(), None), |
| 2282 | 2260 | scope2: Scope::ModuleGlobs(b2.parent_module.unwrap(), None), |
| 2283 | warning: if warn_ambiguity { Some(AmbiguityWarning::GlobImport) } else { None }, | |
| 2261 | warning: if warning { Some(AmbiguityWarning::GlobImport) } else { None }, | |
| 2284 | 2262 | }; |
| 2285 | 2263 | if !self.matches_previous_ambiguity_error(&ambiguity_error) { |
| 2286 | 2264 | // avoid duplicated span information to be emit out |
| ... | ... | @@ -2330,12 +2308,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2330 | 2308 | self.used_imports.insert(id); |
| 2331 | 2309 | } |
| 2332 | 2310 | self.add_to_glob_map(import, ident.name); |
| 2333 | self.record_use_inner( | |
| 2334 | ident, | |
| 2335 | source_decl, | |
| 2336 | Used::Other, | |
| 2337 | warn_ambiguity || source_decl.warn_ambiguity.get(), | |
| 2338 | ); | |
| 2311 | self.record_use(ident, source_decl, Used::Other); | |
| 2339 | 2312 | } |
| 2340 | 2313 | } |
| 2341 | 2314 |
compiler/rustc_span/src/symbol.rs+1| ... | ... | @@ -600,6 +600,7 @@ symbols! { |
| 600 | 600 | cfi, |
| 601 | 601 | cfi_encoding, |
| 602 | 602 | char, |
| 603 | clflushopt_target_feature, | |
| 603 | 604 | client, |
| 604 | 605 | clippy, |
| 605 | 606 | clobber_abi, |
compiler/rustc_target/src/spec/mod.rs+23-28| ... | ... | @@ -132,8 +132,6 @@ pub enum LinkerFlavor { |
| 132 | 132 | // Below: other linker-like tools with unique interfaces for exotic targets. |
| 133 | 133 | /// Linker tool for BPF. |
| 134 | 134 | Bpf, |
| 135 | /// Linker tool for Nvidia PTX. | |
| 136 | Ptx, | |
| 137 | 135 | /// LLVM bitcode linker that can be used as a `self-contained` linker |
| 138 | 136 | Llbc, |
| 139 | 137 | } |
| ... | ... | @@ -153,7 +151,6 @@ pub enum LinkerFlavorCli { |
| 153 | 151 | Msvc(Lld), |
| 154 | 152 | EmCc, |
| 155 | 153 | Bpf, |
| 156 | Ptx, | |
| 157 | 154 | Llbc, |
| 158 | 155 | |
| 159 | 156 | // Legacy stable values |
| ... | ... | @@ -174,8 +171,7 @@ impl LinkerFlavorCli { |
| 174 | 171 | | LinkerFlavorCli::Msvc(Lld::Yes) |
| 175 | 172 | | LinkerFlavorCli::EmCc |
| 176 | 173 | | LinkerFlavorCli::Bpf |
| 177 | | LinkerFlavorCli::Llbc | |
| 178 | | LinkerFlavorCli::Ptx => true, | |
| 174 | | LinkerFlavorCli::Llbc => true, | |
| 179 | 175 | LinkerFlavorCli::Gcc |
| 180 | 176 | | LinkerFlavorCli::Ld |
| 181 | 177 | | LinkerFlavorCli::Lld(..) |
| ... | ... | @@ -211,7 +207,6 @@ impl LinkerFlavor { |
| 211 | 207 | LinkerFlavorCli::EmCc => LinkerFlavor::EmCc, |
| 212 | 208 | LinkerFlavorCli::Bpf => LinkerFlavor::Bpf, |
| 213 | 209 | LinkerFlavorCli::Llbc => LinkerFlavor::Llbc, |
| 214 | LinkerFlavorCli::Ptx => LinkerFlavor::Ptx, | |
| 215 | 210 | |
| 216 | 211 | // Below: legacy stable values |
| 217 | 212 | LinkerFlavorCli::Gcc => match lld_flavor { |
| ... | ... | @@ -251,7 +246,6 @@ impl LinkerFlavor { |
| 251 | 246 | LinkerFlavor::EmCc => LinkerFlavorCli::Em, |
| 252 | 247 | LinkerFlavor::Bpf => LinkerFlavorCli::Bpf, |
| 253 | 248 | LinkerFlavor::Llbc => LinkerFlavorCli::Llbc, |
| 254 | LinkerFlavor::Ptx => LinkerFlavorCli::Ptx, | |
| 255 | 249 | } |
| 256 | 250 | } |
| 257 | 251 | |
| ... | ... | @@ -266,7 +260,6 @@ impl LinkerFlavor { |
| 266 | 260 | LinkerFlavor::EmCc => LinkerFlavorCli::EmCc, |
| 267 | 261 | LinkerFlavor::Bpf => LinkerFlavorCli::Bpf, |
| 268 | 262 | LinkerFlavor::Llbc => LinkerFlavorCli::Llbc, |
| 269 | LinkerFlavor::Ptx => LinkerFlavorCli::Ptx, | |
| 270 | 263 | } |
| 271 | 264 | } |
| 272 | 265 | |
| ... | ... | @@ -279,7 +272,7 @@ impl LinkerFlavor { |
| 279 | 272 | LinkerFlavorCli::Unix(cc) => (Some(cc), None), |
| 280 | 273 | LinkerFlavorCli::Msvc(lld) => (Some(Cc::No), Some(lld)), |
| 281 | 274 | LinkerFlavorCli::EmCc => (Some(Cc::Yes), Some(Lld::Yes)), |
| 282 | LinkerFlavorCli::Bpf | LinkerFlavorCli::Ptx => (None, None), | |
| 275 | LinkerFlavorCli::Bpf => (None, None), | |
| 283 | 276 | LinkerFlavorCli::Llbc => (None, None), |
| 284 | 277 | |
| 285 | 278 | // Below: legacy stable values |
| ... | ... | @@ -336,7 +329,7 @@ impl LinkerFlavor { |
| 336 | 329 | LinkerFlavor::WasmLld(cc) => LinkerFlavor::WasmLld(cc_hint.unwrap_or(cc)), |
| 337 | 330 | LinkerFlavor::Unix(cc) => LinkerFlavor::Unix(cc_hint.unwrap_or(cc)), |
| 338 | 331 | LinkerFlavor::Msvc(lld) => LinkerFlavor::Msvc(lld_hint.unwrap_or(lld)), |
| 339 | LinkerFlavor::EmCc | LinkerFlavor::Bpf | LinkerFlavor::Llbc | LinkerFlavor::Ptx => self, | |
| 332 | LinkerFlavor::EmCc | LinkerFlavor::Bpf | LinkerFlavor::Llbc => self, | |
| 340 | 333 | } |
| 341 | 334 | } |
| 342 | 335 | |
| ... | ... | @@ -355,7 +348,7 @@ impl LinkerFlavor { |
| 355 | 348 | let compatible = |cli| { |
| 356 | 349 | // The CLI flavor should be compatible with the target if: |
| 357 | 350 | match (self, cli) { |
| 358 | // 1. they are counterparts: they have the same principal flavor. | |
| 351 | // they are counterparts: they have the same principal flavor. | |
| 359 | 352 | (LinkerFlavor::Gnu(..), LinkerFlavorCli::Gnu(..)) |
| 360 | 353 | | (LinkerFlavor::Darwin(..), LinkerFlavorCli::Darwin(..)) |
| 361 | 354 | | (LinkerFlavor::WasmLld(..), LinkerFlavorCli::WasmLld(..)) |
| ... | ... | @@ -363,10 +356,7 @@ impl LinkerFlavor { |
| 363 | 356 | | (LinkerFlavor::Msvc(..), LinkerFlavorCli::Msvc(..)) |
| 364 | 357 | | (LinkerFlavor::EmCc, LinkerFlavorCli::EmCc) |
| 365 | 358 | | (LinkerFlavor::Bpf, LinkerFlavorCli::Bpf) |
| 366 | | (LinkerFlavor::Llbc, LinkerFlavorCli::Llbc) | |
| 367 | | (LinkerFlavor::Ptx, LinkerFlavorCli::Ptx) => return true, | |
| 368 | // 2. The linker flavor is independent of target and compatible | |
| 369 | (LinkerFlavor::Ptx, LinkerFlavorCli::Llbc) => return true, | |
| 359 | | (LinkerFlavor::Llbc, LinkerFlavorCli::Llbc) => return true, | |
| 370 | 360 | _ => {} |
| 371 | 361 | } |
| 372 | 362 | |
| ... | ... | @@ -389,8 +379,7 @@ impl LinkerFlavor { |
| 389 | 379 | | LinkerFlavor::Unix(..) |
| 390 | 380 | | LinkerFlavor::EmCc |
| 391 | 381 | | LinkerFlavor::Bpf |
| 392 | | LinkerFlavor::Llbc | |
| 393 | | LinkerFlavor::Ptx => LldFlavor::Ld, | |
| 382 | | LinkerFlavor::Llbc => LldFlavor::Ld, | |
| 394 | 383 | LinkerFlavor::Darwin(..) => LldFlavor::Ld64, |
| 395 | 384 | LinkerFlavor::WasmLld(..) => LldFlavor::Wasm, |
| 396 | 385 | LinkerFlavor::Msvc(..) => LldFlavor::Link, |
| ... | ... | @@ -415,8 +404,7 @@ impl LinkerFlavor { |
| 415 | 404 | | LinkerFlavor::Msvc(_) |
| 416 | 405 | | LinkerFlavor::Unix(_) |
| 417 | 406 | | LinkerFlavor::Bpf |
| 418 | | LinkerFlavor::Llbc | |
| 419 | | LinkerFlavor::Ptx => false, | |
| 407 | | LinkerFlavor::Llbc => false, | |
| 420 | 408 | } |
| 421 | 409 | } |
| 422 | 410 | |
| ... | ... | @@ -435,8 +423,7 @@ impl LinkerFlavor { |
| 435 | 423 | | LinkerFlavor::Msvc(_) |
| 436 | 424 | | LinkerFlavor::Unix(_) |
| 437 | 425 | | LinkerFlavor::Bpf |
| 438 | | LinkerFlavor::Llbc | |
| 439 | | LinkerFlavor::Ptx => false, | |
| 426 | | LinkerFlavor::Llbc => false, | |
| 440 | 427 | } |
| 441 | 428 | } |
| 442 | 429 | |
| ... | ... | @@ -512,7 +499,6 @@ linker_flavor_cli_impls! { |
| 512 | 499 | (LinkerFlavorCli::EmCc) "em-cc" |
| 513 | 500 | (LinkerFlavorCli::Bpf) "bpf" |
| 514 | 501 | (LinkerFlavorCli::Llbc) "llbc" |
| 515 | (LinkerFlavorCli::Ptx) "ptx" | |
| 516 | 502 | |
| 517 | 503 | // Legacy stable flavors |
| 518 | 504 | (LinkerFlavorCli::Gcc) "gcc" |
| ... | ... | @@ -2740,8 +2726,7 @@ fn add_link_args_iter( |
| 2740 | 2726 | | LinkerFlavor::Unix(..) |
| 2741 | 2727 | | LinkerFlavor::EmCc |
| 2742 | 2728 | | LinkerFlavor::Bpf |
| 2743 | | LinkerFlavor::Llbc | |
| 2744 | | LinkerFlavor::Ptx => {} | |
| 2729 | | LinkerFlavor::Llbc => {} | |
| 2745 | 2730 | } |
| 2746 | 2731 | } |
| 2747 | 2732 | |
| ... | ... | @@ -3127,10 +3112,7 @@ impl Target { |
| 3127 | 3112 | "mixing MSVC and non-MSVC linker flavors" |
| 3128 | 3113 | ); |
| 3129 | 3114 | } |
| 3130 | LinkerFlavor::EmCc | |
| 3131 | | LinkerFlavor::Bpf | |
| 3132 | | LinkerFlavor::Ptx | |
| 3133 | | LinkerFlavor::Llbc => { | |
| 3115 | LinkerFlavor::EmCc | LinkerFlavor::Bpf | LinkerFlavor::Llbc => { | |
| 3134 | 3116 | check_eq!(flavor, self.linker_flavor, "mixing different linker flavors") |
| 3135 | 3117 | } |
| 3136 | 3118 | } |
| ... | ... | @@ -3582,6 +3564,19 @@ impl Target { |
| 3582 | 3564 | "invalid `target_abi` for CSky" |
| 3583 | 3565 | ); |
| 3584 | 3566 | } |
| 3567 | Arch::Wasm32 | Arch::Wasm64 => { | |
| 3568 | check!( | |
| 3569 | self.llvm_abiname == LlvmAbi::Unspecified, | |
| 3570 | "`llvm_abiname` is unused on wasm" | |
| 3571 | ); | |
| 3572 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on wasm"); | |
| 3573 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on wasm"); | |
| 3574 | check_matches!( | |
| 3575 | self.cfg_abi, | |
| 3576 | CfgAbi::Unspecified | CfgAbi::Other(_), | |
| 3577 | "invalid `target_abi` for wasm" | |
| 3578 | ); | |
| 3579 | } | |
| 3585 | 3580 | ref arch => { |
| 3586 | 3581 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on {arch}"); |
| 3587 | 3582 | // Ensure consistency among built-in targets, but give JSON targets the opportunity |
compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs-1| ... | ... | @@ -21,7 +21,6 @@ pub(crate) fn target() -> Target { |
| 21 | 21 | vendor: "nvidia".into(), |
| 22 | 22 | linker_flavor: LinkerFlavor::Llbc, |
| 23 | 23 | |
| 24 | // With `ptx-linker` approach, it can be later overridden via link flags. | |
| 25 | 24 | cpu: "sm_70".into(), |
| 26 | 25 | |
| 27 | 26 | // No longer supported architectures |
compiler/rustc_target/src/target_features.rs+7| ... | ... | @@ -464,6 +464,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ |
| 464 | 464 | ("avxvnniint16", Stable, &["avx2"]), |
| 465 | 465 | ("bmi1", Stable, &[]), |
| 466 | 466 | ("bmi2", Stable, &[]), |
| 467 | ("clflushopt", Unstable(sym::clflushopt_target_feature), &[]), | |
| 467 | 468 | ("cmpxchg16b", Stable, &[]), |
| 468 | 469 | ("ermsb", Unstable(sym::ermsb_target_feature), &[]), |
| 469 | 470 | ("f16c", Stable, &["avx"]), |
| ... | ... | @@ -1312,11 +1313,17 @@ impl Target { |
| 1312 | 1313 | } |
| 1313 | 1314 | } |
| 1314 | 1315 | Arch::Avr => { |
| 1316 | // We only support one ABI on AVR at the moment. | |
| 1315 | 1317 | // SRAM is minimum requirement for C/C++ in both avr-gcc and Clang, |
| 1316 | 1318 | // and backends of them only support assembly for devices have no SRAM. |
| 1317 | 1319 | // See the discussion in https://github.com/rust-lang/rust/pull/146900 for more. |
| 1318 | 1320 | FeatureConstraints { required: &["sram"], incompatible: &[] } |
| 1319 | 1321 | } |
| 1322 | Arch::Wasm32 | Arch::Wasm64 => { | |
| 1323 | // We only support one ABI on wasm at the moment. | |
| 1324 | // No ABI-relevant target features have been identified thus far. | |
| 1325 | NOTHING | |
| 1326 | } | |
| 1320 | 1327 | _ => NOTHING, |
| 1321 | 1328 | } |
| 1322 | 1329 | } |
library/core/src/intrinsics/mod.rs+1| ... | ... | @@ -3569,6 +3569,7 @@ pub const fn offload<F, T: crate::marker::Tuple, R>( |
| 3569 | 3569 | f: F, |
| 3570 | 3570 | workgroup_dim: [u32; 3], |
| 3571 | 3571 | thread_dim: [u32; 3], |
| 3572 | dyn_cache: u32, | |
| 3572 | 3573 | args: T, |
| 3573 | 3574 | ) -> R; |
| 3574 | 3575 |
library/proc_macro/src/bridge/client.rs+23-39| ... | ... | @@ -2,19 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | use std::cell::RefCell; |
| 4 | 4 | use std::marker::PhantomData; |
| 5 | use std::sync::atomic::AtomicU32; | |
| 6 | 5 | |
| 7 | 6 | use super::*; |
| 8 | 7 | |
| 9 | #[repr(C)] | |
| 10 | pub(super) struct HandleCounters { | |
| 11 | pub(super) token_stream: AtomicU32, | |
| 12 | pub(super) span: AtomicU32, | |
| 13 | } | |
| 14 | ||
| 15 | static COUNTERS: HandleCounters = | |
| 16 | HandleCounters { token_stream: AtomicU32::new(1), span: AtomicU32::new(1) }; | |
| 17 | ||
| 18 | 8 | pub(crate) struct TokenStream { |
| 19 | 9 | handle: handle::Handle, |
| 20 | 10 | } |
| ... | ... | @@ -47,6 +37,18 @@ impl<S> Decode<'_, '_, S> for TokenStream { |
| 47 | 37 | } |
| 48 | 38 | } |
| 49 | 39 | |
| 40 | impl Encode<()> for crate::TokenStream { | |
| 41 | fn encode(self, w: &mut Buffer, s: &mut ()) { | |
| 42 | self.0.encode(w, s) | |
| 43 | } | |
| 44 | } | |
| 45 | ||
| 46 | impl Decode<'_, '_, ()> for crate::TokenStream { | |
| 47 | fn decode(r: &mut &[u8], s: &mut ()) -> Self { | |
| 48 | crate::TokenStream(Some(Decode::decode(r, s))) | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 50 | 52 | #[derive(Copy, Clone, PartialEq, Eq, Hash)] |
| 51 | 53 | pub(crate) struct Span { |
| 52 | 54 | handle: handle::Handle, |
| ... | ... | @@ -209,8 +211,6 @@ pub(crate) fn is_available() -> bool { |
| 209 | 211 | /// and forcing the use of APIs that take/return `S::TokenStream`, server-side. |
| 210 | 212 | #[repr(C)] |
| 211 | 213 | pub struct Client<I, O> { |
| 212 | pub(super) handle_counters: &'static HandleCounters, | |
| 213 | ||
| 214 | 214 | pub(super) run: extern "C" fn(BridgeConfig<'_>) -> Buffer, |
| 215 | 215 | |
| 216 | 216 | pub(super) _marker: PhantomData<fn(I) -> O>, |
| ... | ... | @@ -243,14 +243,13 @@ fn maybe_install_panic_hook(force_show_panics: bool) { |
| 243 | 243 | |
| 244 | 244 | /// Client-side helper for handling client panics, entering the bridge, |
| 245 | 245 | /// deserializing input and serializing output. |
| 246 | // FIXME(eddyb) maybe replace `Bridge::enter` with this? | |
| 247 | fn run_client<A: for<'a, 's> Decode<'a, 's, ()>, R: Encode<()>>( | |
| 246 | fn run_client<A: for<'a, 's> Decode<'a, 's, ()>>( | |
| 248 | 247 | config: BridgeConfig<'_>, |
| 249 | f: impl FnOnce(A) -> R, | |
| 248 | f: impl FnOnce(A) -> crate::TokenStream, | |
| 250 | 249 | ) -> Buffer { |
| 251 | 250 | let BridgeConfig { input: mut buf, dispatch, force_show_panics, .. } = config; |
| 252 | 251 | |
| 253 | panic::catch_unwind(panic::AssertUnwindSafe(|| { | |
| 252 | let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { | |
| 254 | 253 | maybe_install_panic_hook(force_show_panics); |
| 255 | 254 | |
| 256 | 255 | // Make sure the symbol store is empty before decoding inputs. |
| ... | ... | @@ -267,23 +266,12 @@ fn run_client<A: for<'a, 's> Decode<'a, 's, ()>, R: Encode<()>>( |
| 267 | 266 | // Take the `cached_buffer` back out, for the output value. |
| 268 | 267 | buf = RefCell::into_inner(state).cached_buffer; |
| 269 | 268 | |
| 270 | // HACK(eddyb) Separate encoding a success value (`Ok(output)`) | |
| 271 | // from encoding a panic (`Err(e: PanicMessage)`) to avoid | |
| 272 | // having handles outside the `bridge.enter(|| ...)` scope, and | |
| 273 | // to catch panics that could happen while encoding the success. | |
| 274 | // | |
| 275 | // Note that panics should be impossible beyond this point, but | |
| 276 | // this is defensively trying to avoid any accidental panicking | |
| 277 | // reaching the `extern "C"` (which should `abort` but might not | |
| 278 | // at the moment, so this is also potentially preventing UB). | |
| 279 | buf.clear(); | |
| 280 | Ok::<_, ()>(output).encode(&mut buf, &mut ()); | |
| 281 | })) | |
| 282 | .map_err(PanicMessage::from) | |
| 283 | .unwrap_or_else(|e| { | |
| 284 | buf.clear(); | |
| 285 | Err::<(), _>(e).encode(&mut buf, &mut ()); | |
| 286 | }); | |
| 269 | output | |
| 270 | })); | |
| 271 | ||
| 272 | // Serialize response of type `Result<R, PanicMessage>`. | |
| 273 | buf.clear(); | |
| 274 | res.map_err(PanicMessage::from).encode(&mut buf, &mut ()); | |
| 287 | 275 | |
| 288 | 276 | // Now that a response has been serialized, invalidate all symbols |
| 289 | 277 | // registered with the interner. |
| ... | ... | @@ -294,9 +282,8 @@ fn run_client<A: for<'a, 's> Decode<'a, 's, ()>, R: Encode<()>>( |
| 294 | 282 | impl Client<crate::TokenStream, crate::TokenStream> { |
| 295 | 283 | pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy) -> Self { |
| 296 | 284 | Client { |
| 297 | handle_counters: &COUNTERS, | |
| 298 | 285 | run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| { |
| 299 | run_client(bridge, |input| f(crate::TokenStream(Some(input))).0) | |
| 286 | run_client(bridge, |input| f(input)) | |
| 300 | 287 | }), |
| 301 | 288 | _marker: PhantomData, |
| 302 | 289 | } |
| ... | ... | @@ -308,11 +295,8 @@ impl Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> { |
| 308 | 295 | f: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy, |
| 309 | 296 | ) -> Self { |
| 310 | 297 | Client { |
| 311 | handle_counters: &COUNTERS, | |
| 312 | 298 | run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| { |
| 313 | run_client(bridge, |(input, input2)| { | |
| 314 | f(crate::TokenStream(Some(input)), crate::TokenStream(Some(input2))).0 | |
| 315 | }) | |
| 299 | run_client(bridge, |(input, input2)| f(input, input2)) | |
| 316 | 300 | }), |
| 317 | 301 | _marker: PhantomData, |
| 318 | 302 | } |
library/proc_macro/src/bridge/rpc.rs+15-5| ... | ... | @@ -15,20 +15,30 @@ pub(super) trait Decode<'a, 's, S>: Sized { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | macro_rules! rpc_encode_decode { |
| 18 | (le $ty:ty) => { | |
| 18 | (le $ty:ident $size:literal) => { | |
| 19 | 19 | impl<S> Encode<S> for $ty { |
| 20 | 20 | fn encode(self, w: &mut Buffer, _: &mut S) { |
| 21 | w.extend_from_array(&self.to_le_bytes()); | |
| 21 | const N: usize = size_of::<$ty>(); | |
| 22 | ||
| 23 | // We can pad with zeros without changing the value because of | |
| 24 | // little endian encoding. | |
| 25 | let mut bytes = [0; $size]; | |
| 26 | bytes[..N].copy_from_slice(&self.to_le_bytes()); | |
| 27 | ||
| 28 | w.extend_from_array(&bytes); | |
| 22 | 29 | } |
| 23 | 30 | } |
| 24 | 31 | |
| 25 | 32 | impl<S> Decode<'_, '_, S> for $ty { |
| 26 | 33 | fn decode(r: &mut &[u8], _: &mut S) -> Self { |
| 27 | 34 | const N: usize = size_of::<$ty>(); |
| 35 | const { | |
| 36 | assert!(N <= $size); | |
| 37 | } | |
| 28 | 38 | |
| 29 | 39 | let mut bytes = [0; N]; |
| 30 | 40 | bytes.copy_from_slice(&r[..N]); |
| 31 | *r = &r[N..]; | |
| 41 | *r = &r[$size..]; | |
| 32 | 42 | |
| 33 | 43 | Self::from_le_bytes(bytes) |
| 34 | 44 | } |
| ... | ... | @@ -108,8 +118,8 @@ impl<S> Decode<'_, '_, S> for u8 { |
| 108 | 118 | } |
| 109 | 119 | } |
| 110 | 120 | |
| 111 | rpc_encode_decode!(le u32); | |
| 112 | rpc_encode_decode!(le usize); | |
| 121 | rpc_encode_decode!(le u32 4); | |
| 122 | rpc_encode_decode!(le usize 8); | |
| 113 | 123 | |
| 114 | 124 | impl<S> Encode<S> for bool { |
| 115 | 125 | fn encode(self, w: &mut Buffer, s: &mut S) { |
library/proc_macro/src/bridge/server.rs+12-17| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //! Server-side traits. |
| 2 | 2 | |
| 3 | 3 | use std::cell::Cell; |
| 4 | use std::sync::atomic::AtomicU32; | |
| 4 | 5 | use std::sync::mpsc; |
| 5 | 6 | |
| 6 | 7 | use super::*; |
| ... | ... | @@ -11,10 +12,13 @@ pub(super) struct HandleStore<S: Server> { |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | impl<S: Server> HandleStore<S> { |
| 14 | fn new(handle_counters: &'static client::HandleCounters) -> Self { | |
| 15 | fn new() -> Self { | |
| 16 | static TOKEN_STREAM: AtomicU32 = AtomicU32::new(1); | |
| 17 | static SPAN: AtomicU32 = AtomicU32::new(1); | |
| 18 | ||
| 15 | 19 | HandleStore { |
| 16 | token_stream: handle::OwnedStore::new(&handle_counters.token_stream), | |
| 17 | span: handle::InternedStore::new(&handle_counters.span), | |
| 20 | token_stream: handle::OwnedStore::new(&TOKEN_STREAM), | |
| 21 | span: handle::InternedStore::new(&SPAN), | |
| 18 | 22 | } |
| 19 | 23 | } |
| 20 | 24 | } |
| ... | ... | @@ -246,13 +250,12 @@ fn run_server< |
| 246 | 250 | O: for<'a, 's> Decode<'a, 's, HandleStore<S>>, |
| 247 | 251 | >( |
| 248 | 252 | strategy: &impl ExecutionStrategy, |
| 249 | handle_counters: &'static client::HandleCounters, | |
| 250 | 253 | server: S, |
| 251 | 254 | input: I, |
| 252 | 255 | run_client: extern "C" fn(BridgeConfig<'_>) -> Buffer, |
| 253 | 256 | force_show_panics: bool, |
| 254 | 257 | ) -> Result<O, PanicMessage> { |
| 255 | let mut dispatcher = Dispatcher { handle_store: HandleStore::new(handle_counters), server }; | |
| 258 | let mut dispatcher = Dispatcher { handle_store: HandleStore::new(), server }; | |
| 256 | 259 | |
| 257 | 260 | let globals = dispatcher.server.globals(); |
| 258 | 261 | |
| ... | ... | @@ -276,16 +279,9 @@ impl client::Client<crate::TokenStream, crate::TokenStream> { |
| 276 | 279 | where |
| 277 | 280 | S: Server, |
| 278 | 281 | { |
| 279 | let client::Client { handle_counters, run, _marker } = *self; | |
| 280 | run_server( | |
| 281 | strategy, | |
| 282 | handle_counters, | |
| 283 | server, | |
| 284 | <MarkedTokenStream<S>>::mark(input), | |
| 285 | run, | |
| 286 | force_show_panics, | |
| 287 | ) | |
| 288 | .map(|s| <Option<MarkedTokenStream<S>>>::unmark(s).unwrap_or_default()) | |
| 282 | let client::Client { run, _marker } = *self; | |
| 283 | run_server(strategy, server, <MarkedTokenStream<S>>::mark(input), run, force_show_panics) | |
| 284 | .map(|s| <Option<MarkedTokenStream<S>>>::unmark(s).unwrap_or_default()) | |
| 289 | 285 | } |
| 290 | 286 | } |
| 291 | 287 | |
| ... | ... | @@ -301,10 +297,9 @@ impl client::Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream |
| 301 | 297 | where |
| 302 | 298 | S: Server, |
| 303 | 299 | { |
| 304 | let client::Client { handle_counters, run, _marker } = *self; | |
| 300 | let client::Client { run, _marker } = *self; | |
| 305 | 301 | run_server( |
| 306 | 302 | strategy, |
| 307 | handle_counters, | |
| 308 | 303 | server, |
| 309 | 304 | (<MarkedTokenStream<S>>::mark(input), <MarkedTokenStream<S>>::mark(input2)), |
| 310 | 305 | run, |
library/std/src/path.rs+1-2| ... | ... | @@ -2854,7 +2854,6 @@ impl Path { |
| 2854 | 2854 | /// # Examples |
| 2855 | 2855 | /// |
| 2856 | 2856 | /// ``` |
| 2857 | /// #![feature(path_is_empty)] | |
| 2858 | 2857 | /// use std::path::Path; |
| 2859 | 2858 | /// |
| 2860 | 2859 | /// let path = Path::new(""); |
| ... | ... | @@ -2866,7 +2865,7 @@ impl Path { |
| 2866 | 2865 | /// let path = Path::new("."); |
| 2867 | 2866 | /// assert!(!path.is_empty()); |
| 2868 | 2867 | /// ``` |
| 2869 | #[unstable(feature = "path_is_empty", issue = "148494")] | |
| 2868 | #[stable(feature = "path_is_empty", since = "CURRENT_RUSTC_VERSION")] | |
| 2870 | 2869 | pub fn is_empty(&self) -> bool { |
| 2871 | 2870 | self.as_os_str().is_empty() |
| 2872 | 2871 | } |
library/std_detect/src/detect/arch/x86.rs+3| ... | ... | @@ -106,6 +106,7 @@ features! { |
| 106 | 106 | /// * `"xsaves"` |
| 107 | 107 | /// * `"xsavec"` |
| 108 | 108 | /// * `"cmpxchg16b"` |
| 109 | /// * `"clflushopt"` | |
| 109 | 110 | /// * `"kl"` |
| 110 | 111 | /// * `"widekl"` |
| 111 | 112 | /// * `"adx"` |
| ... | ... | @@ -261,6 +262,8 @@ features! { |
| 261 | 262 | /// XSAVEC (Save Processor Extended States Compacted) |
| 262 | 263 | @FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] cmpxchg16b: "cmpxchg16b"; |
| 263 | 264 | /// CMPXCH16B (16-byte compare-and-swap instruction) |
| 265 | @FEATURE: #[unstable(feature = "clflushopt_target_feature", issue = "157096")] clflushopt: "clflushopt"; | |
| 266 | /// CLFLUSHOPT (Cache Line Flush Optimized) | |
| 264 | 267 | @FEATURE: #[stable(feature = "keylocker_x86", since = "1.89.0")] kl: "kl"; |
| 265 | 268 | /// Intel Key Locker |
| 266 | 269 | @FEATURE: #[stable(feature = "keylocker_x86", since = "1.89.0")] widekl: "widekl"; |
library/std_detect/src/detect/os/x86.rs+2| ... | ... | @@ -127,6 +127,8 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 127 | 127 | |
| 128 | 128 | enable(extended_features_ebx, 9, Feature::ermsb); |
| 129 | 129 | |
| 130 | enable(extended_features_ebx, 23, Feature::clflushopt); | |
| 131 | ||
| 130 | 132 | enable(extended_features_eax_leaf_1, 31, Feature::movrs); |
| 131 | 133 | |
| 132 | 134 | // Detect if CPUID.19h available |
library/std_detect/tests/x86-specific.rs+8-1| ... | ... | @@ -1,6 +1,12 @@ |
| 1 | 1 | #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 2 | 2 | #![allow(internal_features)] |
| 3 | #![feature(stdarch_internal, x86_amx_intrinsics, xop_target_feature, movrs_target_feature)] | |
| 3 | #![feature( | |
| 4 | stdarch_internal, | |
| 5 | x86_amx_intrinsics, | |
| 6 | xop_target_feature, | |
| 7 | movrs_target_feature, | |
| 8 | clflushopt_target_feature | |
| 9 | )] | |
| 4 | 10 | |
| 5 | 11 | #[macro_use] |
| 6 | 12 | extern crate std_detect; |
| ... | ... | @@ -58,6 +64,7 @@ fn dump() { |
| 58 | 64 | println!("xsaves: {:?}", is_x86_feature_detected!("xsaves")); |
| 59 | 65 | println!("xsavec: {:?}", is_x86_feature_detected!("xsavec")); |
| 60 | 66 | println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b")); |
| 67 | println!("clflushopt: {:?}", is_x86_feature_detected!("clflushopt")); | |
| 61 | 68 | println!("adx: {:?}", is_x86_feature_detected!("adx")); |
| 62 | 69 | println!("rtm: {:?}", is_x86_feature_detected!("rtm")); |
| 63 | 70 | println!("movbe: {:?}", is_x86_feature_detected!("movbe")); |
src/doc/rustc/src/platform-support/x86_64-unknown-linux-none.md+1-1| ... | ... | @@ -6,7 +6,7 @@ Freestanding x86-64 linux binary with no dependency on libc. |
| 6 | 6 | |
| 7 | 7 | ## Target maintainers |
| 8 | 8 | |
| 9 | [@morr0ne](https://github.com/morr0ne) | |
| 9 | [@rosymati](https://github.com/rosymati) | |
| 10 | 10 | |
| 11 | 11 | ## Requirements |
| 12 | 12 |
src/doc/unstable-book/src/compiler-flags/codegen-options.md-2| ... | ... | @@ -7,8 +7,6 @@ unstable-options` to be accepted. |
| 7 | 7 | ## linker-flavor |
| 8 | 8 | |
| 9 | 9 | In addition to the stable set of linker flavors, the following unstable values also exist: |
| 10 | - `ptx`: use [`rust-ptx-linker`](https://github.com/denzp/rust-ptx-linker) | |
| 11 | for Nvidia NVPTX GPGPU support. | |
| 12 | 10 | - `bpf`: use [`bpf-linker`](https://github.com/alessandrod/bpf-linker) for eBPF support. |
| 13 | 11 | - `llbc`: for linking in llvm bitcode. Install the preview rustup components`llvm-bitcode-linker` |
| 14 | 12 | and `llvm-tools` to use as a self-contained linker by passing |
src/tools/compiletest/src/runtest/assembly.rs+1-2| ... | ... | @@ -23,7 +23,7 @@ impl TestCx<'_> { |
| 23 | 23 | |
| 24 | 24 | fn compile_test_and_save_assembly(&self) -> (ProcRes, Utf8PathBuf) { |
| 25 | 25 | // This works with both `--emit asm` (as default output name for the assembly) |
| 26 | // and `ptx-linker` because the latter can write output at requested location. | |
| 26 | // and `llvm-bitcode-linker` because the latter can write output at requested location. | |
| 27 | 27 | let output_path = self.output_base_name().with_extension("s"); |
| 28 | 28 | let input_file = &self.testpaths.file; |
| 29 | 29 | |
| ... | ... | @@ -31,7 +31,6 @@ impl TestCx<'_> { |
| 31 | 31 | let emit = match self.props.assembly_output.as_deref() { |
| 32 | 32 | Some("emit-asm") => Emit::Asm, |
| 33 | 33 | Some("bpf-linker") => Emit::LinkArgsAsm, |
| 34 | Some("ptx-linker") => Emit::None, // No extra flags needed. | |
| 35 | 34 | Some(other) => self.fatal(&format!("unknown 'assembly-output' directive: {other}")), |
| 36 | 35 | None => self.fatal("missing 'assembly-output' directive"), |
| 37 | 36 | }; |
tests/assembly-llvm/nvptx-arch-default.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 | |
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | //@ aux-build: breakpoint-panic-handler.rs |
| 8 | 8 | extern crate breakpoint_panic_handler; |
| 9 | 9 | |
| 10 | // Verify default target arch with ptx-linker. | |
| 10 | // Verify default arch with llvm-bitcode-linker. | |
| 11 | 11 | // CHECK: .version 7.0 |
| 12 | 12 | // CHECK: .target sm_70 |
| 13 | 13 | // CHECK: .address_size 64 |
tests/assembly-llvm/nvptx-arch-emit-asm.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | #![no_std] |
| 6 | 6 | |
| 7 | // Verify default arch without ptx-linker involved. | |
| 7 | // Verify default arch without llvm-bitcode-linker involved. | |
| 8 | 8 | // CHECK: .version 7.0 |
| 9 | 9 | // CHECK: .target sm_70 |
| 10 | 10 | // CHECK: .address_size 64 |
tests/assembly-llvm/nvptx-arch-link-arg.rs deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 2 | //@ compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60 | |
| 3 | //@ only-nvptx64 | |
| 4 | //@ ignore-nvptx64 | |
| 5 | ||
| 6 | #![no_std] | |
| 7 | ||
| 8 | //@ aux-build: breakpoint-panic-handler.rs | |
| 9 | extern crate breakpoint_panic_handler; | |
| 10 | ||
| 11 | // Verify target arch override via `link-arg`. | |
| 12 | // CHECK: .target sm_60 | |
| 13 | // CHECK: .address_size 64 |
tests/assembly-llvm/nvptx-arch-target-cpu.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_87 |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 |
tests/assembly-llvm/nvptx-atomics.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 | //@ ignore-nvptx64 |
tests/assembly-llvm/nvptx-c-abi-arg-v7.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 |
tests/assembly-llvm/nvptx-c-abi-ret-v7.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 |
tests/assembly-llvm/nvptx-internalizing.rs+1-2| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | //@ ignore-nvptx64 | |
| 5 | 4 | |
| 6 | 5 | #![feature(abi_ptx)] |
| 7 | 6 | #![no_std] |
tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 |
tests/assembly-llvm/nvptx-linking-binary.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type bin |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 | //@ ignore-nvptx64 |
tests/assembly-llvm/nvptx-linking-cdylib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 | //@ ignore-nvptx64 |
tests/assembly-llvm/nvptx-safe-naming.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 |
tests/codegen-llvm/gpu_offload/control_flow.rs+2-1| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | // CHECK-NOT define |
| 20 | 20 | // CHECK: bb3 |
| 21 | 21 | // CHECK: call void @__tgt_target_data_begin_mapper(ptr nonnull @anon.{{.*}}.1, i64 -1, i32 1, ptr nonnull %.offload_baseptrs, ptr nonnull %.offload_ptrs, ptr nonnull @.offload_sizes.foo, ptr nonnull @.offload_maptypes.foo.begin, ptr null, ptr null) |
| 22 | // CHECK: %10 = call i32 @__tgt_target_kernel(ptr nonnull @anon.{{.*}}.1, i64 -1, i32 256, i32 32, ptr nonnull @.foo.region_id, ptr nonnull %kernel_args) | |
| 22 | // CHECK: = call i32 @__tgt_target_kernel(ptr nonnull @anon.{{.*}}.1, i64 -1, i32 256, i32 32, ptr nonnull @.foo.region_id, ptr nonnull %kernel_args) | |
| 23 | 23 | // CHECK-NEXT: call void @__tgt_target_data_end_mapper(ptr nonnull @anon.{{.*}}.1, i64 -1, i32 1, ptr nonnull %.offload_baseptrs, ptr nonnull %.offload_ptrs, ptr nonnull @.offload_sizes.foo, ptr nonnull @.offload_maptypes.foo.end, ptr null, ptr null) |
| 24 | 24 | #[unsafe(no_mangle)] |
| 25 | 25 | unsafe fn main() { |
| ... | ... | @@ -30,6 +30,7 @@ unsafe fn main() { |
| 30 | 30 | foo, |
| 31 | 31 | [256, 1, 1], |
| 32 | 32 | [32, 1, 1], |
| 33 | 0, | |
| 33 | 34 | (A.as_ptr() as *const [f32; 6],), |
| 34 | 35 | ); |
| 35 | 36 | } |
tests/codegen-llvm/gpu_offload/gpu_host.rs+5-5| ... | ... | @@ -21,7 +21,7 @@ fn main() { |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | pub fn kernel_1(x: &mut [f32; 256], y: &[f32; 256]) { |
| 24 | core::intrinsics::offload(_kernel_1, [256, 1, 1], [32, 1, 1], (x, y)) | |
| 24 | core::intrinsics::offload(_kernel_1, [256, 1, 1], [32, 1, 1], 0, (x, y)) | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | #[inline(never)] |
| ... | ... | @@ -52,8 +52,8 @@ pub fn _kernel_1(x: &mut [f32; 256], y: &[f32; 256]) { |
| 52 | 52 | |
| 53 | 53 | // CHECK-LABEL: define{{( dso_local)?}} void @main() |
| 54 | 54 | // CHECK-NEXT: start: |
| 55 | // CHECK-NEXT: %0 = alloca [8 x i8], align 8 | |
| 56 | // CHECK-NEXT: %1 = alloca [8 x i8], align 8 | |
| 55 | // CHECK-NEXT: {{%[^ ]+}} = alloca [8 x i8], align 8 | |
| 56 | // CHECK-NEXT: {{%[^ ]+}} = alloca [8 x i8], align 8 | |
| 57 | 57 | // CHECK-NEXT: %y = alloca [1024 x i8], align 16 |
| 58 | 58 | // CHECK-NEXT: %x = alloca [1024 x i8], align 16 |
| 59 | 59 | // CHECK-NEXT: %.offload_baseptrs = alloca [2 x ptr], align 8 |
| ... | ... | @@ -61,9 +61,9 @@ pub fn _kernel_1(x: &mut [f32; 256], y: &[f32; 256]) { |
| 61 | 61 | // CHECK-NEXT: %kernel_args = alloca %struct.__tgt_kernel_arguments, align 8 |
| 62 | 62 | // CHECK: store ptr %x, ptr %.offload_baseptrs, align 8 |
| 63 | 63 | // CHECK-NEXT: store ptr %x, ptr %.offload_ptrs, align 8 |
| 64 | // CHECK-NEXT: [[BPTRS_1:%.*]] = getelementptr inbounds nuw i8, ptr %.offload_baseptrs, i64 8 | |
| 64 | // CHECK-NEXT: [[BPTRS_1:%[^ ]+]] = getelementptr inbounds nuw i8, ptr %.offload_baseptrs, i64 8 | |
| 65 | 65 | // CHECK-NEXT: store ptr %y, ptr [[BPTRS_1]], align 8 |
| 66 | // CHECK-NEXT: [[PTRS_1:%.*]] = getelementptr inbounds nuw i8, ptr %.offload_ptrs, i64 8 | |
| 66 | // CHECK-NEXT: [[PTRS_1:%[^ ]+]] = getelementptr inbounds nuw i8, ptr %.offload_ptrs, i64 8 | |
| 67 | 67 | // CHECK-NEXT: store ptr %y, ptr [[PTRS_1]], align 8 |
| 68 | 68 | // CHECK-NEXT: call void @__tgt_target_data_begin_mapper(ptr nonnull @anon.{{.*}}.1, i64 -1, i32 2, ptr nonnull %.offload_baseptrs, ptr nonnull %.offload_ptrs, ptr nonnull @.offload_sizes.[[K]], ptr nonnull @.offload_maptypes.[[K]].begin, ptr null, ptr null) |
| 69 | 69 | // CHECK-NEXT: store i32 3, ptr %kernel_args, align 8 |
tests/codegen-llvm/gpu_offload/scalar_host.rs+5-5| ... | ... | @@ -13,11 +13,11 @@ |
| 13 | 13 | // CHECK: define{{( dso_local)?}} void @main() |
| 14 | 14 | // CHECK-NOT: define |
| 15 | 15 | // CHECK: %addr = alloca i64, align 8 |
| 16 | // CHECK: store double 4.200000e+01, ptr %0, align 8 | |
| 17 | // CHECK: %_0.i = load double, ptr %0, align 8 | |
| 18 | // CHECK: store double %_0.i, ptr %addr, align 8 | |
| 16 | // CHECK: store double 4.200000e+01, ptr [[TMP:%[^,]+]], align 8 | |
| 17 | // CHECK: [[VAL:%[0-9]+]] = load double, ptr [[TMP]], align 8 | |
| 18 | // CHECK: store double [[VAL]], ptr %addr, align 8 | |
| 19 | 19 | // CHECK: %1 = getelementptr inbounds nuw i8, ptr %.offload_baseptrs, i64 8 |
| 20 | // CHECK-NEXT: store double %_0.i, ptr %1, align 8 | |
| 20 | // CHECK-NEXT: store double [[VAL]], ptr %1, align 8 | |
| 21 | 21 | // CHECK-NEXT: %2 = getelementptr inbounds nuw i8, ptr %.offload_ptrs, i64 8 |
| 22 | 22 | // CHECK-NEXT: store ptr %addr, ptr %2, align 8 |
| 23 | 23 | // CHECK-NEXT: call void @__tgt_target_data_begin_mapper |
| ... | ... | @@ -27,7 +27,7 @@ fn main() { |
| 27 | 27 | let mut x = 0.0; |
| 28 | 28 | let k = core::hint::black_box(42.0); |
| 29 | 29 | |
| 30 | core::intrinsics::offload::<_, _, ()>(foo, [1, 1, 1], [1, 1, 1], (&mut x, k)); | |
| 30 | core::intrinsics::offload::<_, _, ()>(foo, [1, 1, 1], [1, 1, 1], 0, (&mut x, k)); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | unsafe extern "C" { |
tests/codegen-llvm/gpu_offload/slice_host.rs+2-2| ... | ... | @@ -21,13 +21,13 @@ |
| 21 | 21 | // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}} %.offload_sizes, ptr {{.*}} @.offload_sizes.foo, i64 16, i1 false) |
| 22 | 22 | // CHECK: store i64 16, ptr %.offload_sizes, align 8 |
| 23 | 23 | // CHECK: call void @__tgt_target_data_begin_mapper(ptr nonnull @anon.[[ID]].1, i64 -1, i32 2, ptr nonnull %.offload_baseptrs, ptr nonnull %.offload_ptrs, ptr nonnull %.offload_sizes, ptr nonnull @.offload_maptypes.[[K]].begin, ptr null, ptr null) |
| 24 | // CHECK: %11 = call i32 @__tgt_target_kernel(ptr nonnull @anon.[[ID]].1, i64 -1, i32 1, i32 1, ptr nonnull @.foo.region_id, ptr nonnull %kernel_args) | |
| 24 | // CHECK: call i32 @__tgt_target_kernel(ptr nonnull @anon.[[ID]].1, i64 -1, i32 1, i32 1, ptr nonnull @.foo.region_id, ptr nonnull %kernel_args) | |
| 25 | 25 | // CHECK-NEXT: call void @__tgt_target_data_end_mapper(ptr nonnull @anon.[[ID]].1, i64 -1, i32 2, ptr nonnull %.offload_baseptrs, ptr nonnull %.offload_ptrs, ptr nonnull %.offload_sizes, ptr nonnull @.offload_maptypes.[[K]].end, ptr null, ptr null) |
| 26 | 26 | |
| 27 | 27 | #[unsafe(no_mangle)] |
| 28 | 28 | fn main() { |
| 29 | 29 | let mut x = [0.0, 0.0, 0.0, 0.0]; |
| 30 | core::intrinsics::offload::<_, _, ()>(foo, [1, 1, 1], [1, 1, 1], ((&mut x) as &mut [f64],)); | |
| 30 | core::intrinsics::offload::<_, _, ()>(foo, [1, 1, 1], [1, 1, 1], 0, ((&mut x) as &mut [f64],)); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | unsafe extern "C" { |
tests/ui/check-cfg/target_feature.stderr+1| ... | ... | @@ -65,6 +65,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); |
| 65 | 65 | `bulk-memory` |
| 66 | 66 | `c` |
| 67 | 67 | `cache` |
| 68 | `clflushopt` | |
| 68 | 69 | `cmpxchg16b` |
| 69 | 70 | `concurrent-functions` |
| 70 | 71 | `crc` |
tests/ui/closures/2229_closure_analysis/diagnostics/liveness.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ edition:2021 |
| 2 | ||
| 3 | 2 | //@ check-pass |
| 3 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 4 | 4 | #![allow(unreachable_code)] |
| 5 | 5 | #![warn(unused)] |
| 6 | 6 | #![allow(dead_code)] |
tests/ui/deprecation/deprecation-sanity.rs+3| ... | ... | @@ -23,6 +23,9 @@ mod bogus_attribute_types_1 { |
| 23 | 23 | |
| 24 | 24 | #[deprecated("test")] //~ ERROR malformed `deprecated` attribute input [E0565] |
| 25 | 25 | fn f8() { } |
| 26 | ||
| 27 | #[deprecated("1.2.3")] //~ ERROR malformed `deprecated` attribute input [E0565] | |
| 28 | fn f9() { } | |
| 26 | 29 | } |
| 27 | 30 | |
| 28 | 31 | #[deprecated(since = "a", note = "b")] |
tests/ui/deprecation/deprecation-sanity.stderr+24-5| ... | ... | @@ -55,21 +55,40 @@ LL | #[deprecated("test")] |
| 55 | 55 | | ^^^^^^^^^^^^^------^^ |
| 56 | 56 | | | |
| 57 | 57 | | didn't expect a literal here |
| 58 | | | |
| 59 | help: try using `=` instead | |
| 60 | | | |
| 61 | LL - #[deprecated("test")] | |
| 62 | LL + #[deprecated = "test"] | |
| 63 | | | |
| 64 | ||
| 65 | error[E0565]: malformed `deprecated` attribute input | |
| 66 | --> $DIR/deprecation-sanity.rs:27:5 | |
| 67 | | | |
| 68 | LL | #[deprecated("1.2.3")] | |
| 69 | | ^^^^^^^^^^^^^-------^^ | |
| 70 | | | | |
| 71 | | didn't expect a literal here | |
| 72 | | | |
| 73 | help: try specifying a deprecated since version | |
| 74 | | | |
| 75 | LL | #[deprecated(since = "1.2.3")] | |
| 76 | | +++++++ | |
| 58 | 77 | |
| 59 | 78 | error: multiple `deprecated` attributes |
| 60 | --> $DIR/deprecation-sanity.rs:29:1 | |
| 79 | --> $DIR/deprecation-sanity.rs:32:1 | |
| 61 | 80 | | |
| 62 | 81 | LL | #[deprecated(since = "a", note = "b")] |
| 63 | 82 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute |
| 64 | 83 | | |
| 65 | 84 | note: attribute also specified here |
| 66 | --> $DIR/deprecation-sanity.rs:28:1 | |
| 85 | --> $DIR/deprecation-sanity.rs:31:1 | |
| 67 | 86 | | |
| 68 | 87 | LL | #[deprecated(since = "a", note = "b")] |
| 69 | 88 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 70 | 89 | |
| 71 | 90 | error[E0538]: malformed `deprecated` attribute input |
| 72 | --> $DIR/deprecation-sanity.rs:32:1 | |
| 91 | --> $DIR/deprecation-sanity.rs:35:1 | |
| 73 | 92 | | |
| 74 | 93 | LL | #[deprecated(since = "a", since = "b", note = "c")] |
| 75 | 94 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^ |
| ... | ... | @@ -77,7 +96,7 @@ LL | #[deprecated(since = "a", since = "b", note = "c")] |
| 77 | 96 | | found `since` used as a key more than once |
| 78 | 97 | |
| 79 | 98 | error: `#[deprecated]` attribute cannot be used on trait impl blocks |
| 80 | --> $DIR/deprecation-sanity.rs:37:1 | |
| 99 | --> $DIR/deprecation-sanity.rs:40:1 | |
| 81 | 100 | | |
| 82 | 101 | LL | #[deprecated = "hello"] |
| 83 | 102 | | ^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -86,7 +105,7 @@ LL | #[deprecated = "hello"] |
| 86 | 105 | = help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements |
| 87 | 106 | = note: `#[deny(useless_deprecated)]` on by default |
| 88 | 107 | |
| 89 | error: aborting due to 10 previous errors | |
| 108 | error: aborting due to 11 previous errors | |
| 90 | 109 | |
| 91 | 110 | Some errors have detailed explanations: E0538, E0539, E0565. |
| 92 | 111 | For more information about an error, try `rustc --explain E0538`. |
tests/ui/error-codes/E0565-1.stderr+6| ... | ... | @@ -5,6 +5,12 @@ LL | #[deprecated("since")] |
| 5 | 5 | | ^^^^^^^^^^^^^-------^^ |
| 6 | 6 | | | |
| 7 | 7 | | didn't expect a literal here |
| 8 | | | |
| 9 | help: try using `=` instead | |
| 10 | | | |
| 11 | LL - #[deprecated("since")] | |
| 12 | LL + #[deprecated = "since"] | |
| 13 | | | |
| 8 | 14 | |
| 9 | 15 | error: aborting due to 1 previous error |
| 10 | 16 |
tests/ui/feature-gates/feature-gate-clflushopt_target_feature.rs created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | //@ only-x86_64 | |
| 2 | #[target_feature(enable = "clflushopt")] | |
| 3 | //~^ ERROR: currently unstable | |
| 4 | unsafe fn foo() {} | |
| 5 | ||
| 6 | fn main() {} |
tests/ui/feature-gates/feature-gate-clflushopt_target_feature.stderr created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | error[E0658]: the target feature `clflushopt` is currently unstable | |
| 2 | --> $DIR/feature-gate-clflushopt_target_feature.rs:2:18 | |
| 3 | | | |
| 4 | LL | #[target_feature(enable = "clflushopt")] | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: see issue #157096 <https://github.com/rust-lang/rust/issues/157096> for more information | |
| 8 | = help: add `#![feature(clflushopt_target_feature)]` to the crate attributes to enable | |
| 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 10 | ||
| 11 | error: aborting due to 1 previous error | |
| 12 | ||
| 13 | For more information about this error, try `rustc --explain E0658`. |
tests/ui/imports/ambiguous-1.rs+1-5| ... | ... | @@ -1,8 +1,5 @@ |
| 1 | //@ check-pass | |
| 2 | 1 | // https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883 |
| 3 | 2 | |
| 4 | #![warn(ambiguous_glob_imports)] | |
| 5 | ||
| 6 | 3 | macro_rules! m { |
| 7 | 4 | () => { |
| 8 | 5 | pub fn id() {} |
| ... | ... | @@ -27,6 +24,5 @@ pub use openssl::*; |
| 27 | 24 | |
| 28 | 25 | fn main() { |
| 29 | 26 | id(); |
| 30 | //~^ WARNING `id` is ambiguous | |
| 31 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 27 | //~^ ERROR `id` is ambiguous | |
| 32 | 28 | } |
tests/ui/imports/ambiguous-1.stderr+13-47| ... | ... | @@ -1,68 +1,34 @@ |
| 1 | warning: ambiguous glob re-exports | |
| 2 | --> $DIR/ambiguous-1.rs:13:13 | |
| 3 | | | |
| 4 | LL | pub use self::evp::*; | |
| 5 | | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 6 | LL | | |
| 7 | LL | pub use self::handwritten::*; | |
| 8 | | -------------------- but the name `id` in the value namespace is also re-exported here | |
| 9 | | | |
| 10 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 11 | ||
| 12 | warning: `id` is ambiguous | |
| 13 | --> $DIR/ambiguous-1.rs:29:5 | |
| 1 | error[E0659]: `id` is ambiguous | |
| 2 | --> $DIR/ambiguous-1.rs:26:5 | |
| 14 | 3 | | |
| 15 | 4 | LL | id(); |
| 16 | 5 | | ^^ ambiguous name |
| 17 | 6 | | |
| 18 | 7 | = note: ambiguous because of multiple glob imports of a name in the same module |
| 19 | 8 | note: `id` could refer to the function imported here |
| 20 | --> $DIR/ambiguous-1.rs:13:13 | |
| 9 | --> $DIR/ambiguous-1.rs:10:13 | |
| 21 | 10 | | |
| 22 | 11 | LL | pub use self::evp::*; |
| 23 | 12 | | ^^^^^^^^^^^^ |
| 24 | 13 | = help: consider adding an explicit import of `id` to disambiguate |
| 25 | 14 | note: `id` could also refer to the function imported here |
| 26 | --> $DIR/ambiguous-1.rs:15:13 | |
| 15 | --> $DIR/ambiguous-1.rs:12:13 | |
| 27 | 16 | | |
| 28 | 17 | LL | pub use self::handwritten::*; |
| 29 | 18 | | ^^^^^^^^^^^^^^^^^^^^ |
| 30 | 19 | = help: consider adding an explicit import of `id` to disambiguate |
| 31 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 32 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 33 | note: the lint level is defined here | |
| 34 | --> $DIR/ambiguous-1.rs:4:9 | |
| 35 | | | |
| 36 | LL | #![warn(ambiguous_glob_imports)] | |
| 37 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 38 | ||
| 39 | warning: 2 warnings emitted | |
| 40 | 20 | |
| 41 | Future incompatibility report: Future breakage diagnostic: | |
| 42 | warning: `id` is ambiguous | |
| 43 | --> $DIR/ambiguous-1.rs:29:5 | |
| 44 | | | |
| 45 | LL | id(); | |
| 46 | | ^^ ambiguous name | |
| 47 | | | |
| 48 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 49 | note: `id` could refer to the function imported here | |
| 50 | --> $DIR/ambiguous-1.rs:13:13 | |
| 21 | warning: ambiguous glob re-exports | |
| 22 | --> $DIR/ambiguous-1.rs:10:13 | |
| 51 | 23 | | |
| 52 | 24 | LL | pub use self::evp::*; |
| 53 | | ^^^^^^^^^^^^ | |
| 54 | = help: consider adding an explicit import of `id` to disambiguate | |
| 55 | note: `id` could also refer to the function imported here | |
| 56 | --> $DIR/ambiguous-1.rs:15:13 | |
| 57 | | | |
| 25 | | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 26 | LL | | |
| 58 | 27 | LL | pub use self::handwritten::*; |
| 59 | | ^^^^^^^^^^^^^^^^^^^^ | |
| 60 | = help: consider adding an explicit import of `id` to disambiguate | |
| 61 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 62 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 63 | note: the lint level is defined here | |
| 64 | --> $DIR/ambiguous-1.rs:4:9 | |
| 28 | | -------------------- but the name `id` in the value namespace is also re-exported here | |
| 65 | 29 | | |
| 66 | LL | #![warn(ambiguous_glob_imports)] | |
| 67 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 30 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 31 | ||
| 32 | error: aborting due to 1 previous error; 1 warning emitted | |
| 68 | 33 | |
| 34 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-10.rs-1| ... | ... | @@ -14,5 +14,4 @@ use crate::a::*; |
| 14 | 14 | use crate::b::*; |
| 15 | 15 | fn c(_: Token) {} |
| 16 | 16 | //~^ ERROR `Token` is ambiguous |
| 17 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 18 | 17 | fn main() { } |
tests/ui/imports/ambiguous-10.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `Token` is ambiguous | |
| 1 | error[E0659]: `Token` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-10.rs:15:9 |
| 3 | 3 | | |
| 4 | 4 | LL | fn c(_: Token) {} |
| ... | ... | @@ -17,33 +17,7 @@ note: `Token` could also refer to the enum imported here |
| 17 | 17 | LL | use crate::b::*; |
| 18 | 18 | | ^^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `Token` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `Token` is ambiguous | |
| 28 | --> $DIR/ambiguous-10.rs:15:9 | |
| 29 | | | |
| 30 | LL | fn c(_: Token) {} | |
| 31 | | ^^^^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `Token` could refer to the enum imported here | |
| 35 | --> $DIR/ambiguous-10.rs:13:5 | |
| 36 | | | |
| 37 | LL | use crate::a::*; | |
| 38 | | ^^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `Token` to disambiguate | |
| 40 | note: `Token` could also refer to the enum imported here | |
| 41 | --> $DIR/ambiguous-10.rs:14:5 | |
| 42 | | | |
| 43 | LL | use crate::b::*; | |
| 44 | | ^^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `Token` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-12.rs-1| ... | ... | @@ -20,5 +20,4 @@ use crate::public::*; |
| 20 | 20 | fn main() { |
| 21 | 21 | b(); |
| 22 | 22 | //~^ ERROR `b` is ambiguous |
| 23 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 24 | 23 | } |
tests/ui/imports/ambiguous-12.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `b` is ambiguous | |
| 1 | error[E0659]: `b` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-12.rs:21:5 |
| 3 | 3 | | |
| 4 | 4 | LL | b(); |
| ... | ... | @@ -17,33 +17,7 @@ note: `b` could also refer to the function imported here |
| 17 | 17 | LL | use crate::public::*; |
| 18 | 18 | | ^^^^^^^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `b` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `b` is ambiguous | |
| 28 | --> $DIR/ambiguous-12.rs:21:5 | |
| 29 | | | |
| 30 | LL | b(); | |
| 31 | | ^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `b` could refer to the function imported here | |
| 35 | --> $DIR/ambiguous-12.rs:17:5 | |
| 36 | | | |
| 37 | LL | use crate::ciphertext::*; | |
| 38 | | ^^^^^^^^^^^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `b` to disambiguate | |
| 40 | note: `b` could also refer to the function imported here | |
| 41 | --> $DIR/ambiguous-12.rs:18:5 | |
| 42 | | | |
| 43 | LL | use crate::public::*; | |
| 44 | | ^^^^^^^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `b` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-13.rs-1| ... | ... | @@ -17,5 +17,4 @@ use crate::content::*; |
| 17 | 17 | |
| 18 | 18 | fn a(_: Rect) {} |
| 19 | 19 | //~^ ERROR `Rect` is ambiguous |
| 20 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | 20 | fn main() { } |
tests/ui/imports/ambiguous-13.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `Rect` is ambiguous | |
| 1 | error[E0659]: `Rect` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-13.rs:18:9 |
| 3 | 3 | | |
| 4 | 4 | LL | fn a(_: Rect) {} |
| ... | ... | @@ -17,33 +17,7 @@ note: `Rect` could also refer to the struct imported here |
| 17 | 17 | LL | use crate::content::*; |
| 18 | 18 | | ^^^^^^^^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `Rect` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `Rect` is ambiguous | |
| 28 | --> $DIR/ambiguous-13.rs:18:9 | |
| 29 | | | |
| 30 | LL | fn a(_: Rect) {} | |
| 31 | | ^^^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `Rect` could refer to the struct imported here | |
| 35 | --> $DIR/ambiguous-13.rs:15:5 | |
| 36 | | | |
| 37 | LL | use crate::object::*; | |
| 38 | | ^^^^^^^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `Rect` to disambiguate | |
| 40 | note: `Rect` could also refer to the struct imported here | |
| 41 | --> $DIR/ambiguous-13.rs:16:5 | |
| 42 | | | |
| 43 | LL | use crate::content::*; | |
| 44 | | ^^^^^^^^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `Rect` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-15.rs-1| ... | ... | @@ -21,6 +21,5 @@ mod t3 { |
| 21 | 21 | use self::t3::*; |
| 22 | 22 | fn a<E: Error>(_: E) {} |
| 23 | 23 | //~^ ERROR `Error` is ambiguous |
| 24 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 25 | 24 | |
| 26 | 25 | fn main() {} |
tests/ui/imports/ambiguous-15.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `Error` is ambiguous | |
| 1 | error[E0659]: `Error` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-15.rs:22:9 |
| 3 | 3 | | |
| 4 | 4 | LL | fn a<E: Error>(_: E) {} |
| ... | ... | @@ -17,33 +17,7 @@ note: `Error` could also refer to the enum imported here |
| 17 | 17 | LL | pub use t2::*; |
| 18 | 18 | | ^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `Error` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `Error` is ambiguous | |
| 28 | --> $DIR/ambiguous-15.rs:22:9 | |
| 29 | | | |
| 30 | LL | fn a<E: Error>(_: E) {} | |
| 31 | | ^^^^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `Error` could refer to the trait imported here | |
| 35 | --> $DIR/ambiguous-15.rs:21:5 | |
| 36 | | | |
| 37 | LL | use self::t3::*; | |
| 38 | | ^^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `Error` to disambiguate | |
| 40 | note: `Error` could also refer to the enum imported here | |
| 41 | --> $DIR/ambiguous-15.rs:15:9 | |
| 42 | | | |
| 43 | LL | pub use t2::*; | |
| 44 | | ^^^^^ | |
| 45 | = help: consider adding an explicit import of `Error` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-16.rs-1| ... | ... | @@ -21,6 +21,5 @@ mod framing { |
| 21 | 21 | |
| 22 | 22 | use crate::framing::ConfirmedTranscriptHashInput; |
| 23 | 23 | //~^ ERROR `ConfirmedTranscriptHashInput` is ambiguous |
| 24 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 25 | 24 | |
| 26 | 25 | fn main() { } |
tests/ui/imports/ambiguous-16.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `ConfirmedTranscriptHashInput` is ambiguous | |
| 1 | error[E0659]: `ConfirmedTranscriptHashInput` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-16.rs:22:21 |
| 3 | 3 | | |
| 4 | 4 | LL | use crate::framing::ConfirmedTranscriptHashInput; |
| ... | ... | @@ -17,33 +17,7 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her |
| 17 | 17 | LL | pub use self::public_message_in::*; |
| 18 | 18 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `ConfirmedTranscriptHashInput` is ambiguous | |
| 28 | --> $DIR/ambiguous-16.rs:22:21 | |
| 29 | | | |
| 30 | LL | use crate::framing::ConfirmedTranscriptHashInput; | |
| 31 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `ConfirmedTranscriptHashInput` could refer to the struct imported here | |
| 35 | --> $DIR/ambiguous-16.rs:18:13 | |
| 36 | | | |
| 37 | LL | pub use self::public_message::*; | |
| 38 | | ^^^^^^^^^^^^^^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate | |
| 40 | note: `ConfirmedTranscriptHashInput` could also refer to the struct imported here | |
| 41 | --> $DIR/ambiguous-16.rs:19:13 | |
| 42 | | | |
| 43 | LL | pub use self::public_message_in::*; | |
| 44 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-17.rs-1| ... | ... | @@ -25,5 +25,4 @@ mod handwritten { |
| 25 | 25 | fn main() { |
| 26 | 26 | id(); |
| 27 | 27 | //~^ ERROR `id` is ambiguous |
| 28 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 29 | 28 | } |
tests/ui/imports/ambiguous-17.stderr+9-35| ... | ... | @@ -1,14 +1,4 @@ |
| 1 | warning: ambiguous glob re-exports | |
| 2 | --> $DIR/ambiguous-17.rs:4:9 | |
| 3 | | | |
| 4 | LL | pub use evp::*; | |
| 5 | | ^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 6 | LL | pub use handwritten::*; | |
| 7 | | -------------- but the name `id` in the value namespace is also re-exported here | |
| 8 | | | |
| 9 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 10 | ||
| 11 | error: `id` is ambiguous | |
| 1 | error[E0659]: `id` is ambiguous | |
| 12 | 2 | --> $DIR/ambiguous-17.rs:26:5 |
| 13 | 3 | | |
| 14 | 4 | LL | id(); |
| ... | ... | @@ -27,33 +17,17 @@ note: `id` could also refer to the function imported here |
| 27 | 17 | LL | pub use handwritten::*; |
| 28 | 18 | | ^^^^^^^^^^^^^^ |
| 29 | 19 | = help: consider adding an explicit import of `id` to disambiguate |
| 30 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 31 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 32 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 33 | ||
| 34 | error: aborting due to 1 previous error; 1 warning emitted | |
| 35 | 20 | |
| 36 | Future incompatibility report: Future breakage diagnostic: | |
| 37 | error: `id` is ambiguous | |
| 38 | --> $DIR/ambiguous-17.rs:26:5 | |
| 39 | | | |
| 40 | LL | id(); | |
| 41 | | ^^ ambiguous name | |
| 42 | | | |
| 43 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 44 | note: `id` could refer to the function imported here | |
| 21 | warning: ambiguous glob re-exports | |
| 45 | 22 | --> $DIR/ambiguous-17.rs:4:9 |
| 46 | 23 | | |
| 47 | 24 | LL | pub use evp::*; |
| 48 | | ^^^^^^ | |
| 49 | = help: consider adding an explicit import of `id` to disambiguate | |
| 50 | note: `id` could also refer to the function imported here | |
| 51 | --> $DIR/ambiguous-17.rs:5:9 | |
| 52 | | | |
| 25 | | ^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 53 | 26 | LL | pub use handwritten::*; |
| 54 | | ^^^^^^^^^^^^^^ | |
| 55 | = help: consider adding an explicit import of `id` to disambiguate | |
| 56 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 57 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 58 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 27 | | -------------- but the name `id` in the value namespace is also re-exported here | |
| 28 | | | |
| 29 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 30 | ||
| 31 | error: aborting due to 1 previous error; 1 warning emitted | |
| 59 | 32 | |
| 33 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-2.rs deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | //@ aux-build: ../ambiguous-1.rs | |
| 2 | // https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396 | |
| 3 | ||
| 4 | extern crate ambiguous_1; | |
| 5 | ||
| 6 | fn main() { | |
| 7 | ambiguous_1::id(); //~ ERROR `id` is ambiguous | |
| 8 | //~| WARN this was previously accepted | |
| 9 | } |
tests/ui/imports/ambiguous-2.stderr deleted-49| ... | ... | @@ -1,49 +0,0 @@ |
| 1 | error: `id` is ambiguous | |
| 2 | --> $DIR/ambiguous-2.rs:7:18 | |
| 3 | | | |
| 4 | LL | ambiguous_1::id(); | |
| 5 | | ^^ ambiguous name | |
| 6 | | | |
| 7 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 8 | note: `id` could refer to the function defined here | |
| 9 | --> $DIR/auxiliary/../ambiguous-1.rs:13:13 | |
| 10 | | | |
| 11 | LL | pub use self::evp::*; | |
| 12 | | ^^^^^^^^^ | |
| 13 | = help: consider updating this dependency to resolve this error | |
| 14 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 15 | note: `id` could also refer to the function defined here | |
| 16 | --> $DIR/auxiliary/../ambiguous-1.rs:15:13 | |
| 17 | | | |
| 18 | LL | pub use self::handwritten::*; | |
| 19 | | ^^^^^^^^^^^^^^^^^ | |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | ||
| 24 | error: aborting due to 1 previous error | |
| 25 | ||
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `id` is ambiguous | |
| 28 | --> $DIR/ambiguous-2.rs:7:18 | |
| 29 | | | |
| 30 | LL | ambiguous_1::id(); | |
| 31 | | ^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `id` could refer to the function defined here | |
| 35 | --> $DIR/auxiliary/../ambiguous-1.rs:13:13 | |
| 36 | | | |
| 37 | LL | pub use self::evp::*; | |
| 38 | | ^^^^^^^^^ | |
| 39 | = help: consider updating this dependency to resolve this error | |
| 40 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 41 | note: `id` could also refer to the function defined here | |
| 42 | --> $DIR/auxiliary/../ambiguous-1.rs:15:13 | |
| 43 | | | |
| 44 | LL | pub use self::handwritten::*; | |
| 45 | | ^^^^^^^^^^^^^^^^^ | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 |
tests/ui/imports/ambiguous-3.rs-1| ... | ... | @@ -4,7 +4,6 @@ fn main() { |
| 4 | 4 | use a::*; |
| 5 | 5 | x(); |
| 6 | 6 | //~^ ERROR `x` is ambiguous |
| 7 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | 9 | mod a { |
tests/ui/imports/ambiguous-3.stderr+4-30| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `x` is ambiguous | |
| 1 | error[E0659]: `x` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-3.rs:5:5 |
| 3 | 3 | | |
| 4 | 4 | LL | x(); |
| ... | ... | @@ -6,44 +6,18 @@ LL | x(); |
| 6 | 6 | | |
| 7 | 7 | = note: ambiguous because of multiple glob imports of a name in the same module |
| 8 | 8 | note: `x` could refer to the function imported here |
| 9 | --> $DIR/ambiguous-3.rs:18:13 | |
| 9 | --> $DIR/ambiguous-3.rs:17:13 | |
| 10 | 10 | | |
| 11 | 11 | LL | pub use self::b::*; |
| 12 | 12 | | ^^^^^^^^^^ |
| 13 | 13 | = help: consider adding an explicit import of `x` to disambiguate |
| 14 | 14 | note: `x` could also refer to the function imported here |
| 15 | --> $DIR/ambiguous-3.rs:19:13 | |
| 15 | --> $DIR/ambiguous-3.rs:18:13 | |
| 16 | 16 | | |
| 17 | 17 | LL | pub use self::c::*; |
| 18 | 18 | | ^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `x` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `x` is ambiguous | |
| 28 | --> $DIR/ambiguous-3.rs:5:5 | |
| 29 | | | |
| 30 | LL | x(); | |
| 31 | | ^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `x` could refer to the function imported here | |
| 35 | --> $DIR/ambiguous-3.rs:18:13 | |
| 36 | | | |
| 37 | LL | pub use self::b::*; | |
| 38 | | ^^^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `x` to disambiguate | |
| 40 | note: `x` could also refer to the function imported here | |
| 41 | --> $DIR/ambiguous-3.rs:19:13 | |
| 42 | | | |
| 43 | LL | pub use self::c::*; | |
| 44 | | ^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `x` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-4-extern.rs+1-5| ... | ... | @@ -1,9 +1,6 @@ |
| 1 | 1 | //@ edition:2015 |
| 2 | //@ check-pass | |
| 3 | 2 | // https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883 |
| 4 | 3 | |
| 5 | #![warn(ambiguous_glob_imports)] | |
| 6 | ||
| 7 | 4 | macro_rules! m { |
| 8 | 5 | () => { |
| 9 | 6 | pub fn id() {} |
| ... | ... | @@ -24,6 +21,5 @@ mod handwritten { |
| 24 | 21 | |
| 25 | 22 | fn main() { |
| 26 | 23 | id(); |
| 27 | //~^ WARNING `id` is ambiguous | |
| 28 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 24 | //~^ ERROR `id` is ambiguous | |
| 29 | 25 | } |
tests/ui/imports/ambiguous-4-extern.stderr+12-46| ... | ... | @@ -1,67 +1,33 @@ |
| 1 | warning: ambiguous glob re-exports | |
| 2 | --> $DIR/ambiguous-4-extern.rs:13:9 | |
| 3 | | | |
| 4 | LL | pub use evp::*; | |
| 5 | | ^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 6 | LL | pub use handwritten::*; | |
| 7 | | -------------- but the name `id` in the value namespace is also re-exported here | |
| 8 | | | |
| 9 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 10 | ||
| 11 | warning: `id` is ambiguous | |
| 12 | --> $DIR/ambiguous-4-extern.rs:26:5 | |
| 1 | error[E0659]: `id` is ambiguous | |
| 2 | --> $DIR/ambiguous-4-extern.rs:23:5 | |
| 13 | 3 | | |
| 14 | 4 | LL | id(); |
| 15 | 5 | | ^^ ambiguous name |
| 16 | 6 | | |
| 17 | 7 | = note: ambiguous because of multiple glob imports of a name in the same module |
| 18 | 8 | note: `id` could refer to the function imported here |
| 19 | --> $DIR/ambiguous-4-extern.rs:13:9 | |
| 9 | --> $DIR/ambiguous-4-extern.rs:10:9 | |
| 20 | 10 | | |
| 21 | 11 | LL | pub use evp::*; |
| 22 | 12 | | ^^^^^^ |
| 23 | 13 | = help: consider adding an explicit import of `id` to disambiguate |
| 24 | 14 | note: `id` could also refer to the function imported here |
| 25 | --> $DIR/ambiguous-4-extern.rs:14:9 | |
| 15 | --> $DIR/ambiguous-4-extern.rs:11:9 | |
| 26 | 16 | | |
| 27 | 17 | LL | pub use handwritten::*; |
| 28 | 18 | | ^^^^^^^^^^^^^^ |
| 29 | 19 | = help: consider adding an explicit import of `id` to disambiguate |
| 30 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 31 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 32 | note: the lint level is defined here | |
| 33 | --> $DIR/ambiguous-4-extern.rs:5:9 | |
| 34 | | | |
| 35 | LL | #![warn(ambiguous_glob_imports)] | |
| 36 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 37 | ||
| 38 | warning: 2 warnings emitted | |
| 39 | 20 | |
| 40 | Future incompatibility report: Future breakage diagnostic: | |
| 41 | warning: `id` is ambiguous | |
| 42 | --> $DIR/ambiguous-4-extern.rs:26:5 | |
| 43 | | | |
| 44 | LL | id(); | |
| 45 | | ^^ ambiguous name | |
| 46 | | | |
| 47 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 48 | note: `id` could refer to the function imported here | |
| 49 | --> $DIR/ambiguous-4-extern.rs:13:9 | |
| 21 | warning: ambiguous glob re-exports | |
| 22 | --> $DIR/ambiguous-4-extern.rs:10:9 | |
| 50 | 23 | | |
| 51 | 24 | LL | pub use evp::*; |
| 52 | | ^^^^^^ | |
| 53 | = help: consider adding an explicit import of `id` to disambiguate | |
| 54 | note: `id` could also refer to the function imported here | |
| 55 | --> $DIR/ambiguous-4-extern.rs:14:9 | |
| 56 | | | |
| 25 | | ^^^^^^ the name `id` in the value namespace is first re-exported here | |
| 57 | 26 | LL | pub use handwritten::*; |
| 58 | | ^^^^^^^^^^^^^^ | |
| 59 | = help: consider adding an explicit import of `id` to disambiguate | |
| 60 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 61 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 62 | note: the lint level is defined here | |
| 63 | --> $DIR/ambiguous-4-extern.rs:5:9 | |
| 27 | | -------------- but the name `id` in the value namespace is also re-exported here | |
| 64 | 28 | | |
| 65 | LL | #![warn(ambiguous_glob_imports)] | |
| 66 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 29 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 30 | ||
| 31 | error: aborting due to 1 previous error; 1 warning emitted | |
| 67 | 32 | |
| 33 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-4.rs deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | //@ edition:2015 | |
| 2 | //@ aux-build: ../ambiguous-4-extern.rs | |
| 3 | ||
| 4 | extern crate ambiguous_4_extern; | |
| 5 | ||
| 6 | fn main() { | |
| 7 | ambiguous_4_extern::id(); //~ ERROR `id` is ambiguous | |
| 8 | //~| WARN this was previously accepted | |
| 9 | } |
tests/ui/imports/ambiguous-4.stderr deleted-49| ... | ... | @@ -1,49 +0,0 @@ |
| 1 | error: `id` is ambiguous | |
| 2 | --> $DIR/ambiguous-4.rs:7:25 | |
| 3 | | | |
| 4 | LL | ambiguous_4_extern::id(); | |
| 5 | | ^^ ambiguous name | |
| 6 | | | |
| 7 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 8 | note: `id` could refer to the function defined here | |
| 9 | --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 | |
| 10 | | | |
| 11 | LL | pub use evp::*; | |
| 12 | | ^^^ | |
| 13 | = help: consider updating this dependency to resolve this error | |
| 14 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 15 | note: `id` could also refer to the function defined here | |
| 16 | --> $DIR/auxiliary/../ambiguous-4-extern.rs:14:9 | |
| 17 | | | |
| 18 | LL | pub use handwritten::*; | |
| 19 | | ^^^^^^^^^^^ | |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | ||
| 24 | error: aborting due to 1 previous error | |
| 25 | ||
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `id` is ambiguous | |
| 28 | --> $DIR/ambiguous-4.rs:7:25 | |
| 29 | | | |
| 30 | LL | ambiguous_4_extern::id(); | |
| 31 | | ^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `id` could refer to the function defined here | |
| 35 | --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 | |
| 36 | | | |
| 37 | LL | pub use evp::*; | |
| 38 | | ^^^ | |
| 39 | = help: consider updating this dependency to resolve this error | |
| 40 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 41 | note: `id` could also refer to the function defined here | |
| 42 | --> $DIR/auxiliary/../ambiguous-4-extern.rs:14:9 | |
| 43 | | | |
| 44 | LL | pub use handwritten::*; | |
| 45 | | ^^^^^^^^^^^ | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 |
tests/ui/imports/ambiguous-5.rs-1| ... | ... | @@ -11,7 +11,6 @@ mod gpos { |
| 11 | 11 | use super::*; |
| 12 | 12 | struct MarkRecord(Class); |
| 13 | 13 | //~^ ERROR`Class` is ambiguous |
| 14 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 15 | 14 | } |
| 16 | 15 | |
| 17 | 16 | mod gsubgpos { |
tests/ui/imports/ambiguous-5.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `Class` is ambiguous | |
| 1 | error[E0659]: `Class` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-5.rs:12:23 |
| 3 | 3 | | |
| 4 | 4 | LL | struct MarkRecord(Class); |
| ... | ... | @@ -17,33 +17,7 @@ note: `Class` could also refer to the struct imported here |
| 17 | 17 | LL | use super::gsubgpos::*; |
| 18 | 18 | | ^^^^^^^^^^^^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `Class` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `Class` is ambiguous | |
| 28 | --> $DIR/ambiguous-5.rs:12:23 | |
| 29 | | | |
| 30 | LL | struct MarkRecord(Class); | |
| 31 | | ^^^^^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `Class` could refer to the struct imported here | |
| 35 | --> $DIR/ambiguous-5.rs:11:9 | |
| 36 | | | |
| 37 | LL | use super::*; | |
| 38 | | ^^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `Class` to disambiguate | |
| 40 | note: `Class` could also refer to the struct imported here | |
| 41 | --> $DIR/ambiguous-5.rs:10:9 | |
| 42 | | | |
| 43 | LL | use super::gsubgpos::*; | |
| 44 | | ^^^^^^^^^^^^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `Class` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-6.rs-1| ... | ... | @@ -5,7 +5,6 @@ pub fn foo() -> u32 { |
| 5 | 5 | use sub::*; |
| 6 | 6 | C |
| 7 | 7 | //~^ ERROR `C` is ambiguous |
| 8 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 9 | 8 | } |
| 10 | 9 | |
| 11 | 10 | mod sub { |
tests/ui/imports/ambiguous-6.stderr+4-30| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `C` is ambiguous | |
| 1 | error[E0659]: `C` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-6.rs:6:5 |
| 3 | 3 | | |
| 4 | 4 | LL | C |
| ... | ... | @@ -6,44 +6,18 @@ LL | C |
| 6 | 6 | | |
| 7 | 7 | = note: ambiguous because of multiple glob imports of a name in the same module |
| 8 | 8 | note: `C` could refer to the constant imported here |
| 9 | --> $DIR/ambiguous-6.rs:15:13 | |
| 9 | --> $DIR/ambiguous-6.rs:14:13 | |
| 10 | 10 | | |
| 11 | 11 | LL | pub use mod1::*; |
| 12 | 12 | | ^^^^^^^ |
| 13 | 13 | = help: consider adding an explicit import of `C` to disambiguate |
| 14 | 14 | note: `C` could also refer to the constant imported here |
| 15 | --> $DIR/ambiguous-6.rs:16:13 | |
| 15 | --> $DIR/ambiguous-6.rs:15:13 | |
| 16 | 16 | | |
| 17 | 17 | LL | pub use mod2::*; |
| 18 | 18 | | ^^^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `C` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | error: aborting due to 1 previous error |
| 25 | 22 | |
| 26 | Future incompatibility report: Future breakage diagnostic: | |
| 27 | error: `C` is ambiguous | |
| 28 | --> $DIR/ambiguous-6.rs:6:5 | |
| 29 | | | |
| 30 | LL | C | |
| 31 | | ^ ambiguous name | |
| 32 | | | |
| 33 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 34 | note: `C` could refer to the constant imported here | |
| 35 | --> $DIR/ambiguous-6.rs:15:13 | |
| 36 | | | |
| 37 | LL | pub use mod1::*; | |
| 38 | | ^^^^^^^ | |
| 39 | = help: consider adding an explicit import of `C` to disambiguate | |
| 40 | note: `C` could also refer to the constant imported here | |
| 41 | --> $DIR/ambiguous-6.rs:16:13 | |
| 42 | | | |
| 43 | LL | pub use mod2::*; | |
| 44 | | ^^^^^^^ | |
| 45 | = help: consider adding an explicit import of `C` to disambiguate | |
| 46 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 47 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 48 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 49 | ||
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-9.rs-2| ... | ... | @@ -22,7 +22,5 @@ use prelude::*; |
| 22 | 22 | fn main() { |
| 23 | 23 | date_range(); |
| 24 | 24 | //~^ ERROR `date_range` is ambiguous |
| 25 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 26 | 25 | //~| ERROR `date_range` is ambiguous |
| 27 | //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 28 | 26 | } |
tests/ui/imports/ambiguous-9.stderr+19-71| ... | ... | @@ -1,45 +1,4 @@ |
| 1 | warning: ambiguous glob re-exports | |
| 2 | --> $DIR/ambiguous-9.rs:7:13 | |
| 3 | | | |
| 4 | LL | pub use self::range::*; | |
| 5 | | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here | |
| 6 | LL | use super::prelude::*; | |
| 7 | | ----------------- but the name `date_range` in the value namespace is also re-exported here | |
| 8 | | | |
| 9 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 10 | ||
| 11 | error: `date_range` is ambiguous | |
| 12 | --> $DIR/ambiguous-9.rs:23:5 | |
| 13 | | | |
| 14 | LL | date_range(); | |
| 15 | | ^^^^^^^^^^ ambiguous name | |
| 16 | | | |
| 17 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 18 | note: `date_range` could refer to the function imported here | |
| 19 | --> $DIR/ambiguous-9.rs:7:13 | |
| 20 | | | |
| 21 | LL | pub use self::range::*; | |
| 22 | | ^^^^^^^^^^^^^^ | |
| 23 | = help: consider adding an explicit import of `date_range` to disambiguate | |
| 24 | note: `date_range` could also refer to the function imported here | |
| 25 | --> $DIR/ambiguous-9.rs:8:9 | |
| 26 | | | |
| 27 | LL | use super::prelude::*; | |
| 28 | | ^^^^^^^^^^^^^^^^^ | |
| 29 | = help: consider adding an explicit import of `date_range` to disambiguate | |
| 30 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 31 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 32 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 33 | ||
| 34 | warning: ambiguous glob re-exports | |
| 35 | --> $DIR/ambiguous-9.rs:15:13 | |
| 36 | | | |
| 37 | LL | pub use self::t::*; | |
| 38 | | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here | |
| 39 | LL | pub use super::dsl::*; | |
| 40 | | ------------- but the name `date_range` in the value namespace is also re-exported here | |
| 41 | ||
| 42 | error: `date_range` is ambiguous | |
| 1 | error[E0659]: `date_range` is ambiguous | |
| 43 | 2 | --> $DIR/ambiguous-9.rs:23:5 |
| 44 | 3 | | |
| 45 | 4 | LL | date_range(); |
| ... | ... | @@ -58,13 +17,8 @@ note: `date_range` could also refer to the function imported here |
| 58 | 17 | LL | use prelude::*; |
| 59 | 18 | | ^^^^^^^^^^ |
| 60 | 19 | = help: consider adding an explicit import of `date_range` to disambiguate |
| 61 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 62 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 63 | 20 | |
| 64 | error: aborting due to 2 previous errors; 2 warnings emitted | |
| 65 | ||
| 66 | Future incompatibility report: Future breakage diagnostic: | |
| 67 | error: `date_range` is ambiguous | |
| 21 | error[E0659]: `date_range` is ambiguous | |
| 68 | 22 | --> $DIR/ambiguous-9.rs:23:5 |
| 69 | 23 | | |
| 70 | 24 | LL | date_range(); |
| ... | ... | @@ -83,31 +37,25 @@ note: `date_range` could also refer to the function imported here |
| 83 | 37 | LL | use super::prelude::*; |
| 84 | 38 | | ^^^^^^^^^^^^^^^^^ |
| 85 | 39 | = help: consider adding an explicit import of `date_range` to disambiguate |
| 86 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 87 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 88 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 89 | 40 | |
| 90 | Future breakage diagnostic: | |
| 91 | error: `date_range` is ambiguous | |
| 92 | --> $DIR/ambiguous-9.rs:23:5 | |
| 93 | | | |
| 94 | LL | date_range(); | |
| 95 | | ^^^^^^^^^^ ambiguous name | |
| 41 | warning: ambiguous glob re-exports | |
| 42 | --> $DIR/ambiguous-9.rs:7:13 | |
| 96 | 43 | | |
| 97 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 98 | note: `date_range` could refer to the function imported here | |
| 99 | --> $DIR/ambiguous-9.rs:19:5 | |
| 44 | LL | pub use self::range::*; | |
| 45 | | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here | |
| 46 | LL | use super::prelude::*; | |
| 47 | | ----------------- but the name `date_range` in the value namespace is also re-exported here | |
| 100 | 48 | | |
| 101 | LL | use dsl::*; | |
| 102 | | ^^^^^^ | |
| 103 | = help: consider adding an explicit import of `date_range` to disambiguate | |
| 104 | note: `date_range` could also refer to the function imported here | |
| 105 | --> $DIR/ambiguous-9.rs:20:5 | |
| 49 | = note: `#[warn(ambiguous_glob_reexports)]` on by default | |
| 50 | ||
| 51 | warning: ambiguous glob re-exports | |
| 52 | --> $DIR/ambiguous-9.rs:15:13 | |
| 106 | 53 | | |
| 107 | LL | use prelude::*; | |
| 108 | | ^^^^^^^^^^ | |
| 109 | = help: consider adding an explicit import of `date_range` to disambiguate | |
| 110 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 111 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 112 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 54 | LL | pub use self::t::*; | |
| 55 | | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here | |
| 56 | LL | pub use super::dsl::*; | |
| 57 | | ------------- but the name `date_range` in the value namespace is also re-exported here | |
| 58 | ||
| 59 | error: aborting due to 2 previous errors; 2 warnings emitted | |
| 113 | 60 | |
| 61 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/ambiguous-panic-globvsglob.rs+1-2| ... | ... | @@ -18,6 +18,5 @@ fn foo() { |
| 18 | 18 | panic!(); |
| 19 | 19 | //~^ WARN: `panic` is ambiguous [ambiguous_panic_imports] |
| 20 | 20 | //~| WARN: this was previously accepted by the compiler |
| 21 | //~| ERROR: `panic` is ambiguous [ambiguous_glob_imports] | |
| 22 | //~| WARN: this was previously accepted by the compiler | |
| 21 | //~| ERROR: `panic` is ambiguous | |
| 23 | 22 | } |
tests/ui/imports/ambiguous-panic-globvsglob.stderr+2-28| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error: `panic` is ambiguous | |
| 1 | error[E0659]: `panic` is ambiguous | |
| 2 | 2 | --> $DIR/ambiguous-panic-globvsglob.rs:18:5 |
| 3 | 3 | | |
| 4 | 4 | LL | panic!(); |
| ... | ... | @@ -17,9 +17,6 @@ note: `panic` could also refer to the macro imported here |
| 17 | 17 | LL | use m2::*; |
| 18 | 18 | | ^^^^^ |
| 19 | 19 | = help: consider adding an explicit import of `panic` to disambiguate |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | 20 | |
| 24 | 21 | warning: `panic` is ambiguous |
| 25 | 22 | --> $DIR/ambiguous-panic-globvsglob.rs:18:5 |
| ... | ... | @@ -42,27 +39,4 @@ note: `panic` could also refer to a macro from prelude |
| 42 | 39 | |
| 43 | 40 | error: aborting due to 1 previous error; 1 warning emitted |
| 44 | 41 | |
| 45 | Future incompatibility report: Future breakage diagnostic: | |
| 46 | error: `panic` is ambiguous | |
| 47 | --> $DIR/ambiguous-panic-globvsglob.rs:18:5 | |
| 48 | | | |
| 49 | LL | panic!(); | |
| 50 | | ^^^^^ ambiguous name | |
| 51 | | | |
| 52 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 53 | note: `panic` could refer to the macro imported here | |
| 54 | --> $DIR/ambiguous-panic-globvsglob.rs:12:9 | |
| 55 | | | |
| 56 | LL | use m1::*; | |
| 57 | | ^^^^^ | |
| 58 | = help: consider adding an explicit import of `panic` to disambiguate | |
| 59 | note: `panic` could also refer to the macro imported here | |
| 60 | --> $DIR/ambiguous-panic-globvsglob.rs:13:9 | |
| 61 | | | |
| 62 | LL | use m2::*; | |
| 63 | | ^^^^^ | |
| 64 | = help: consider adding an explicit import of `panic` to disambiguate | |
| 65 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 66 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 67 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 68 | ||
| 42 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/imports/glob-conflict-cross-crate-3.rs-1| ... | ... | @@ -14,5 +14,4 @@ fn main() { |
| 14 | 14 | //~^ ERROR `C` is ambiguous |
| 15 | 15 | //~| ERROR `C` is ambiguous |
| 16 | 16 | //~| WARN this was previously accepted |
| 17 | //~| WARN this was previously accepted | |
| 18 | 17 | } |
tests/ui/imports/glob-conflict-cross-crate-3.stderr+15-40| ... | ... | @@ -1,27 +1,4 @@ |
| 1 | error: `C` is ambiguous | |
| 2 | --> $DIR/glob-conflict-cross-crate-3.rs:13:13 | |
| 3 | | | |
| 4 | LL | let _a: C = 1; | |
| 5 | | ^ ambiguous name | |
| 6 | | | |
| 7 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 8 | note: `C` could refer to the type alias defined here | |
| 9 | --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 | |
| 10 | | | |
| 11 | LL | pub use a::*; | |
| 12 | | ^ | |
| 13 | = help: consider updating this dependency to resolve this error | |
| 14 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 15 | note: `C` could also refer to the type alias defined here | |
| 16 | --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:10:9 | |
| 17 | | | |
| 18 | LL | pub use b::*; | |
| 19 | | ^ | |
| 20 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 21 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 22 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 23 | ||
| 24 | error: `C` is ambiguous | |
| 1 | error[E0659]: `C` is ambiguous | |
| 25 | 2 | --> $DIR/glob-conflict-cross-crate-3.rs:13:13 |
| 26 | 3 | | |
| 27 | 4 | LL | let _a: C = 1; |
| ... | ... | @@ -40,12 +17,7 @@ note: `C` could also refer to the type alias imported here |
| 40 | 17 | LL | use a::*; |
| 41 | 18 | | ^^^^ |
| 42 | 19 | = help: consider adding an explicit import of `C` to disambiguate |
| 43 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 44 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 45 | 20 | |
| 46 | error: aborting due to 2 previous errors | |
| 47 | ||
| 48 | Future incompatibility report: Future breakage diagnostic: | |
| 49 | 21 | error: `C` is ambiguous |
| 50 | 22 | --> $DIR/glob-conflict-cross-crate-3.rs:13:13 |
| 51 | 23 | | |
| ... | ... | @@ -69,7 +41,10 @@ LL | pub use b::*; |
| 69 | 41 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> |
| 70 | 42 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default |
| 71 | 43 | |
| 72 | Future breakage diagnostic: | |
| 44 | error: aborting due to 2 previous errors | |
| 45 | ||
| 46 | For more information about this error, try `rustc --explain E0659`. | |
| 47 | Future incompatibility report: Future breakage diagnostic: | |
| 73 | 48 | error: `C` is ambiguous |
| 74 | 49 | --> $DIR/glob-conflict-cross-crate-3.rs:13:13 |
| 75 | 50 | | |
| ... | ... | @@ -77,18 +52,18 @@ LL | let _a: C = 1; |
| 77 | 52 | | ^ ambiguous name |
| 78 | 53 | | |
| 79 | 54 | = note: ambiguous because of multiple glob imports of a name in the same module |
| 80 | note: `C` could refer to the type alias imported here | |
| 81 | --> $DIR/glob-conflict-cross-crate-3.rs:9:5 | |
| 55 | note: `C` could refer to the type alias defined here | |
| 56 | --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 | |
| 82 | 57 | | |
| 83 | LL | use glob_conflict_cross_crate_2_extern::*; | |
| 84 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 85 | = help: consider adding an explicit import of `C` to disambiguate | |
| 86 | note: `C` could also refer to the type alias imported here | |
| 87 | --> $DIR/glob-conflict-cross-crate-3.rs:10:5 | |
| 58 | LL | pub use a::*; | |
| 59 | | ^ | |
| 60 | = help: consider updating this dependency to resolve this error | |
| 61 | = help: if updating the dependency does not resolve the problem report the problem to the author of the relevant crate | |
| 62 | note: `C` could also refer to the type alias defined here | |
| 63 | --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:10:9 | |
| 88 | 64 | | |
| 89 | LL | use a::*; | |
| 90 | | ^^^^ | |
| 91 | = help: consider adding an explicit import of `C` to disambiguate | |
| 65 | LL | pub use b::*; | |
| 66 | | ^ | |
| 92 | 67 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 93 | 68 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> |
| 94 | 69 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default |
tests/ui/imports/unresolved-seg-after-ambiguous.rs+1-3| ... | ... | @@ -17,8 +17,6 @@ mod a { |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | use self::a::E::in_exist; |
| 20 | //~^ ERROR: unresolved import `self::a::E` | |
| 21 | //~| ERROR: `E` is ambiguous | |
| 22 | //~| WARNING: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 20 | //~^ ERROR: `E` is ambiguous | |
| 23 | 21 | |
| 24 | 22 | fn main() {} |
tests/ui/imports/unresolved-seg-after-ambiguous.stderr+3-36| ... | ... | @@ -1,10 +1,4 @@ |
| 1 | error[E0432]: unresolved import `self::a::E` | |
| 2 | --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 | |
| 3 | | | |
| 4 | LL | use self::a::E::in_exist; | |
| 5 | | ^ `E` is a struct, not a module | |
| 6 | ||
| 7 | error: `E` is ambiguous | |
| 1 | error[E0659]: `E` is ambiguous | |
| 8 | 2 | --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 |
| 9 | 3 | | |
| 10 | 4 | LL | use self::a::E::in_exist; |
| ... | ... | @@ -23,34 +17,7 @@ note: `E` could also refer to the struct imported here |
| 23 | 17 | LL | pub use self::d::*; |
| 24 | 18 | | ^^^^^^^^^^ |
| 25 | 19 | = help: consider adding an explicit import of `E` to disambiguate |
| 26 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 27 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 28 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 29 | ||
| 30 | error: aborting due to 2 previous errors | |
| 31 | 20 | |
| 32 | For more information about this error, try `rustc --explain E0432`. | |
| 33 | Future incompatibility report: Future breakage diagnostic: | |
| 34 | error: `E` is ambiguous | |
| 35 | --> $DIR/unresolved-seg-after-ambiguous.rs:19:14 | |
| 36 | | | |
| 37 | LL | use self::a::E::in_exist; | |
| 38 | | ^ ambiguous name | |
| 39 | | | |
| 40 | = note: ambiguous because of multiple glob imports of a name in the same module | |
| 41 | note: `E` could refer to the struct imported here | |
| 42 | --> $DIR/unresolved-seg-after-ambiguous.rs:13:17 | |
| 43 | | | |
| 44 | LL | pub use self::c::*; | |
| 45 | | ^^^^^^^^^^ | |
| 46 | = help: consider adding an explicit import of `E` to disambiguate | |
| 47 | note: `E` could also refer to the struct imported here | |
| 48 | --> $DIR/unresolved-seg-after-ambiguous.rs:12:17 | |
| 49 | | | |
| 50 | LL | pub use self::d::*; | |
| 51 | | ^^^^^^^^^^ | |
| 52 | = help: consider adding an explicit import of `E` to disambiguate | |
| 53 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 54 | = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095> | |
| 55 | = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default | |
| 21 | error: aborting due to 1 previous error | |
| 56 | 22 | |
| 23 | For more information about this error, try `rustc --explain E0659`. |
tests/ui/linkage-attr/unstable-flavor.llbc.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: the linker flavor `llbc` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values | |
| 2 |
tests/ui/linkage-attr/unstable-flavor.ptx.stderr deleted-2| ... | ... | @@ -1,2 +0,0 @@ |
| 1 | error: the linker flavor `ptx` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values | |
| 2 |
tests/ui/linkage-attr/unstable-flavor.rs+4-4| ... | ... | @@ -2,14 +2,14 @@ |
| 2 | 2 | // unique codepath checking all unstable options (see `LinkerFlavorCli::is_unstable` and its |
| 3 | 3 | // caller). If it passes, all the other unstable options are rejected as well. |
| 4 | 4 | // |
| 5 | //@ revisions: bpf ptx | |
| 5 | //@ revisions: bpf llbc | |
| 6 | 6 | //@ [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib |
| 7 | 7 | //@ [bpf] needs-llvm-components: bpf |
| 8 | //@ [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib | |
| 9 | //@ [ptx] needs-llvm-components: nvptx | |
| 8 | //@ [llbc] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=llbc --crate-type=rlib | |
| 9 | //@ [llbc] needs-llvm-components: nvptx | |
| 10 | 10 | |
| 11 | 11 | #![feature(no_core)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | 14 | //[bpf]~? ERROR the linker flavor `bpf` is unstable |
| 15 | //[ptx]~? ERROR the linker flavor `ptx` is unstable | |
| 15 | //[llbc]~? ERROR the linker flavor `llbc` is unstable |
tests/ui/lint/unused/unused-assign-148960.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | //@ check-fail |
| 2 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 2 | 3 | #![deny(unused)] |
| 3 | 4 | #![allow(dead_code)] |
| 4 | 5 |
tests/ui/lint/unused/unused-assign-148960.stderr+7-7| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: value assigned to `value` is never read |
| 2 | --> $DIR/unused-assign-148960.rs:6:21 | |
| 2 | --> $DIR/unused-assign-148960.rs:7:21 | |
| 3 | 3 | | |
| 4 | 4 | LL | let mut value = b"0".to_vec(); |
| 5 | 5 | | ^^^^^^^^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -7,14 +7,14 @@ LL | value = b"1".to_vec(); |
| 7 | 7 | | ----- `value` is overwritten here before the previous value is read |
| 8 | 8 | | |
| 9 | 9 | note: the lint level is defined here |
| 10 | --> $DIR/unused-assign-148960.rs:2:9 | |
| 10 | --> $DIR/unused-assign-148960.rs:3:9 | |
| 11 | 11 | | |
| 12 | 12 | LL | #![deny(unused)] |
| 13 | 13 | | ^^^^^^ |
| 14 | 14 | = note: `#[deny(unused_assignments)]` implied by `#[deny(unused)]` |
| 15 | 15 | |
| 16 | 16 | error: value assigned to `x` is never read |
| 17 | --> $DIR/unused-assign-148960.rs:12:17 | |
| 17 | --> $DIR/unused-assign-148960.rs:13:17 | |
| 18 | 18 | | |
| 19 | 19 | LL | let mut x = 1; |
| 20 | 20 | | ^ this value is reassigned later and never used |
| ... | ... | @@ -22,7 +22,7 @@ LL | x = 2; |
| 22 | 22 | | ----- `x` is overwritten here before the previous value is read |
| 23 | 23 | |
| 24 | 24 | error: value assigned to `x` is never read |
| 25 | --> $DIR/unused-assign-148960.rs:13:5 | |
| 25 | --> $DIR/unused-assign-148960.rs:14:5 | |
| 26 | 26 | | |
| 27 | 27 | LL | x = 2; |
| 28 | 28 | | ^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -30,7 +30,7 @@ LL | x = 3; |
| 30 | 30 | | ----- `x` is overwritten here before the previous value is read |
| 31 | 31 | |
| 32 | 32 | error: value assigned to `p` is never read |
| 33 | --> $DIR/unused-assign-148960.rs:24:17 | |
| 33 | --> $DIR/unused-assign-148960.rs:25:17 | |
| 34 | 34 | | |
| 35 | 35 | LL | let mut p = Point { x: 1, y: 1 }; |
| 36 | 36 | | ^^^^^^^^^^^^^^^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -38,7 +38,7 @@ LL | p = Point { x: 2, y: 2 }; |
| 38 | 38 | | ------------------------ `p` is overwritten here before the previous value is read |
| 39 | 39 | |
| 40 | 40 | error: variable `foo` is assigned to, but never used |
| 41 | --> $DIR/unused-assign-148960.rs:38:9 | |
| 41 | --> $DIR/unused-assign-148960.rs:39:9 | |
| 42 | 42 | | |
| 43 | 43 | LL | let mut foo = Foo; |
| 44 | 44 | | ^^^^^^^ |
| ... | ... | @@ -52,7 +52,7 @@ LL + let Foo = Foo; |
| 52 | 52 | | |
| 53 | 53 | |
| 54 | 54 | error: value assigned to `foo` is never read |
| 55 | --> $DIR/unused-assign-148960.rs:39:5 | |
| 55 | --> $DIR/unused-assign-148960.rs:40:5 | |
| 56 | 56 | | |
| 57 | 57 | LL | foo = Foo; |
| 58 | 58 | | ^^^ |
tests/ui/liveness/liveness-consts.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | //@ check-pass |
| 2 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 2 | 3 | #![warn(unused)] |
| 3 | 4 | #![allow(unreachable_code)] |
| 4 | 5 |
tests/ui/liveness/liveness-consts.stderr+11-11| ... | ... | @@ -1,30 +1,30 @@ |
| 1 | 1 | warning: unused variable: `e` |
| 2 | --> $DIR/liveness-consts.rs:26:13 | |
| 2 | --> $DIR/liveness-consts.rs:27:13 | |
| 3 | 3 | | |
| 4 | 4 | LL | let e = 1; |
| 5 | 5 | | ^ help: if this is intentional, prefix it with an underscore: `_e` |
| 6 | 6 | | |
| 7 | 7 | note: the lint level is defined here |
| 8 | --> $DIR/liveness-consts.rs:2:9 | |
| 8 | --> $DIR/liveness-consts.rs:3:9 | |
| 9 | 9 | | |
| 10 | 10 | LL | #![warn(unused)] |
| 11 | 11 | | ^^^^^^ |
| 12 | 12 | = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` |
| 13 | 13 | |
| 14 | 14 | warning: unused variable: `s` |
| 15 | --> $DIR/liveness-consts.rs:35:24 | |
| 15 | --> $DIR/liveness-consts.rs:36:24 | |
| 16 | 16 | | |
| 17 | 17 | LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { |
| 18 | 18 | | ^ help: if this is intentional, prefix it with an underscore: `_s` |
| 19 | 19 | |
| 20 | 20 | warning: unused variable: `z` |
| 21 | --> $DIR/liveness-consts.rs:35:55 | |
| 21 | --> $DIR/liveness-consts.rs:36:55 | |
| 22 | 22 | | |
| 23 | 23 | LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { |
| 24 | 24 | | ^ help: if this is intentional, prefix it with an underscore: `_z` |
| 25 | 25 | |
| 26 | 26 | warning: variable `a` is assigned to, but never used |
| 27 | --> $DIR/liveness-consts.rs:7:9 | |
| 27 | --> $DIR/liveness-consts.rs:8:9 | |
| 28 | 28 | | |
| 29 | 29 | LL | let mut a = 0; |
| 30 | 30 | | ^^^^^ |
| ... | ... | @@ -32,7 +32,7 @@ LL | let mut a = 0; |
| 32 | 32 | = note: consider using `_a` instead |
| 33 | 33 | |
| 34 | 34 | warning: value assigned to `a` is never read |
| 35 | --> $DIR/liveness-consts.rs:11:9 | |
| 35 | --> $DIR/liveness-consts.rs:12:9 | |
| 36 | 36 | | |
| 37 | 37 | LL | a += 1; |
| 38 | 38 | | ^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL | a += 1; |
| 41 | 41 | = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` |
| 42 | 42 | |
| 43 | 43 | warning: value assigned to `b` is never read |
| 44 | --> $DIR/liveness-consts.rs:18:17 | |
| 44 | --> $DIR/liveness-consts.rs:19:17 | |
| 45 | 45 | | |
| 46 | 46 | LL | let mut b = 1; |
| 47 | 47 | | ^ this value is reassigned later and never used |
| ... | ... | @@ -49,7 +49,7 @@ LL | b += 1; |
| 49 | 49 | | ------ `b` is overwritten here before the previous value is read |
| 50 | 50 | |
| 51 | 51 | warning: value assigned to `b` is never read |
| 52 | --> $DIR/liveness-consts.rs:19:5 | |
| 52 | --> $DIR/liveness-consts.rs:20:5 | |
| 53 | 53 | | |
| 54 | 54 | LL | b += 1; |
| 55 | 55 | | ^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -57,13 +57,13 @@ LL | b = 42; |
| 57 | 57 | | ------ `b` is overwritten here before the previous value is read |
| 58 | 58 | |
| 59 | 59 | warning: unused variable: `z` |
| 60 | --> $DIR/liveness-consts.rs:62:13 | |
| 60 | --> $DIR/liveness-consts.rs:63:13 | |
| 61 | 61 | | |
| 62 | 62 | LL | let z = 42; |
| 63 | 63 | | ^ help: if this is intentional, prefix it with an underscore: `_z` |
| 64 | 64 | |
| 65 | 65 | warning: value assigned to `t` is never read |
| 66 | --> $DIR/liveness-consts.rs:44:9 | |
| 66 | --> $DIR/liveness-consts.rs:45:9 | |
| 67 | 67 | | |
| 68 | 68 | LL | t = t + t; |
| 69 | 69 | | ^^^^^^^^^ |
| ... | ... | @@ -71,7 +71,7 @@ LL | t = t + t; |
| 71 | 71 | = help: maybe it is overwritten before being read? |
| 72 | 72 | |
| 73 | 73 | warning: unused variable: `w` |
| 74 | --> $DIR/liveness-consts.rs:51:13 | |
| 74 | --> $DIR/liveness-consts.rs:52:13 | |
| 75 | 75 | | |
| 76 | 76 | LL | let w = 10; |
| 77 | 77 | | ^ help: if this is intentional, prefix it with an underscore: `_w` |
tests/ui/liveness/liveness-dead.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 1 | 2 | #![allow(dead_code)] |
| 2 | 3 | #![deny(unused_assignments)] |
| 3 | 4 |
tests/ui/liveness/liveness-dead.stderr+5-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: value assigned to `x` is never read |
| 2 | --> $DIR/liveness-dead.rs:9:24 | |
| 2 | --> $DIR/liveness-dead.rs:10:24 | |
| 3 | 3 | | |
| 4 | 4 | LL | let mut x: isize = 3; |
| 5 | 5 | | ^ this value is reassigned later and never used |
| ... | ... | @@ -7,13 +7,13 @@ LL | x = 4; |
| 7 | 7 | | ----- `x` is overwritten here before the previous value is read |
| 8 | 8 | | |
| 9 | 9 | note: the lint level is defined here |
| 10 | --> $DIR/liveness-dead.rs:2:9 | |
| 10 | --> $DIR/liveness-dead.rs:3:9 | |
| 11 | 11 | | |
| 12 | 12 | LL | #![deny(unused_assignments)] |
| 13 | 13 | | ^^^^^^^^^^^^^^^^^^ |
| 14 | 14 | |
| 15 | 15 | error: value assigned to `x` is never read |
| 16 | --> $DIR/liveness-dead.rs:17:5 | |
| 16 | --> $DIR/liveness-dead.rs:18:5 | |
| 17 | 17 | | |
| 18 | 18 | LL | x = 4; |
| 19 | 19 | | ^^^^^ |
| ... | ... | @@ -21,7 +21,7 @@ LL | x = 4; |
| 21 | 21 | = help: maybe it is overwritten before being read? |
| 22 | 22 | |
| 23 | 23 | error: value passed to `x` is never read |
| 24 | --> $DIR/liveness-dead.rs:20:7 | |
| 24 | --> $DIR/liveness-dead.rs:21:7 | |
| 25 | 25 | | |
| 26 | 26 | LL | fn f4(mut x: i32) { |
| 27 | 27 | | ^^^^^ |
| ... | ... | @@ -29,7 +29,7 @@ LL | fn f4(mut x: i32) { |
| 29 | 29 | = help: maybe it is overwritten before being read? |
| 30 | 30 | |
| 31 | 31 | error: value assigned to `x` is never read |
| 32 | --> $DIR/liveness-dead.rs:27:5 | |
| 32 | --> $DIR/liveness-dead.rs:28:5 | |
| 33 | 33 | | |
| 34 | 34 | LL | x = 4; |
| 35 | 35 | | ^^^^^ |
tests/ui/liveness/liveness-upvars.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ edition:2018 |
| 2 | 2 | //@ check-pass |
| 3 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 3 | 4 | #![feature(coroutines, stmt_expr_attributes)] |
| 4 | 5 | #![warn(unused)] |
| 5 | 6 | #![allow(unreachable_code)] |
tests/ui/liveness/liveness-upvars.stderr+25-25| ... | ... | @@ -1,19 +1,19 @@ |
| 1 | 1 | warning: value captured by `last` is never read |
| 2 | --> $DIR/liveness-upvars.rs:10:9 | |
| 2 | --> $DIR/liveness-upvars.rs:11:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | last = Some(s); |
| 5 | 5 | | ^^^^ |
| 6 | 6 | | |
| 7 | 7 | = help: did you mean to capture by reference instead? |
| 8 | 8 | note: the lint level is defined here |
| 9 | --> $DIR/liveness-upvars.rs:4:9 | |
| 9 | --> $DIR/liveness-upvars.rs:5:9 | |
| 10 | 10 | | |
| 11 | 11 | LL | #![warn(unused)] |
| 12 | 12 | | ^^^^^^ |
| 13 | 13 | = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` |
| 14 | 14 | |
| 15 | 15 | warning: value assigned to `last` is never read |
| 16 | --> $DIR/liveness-upvars.rs:10:9 | |
| 16 | --> $DIR/liveness-upvars.rs:11:9 | |
| 17 | 17 | | |
| 18 | 18 | LL | last = Some(s); |
| 19 | 19 | | ^^^^^^^^^^^^^^ |
| ... | ... | @@ -21,7 +21,7 @@ LL | last = Some(s); |
| 21 | 21 | = help: maybe it is overwritten before being read? |
| 22 | 22 | |
| 23 | 23 | warning: value captured by `sum` is never read |
| 24 | --> $DIR/liveness-upvars.rs:22:9 | |
| 24 | --> $DIR/liveness-upvars.rs:23:9 | |
| 25 | 25 | | |
| 26 | 26 | LL | sum += x; |
| 27 | 27 | | ^^^ |
| ... | ... | @@ -29,7 +29,7 @@ LL | sum += x; |
| 29 | 29 | = help: did you mean to capture by reference instead? |
| 30 | 30 | |
| 31 | 31 | warning: value assigned to `sum` is never read |
| 32 | --> $DIR/liveness-upvars.rs:22:9 | |
| 32 | --> $DIR/liveness-upvars.rs:23:9 | |
| 33 | 33 | | |
| 34 | 34 | LL | sum += x; |
| 35 | 35 | | ^^^^^^^^ |
| ... | ... | @@ -37,7 +37,7 @@ LL | sum += x; |
| 37 | 37 | = help: maybe it is overwritten before being read? |
| 38 | 38 | |
| 39 | 39 | warning: value assigned to `c` is never read |
| 40 | --> $DIR/liveness-upvars.rs:69:9 | |
| 40 | --> $DIR/liveness-upvars.rs:70:9 | |
| 41 | 41 | | |
| 42 | 42 | LL | c += 1; |
| 43 | 43 | | ^^^^^^ |
| ... | ... | @@ -45,7 +45,7 @@ LL | c += 1; |
| 45 | 45 | = help: maybe it is overwritten before being read? |
| 46 | 46 | |
| 47 | 47 | warning: value assigned to `c` is never read |
| 48 | --> $DIR/liveness-upvars.rs:63:9 | |
| 48 | --> $DIR/liveness-upvars.rs:64:9 | |
| 49 | 49 | | |
| 50 | 50 | LL | c += 1; |
| 51 | 51 | | ^^^^^^ |
| ... | ... | @@ -53,7 +53,7 @@ LL | c += 1; |
| 53 | 53 | = help: maybe it is overwritten before being read? |
| 54 | 54 | |
| 55 | 55 | warning: value captured by `c` is never read |
| 56 | --> $DIR/liveness-upvars.rs:49:9 | |
| 56 | --> $DIR/liveness-upvars.rs:50:9 | |
| 57 | 57 | | |
| 58 | 58 | LL | c += 1; |
| 59 | 59 | | ^ |
| ... | ... | @@ -61,7 +61,7 @@ LL | c += 1; |
| 61 | 61 | = help: did you mean to capture by reference instead? |
| 62 | 62 | |
| 63 | 63 | warning: value assigned to `c` is never read |
| 64 | --> $DIR/liveness-upvars.rs:49:9 | |
| 64 | --> $DIR/liveness-upvars.rs:50:9 | |
| 65 | 65 | | |
| 66 | 66 | LL | c += 1; |
| 67 | 67 | | ^^^^^^ |
| ... | ... | @@ -69,7 +69,7 @@ LL | c += 1; |
| 69 | 69 | = help: maybe it is overwritten before being read? |
| 70 | 70 | |
| 71 | 71 | warning: value captured by `c` is never read |
| 72 | --> $DIR/liveness-upvars.rs:44:9 | |
| 72 | --> $DIR/liveness-upvars.rs:45:9 | |
| 73 | 73 | | |
| 74 | 74 | LL | c += 1; |
| 75 | 75 | | ^ |
| ... | ... | @@ -77,7 +77,7 @@ LL | c += 1; |
| 77 | 77 | = help: did you mean to capture by reference instead? |
| 78 | 78 | |
| 79 | 79 | warning: value assigned to `c` is never read |
| 80 | --> $DIR/liveness-upvars.rs:44:9 | |
| 80 | --> $DIR/liveness-upvars.rs:45:9 | |
| 81 | 81 | | |
| 82 | 82 | LL | c += 1; |
| 83 | 83 | | ^^^^^^ |
| ... | ... | @@ -85,7 +85,7 @@ LL | c += 1; |
| 85 | 85 | = help: maybe it is overwritten before being read? |
| 86 | 86 | |
| 87 | 87 | warning: value captured by `c` is never read |
| 88 | --> $DIR/liveness-upvars.rs:38:9 | |
| 88 | --> $DIR/liveness-upvars.rs:39:9 | |
| 89 | 89 | | |
| 90 | 90 | LL | c = 1; |
| 91 | 91 | | ^ |
| ... | ... | @@ -93,7 +93,7 @@ LL | c = 1; |
| 93 | 93 | = help: did you mean to capture by reference instead? |
| 94 | 94 | |
| 95 | 95 | warning: value captured by `c` is never read |
| 96 | --> $DIR/liveness-upvars.rs:34:9 | |
| 96 | --> $DIR/liveness-upvars.rs:35:9 | |
| 97 | 97 | | |
| 98 | 98 | LL | c = 1; |
| 99 | 99 | | ^ |
| ... | ... | @@ -101,7 +101,7 @@ LL | c = 1; |
| 101 | 101 | = help: did you mean to capture by reference instead? |
| 102 | 102 | |
| 103 | 103 | warning: value captured by `e` is never read |
| 104 | --> $DIR/liveness-upvars.rs:82:13 | |
| 104 | --> $DIR/liveness-upvars.rs:83:13 | |
| 105 | 105 | | |
| 106 | 106 | LL | e = Some("e1"); |
| 107 | 107 | | ^ |
| ... | ... | @@ -109,7 +109,7 @@ LL | e = Some("e1"); |
| 109 | 109 | = help: did you mean to capture by reference instead? |
| 110 | 110 | |
| 111 | 111 | warning: value assigned to `e` is never read |
| 112 | --> $DIR/liveness-upvars.rs:82:13 | |
| 112 | --> $DIR/liveness-upvars.rs:83:13 | |
| 113 | 113 | | |
| 114 | 114 | LL | e = Some("e1"); |
| 115 | 115 | | ^^^^^^^^^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -118,7 +118,7 @@ LL | e = Some("e2"); |
| 118 | 118 | | -------------- `e` is overwritten here before the previous value is read |
| 119 | 119 | |
| 120 | 120 | warning: value assigned to `e` is never read |
| 121 | --> $DIR/liveness-upvars.rs:84:13 | |
| 121 | --> $DIR/liveness-upvars.rs:85:13 | |
| 122 | 122 | | |
| 123 | 123 | LL | e = Some("e2"); |
| 124 | 124 | | ^^^^^^^^^^^^^^ |
| ... | ... | @@ -126,7 +126,7 @@ LL | e = Some("e2"); |
| 126 | 126 | = help: maybe it is overwritten before being read? |
| 127 | 127 | |
| 128 | 128 | warning: value assigned to `d` is never read |
| 129 | --> $DIR/liveness-upvars.rs:78:13 | |
| 129 | --> $DIR/liveness-upvars.rs:79:13 | |
| 130 | 130 | | |
| 131 | 131 | LL | d = Some("d1"); |
| 132 | 132 | | ^^^^^^^^^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -134,7 +134,7 @@ LL | d = Some("d2"); |
| 134 | 134 | | -------------- `d` is overwritten here before the previous value is read |
| 135 | 135 | |
| 136 | 136 | warning: value assigned to `v` is never read |
| 137 | --> $DIR/liveness-upvars.rs:92:13 | |
| 137 | --> $DIR/liveness-upvars.rs:93:13 | |
| 138 | 138 | | |
| 139 | 139 | LL | v = T::default(); |
| 140 | 140 | | ^ |
| ... | ... | @@ -142,7 +142,7 @@ LL | v = T::default(); |
| 142 | 142 | = help: maybe it is overwritten before being read? |
| 143 | 143 | |
| 144 | 144 | warning: value captured by `z` is never read |
| 145 | --> $DIR/liveness-upvars.rs:105:17 | |
| 145 | --> $DIR/liveness-upvars.rs:106:17 | |
| 146 | 146 | | |
| 147 | 147 | LL | z = T::default(); |
| 148 | 148 | | ^ |
| ... | ... | @@ -150,7 +150,7 @@ LL | z = T::default(); |
| 150 | 150 | = help: did you mean to capture by reference instead? |
| 151 | 151 | |
| 152 | 152 | warning: value assigned to `z` is never read |
| 153 | --> $DIR/liveness-upvars.rs:105:17 | |
| 153 | --> $DIR/liveness-upvars.rs:106:17 | |
| 154 | 154 | | |
| 155 | 155 | LL | z = T::default(); |
| 156 | 156 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -158,7 +158,7 @@ LL | z = T::default(); |
| 158 | 158 | = help: maybe it is overwritten before being read? |
| 159 | 159 | |
| 160 | 160 | warning: value captured by `state` is never read |
| 161 | --> $DIR/liveness-upvars.rs:131:9 | |
| 161 | --> $DIR/liveness-upvars.rs:132:9 | |
| 162 | 162 | | |
| 163 | 163 | LL | state = 4; |
| 164 | 164 | | ^^^^^ |
| ... | ... | @@ -166,7 +166,7 @@ LL | state = 4; |
| 166 | 166 | = help: did you mean to capture by reference instead? |
| 167 | 167 | |
| 168 | 168 | warning: value assigned to `state` is never read |
| 169 | --> $DIR/liveness-upvars.rs:131:9 | |
| 169 | --> $DIR/liveness-upvars.rs:132:9 | |
| 170 | 170 | | |
| 171 | 171 | LL | state = 4; |
| 172 | 172 | | ^^^^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -175,7 +175,7 @@ LL | state = 5; |
| 175 | 175 | | --------- `state` is overwritten here before the previous value is read |
| 176 | 176 | |
| 177 | 177 | warning: value assigned to `state` is never read |
| 178 | --> $DIR/liveness-upvars.rs:134:9 | |
| 178 | --> $DIR/liveness-upvars.rs:135:9 | |
| 179 | 179 | | |
| 180 | 180 | LL | state = 5; |
| 181 | 181 | | ^^^^^^^^^ |
| ... | ... | @@ -183,7 +183,7 @@ LL | state = 5; |
| 183 | 183 | = help: maybe it is overwritten before being read? |
| 184 | 184 | |
| 185 | 185 | warning: value assigned to `s` is never read |
| 186 | --> $DIR/liveness-upvars.rs:143:9 | |
| 186 | --> $DIR/liveness-upvars.rs:144:9 | |
| 187 | 187 | | |
| 188 | 188 | LL | s = 1; |
| 189 | 189 | | ^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -191,7 +191,7 @@ LL | yield (s = 2); |
| 191 | 191 | | ------- `s` is overwritten here before the previous value is read |
| 192 | 192 | |
| 193 | 193 | warning: value assigned to `s` is never read |
| 194 | --> $DIR/liveness-upvars.rs:145:9 | |
| 194 | --> $DIR/liveness-upvars.rs:146:9 | |
| 195 | 195 | | |
| 196 | 196 | LL | s = yield (); |
| 197 | 197 | | ^^^^^^^^^^^^ this value is reassigned later and never used |
tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | //@ run-pass |
| 2 | //@ ignore-parallel-frontend unstable liveness diagnostics | |
| 2 | 3 | #![allow(dead_code)] |
| 3 | 4 | #![warn(unused_assignments)] |
| 4 | 5 |
tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.stderr+5-5| ... | ... | @@ -1,18 +1,18 @@ |
| 1 | 1 | warning: value assigned to `x` is never read |
| 2 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:10:9 | |
| 2 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:11:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | x = 35; |
| 5 | 5 | | ^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | = help: maybe it is overwritten before being read? |
| 8 | 8 | note: the lint level is defined here |
| 9 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:3:9 | |
| 9 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:4:9 | |
| 10 | 10 | | |
| 11 | 11 | LL | #![warn(unused_assignments)] |
| 12 | 12 | | ^^^^^^^^^^^^^^^^^^ |
| 13 | 13 | |
| 14 | 14 | warning: value assigned to `x` is never read |
| 15 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:21:13 | |
| 15 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:22:13 | |
| 16 | 16 | | |
| 17 | 17 | LL | x = 35; |
| 18 | 18 | | ^^^^^^ |
| ... | ... | @@ -20,7 +20,7 @@ LL | x = 35; |
| 20 | 20 | = help: maybe it is overwritten before being read? |
| 21 | 21 | |
| 22 | 22 | warning: value assigned to `x` is never read |
| 23 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:36:9 | |
| 23 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:37:9 | |
| 24 | 24 | | |
| 25 | 25 | LL | x = 42; |
| 26 | 26 | | ^^^^^^ this value is reassigned later and never used |
| ... | ... | @@ -29,7 +29,7 @@ LL | x = 99; |
| 29 | 29 | | ------ `x` is overwritten here before the previous value is read |
| 30 | 30 | |
| 31 | 31 | warning: value assigned to `x` is never read |
| 32 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:33:9 | |
| 32 | --> $DIR/unused-assignments-diverging-branch-issue-156416.rs:34:9 | |
| 33 | 33 | | |
| 34 | 34 | LL | x = 35; |
| 35 | 35 | | ^^^^^^ this value is reassigned later and never used |
tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr+50-50| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: unreachable pattern |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 2 | --> $DIR/empty-types.rs:48:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | _ => {} |
| 5 | 5 | | ^------ |
| ... | ... | @@ -9,13 +9,13 @@ LL | _ => {} |
| 9 | 9 | | |
| 10 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 11 | 11 | note: the lint level is defined here |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 12 | --> $DIR/empty-types.rs:14:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | #![deny(unreachable_patterns)] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | 16 | |
| 17 | 17 | error: unreachable pattern |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 18 | --> $DIR/empty-types.rs:51:9 | |
| 19 | 19 | | |
| 20 | 20 | LL | _x => {} |
| 21 | 21 | | ^^------ |
| ... | ... | @@ -26,7 +26,7 @@ LL | _x => {} |
| 26 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 27 | 27 | |
| 28 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 29 | --> $DIR/empty-types.rs:55:11 | |
| 30 | 30 | | |
| 31 | 31 | LL | match ref_never {} |
| 32 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL ~ } |
| 41 | 41 | | |
| 42 | 42 | |
| 43 | 43 | error: unreachable pattern |
| 44 | --> $DIR/empty-types.rs:68:9 | |
| 44 | --> $DIR/empty-types.rs:69:9 | |
| 45 | 45 | | |
| 46 | 46 | LL | (_, _) => {} |
| 47 | 47 | | ^^^^^^------ |
| ... | ... | @@ -52,7 +52,7 @@ LL | (_, _) => {} |
| 52 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 53 | 53 | |
| 54 | 54 | error: unreachable pattern |
| 55 | --> $DIR/empty-types.rs:74:9 | |
| 55 | --> $DIR/empty-types.rs:75:9 | |
| 56 | 56 | | |
| 57 | 57 | LL | _ => {} |
| 58 | 58 | | ^------ |
| ... | ... | @@ -63,7 +63,7 @@ LL | _ => {} |
| 63 | 63 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 64 | 64 | |
| 65 | 65 | error: unreachable pattern |
| 66 | --> $DIR/empty-types.rs:77:9 | |
| 66 | --> $DIR/empty-types.rs:78:9 | |
| 67 | 67 | | |
| 68 | 68 | LL | (_, _) => {} |
| 69 | 69 | | ^^^^^^------ |
| ... | ... | @@ -74,7 +74,7 @@ LL | (_, _) => {} |
| 74 | 74 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 75 | 75 | |
| 76 | 76 | error: unreachable pattern |
| 77 | --> $DIR/empty-types.rs:81:9 | |
| 77 | --> $DIR/empty-types.rs:82:9 | |
| 78 | 78 | | |
| 79 | 79 | LL | _ => {} |
| 80 | 80 | | ^------ |
| ... | ... | @@ -85,7 +85,7 @@ LL | _ => {} |
| 85 | 85 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 86 | 86 | |
| 87 | 87 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 88 | --> $DIR/empty-types.rs:85:11 | |
| 88 | --> $DIR/empty-types.rs:86:11 | |
| 89 | 89 | | |
| 90 | 90 | LL | match res_u32_never {} |
| 91 | 91 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -104,7 +104,7 @@ LL ~ } |
| 104 | 104 | | |
| 105 | 105 | |
| 106 | 106 | error: unreachable pattern |
| 107 | --> $DIR/empty-types.rs:92:9 | |
| 107 | --> $DIR/empty-types.rs:93:9 | |
| 108 | 108 | | |
| 109 | 109 | LL | Err(_) => {} |
| 110 | 110 | | ^^^^^^------ |
| ... | ... | @@ -115,7 +115,7 @@ LL | Err(_) => {} |
| 115 | 115 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 116 | 116 | |
| 117 | 117 | error: unreachable pattern |
| 118 | --> $DIR/empty-types.rs:97:9 | |
| 118 | --> $DIR/empty-types.rs:98:9 | |
| 119 | 119 | | |
| 120 | 120 | LL | Err(_) => {} |
| 121 | 121 | | ^^^^^^------ |
| ... | ... | @@ -126,7 +126,7 @@ LL | Err(_) => {} |
| 126 | 126 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 127 | 127 | |
| 128 | 128 | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered |
| 129 | --> $DIR/empty-types.rs:94:11 | |
| 129 | --> $DIR/empty-types.rs:95:11 | |
| 130 | 130 | | |
| 131 | 131 | LL | match res_u32_never { |
| 132 | 132 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -144,7 +144,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 144 | 144 | | |
| 145 | 145 | |
| 146 | 146 | error[E0005]: refutable pattern in local binding |
| 147 | --> $DIR/empty-types.rs:100:9 | |
| 147 | --> $DIR/empty-types.rs:101:9 | |
| 148 | 148 | | |
| 149 | 149 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 150 | 150 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -158,7 +158,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 158 | 158 | | ++++++++++++++++ |
| 159 | 159 | |
| 160 | 160 | error: unreachable pattern |
| 161 | --> $DIR/empty-types.rs:110:9 | |
| 161 | --> $DIR/empty-types.rs:111:9 | |
| 162 | 162 | | |
| 163 | 163 | LL | _ => {} |
| 164 | 164 | | ^------ |
| ... | ... | @@ -169,7 +169,7 @@ LL | _ => {} |
| 169 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 170 | 170 | |
| 171 | 171 | error: unreachable pattern |
| 172 | --> $DIR/empty-types.rs:113:9 | |
| 172 | --> $DIR/empty-types.rs:114:9 | |
| 173 | 173 | | |
| 174 | 174 | LL | Ok(_) => {} |
| 175 | 175 | | ^^^^^------ |
| ... | ... | @@ -180,7 +180,7 @@ LL | Ok(_) => {} |
| 180 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 181 | 181 | |
| 182 | 182 | error: unreachable pattern |
| 183 | --> $DIR/empty-types.rs:116:9 | |
| 183 | --> $DIR/empty-types.rs:117:9 | |
| 184 | 184 | | |
| 185 | 185 | LL | Ok(_) => {} |
| 186 | 186 | | ^^^^^------ |
| ... | ... | @@ -191,7 +191,7 @@ LL | Ok(_) => {} |
| 191 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 192 | 192 | |
| 193 | 193 | error: unreachable pattern |
| 194 | --> $DIR/empty-types.rs:117:9 | |
| 194 | --> $DIR/empty-types.rs:118:9 | |
| 195 | 195 | | |
| 196 | 196 | LL | _ => {} |
| 197 | 197 | | ^------ |
| ... | ... | @@ -202,7 +202,7 @@ LL | _ => {} |
| 202 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 203 | 203 | |
| 204 | 204 | error: unreachable pattern |
| 205 | --> $DIR/empty-types.rs:120:9 | |
| 205 | --> $DIR/empty-types.rs:121:9 | |
| 206 | 206 | | |
| 207 | 207 | LL | Ok(_) => {} |
| 208 | 208 | | ^^^^^------ |
| ... | ... | @@ -213,7 +213,7 @@ LL | Ok(_) => {} |
| 213 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 214 | 214 | |
| 215 | 215 | error: unreachable pattern |
| 216 | --> $DIR/empty-types.rs:121:9 | |
| 216 | --> $DIR/empty-types.rs:122:9 | |
| 217 | 217 | | |
| 218 | 218 | LL | Err(_) => {} |
| 219 | 219 | | ^^^^^^------ |
| ... | ... | @@ -224,7 +224,7 @@ LL | Err(_) => {} |
| 224 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 225 | 225 | |
| 226 | 226 | error: unreachable pattern |
| 227 | --> $DIR/empty-types.rs:130:13 | |
| 227 | --> $DIR/empty-types.rs:131:13 | |
| 228 | 228 | | |
| 229 | 229 | LL | _ => {} |
| 230 | 230 | | ^------ |
| ... | ... | @@ -235,7 +235,7 @@ LL | _ => {} |
| 235 | 235 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 236 | 236 | |
| 237 | 237 | error: unreachable pattern |
| 238 | --> $DIR/empty-types.rs:133:13 | |
| 238 | --> $DIR/empty-types.rs:134:13 | |
| 239 | 239 | | |
| 240 | 240 | LL | _ if false => {} |
| 241 | 241 | | ^--------------- |
| ... | ... | @@ -246,7 +246,7 @@ LL | _ if false => {} |
| 246 | 246 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 247 | 247 | |
| 248 | 248 | error: unreachable pattern |
| 249 | --> $DIR/empty-types.rs:141:13 | |
| 249 | --> $DIR/empty-types.rs:142:13 | |
| 250 | 250 | | |
| 251 | 251 | LL | Some(_) => {} |
| 252 | 252 | | ^^^^^^^------ |
| ... | ... | @@ -257,7 +257,7 @@ LL | Some(_) => {} |
| 257 | 257 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 258 | 258 | |
| 259 | 259 | error: unreachable pattern |
| 260 | --> $DIR/empty-types.rs:145:13 | |
| 260 | --> $DIR/empty-types.rs:146:13 | |
| 261 | 261 | | |
| 262 | 262 | LL | None => {} |
| 263 | 263 | | ---- matches all the relevant values |
| ... | ... | @@ -265,7 +265,7 @@ LL | _ => {} |
| 265 | 265 | | ^ no value can reach this |
| 266 | 266 | |
| 267 | 267 | error: unreachable pattern |
| 268 | --> $DIR/empty-types.rs:197:13 | |
| 268 | --> $DIR/empty-types.rs:198:13 | |
| 269 | 269 | | |
| 270 | 270 | LL | _ => {} |
| 271 | 271 | | ^------ |
| ... | ... | @@ -276,7 +276,7 @@ LL | _ => {} |
| 276 | 276 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 277 | 277 | |
| 278 | 278 | error: unreachable pattern |
| 279 | --> $DIR/empty-types.rs:202:13 | |
| 279 | --> $DIR/empty-types.rs:203:13 | |
| 280 | 280 | | |
| 281 | 281 | LL | _ => {} |
| 282 | 282 | | ^------ |
| ... | ... | @@ -287,7 +287,7 @@ LL | _ => {} |
| 287 | 287 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 288 | 288 | |
| 289 | 289 | error: unreachable pattern |
| 290 | --> $DIR/empty-types.rs:207:13 | |
| 290 | --> $DIR/empty-types.rs:208:13 | |
| 291 | 291 | | |
| 292 | 292 | LL | _ => {} |
| 293 | 293 | | ^------ |
| ... | ... | @@ -298,7 +298,7 @@ LL | _ => {} |
| 298 | 298 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 299 | 299 | |
| 300 | 300 | error: unreachable pattern |
| 301 | --> $DIR/empty-types.rs:212:13 | |
| 301 | --> $DIR/empty-types.rs:213:13 | |
| 302 | 302 | | |
| 303 | 303 | LL | _ => {} |
| 304 | 304 | | ^------ |
| ... | ... | @@ -309,7 +309,7 @@ LL | _ => {} |
| 309 | 309 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 310 | 310 | |
| 311 | 311 | error: unreachable pattern |
| 312 | --> $DIR/empty-types.rs:218:13 | |
| 312 | --> $DIR/empty-types.rs:219:13 | |
| 313 | 313 | | |
| 314 | 314 | LL | _ => {} |
| 315 | 315 | | ^------ |
| ... | ... | @@ -320,7 +320,7 @@ LL | _ => {} |
| 320 | 320 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 321 | 321 | |
| 322 | 322 | error: unreachable pattern |
| 323 | --> $DIR/empty-types.rs:279:9 | |
| 323 | --> $DIR/empty-types.rs:280:9 | |
| 324 | 324 | | |
| 325 | 325 | LL | _ => {} |
| 326 | 326 | | ^------ |
| ... | ... | @@ -331,7 +331,7 @@ LL | _ => {} |
| 331 | 331 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 332 | 332 | |
| 333 | 333 | error: unreachable pattern |
| 334 | --> $DIR/empty-types.rs:282:9 | |
| 334 | --> $DIR/empty-types.rs:283:9 | |
| 335 | 335 | | |
| 336 | 336 | LL | (_, _) => {} |
| 337 | 337 | | ^^^^^^------ |
| ... | ... | @@ -342,7 +342,7 @@ LL | (_, _) => {} |
| 342 | 342 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 343 | 343 | |
| 344 | 344 | error: unreachable pattern |
| 345 | --> $DIR/empty-types.rs:285:9 | |
| 345 | --> $DIR/empty-types.rs:286:9 | |
| 346 | 346 | | |
| 347 | 347 | LL | Ok(_) => {} |
| 348 | 348 | | ^^^^^------ |
| ... | ... | @@ -353,7 +353,7 @@ LL | Ok(_) => {} |
| 353 | 353 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 354 | 354 | |
| 355 | 355 | error: unreachable pattern |
| 356 | --> $DIR/empty-types.rs:286:9 | |
| 356 | --> $DIR/empty-types.rs:287:9 | |
| 357 | 357 | | |
| 358 | 358 | LL | Err(_) => {} |
| 359 | 359 | | ^^^^^^------ |
| ... | ... | @@ -364,7 +364,7 @@ LL | Err(_) => {} |
| 364 | 364 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 365 | 365 | |
| 366 | 366 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 367 | --> $DIR/empty-types.rs:325:11 | |
| 367 | --> $DIR/empty-types.rs:326:11 | |
| 368 | 368 | | |
| 369 | 369 | LL | match slice_never {} |
| 370 | 370 | | ^^^^^^^^^^^ |
| ... | ... | @@ -378,7 +378,7 @@ LL ~ } |
| 378 | 378 | | |
| 379 | 379 | |
| 380 | 380 | error[E0004]: non-exhaustive patterns: `&[]` not covered |
| 381 | --> $DIR/empty-types.rs:336:11 | |
| 381 | --> $DIR/empty-types.rs:337:11 | |
| 382 | 382 | | |
| 383 | 383 | LL | match slice_never { |
| 384 | 384 | | ^^^^^^^^^^^ pattern `&[]` not covered |
| ... | ... | @@ -391,7 +391,7 @@ LL + &[] => todo!() |
| 391 | 391 | | |
| 392 | 392 | |
| 393 | 393 | error[E0004]: non-exhaustive patterns: `&[]` not covered |
| 394 | --> $DIR/empty-types.rs:350:11 | |
| 394 | --> $DIR/empty-types.rs:351:11 | |
| 395 | 395 | | |
| 396 | 396 | LL | match slice_never { |
| 397 | 397 | | ^^^^^^^^^^^ pattern `&[]` not covered |
| ... | ... | @@ -405,7 +405,7 @@ LL + &[] => todo!() |
| 405 | 405 | | |
| 406 | 406 | |
| 407 | 407 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 408 | --> $DIR/empty-types.rs:357:11 | |
| 408 | --> $DIR/empty-types.rs:358:11 | |
| 409 | 409 | | |
| 410 | 410 | LL | match *slice_never {} |
| 411 | 411 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -419,7 +419,7 @@ LL ~ } |
| 419 | 419 | | |
| 420 | 420 | |
| 421 | 421 | error: unreachable pattern |
| 422 | --> $DIR/empty-types.rs:366:9 | |
| 422 | --> $DIR/empty-types.rs:367:9 | |
| 423 | 423 | | |
| 424 | 424 | LL | _ => {} |
| 425 | 425 | | ^------ |
| ... | ... | @@ -430,7 +430,7 @@ LL | _ => {} |
| 430 | 430 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 431 | 431 | |
| 432 | 432 | error: unreachable pattern |
| 433 | --> $DIR/empty-types.rs:369:9 | |
| 433 | --> $DIR/empty-types.rs:370:9 | |
| 434 | 434 | | |
| 435 | 435 | LL | [_, _, _] => {} |
| 436 | 436 | | ^^^^^^^^^------ |
| ... | ... | @@ -441,7 +441,7 @@ LL | [_, _, _] => {} |
| 441 | 441 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 442 | 442 | |
| 443 | 443 | error: unreachable pattern |
| 444 | --> $DIR/empty-types.rs:372:9 | |
| 444 | --> $DIR/empty-types.rs:373:9 | |
| 445 | 445 | | |
| 446 | 446 | LL | [_, ..] => {} |
| 447 | 447 | | ^^^^^^^------ |
| ... | ... | @@ -452,7 +452,7 @@ LL | [_, ..] => {} |
| 452 | 452 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 453 | 453 | |
| 454 | 454 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 455 | --> $DIR/empty-types.rs:386:11 | |
| 455 | --> $DIR/empty-types.rs:387:11 | |
| 456 | 456 | | |
| 457 | 457 | LL | match array_0_never {} |
| 458 | 458 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -466,7 +466,7 @@ LL ~ } |
| 466 | 466 | | |
| 467 | 467 | |
| 468 | 468 | error: unreachable pattern |
| 469 | --> $DIR/empty-types.rs:393:9 | |
| 469 | --> $DIR/empty-types.rs:394:9 | |
| 470 | 470 | | |
| 471 | 471 | LL | [] => {} |
| 472 | 472 | | -- matches all the relevant values |
| ... | ... | @@ -474,7 +474,7 @@ LL | _ => {} |
| 474 | 474 | | ^ no value can reach this |
| 475 | 475 | |
| 476 | 476 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 477 | --> $DIR/empty-types.rs:395:11 | |
| 477 | --> $DIR/empty-types.rs:396:11 | |
| 478 | 478 | | |
| 479 | 479 | LL | match array_0_never { |
| 480 | 480 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -488,7 +488,7 @@ LL + [] => todo!() |
| 488 | 488 | | |
| 489 | 489 | |
| 490 | 490 | error: unreachable pattern |
| 491 | --> $DIR/empty-types.rs:414:9 | |
| 491 | --> $DIR/empty-types.rs:415:9 | |
| 492 | 492 | | |
| 493 | 493 | LL | Some(_) => {} |
| 494 | 494 | | ^^^^^^^------ |
| ... | ... | @@ -499,7 +499,7 @@ LL | Some(_) => {} |
| 499 | 499 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 500 | 500 | |
| 501 | 501 | error: unreachable pattern |
| 502 | --> $DIR/empty-types.rs:419:9 | |
| 502 | --> $DIR/empty-types.rs:420:9 | |
| 503 | 503 | | |
| 504 | 504 | LL | Some(_a) => {} |
| 505 | 505 | | ^^^^^^^^------ |
| ... | ... | @@ -510,7 +510,7 @@ LL | Some(_a) => {} |
| 510 | 510 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 511 | 511 | |
| 512 | 512 | error: unreachable pattern |
| 513 | --> $DIR/empty-types.rs:424:9 | |
| 513 | --> $DIR/empty-types.rs:425:9 | |
| 514 | 514 | | |
| 515 | 515 | LL | None => {} |
| 516 | 516 | | ---- matches all the relevant values |
| ... | ... | @@ -519,7 +519,7 @@ LL | _ => {} |
| 519 | 519 | | ^ no value can reach this |
| 520 | 520 | |
| 521 | 521 | error: unreachable pattern |
| 522 | --> $DIR/empty-types.rs:429:9 | |
| 522 | --> $DIR/empty-types.rs:430:9 | |
| 523 | 523 | | |
| 524 | 524 | LL | None => {} |
| 525 | 525 | | ---- matches all the relevant values |
| ... | ... | @@ -528,7 +528,7 @@ LL | _a => {} |
| 528 | 528 | | ^^ no value can reach this |
| 529 | 529 | |
| 530 | 530 | error: unreachable pattern |
| 531 | --> $DIR/empty-types.rs:601:9 | |
| 531 | --> $DIR/empty-types.rs:602:9 | |
| 532 | 532 | | |
| 533 | 533 | LL | _ => {} |
| 534 | 534 | | ^------ |
| ... | ... | @@ -539,7 +539,7 @@ LL | _ => {} |
| 539 | 539 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 540 | 540 | |
| 541 | 541 | error: unreachable pattern |
| 542 | --> $DIR/empty-types.rs:604:9 | |
| 542 | --> $DIR/empty-types.rs:605:9 | |
| 543 | 543 | | |
| 544 | 544 | LL | _x => {} |
| 545 | 545 | | ^^------ |
| ... | ... | @@ -550,7 +550,7 @@ LL | _x => {} |
| 550 | 550 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 551 | 551 | |
| 552 | 552 | error: unreachable pattern |
| 553 | --> $DIR/empty-types.rs:607:9 | |
| 553 | --> $DIR/empty-types.rs:608:9 | |
| 554 | 554 | | |
| 555 | 555 | LL | _ if false => {} |
| 556 | 556 | | ^--------------- |
| ... | ... | @@ -561,7 +561,7 @@ LL | _ if false => {} |
| 561 | 561 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 562 | 562 | |
| 563 | 563 | error: unreachable pattern |
| 564 | --> $DIR/empty-types.rs:610:9 | |
| 564 | --> $DIR/empty-types.rs:611:9 | |
| 565 | 565 | | |
| 566 | 566 | LL | _x if false => {} |
| 567 | 567 | | ^^--------------- |
tests/ui/pattern/usefulness/empty-types.never_pats.stderr+43-43| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: unreachable pattern |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 2 | --> $DIR/empty-types.rs:48:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | _ => {} |
| 5 | 5 | | ^------ |
| ... | ... | @@ -9,13 +9,13 @@ LL | _ => {} |
| 9 | 9 | | |
| 10 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 11 | 11 | note: the lint level is defined here |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 12 | --> $DIR/empty-types.rs:14:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | #![deny(unreachable_patterns)] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | 16 | |
| 17 | 17 | error: unreachable pattern |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 18 | --> $DIR/empty-types.rs:51:9 | |
| 19 | 19 | | |
| 20 | 20 | LL | _x => {} |
| 21 | 21 | | ^^------ |
| ... | ... | @@ -26,7 +26,7 @@ LL | _x => {} |
| 26 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 27 | 27 | |
| 28 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 29 | --> $DIR/empty-types.rs:55:11 | |
| 30 | 30 | | |
| 31 | 31 | LL | match ref_never {} |
| 32 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL ~ } |
| 41 | 41 | | |
| 42 | 42 | |
| 43 | 43 | error: unreachable pattern |
| 44 | --> $DIR/empty-types.rs:81:9 | |
| 44 | --> $DIR/empty-types.rs:82:9 | |
| 45 | 45 | | |
| 46 | 46 | LL | _ => {} |
| 47 | 47 | | ^------ |
| ... | ... | @@ -52,7 +52,7 @@ LL | _ => {} |
| 52 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 53 | 53 | |
| 54 | 54 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 55 | --> $DIR/empty-types.rs:85:11 | |
| 55 | --> $DIR/empty-types.rs:86:11 | |
| 56 | 56 | | |
| 57 | 57 | LL | match res_u32_never {} |
| 58 | 58 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -71,7 +71,7 @@ LL ~ } |
| 71 | 71 | | |
| 72 | 72 | |
| 73 | 73 | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered |
| 74 | --> $DIR/empty-types.rs:94:11 | |
| 74 | --> $DIR/empty-types.rs:95:11 | |
| 75 | 75 | | |
| 76 | 76 | LL | match res_u32_never { |
| 77 | 77 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 89 | 89 | | |
| 90 | 90 | |
| 91 | 91 | error[E0005]: refutable pattern in local binding |
| 92 | --> $DIR/empty-types.rs:100:9 | |
| 92 | --> $DIR/empty-types.rs:101:9 | |
| 93 | 93 | | |
| 94 | 94 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 95 | 95 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 103 | 103 | | ++++++++++++++++ |
| 104 | 104 | |
| 105 | 105 | error[E0005]: refutable pattern in local binding |
| 106 | --> $DIR/empty-types.rs:104:9 | |
| 106 | --> $DIR/empty-types.rs:105:9 | |
| 107 | 107 | | |
| 108 | 108 | LL | let Ok(_x) = &res_u32_never; |
| 109 | 109 | | ^^^^^^ pattern `&Err(!)` not covered |
| ... | ... | @@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; |
| 117 | 117 | | ++++++++++++++++ |
| 118 | 118 | |
| 119 | 119 | error: unreachable pattern |
| 120 | --> $DIR/empty-types.rs:130:13 | |
| 120 | --> $DIR/empty-types.rs:131:13 | |
| 121 | 121 | | |
| 122 | 122 | LL | _ => {} |
| 123 | 123 | | ^------ |
| ... | ... | @@ -128,7 +128,7 @@ LL | _ => {} |
| 128 | 128 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 129 | 129 | |
| 130 | 130 | error: unreachable pattern |
| 131 | --> $DIR/empty-types.rs:133:13 | |
| 131 | --> $DIR/empty-types.rs:134:13 | |
| 132 | 132 | | |
| 133 | 133 | LL | _ if false => {} |
| 134 | 134 | | ^--------------- |
| ... | ... | @@ -139,7 +139,7 @@ LL | _ if false => {} |
| 139 | 139 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 140 | 140 | |
| 141 | 141 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 142 | --> $DIR/empty-types.rs:154:15 | |
| 142 | --> $DIR/empty-types.rs:155:15 | |
| 143 | 143 | | |
| 144 | 144 | LL | match *ref_opt_void { |
| 145 | 145 | | ^^^^^^^^^^^^^ pattern `Some(!)` not covered |
| ... | ... | @@ -158,7 +158,7 @@ LL + Some(!) |
| 158 | 158 | | |
| 159 | 159 | |
| 160 | 160 | error: unreachable pattern |
| 161 | --> $DIR/empty-types.rs:197:13 | |
| 161 | --> $DIR/empty-types.rs:198:13 | |
| 162 | 162 | | |
| 163 | 163 | LL | _ => {} |
| 164 | 164 | | ^------ |
| ... | ... | @@ -169,7 +169,7 @@ LL | _ => {} |
| 169 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 170 | 170 | |
| 171 | 171 | error: unreachable pattern |
| 172 | --> $DIR/empty-types.rs:202:13 | |
| 172 | --> $DIR/empty-types.rs:203:13 | |
| 173 | 173 | | |
| 174 | 174 | LL | _ => {} |
| 175 | 175 | | ^------ |
| ... | ... | @@ -180,7 +180,7 @@ LL | _ => {} |
| 180 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 181 | 181 | |
| 182 | 182 | error: unreachable pattern |
| 183 | --> $DIR/empty-types.rs:207:13 | |
| 183 | --> $DIR/empty-types.rs:208:13 | |
| 184 | 184 | | |
| 185 | 185 | LL | _ => {} |
| 186 | 186 | | ^------ |
| ... | ... | @@ -191,7 +191,7 @@ LL | _ => {} |
| 191 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 192 | 192 | |
| 193 | 193 | error: unreachable pattern |
| 194 | --> $DIR/empty-types.rs:212:13 | |
| 194 | --> $DIR/empty-types.rs:213:13 | |
| 195 | 195 | | |
| 196 | 196 | LL | _ => {} |
| 197 | 197 | | ^------ |
| ... | ... | @@ -202,7 +202,7 @@ LL | _ => {} |
| 202 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 203 | 203 | |
| 204 | 204 | error: unreachable pattern |
| 205 | --> $DIR/empty-types.rs:218:13 | |
| 205 | --> $DIR/empty-types.rs:219:13 | |
| 206 | 206 | | |
| 207 | 207 | LL | _ => {} |
| 208 | 208 | | ^------ |
| ... | ... | @@ -213,7 +213,7 @@ LL | _ => {} |
| 213 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 214 | 214 | |
| 215 | 215 | error: unreachable pattern |
| 216 | --> $DIR/empty-types.rs:279:9 | |
| 216 | --> $DIR/empty-types.rs:280:9 | |
| 217 | 217 | | |
| 218 | 218 | LL | _ => {} |
| 219 | 219 | | ^------ |
| ... | ... | @@ -224,7 +224,7 @@ LL | _ => {} |
| 224 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 225 | 225 | |
| 226 | 226 | error[E0005]: refutable pattern in local binding |
| 227 | --> $DIR/empty-types.rs:295:13 | |
| 227 | --> $DIR/empty-types.rs:296:13 | |
| 228 | 228 | | |
| 229 | 229 | LL | let Ok(_) = *ptr_result_never_err; |
| 230 | 230 | | ^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; |
| 238 | 238 | | ++ +++++++++++ |
| 239 | 239 | |
| 240 | 240 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 241 | --> $DIR/empty-types.rs:314:11 | |
| 241 | --> $DIR/empty-types.rs:315:11 | |
| 242 | 242 | | |
| 243 | 243 | LL | match *x {} |
| 244 | 244 | | ^^ |
| ... | ... | @@ -252,7 +252,7 @@ LL ~ } |
| 252 | 252 | | |
| 253 | 253 | |
| 254 | 254 | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty |
| 255 | --> $DIR/empty-types.rs:316:11 | |
| 255 | --> $DIR/empty-types.rs:317:11 | |
| 256 | 256 | | |
| 257 | 257 | LL | match *x {} |
| 258 | 258 | | ^^ |
| ... | ... | @@ -266,7 +266,7 @@ LL ~ } |
| 266 | 266 | | |
| 267 | 267 | |
| 268 | 268 | error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered |
| 269 | --> $DIR/empty-types.rs:318:11 | |
| 269 | --> $DIR/empty-types.rs:319:11 | |
| 270 | 270 | | |
| 271 | 271 | LL | match *x {} |
| 272 | 272 | | ^^ patterns `Ok(!)` and `Err(!)` not covered |
| ... | ... | @@ -288,7 +288,7 @@ LL ~ } |
| 288 | 288 | | |
| 289 | 289 | |
| 290 | 290 | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty |
| 291 | --> $DIR/empty-types.rs:320:11 | |
| 291 | --> $DIR/empty-types.rs:321:11 | |
| 292 | 292 | | |
| 293 | 293 | LL | match *x {} |
| 294 | 294 | | ^^ |
| ... | ... | @@ -302,7 +302,7 @@ LL ~ } |
| 302 | 302 | | |
| 303 | 303 | |
| 304 | 304 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 305 | --> $DIR/empty-types.rs:325:11 | |
| 305 | --> $DIR/empty-types.rs:326:11 | |
| 306 | 306 | | |
| 307 | 307 | LL | match slice_never {} |
| 308 | 308 | | ^^^^^^^^^^^ |
| ... | ... | @@ -316,7 +316,7 @@ LL ~ } |
| 316 | 316 | | |
| 317 | 317 | |
| 318 | 318 | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered |
| 319 | --> $DIR/empty-types.rs:327:11 | |
| 319 | --> $DIR/empty-types.rs:328:11 | |
| 320 | 320 | | |
| 321 | 321 | LL | match slice_never { |
| 322 | 322 | | ^^^^^^^^^^^ pattern `&[!, ..]` not covered |
| ... | ... | @@ -330,7 +330,7 @@ LL + &[!, ..] |
| 330 | 330 | | |
| 331 | 331 | |
| 332 | 332 | error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered |
| 333 | --> $DIR/empty-types.rs:336:11 | |
| 333 | --> $DIR/empty-types.rs:337:11 | |
| 334 | 334 | | |
| 335 | 335 | LL | match slice_never { |
| 336 | 336 | | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered |
| ... | ... | @@ -343,7 +343,7 @@ LL + &[] | &[!] | &[!, !] => todo!() |
| 343 | 343 | | |
| 344 | 344 | |
| 345 | 345 | error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered |
| 346 | --> $DIR/empty-types.rs:350:11 | |
| 346 | --> $DIR/empty-types.rs:351:11 | |
| 347 | 347 | | |
| 348 | 348 | LL | match slice_never { |
| 349 | 349 | | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered |
| ... | ... | @@ -357,7 +357,7 @@ LL + &[] | &[!, ..] => todo!() |
| 357 | 357 | | |
| 358 | 358 | |
| 359 | 359 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 360 | --> $DIR/empty-types.rs:357:11 | |
| 360 | --> $DIR/empty-types.rs:358:11 | |
| 361 | 361 | | |
| 362 | 362 | LL | match *slice_never {} |
| 363 | 363 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -371,7 +371,7 @@ LL ~ } |
| 371 | 371 | | |
| 372 | 372 | |
| 373 | 373 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 374 | --> $DIR/empty-types.rs:386:11 | |
| 374 | --> $DIR/empty-types.rs:387:11 | |
| 375 | 375 | | |
| 376 | 376 | LL | match array_0_never {} |
| 377 | 377 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -385,7 +385,7 @@ LL ~ } |
| 385 | 385 | | |
| 386 | 386 | |
| 387 | 387 | error: unreachable pattern |
| 388 | --> $DIR/empty-types.rs:393:9 | |
| 388 | --> $DIR/empty-types.rs:394:9 | |
| 389 | 389 | | |
| 390 | 390 | LL | [] => {} |
| 391 | 391 | | -- matches all the relevant values |
| ... | ... | @@ -393,7 +393,7 @@ LL | _ => {} |
| 393 | 393 | | ^ no value can reach this |
| 394 | 394 | |
| 395 | 395 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 396 | --> $DIR/empty-types.rs:395:11 | |
| 396 | --> $DIR/empty-types.rs:396:11 | |
| 397 | 397 | | |
| 398 | 398 | LL | match array_0_never { |
| 399 | 399 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -407,7 +407,7 @@ LL + [] => todo!() |
| 407 | 407 | | |
| 408 | 408 | |
| 409 | 409 | error[E0004]: non-exhaustive patterns: `&Some(!)` not covered |
| 410 | --> $DIR/empty-types.rs:449:11 | |
| 410 | --> $DIR/empty-types.rs:450:11 | |
| 411 | 411 | | |
| 412 | 412 | LL | match ref_opt_never { |
| 413 | 413 | | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered |
| ... | ... | @@ -426,7 +426,7 @@ LL + &Some(!) |
| 426 | 426 | | |
| 427 | 427 | |
| 428 | 428 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 429 | --> $DIR/empty-types.rs:490:11 | |
| 429 | --> $DIR/empty-types.rs:491:11 | |
| 430 | 430 | | |
| 431 | 431 | LL | match *ref_opt_never { |
| 432 | 432 | | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered |
| ... | ... | @@ -445,7 +445,7 @@ LL + Some(!) |
| 445 | 445 | | |
| 446 | 446 | |
| 447 | 447 | error[E0004]: non-exhaustive patterns: `Err(!)` not covered |
| 448 | --> $DIR/empty-types.rs:538:11 | |
| 448 | --> $DIR/empty-types.rs:539:11 | |
| 449 | 449 | | |
| 450 | 450 | LL | match *ref_res_never { |
| 451 | 451 | | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -464,7 +464,7 @@ LL + Err(!) |
| 464 | 464 | | |
| 465 | 465 | |
| 466 | 466 | error[E0004]: non-exhaustive patterns: `Err(!)` not covered |
| 467 | --> $DIR/empty-types.rs:549:11 | |
| 467 | --> $DIR/empty-types.rs:550:11 | |
| 468 | 468 | | |
| 469 | 469 | LL | match *ref_res_never { |
| 470 | 470 | | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -483,7 +483,7 @@ LL + Err(!) |
| 483 | 483 | | |
| 484 | 484 | |
| 485 | 485 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 486 | --> $DIR/empty-types.rs:568:11 | |
| 486 | --> $DIR/empty-types.rs:569:11 | |
| 487 | 487 | | |
| 488 | 488 | LL | match *ref_tuple_half_never {} |
| 489 | 489 | | ^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -497,7 +497,7 @@ LL ~ } |
| 497 | 497 | | |
| 498 | 498 | |
| 499 | 499 | error: unreachable pattern |
| 500 | --> $DIR/empty-types.rs:601:9 | |
| 500 | --> $DIR/empty-types.rs:602:9 | |
| 501 | 501 | | |
| 502 | 502 | LL | _ => {} |
| 503 | 503 | | ^------ |
| ... | ... | @@ -508,7 +508,7 @@ LL | _ => {} |
| 508 | 508 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 509 | 509 | |
| 510 | 510 | error: unreachable pattern |
| 511 | --> $DIR/empty-types.rs:604:9 | |
| 511 | --> $DIR/empty-types.rs:605:9 | |
| 512 | 512 | | |
| 513 | 513 | LL | _x => {} |
| 514 | 514 | | ^^------ |
| ... | ... | @@ -519,7 +519,7 @@ LL | _x => {} |
| 519 | 519 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 520 | 520 | |
| 521 | 521 | error: unreachable pattern |
| 522 | --> $DIR/empty-types.rs:607:9 | |
| 522 | --> $DIR/empty-types.rs:608:9 | |
| 523 | 523 | | |
| 524 | 524 | LL | _ if false => {} |
| 525 | 525 | | ^--------------- |
| ... | ... | @@ -530,7 +530,7 @@ LL | _ if false => {} |
| 530 | 530 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 531 | 531 | |
| 532 | 532 | error: unreachable pattern |
| 533 | --> $DIR/empty-types.rs:610:9 | |
| 533 | --> $DIR/empty-types.rs:611:9 | |
| 534 | 534 | | |
| 535 | 535 | LL | _x if false => {} |
| 536 | 536 | | ^^--------------- |
| ... | ... | @@ -541,7 +541,7 @@ LL | _x if false => {} |
| 541 | 541 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 542 | 542 | |
| 543 | 543 | error[E0004]: non-exhaustive patterns: `&!` not covered |
| 544 | --> $DIR/empty-types.rs:635:11 | |
| 544 | --> $DIR/empty-types.rs:636:11 | |
| 545 | 545 | | |
| 546 | 546 | LL | match ref_never { |
| 547 | 547 | | ^^^^^^^^^ pattern `&!` not covered |
| ... | ... | @@ -557,7 +557,7 @@ LL + &! |
| 557 | 557 | | |
| 558 | 558 | |
| 559 | 559 | error[E0004]: non-exhaustive patterns: `Ok(!)` not covered |
| 560 | --> $DIR/empty-types.rs:651:11 | |
| 560 | --> $DIR/empty-types.rs:652:11 | |
| 561 | 561 | | |
| 562 | 562 | LL | match *ref_result_never { |
| 563 | 563 | | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered |
| ... | ... | @@ -577,7 +577,7 @@ LL + Ok(!) |
| 577 | 577 | | |
| 578 | 578 | |
| 579 | 579 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 580 | --> $DIR/empty-types.rs:671:11 | |
| 580 | --> $DIR/empty-types.rs:672:11 | |
| 581 | 581 | | |
| 582 | 582 | LL | match *x { |
| 583 | 583 | | ^^ pattern `Some(!)` not covered |
tests/ui/pattern/usefulness/empty-types.normal.stderr+43-43| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: unreachable pattern |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 2 | --> $DIR/empty-types.rs:48:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | _ => {} |
| 5 | 5 | | ^------ |
| ... | ... | @@ -9,13 +9,13 @@ LL | _ => {} |
| 9 | 9 | | |
| 10 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 11 | 11 | note: the lint level is defined here |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 12 | --> $DIR/empty-types.rs:14:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | #![deny(unreachable_patterns)] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | 16 | |
| 17 | 17 | error: unreachable pattern |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 18 | --> $DIR/empty-types.rs:51:9 | |
| 19 | 19 | | |
| 20 | 20 | LL | _x => {} |
| 21 | 21 | | ^^------ |
| ... | ... | @@ -26,7 +26,7 @@ LL | _x => {} |
| 26 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 27 | 27 | |
| 28 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 29 | --> $DIR/empty-types.rs:55:11 | |
| 30 | 30 | | |
| 31 | 31 | LL | match ref_never {} |
| 32 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL ~ } |
| 41 | 41 | | |
| 42 | 42 | |
| 43 | 43 | error: unreachable pattern |
| 44 | --> $DIR/empty-types.rs:81:9 | |
| 44 | --> $DIR/empty-types.rs:82:9 | |
| 45 | 45 | | |
| 46 | 46 | LL | _ => {} |
| 47 | 47 | | ^------ |
| ... | ... | @@ -52,7 +52,7 @@ LL | _ => {} |
| 52 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 53 | 53 | |
| 54 | 54 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 55 | --> $DIR/empty-types.rs:85:11 | |
| 55 | --> $DIR/empty-types.rs:86:11 | |
| 56 | 56 | | |
| 57 | 57 | LL | match res_u32_never {} |
| 58 | 58 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -71,7 +71,7 @@ LL ~ } |
| 71 | 71 | | |
| 72 | 72 | |
| 73 | 73 | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered |
| 74 | --> $DIR/empty-types.rs:94:11 | |
| 74 | --> $DIR/empty-types.rs:95:11 | |
| 75 | 75 | | |
| 76 | 76 | LL | match res_u32_never { |
| 77 | 77 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 89 | 89 | | |
| 90 | 90 | |
| 91 | 91 | error[E0005]: refutable pattern in local binding |
| 92 | --> $DIR/empty-types.rs:100:9 | |
| 92 | --> $DIR/empty-types.rs:101:9 | |
| 93 | 93 | | |
| 94 | 94 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 95 | 95 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 103 | 103 | | ++++++++++++++++ |
| 104 | 104 | |
| 105 | 105 | error[E0005]: refutable pattern in local binding |
| 106 | --> $DIR/empty-types.rs:104:9 | |
| 106 | --> $DIR/empty-types.rs:105:9 | |
| 107 | 107 | | |
| 108 | 108 | LL | let Ok(_x) = &res_u32_never; |
| 109 | 109 | | ^^^^^^ pattern `&Err(_)` not covered |
| ... | ... | @@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; |
| 117 | 117 | | ++++++++++++++++ |
| 118 | 118 | |
| 119 | 119 | error: unreachable pattern |
| 120 | --> $DIR/empty-types.rs:130:13 | |
| 120 | --> $DIR/empty-types.rs:131:13 | |
| 121 | 121 | | |
| 122 | 122 | LL | _ => {} |
| 123 | 123 | | ^------ |
| ... | ... | @@ -128,7 +128,7 @@ LL | _ => {} |
| 128 | 128 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 129 | 129 | |
| 130 | 130 | error: unreachable pattern |
| 131 | --> $DIR/empty-types.rs:133:13 | |
| 131 | --> $DIR/empty-types.rs:134:13 | |
| 132 | 132 | | |
| 133 | 133 | LL | _ if false => {} |
| 134 | 134 | | ^--------------- |
| ... | ... | @@ -139,7 +139,7 @@ LL | _ if false => {} |
| 139 | 139 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 140 | 140 | |
| 141 | 141 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 142 | --> $DIR/empty-types.rs:154:15 | |
| 142 | --> $DIR/empty-types.rs:155:15 | |
| 143 | 143 | | |
| 144 | 144 | LL | match *ref_opt_void { |
| 145 | 145 | | ^^^^^^^^^^^^^ pattern `Some(_)` not covered |
| ... | ... | @@ -158,7 +158,7 @@ LL + Some(_) => todo!() |
| 158 | 158 | | |
| 159 | 159 | |
| 160 | 160 | error: unreachable pattern |
| 161 | --> $DIR/empty-types.rs:197:13 | |
| 161 | --> $DIR/empty-types.rs:198:13 | |
| 162 | 162 | | |
| 163 | 163 | LL | _ => {} |
| 164 | 164 | | ^------ |
| ... | ... | @@ -169,7 +169,7 @@ LL | _ => {} |
| 169 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 170 | 170 | |
| 171 | 171 | error: unreachable pattern |
| 172 | --> $DIR/empty-types.rs:202:13 | |
| 172 | --> $DIR/empty-types.rs:203:13 | |
| 173 | 173 | | |
| 174 | 174 | LL | _ => {} |
| 175 | 175 | | ^------ |
| ... | ... | @@ -180,7 +180,7 @@ LL | _ => {} |
| 180 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 181 | 181 | |
| 182 | 182 | error: unreachable pattern |
| 183 | --> $DIR/empty-types.rs:207:13 | |
| 183 | --> $DIR/empty-types.rs:208:13 | |
| 184 | 184 | | |
| 185 | 185 | LL | _ => {} |
| 186 | 186 | | ^------ |
| ... | ... | @@ -191,7 +191,7 @@ LL | _ => {} |
| 191 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 192 | 192 | |
| 193 | 193 | error: unreachable pattern |
| 194 | --> $DIR/empty-types.rs:212:13 | |
| 194 | --> $DIR/empty-types.rs:213:13 | |
| 195 | 195 | | |
| 196 | 196 | LL | _ => {} |
| 197 | 197 | | ^------ |
| ... | ... | @@ -202,7 +202,7 @@ LL | _ => {} |
| 202 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 203 | 203 | |
| 204 | 204 | error: unreachable pattern |
| 205 | --> $DIR/empty-types.rs:218:13 | |
| 205 | --> $DIR/empty-types.rs:219:13 | |
| 206 | 206 | | |
| 207 | 207 | LL | _ => {} |
| 208 | 208 | | ^------ |
| ... | ... | @@ -213,7 +213,7 @@ LL | _ => {} |
| 213 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 214 | 214 | |
| 215 | 215 | error: unreachable pattern |
| 216 | --> $DIR/empty-types.rs:279:9 | |
| 216 | --> $DIR/empty-types.rs:280:9 | |
| 217 | 217 | | |
| 218 | 218 | LL | _ => {} |
| 219 | 219 | | ^------ |
| ... | ... | @@ -224,7 +224,7 @@ LL | _ => {} |
| 224 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 225 | 225 | |
| 226 | 226 | error[E0005]: refutable pattern in local binding |
| 227 | --> $DIR/empty-types.rs:295:13 | |
| 227 | --> $DIR/empty-types.rs:296:13 | |
| 228 | 228 | | |
| 229 | 229 | LL | let Ok(_) = *ptr_result_never_err; |
| 230 | 230 | | ^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; |
| 238 | 238 | | ++ +++++++++++ |
| 239 | 239 | |
| 240 | 240 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 241 | --> $DIR/empty-types.rs:314:11 | |
| 241 | --> $DIR/empty-types.rs:315:11 | |
| 242 | 242 | | |
| 243 | 243 | LL | match *x {} |
| 244 | 244 | | ^^ |
| ... | ... | @@ -252,7 +252,7 @@ LL ~ } |
| 252 | 252 | | |
| 253 | 253 | |
| 254 | 254 | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty |
| 255 | --> $DIR/empty-types.rs:316:11 | |
| 255 | --> $DIR/empty-types.rs:317:11 | |
| 256 | 256 | | |
| 257 | 257 | LL | match *x {} |
| 258 | 258 | | ^^ |
| ... | ... | @@ -266,7 +266,7 @@ LL ~ } |
| 266 | 266 | | |
| 267 | 267 | |
| 268 | 268 | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered |
| 269 | --> $DIR/empty-types.rs:318:11 | |
| 269 | --> $DIR/empty-types.rs:319:11 | |
| 270 | 270 | | |
| 271 | 271 | LL | match *x {} |
| 272 | 272 | | ^^ patterns `Ok(_)` and `Err(_)` not covered |
| ... | ... | @@ -288,7 +288,7 @@ LL ~ } |
| 288 | 288 | | |
| 289 | 289 | |
| 290 | 290 | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty |
| 291 | --> $DIR/empty-types.rs:320:11 | |
| 291 | --> $DIR/empty-types.rs:321:11 | |
| 292 | 292 | | |
| 293 | 293 | LL | match *x {} |
| 294 | 294 | | ^^ |
| ... | ... | @@ -302,7 +302,7 @@ LL ~ } |
| 302 | 302 | | |
| 303 | 303 | |
| 304 | 304 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 305 | --> $DIR/empty-types.rs:325:11 | |
| 305 | --> $DIR/empty-types.rs:326:11 | |
| 306 | 306 | | |
| 307 | 307 | LL | match slice_never {} |
| 308 | 308 | | ^^^^^^^^^^^ |
| ... | ... | @@ -316,7 +316,7 @@ LL ~ } |
| 316 | 316 | | |
| 317 | 317 | |
| 318 | 318 | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered |
| 319 | --> $DIR/empty-types.rs:327:11 | |
| 319 | --> $DIR/empty-types.rs:328:11 | |
| 320 | 320 | | |
| 321 | 321 | LL | match slice_never { |
| 322 | 322 | | ^^^^^^^^^^^ pattern `&[_, ..]` not covered |
| ... | ... | @@ -330,7 +330,7 @@ LL + &[_, ..] => todo!() |
| 330 | 330 | | |
| 331 | 331 | |
| 332 | 332 | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered |
| 333 | --> $DIR/empty-types.rs:336:11 | |
| 333 | --> $DIR/empty-types.rs:337:11 | |
| 334 | 334 | | |
| 335 | 335 | LL | match slice_never { |
| 336 | 336 | | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered |
| ... | ... | @@ -343,7 +343,7 @@ LL + &[] | &[_] | &[_, _] => todo!() |
| 343 | 343 | | |
| 344 | 344 | |
| 345 | 345 | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered |
| 346 | --> $DIR/empty-types.rs:350:11 | |
| 346 | --> $DIR/empty-types.rs:351:11 | |
| 347 | 347 | | |
| 348 | 348 | LL | match slice_never { |
| 349 | 349 | | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered |
| ... | ... | @@ -357,7 +357,7 @@ LL + &[] | &[_, ..] => todo!() |
| 357 | 357 | | |
| 358 | 358 | |
| 359 | 359 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 360 | --> $DIR/empty-types.rs:357:11 | |
| 360 | --> $DIR/empty-types.rs:358:11 | |
| 361 | 361 | | |
| 362 | 362 | LL | match *slice_never {} |
| 363 | 363 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -371,7 +371,7 @@ LL ~ } |
| 371 | 371 | | |
| 372 | 372 | |
| 373 | 373 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 374 | --> $DIR/empty-types.rs:386:11 | |
| 374 | --> $DIR/empty-types.rs:387:11 | |
| 375 | 375 | | |
| 376 | 376 | LL | match array_0_never {} |
| 377 | 377 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -385,7 +385,7 @@ LL ~ } |
| 385 | 385 | | |
| 386 | 386 | |
| 387 | 387 | error: unreachable pattern |
| 388 | --> $DIR/empty-types.rs:393:9 | |
| 388 | --> $DIR/empty-types.rs:394:9 | |
| 389 | 389 | | |
| 390 | 390 | LL | [] => {} |
| 391 | 391 | | -- matches all the relevant values |
| ... | ... | @@ -393,7 +393,7 @@ LL | _ => {} |
| 393 | 393 | | ^ no value can reach this |
| 394 | 394 | |
| 395 | 395 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 396 | --> $DIR/empty-types.rs:395:11 | |
| 396 | --> $DIR/empty-types.rs:396:11 | |
| 397 | 397 | | |
| 398 | 398 | LL | match array_0_never { |
| 399 | 399 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -407,7 +407,7 @@ LL + [] => todo!() |
| 407 | 407 | | |
| 408 | 408 | |
| 409 | 409 | error[E0004]: non-exhaustive patterns: `&Some(_)` not covered |
| 410 | --> $DIR/empty-types.rs:449:11 | |
| 410 | --> $DIR/empty-types.rs:450:11 | |
| 411 | 411 | | |
| 412 | 412 | LL | match ref_opt_never { |
| 413 | 413 | | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered |
| ... | ... | @@ -426,7 +426,7 @@ LL + &Some(_) => todo!() |
| 426 | 426 | | |
| 427 | 427 | |
| 428 | 428 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 429 | --> $DIR/empty-types.rs:490:11 | |
| 429 | --> $DIR/empty-types.rs:491:11 | |
| 430 | 430 | | |
| 431 | 431 | LL | match *ref_opt_never { |
| 432 | 432 | | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered |
| ... | ... | @@ -445,7 +445,7 @@ LL + Some(_) => todo!() |
| 445 | 445 | | |
| 446 | 446 | |
| 447 | 447 | error[E0004]: non-exhaustive patterns: `Err(_)` not covered |
| 448 | --> $DIR/empty-types.rs:538:11 | |
| 448 | --> $DIR/empty-types.rs:539:11 | |
| 449 | 449 | | |
| 450 | 450 | LL | match *ref_res_never { |
| 451 | 451 | | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -464,7 +464,7 @@ LL + Err(_) => todo!() |
| 464 | 464 | | |
| 465 | 465 | |
| 466 | 466 | error[E0004]: non-exhaustive patterns: `Err(_)` not covered |
| 467 | --> $DIR/empty-types.rs:549:11 | |
| 467 | --> $DIR/empty-types.rs:550:11 | |
| 468 | 468 | | |
| 469 | 469 | LL | match *ref_res_never { |
| 470 | 470 | | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -483,7 +483,7 @@ LL + Err(_) => todo!() |
| 483 | 483 | | |
| 484 | 484 | |
| 485 | 485 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 486 | --> $DIR/empty-types.rs:568:11 | |
| 486 | --> $DIR/empty-types.rs:569:11 | |
| 487 | 487 | | |
| 488 | 488 | LL | match *ref_tuple_half_never {} |
| 489 | 489 | | ^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -497,7 +497,7 @@ LL ~ } |
| 497 | 497 | | |
| 498 | 498 | |
| 499 | 499 | error: unreachable pattern |
| 500 | --> $DIR/empty-types.rs:601:9 | |
| 500 | --> $DIR/empty-types.rs:602:9 | |
| 501 | 501 | | |
| 502 | 502 | LL | _ => {} |
| 503 | 503 | | ^------ |
| ... | ... | @@ -508,7 +508,7 @@ LL | _ => {} |
| 508 | 508 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 509 | 509 | |
| 510 | 510 | error: unreachable pattern |
| 511 | --> $DIR/empty-types.rs:604:9 | |
| 511 | --> $DIR/empty-types.rs:605:9 | |
| 512 | 512 | | |
| 513 | 513 | LL | _x => {} |
| 514 | 514 | | ^^------ |
| ... | ... | @@ -519,7 +519,7 @@ LL | _x => {} |
| 519 | 519 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 520 | 520 | |
| 521 | 521 | error: unreachable pattern |
| 522 | --> $DIR/empty-types.rs:607:9 | |
| 522 | --> $DIR/empty-types.rs:608:9 | |
| 523 | 523 | | |
| 524 | 524 | LL | _ if false => {} |
| 525 | 525 | | ^--------------- |
| ... | ... | @@ -530,7 +530,7 @@ LL | _ if false => {} |
| 530 | 530 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 531 | 531 | |
| 532 | 532 | error: unreachable pattern |
| 533 | --> $DIR/empty-types.rs:610:9 | |
| 533 | --> $DIR/empty-types.rs:611:9 | |
| 534 | 534 | | |
| 535 | 535 | LL | _x if false => {} |
| 536 | 536 | | ^^--------------- |
| ... | ... | @@ -541,7 +541,7 @@ LL | _x if false => {} |
| 541 | 541 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 542 | 542 | |
| 543 | 543 | error[E0004]: non-exhaustive patterns: `&_` not covered |
| 544 | --> $DIR/empty-types.rs:635:11 | |
| 544 | --> $DIR/empty-types.rs:636:11 | |
| 545 | 545 | | |
| 546 | 546 | LL | match ref_never { |
| 547 | 547 | | ^^^^^^^^^ pattern `&_` not covered |
| ... | ... | @@ -557,7 +557,7 @@ LL + &_ => todo!() |
| 557 | 557 | | |
| 558 | 558 | |
| 559 | 559 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 560 | --> $DIR/empty-types.rs:651:11 | |
| 560 | --> $DIR/empty-types.rs:652:11 | |
| 561 | 561 | | |
| 562 | 562 | LL | match *ref_result_never { |
| 563 | 563 | | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -577,7 +577,7 @@ LL + Ok(_) => todo!() |
| 577 | 577 | | |
| 578 | 578 | |
| 579 | 579 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 580 | --> $DIR/empty-types.rs:671:11 | |
| 580 | --> $DIR/empty-types.rs:672:11 | |
| 581 | 581 | | |
| 582 | 582 | LL | match *x { |
| 583 | 583 | | ^^ pattern `Some(_)` not covered |
tests/ui/pattern/usefulness/empty-types.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ revisions: normal exhaustive_patterns never_pats |
| 2 | 2 | //@ edition: 2024 |
| 3 | //@ ignore-parallel-frontend pattern matching error message mismatch | |
| 3 | 4 | // |
| 4 | 5 | // This tests correct handling of empty types in exhaustiveness checking. |
| 5 | 6 | // |
tests/ui/pin-ergonomics/pinned-drop-sugar-not-other-traits.rs-2| ... | ... | @@ -12,7 +12,6 @@ trait NeedsPinDrop { |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | impl NeedsPinDrop for S { |
| 15 | //~^ ERROR not all trait items implemented, missing: `pin_drop` [E0046] | |
| 16 | 15 | fn drop(&pin mut self) {} |
| 17 | 16 | //~^ ERROR method `drop` with `&pin mut self` is only supported for the `Drop` trait |
| 18 | 17 | } |
| ... | ... | @@ -53,7 +52,6 @@ mod local_drop_trait { |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | impl Drop for S { |
| 56 | //~^ ERROR not all trait items implemented, missing: `pin_drop` [E0046] | |
| 57 | 55 | fn drop(&pin mut self) {} |
| 58 | 56 | //~^ ERROR method `drop` with `&pin mut self` is only supported for the `Drop` trait |
| 59 | 57 | } |
tests/ui/pin-ergonomics/pinned-drop-sugar-not-other-traits.stderr+7-25| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0407]: method `drop` is not a member of trait `HasDrop` |
| 2 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:26:5 | |
| 2 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:25:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn drop(&pin mut self) {} |
| 5 | 5 | | ^^^----^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -8,7 +8,7 @@ LL | fn drop(&pin mut self) {} |
| 8 | 8 | | not a member of trait `HasDrop` |
| 9 | 9 | |
| 10 | 10 | error[E0407]: method `drop` is not a member of trait `HasPinnedDropReceiver` |
| 11 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:36:5 | |
| 11 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:35:5 | |
| 12 | 12 | | |
| 13 | 13 | LL | fn drop(&pin mut self) {} |
| 14 | 14 | | ^^^----^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -17,28 +17,19 @@ LL | fn drop(&pin mut self) {} |
| 17 | 17 | | not a member of trait `HasPinnedDropReceiver` |
| 18 | 18 | |
| 19 | 19 | error: method `drop` with `&pin mut self` is only supported for the `Drop` trait |
| 20 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:16:5 | |
| 20 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:15:5 | |
| 21 | 21 | | |
| 22 | 22 | LL | fn drop(&pin mut self) {} |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a `Drop::pin_drop` implementation |
| 24 | 24 | |
| 25 | 25 | error: method `drop` with `&pin mut self` is only supported for the `Drop` trait |
| 26 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:57:9 | |
| 26 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:55:9 | |
| 27 | 27 | | |
| 28 | 28 | LL | fn drop(&pin mut self) {} |
| 29 | 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a `Drop::pin_drop` implementation |
| 30 | 30 | |
| 31 | error[E0046]: not all trait items implemented, missing: `pin_drop` | |
| 32 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:14:1 | |
| 33 | | | |
| 34 | LL | fn pin_drop(self: Pin<&mut Self>); | |
| 35 | | ---------------------------------- `pin_drop` from trait | |
| 36 | ... | |
| 37 | LL | impl NeedsPinDrop for S { | |
| 38 | | ^^^^^^^^^^^^^^^^^^^^^^^ missing `pin_drop` in implementation | |
| 39 | ||
| 40 | 31 | error[E0046]: not all trait items implemented, missing: `drop` |
| 41 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:24:1 | |
| 32 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:23:1 | |
| 42 | 33 | | |
| 43 | 34 | LL | fn drop(self: Pin<&mut Self>); |
| 44 | 35 | | ------------------------------ `drop` from trait |
| ... | ... | @@ -47,7 +38,7 @@ LL | impl HasDrop for S { |
| 47 | 38 | | ^^^^^^^^^^^^^^^^^^ missing `drop` in implementation |
| 48 | 39 | |
| 49 | 40 | error[E0046]: not all trait items implemented, missing: `drop` |
| 50 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:34:1 | |
| 41 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:33:1 | |
| 51 | 42 | | |
| 52 | 43 | LL | fn drop(self: &pin mut Self); |
| 53 | 44 | | ----------------------------- `drop` from trait |
| ... | ... | @@ -55,16 +46,7 @@ LL | fn drop(self: &pin mut Self); |
| 55 | 46 | LL | impl HasPinnedDropReceiver for S { |
| 56 | 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation |
| 57 | 48 | |
| 58 | error[E0046]: not all trait items implemented, missing: `pin_drop` | |
| 59 | --> $DIR/pinned-drop-sugar-not-other-traits.rs:55:5 | |
| 60 | | | |
| 61 | LL | fn pin_drop(self: Pin<&mut Self>); | |
| 62 | | ---------------------------------- `pin_drop` from trait | |
| 63 | ... | |
| 64 | LL | impl Drop for S { | |
| 65 | | ^^^^^^^^^^^^^^^ missing `pin_drop` in implementation | |
| 66 | ||
| 67 | error: aborting due to 8 previous errors | |
| 49 | error: aborting due to 6 previous errors | |
| 68 | 50 | |
| 69 | 51 | Some errors have detailed explanations: E0046, E0407. |
| 70 | 52 | For more information about an error, try `rustc --explain E0046`. |
tests/ui/target-feature/implied-features-nvptx.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | //@ assembly-output: ptx-linker | |
| 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_80 -Z unstable-options -Clinker-flavor=llbc | |
| 1 | //@ assembly-output: emit-asm | |
| 2 | //@ compile-flags: --crate-type cdylib -C target-cpu=sm_80 | |
| 3 | 3 | //@ only-nvptx64 |
| 4 | 4 | //@ build-pass |
| 5 | 5 | #![no_std] |
tests/ui/target-feature/invalid-attribute.stderr+3-3| ... | ... | @@ -174,7 +174,7 @@ error: the feature named `foo` is not valid for this target |
| 174 | 174 | LL | #[target_feature(enable = "foo")] |
| 175 | 175 | | ^^^^^^^^^^^^^^ `foo` is not valid for this target |
| 176 | 176 | | |
| 177 | = help: valid names are: `fma`, `xop`, `adx`, `aes`, and `avx` and 75 more | |
| 177 | = help: valid names are: `fma`, `xop`, `adx`, `aes`, and `avx` and 76 more | |
| 178 | 178 | |
| 179 | 179 | error[E0046]: not all trait items implemented, missing: `foo` |
| 180 | 180 | --> $DIR/invalid-attribute.rs:80:1 |
| ... | ... | @@ -226,7 +226,7 @@ error: the feature named `sse5` is not valid for this target |
| 226 | 226 | LL | #[target_feature(enable = "sse5")] |
| 227 | 227 | | ^^^^^^^^^^^^^^^ `sse5` is not valid for this target |
| 228 | 228 | | |
| 229 | = help: valid names are: `sse`, `sse2`, `sse3`, `sse4a`, and `ssse3` and 75 more | |
| 229 | = help: valid names are: `sse`, `sse2`, `sse3`, `sse4a`, and `ssse3` and 76 more | |
| 230 | 230 | |
| 231 | 231 | error: the feature named `avx512` is not valid for this target |
| 232 | 232 | --> $DIR/invalid-attribute.rs:126:18 |
| ... | ... | @@ -234,7 +234,7 @@ error: the feature named `avx512` is not valid for this target |
| 234 | 234 | LL | #[target_feature(enable = "avx512")] |
| 235 | 235 | | ^^^^^^^^^^^^^^^^^ `avx512` is not valid for this target |
| 236 | 236 | | |
| 237 | = help: valid names are: `avx512f`, `avx2`, `avx512bw`, `avx512cd`, and `avx512dq` and 75 more | |
| 237 | = help: valid names are: `avx512f`, `avx2`, `avx512bw`, `avx512cd`, and `avx512dq` and 76 more | |
| 238 | 238 | |
| 239 | 239 | error: aborting due to 26 previous errors |
| 240 | 240 |