diff options
| author | Michael Goulet <michael@errs.io> | 2024-02-16 15:07:32 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-02-16 15:07:37 +0000 |
| commit | f624d55ea77b1b24e9294818ee1d6b1da9d0ec2d (patch) | |
| tree | 73c756a8874ee51120d6acf61fc6c32904d26ba9 | |
| parent | a9dbf63087049549a74c0f31705df92bcf15098f (diff) | |
| download | rust-f624d55ea77b1b24e9294818ee1d6b1da9d0ec2d.tar.gz rust-f624d55ea77b1b24e9294818ee1d6b1da9d0ec2d.zip | |
Nits
| -rw-r--r-- | compiler/rustc_infer/src/traits/engine.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/extension.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/normalize.rs | 6 |
3 files changed, 15 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/traits/engine.rs b/compiler/rustc_infer/src/traits/engine.rs index ffd120fa4a4..c495810858f 100644 --- a/compiler/rustc_infer/src/traits/engine.rs +++ b/compiler/rustc_infer/src/traits/engine.rs @@ -64,6 +64,7 @@ impl<'tcx, T: ?Sized + TraitEngine<'tcx>> T { } } + #[must_use] fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> { let errors = self.select_where_possible(infcx); if !errors.is_empty() { diff --git a/compiler/rustc_macros/src/extension.rs b/compiler/rustc_macros/src/extension.rs index 7830137f218..5377bbdfeab 100644 --- a/compiler/rustc_macros/src/extension.rs +++ b/compiler/rustc_macros/src/extension.rs @@ -68,7 +68,14 @@ pub(crate) fn extension( /// Only keep `#[doc]` attrs. fn scrub_attrs(attrs: &[Attribute]) -> Vec<Attribute> { - attrs.into_iter().cloned().filter(|attr| attr.path().segments[0].ident == "doc").collect() + attrs + .into_iter() + .cloned() + .filter(|attr| { + let ident = &attr.path().segments[0].ident; + ident == "doc" || ident == "must_use" + }) + .collect() } /// Scrub arguments so that they're valid for trait signatures. diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index 6ed9ac91027..0f6c0abd280 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -37,6 +37,12 @@ impl<'cx, 'tcx> At<'cx, 'tcx> { /// normalizing, but for now should be used only when we actually /// know that normalization will succeed, since error reporting /// and other details are still "under development". + /// + /// This normalization should *only* be used when the projection does not + /// have possible ambiguity or may not be well-formed. + /// + /// After codegen, when lifetimes do not matter, it is preferable to instead + /// use [`TyCtxt::normalize_erasing_regions`], which wraps this procedure. fn query_normalize<T>(self, value: T) -> Result<Normalized<'tcx, T>, NoSolution> where T: TypeFoldable<TyCtxt<'tcx>>, |
