diff --git a/Cargo.lock b/Cargo.lock index 74bb3c8e6c285..82530c019a91c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,47 +132,36 @@ checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" [[package]] name = "askama" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d8f355701c672c2ba3d718acbd213f740beea577cc4eae66accdffe15be1882" +checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e" dependencies = [ "askama_derive", "askama_escape", - "askama_shared", ] [[package]] name = "askama_derive" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84704cab5b7ae0fd3a9f78ee5eb7b27f3749df445f04623db6633459ae283267" -dependencies = [ - "askama_shared", - "proc-macro2", - "syn", -] - -[[package]] -name = "askama_escape" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1bb320f97e6edf9f756bf015900038e43c7700e059688e5724a928c8f3b8d5" - -[[package]] -name = "askama_shared" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae03eebba55a2697a376e58b573a29fe36893157173ac8df312ad85f3c0e012" +checksum = "e80b5ad1afe82872b7aa3e9de9b206ecb85584aa324f0f60fa4c903ce935936b" dependencies = [ - "askama_escape", + "basic-toml", + "mime", + "mime_guess", "nom", "proc-macro2", "quote", "serde", "syn", - "toml 0.5.7", ] +[[package]] +name = "askama_escape" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" + [[package]] name = "atty" version = "0.2.14" @@ -223,6 +212,15 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +[[package]] +name = "basic-toml" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -2614,6 +2612,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minifier" version = "0.2.2" diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 4f4779d154395..e6d6586d5eefd 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -348,6 +348,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.downgrade_to_delayed_bug(); } + if tcx.ty_is_opaque_future(rcvr_ty) && item_name.name == sym::poll { + err.help(&format!( + "method `poll` found on `Pin<&mut {ty_str}>`, \ + see documentation for `std::pin::Pin`" + )); + err.help("self type must be pinned to call `Future::poll`, \ + see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice" + ); + } + if let Mode::MethodCall = mode && let SelfSource::MethodCall(cal) = source { self.suggest_await_before_method( &mut err, item_name, rcvr_ty, cal, span, expected.only_has_type(self), diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 387843ee69333..fb067e7ac2135 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -114,24 +114,26 @@ pub struct InferCtxtInner<'tcx> { float_unification_storage: ut::UnificationTableStorage, /// Tracks the set of region variables and the constraints between them. + /// /// This is initially `Some(_)` but when /// `resolve_regions_and_report_errors` is invoked, this gets set to `None` /// -- further attempts to perform unification, etc., may fail if new /// region constraints would've been added. region_constraint_storage: Option>, - /// A set of constraints that regionck must validate. Each - /// constraint has the form `T:'a`, meaning "some type `T` must + /// A set of constraints that regionck must validate. + /// + /// Each constraint has the form `T:'a`, meaning "some type `T` must /// outlive the lifetime 'a". These constraints derive from /// instantiated type parameters. So if you had a struct defined - /// like + /// like the following: /// ```ignore (illustrative) - /// struct Foo { ... } + /// struct Foo { ... } /// ``` - /// then in some expression `let x = Foo { ... }` it will + /// In some expression `let x = Foo { ... }`, it will /// instantiate the type parameter `T` with a fresh type `$0`. At /// the same time, it will record a region obligation of - /// `$0:'static`. This will get checked later by regionck. (We + /// `$0: 'static`. This will get checked later by regionck. (We /// can't generally check these things right away because we have /// to wait until types are resolved.) /// @@ -268,7 +270,7 @@ pub struct InferCtxt<'tcx> { /// Caches the results of trait evaluation. pub evaluation_cache: select::EvaluationCache<'tcx>, - /// the set of predicates on which errors have been reported, to + /// The set of predicates on which errors have been reported, to /// avoid reporting the same error twice. pub reported_trait_errors: RefCell>>>, @@ -291,7 +293,7 @@ pub struct InferCtxt<'tcx> { tainted_by_errors: Cell>, /// Track how many errors were reported when this infcx is created. - /// If the number of errors increases, that's also a sign (line + /// If the number of errors increases, that's also a sign (like /// `tainted_by_errors`) to avoid reporting certain kinds of errors. // FIXME(matthewjasper) Merge into `tainted_by_errors` err_count_on_creation: usize, @@ -313,7 +315,7 @@ pub struct InferCtxt<'tcx> { /// During coherence we have to assume that other crates may add /// additional impls which we currently don't know about. /// - /// To deal with this evaluation should be conservative + /// To deal with this evaluation, we should be conservative /// and consider the possibility of impls from outside this crate. /// This comes up primarily when resolving ambiguity. Imagine /// there is some trait reference `$0: Bar` where `$0` is an @@ -323,7 +325,7 @@ pub struct InferCtxt<'tcx> { /// bound to some type that in a downstream crate that implements /// `Bar`. /// - /// Outside of coherence we set this to false because we are only + /// Outside of coherence, we set this to false because we are only /// interested in types that the user could actually have written. /// In other words, we consider `$0: Bar` to be unimplemented if /// there is no type that the user could *actually name* that @@ -373,7 +375,7 @@ pub enum SubregionOrigin<'tcx> { Subtype(Box>), /// When casting `&'a T` to an `&'b Trait` object, - /// relating `'a` to `'b` + /// relating `'a` to `'b`. RelateObjectBound(Span), /// Some type parameter was instantiated with the given type, @@ -384,7 +386,7 @@ pub enum SubregionOrigin<'tcx> { /// that must outlive some other region. RelateRegionParamBound(Span), - /// Creating a pointer `b` to contents of another reference + /// Creating a pointer `b` to contents of another reference. Reborrow(Span), /// (&'a &'b T) where a >= b @@ -398,7 +400,7 @@ pub enum SubregionOrigin<'tcx> { trait_item_def_id: DefId, }, - /// Checking that the bounds of a trait's associated type hold for a given impl + /// Checking that the bounds of a trait's associated type hold for a given impl. CheckAssociatedTypeBounds { parent: Box>, impl_item_def_id: LocalDefId, @@ -435,32 +437,33 @@ pub enum LateBoundRegionConversionTime { AssocTypeProjection(DefId), } -/// Reasons to create a region inference variable +/// Reasons to create a region inference variable. /// -/// See `error_reporting` module for more details +/// See `error_reporting` module for more details. #[derive(Copy, Clone, Debug)] pub enum RegionVariableOrigin { - /// Region variables created for ill-categorized reasons, - /// mostly indicates places in need of refactoring + /// Region variables created for ill-categorized reasons. + /// + /// They mostly indicate places in need of refactoring. MiscVariable(Span), - /// Regions created by a `&P` or `[...]` pattern + /// Regions created by a `&P` or `[...]` pattern. PatternRegion(Span), - /// Regions created by `&` operator + /// Regions created by `&` operator. + /// AddrOfRegion(Span), - - /// Regions created as part of an autoref of a method receiver + /// Regions created as part of an autoref of a method receiver. Autoref(Span), - /// Regions created as part of an automatic coercion + /// Regions created as part of an automatic coercion. Coercion(Span), - /// Region variables created as the values for early-bound regions + /// Region variables created as the values for early-bound regions. EarlyBoundRegion(Span, Symbol), /// Region variables created for bound regions - /// in a function or method that is called + /// in a function or method that is called. LateBoundRegion(Span, ty::BoundRegionKind, LateBoundRegionConversionTime), UpvarRegion(ty::UpvarId, Span), @@ -534,7 +537,7 @@ impl<'tcx> fmt::Display for FixupError<'tcx> { } } -/// Used to configure inference contexts before their creation +/// Used to configure inference contexts before their creation. pub struct InferCtxtBuilder<'tcx> { tcx: TyCtxt<'tcx>, defining_use_anchor: DefiningAnchor, @@ -835,9 +838,9 @@ impl<'tcx> InferCtxt<'tcx> { /// Scan the constraints produced since `snapshot` began and returns: /// - /// - `None` -- if none of them involve "region outlives" constraints - /// - `Some(true)` -- if there are `'a: 'b` constraints where `'a` or `'b` is a placeholder - /// - `Some(false)` -- if there are `'a: 'b` constraints but none involve placeholders + /// - `None` -- if none of them involves "region outlives" constraints. + /// - `Some(true)` -- if there are `'a: 'b` constraints where `'a` or `'b` is a placeholder. + /// - `Some(false)` -- if there are `'a: 'b` constraints but none involve placeholders. pub fn region_constraints_added_in_snapshot( &self, snapshot: &CombinedSnapshot<'tcx>, @@ -1770,7 +1773,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } } -/// Helper for `ty_or_const_infer_var_changed` (see comment on that), currently +/// Helper for [InferCtxt::ty_or_const_infer_var_changed] (see comment on that), currently /// used only for `traits::fulfill`'s list of `stalled_on` inference variables. #[derive(Copy, Clone, Debug)] pub enum TyOrConstInferVar<'tcx> { diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index dbba529aef7a5..09d2eb96d0f16 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -1,5 +1,6 @@ use rustc_middle::mir::interpret::{ConstValue, Scalar}; use rustc_middle::mir::tcx::PlaceTy; +use rustc_middle::ty::cast::mir_cast_kind; use rustc_middle::{mir::*, thir::*, ty}; use rustc_span::Span; use rustc_target::abi::VariantIdx; @@ -142,7 +143,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { } fn parse_rvalue(&self, expr_id: ExprId) -> PResult> { - parse_by_kind!(self, expr_id, _, "rvalue", + parse_by_kind!(self, expr_id, expr, "rvalue", @call("mir_discriminant", args) => self.parse_place(args[0]).map(Rvalue::Discriminant), @call("mir_checked", args) => { parse_by_kind!(self, args[0], _, "binary op", @@ -167,6 +168,12 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { ExprKind::Repeat { value, count } => Ok( Rvalue::Repeat(self.parse_operand(*value)?, *count) ), + ExprKind::Cast { source } => { + let source = self.parse_operand(*source)?; + let source_ty = source.ty(self.body.local_decls(), self.tcx); + let cast_kind = mir_cast_kind(source_ty, expr.ty); + Ok(Rvalue::Cast(cast_kind, source, expr.ty)) + }, _ => self.parse_operand(expr_id).map(Rvalue::Use), ) } diff --git a/config.toml.example b/config.toml.example index 267aa8cb54838..a12c4e0700c88 100644 --- a/config.toml.example +++ b/config.toml.example @@ -75,11 +75,6 @@ changelog-seen = 2 # or alternatively ... #ccache = "/path/to/ccache" -# If an external LLVM root is specified, we automatically check the version by -# default to make sure it's within the range that we're expecting, but setting -# this flag will indicate that this version check should not be done. -#version-check = true - # When true, link libstdc++ statically into the rustc_llvm. # This is useful if you don't want to use the dynamic version of that # library provided by LLVM. diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index 4105fa5ec9600..648eb553c78c1 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `remote-test-server`'s `verbose` argument has been removed in favor of the `--verbose` flag - `remote-test-server`'s `remote` argument has been removed in favor of the `--bind` flag. Use `--bind 0.0.0.0:12345` to replicate the behavior of the `remote` argument. - `x.py fmt` now formats only files modified between the merge-base of HEAD and the last commit in the master branch of the rust-lang repository and the current working directory. To restore old behaviour, use `x.py fmt .`. The check mode is not affected by this change. [#105702](https://github.com/rust-lang/rust/pull/105702) +- The `llvm.version-check` config option has been removed. Older versions were never supported. If you still need to support older versions (e.g. you are applying custom patches), patch `check_llvm_version` in bootstrap to change the minimum version. [#108619](https://github.com/rust-lang/rust/pull/108619) ### Non-breaking changes diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index bf1aff7b72f47..6e64bc20d2079 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -118,7 +118,6 @@ pub struct Config { pub llvm_optimize: bool, pub llvm_thin_lto: bool, pub llvm_release_debuginfo: bool, - pub llvm_version_check: bool, pub llvm_static_stdcpp: bool, /// `None` if `llvm_from_ci` is true and we haven't yet downloaded llvm. #[cfg(not(test))] @@ -672,7 +671,6 @@ define_config! { tests: Option = "tests", plugins: Option = "plugins", ccache: Option = "ccache", - version_check: Option = "version-check", static_libstdcpp: Option = "static-libstdcpp", ninja: Option = "ninja", targets: Option = "targets", @@ -804,7 +802,6 @@ impl Config { let mut config = Config::default(); config.llvm_optimize = true; config.ninja_in_file = true; - config.llvm_version_check = true; config.llvm_static_stdcpp = false; config.backtrace = true; config.rust_optimize = true; @@ -1166,7 +1163,6 @@ impl Config { set(&mut config.llvm_optimize, llvm.optimize); set(&mut config.llvm_thin_lto, llvm.thin_lto); set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo); - set(&mut config.llvm_version_check, llvm.version_check); set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp); if let Some(v) = llvm.link_shared { config.llvm_link_shared.set(Some(v)); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index c0d382d8a503b..5278f0c10b3d2 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -44,7 +44,6 @@ def v(*args): o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ for LLVM") o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)") o("rpath", "rust.rpath", "build rpaths into rustc itself") -o("llvm-version-check", "llvm.version-check", "check if the LLVM version is supported, build anyway") o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests") o("option-checking", None, "complain about unrecognized options in this configure script") o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)") diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 8453a25f38a56..909e7d83a1599 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -520,10 +520,6 @@ impl Step for Llvm { } fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { - if !builder.config.llvm_version_check { - return; - } - if builder.config.dry_run() { return; } diff --git a/src/doc/unstable-book/src/compiler-flags/cf-protection.md b/src/doc/unstable-book/src/compiler-flags/cf-protection.md index ab698c82ba922..efe5f5642b8af 100644 --- a/src/doc/unstable-book/src/compiler-flags/cf-protection.md +++ b/src/doc/unstable-book/src/compiler-flags/cf-protection.md @@ -1,5 +1,9 @@ # `cf-protection` +The tracking issue for this feature is: [#93754](https://github.com/rust-lang/rust/issues/93754). + +------------------------ + This option enables control-flow enforcement technology (CET) on x86; a more detailed description of CET is available [here]. Similar to `clang`, this flag takes one of the following values: diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index c48f7998c5a01..6ca6edfd3c9fe 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -8,7 +8,7 @@ path = "lib.rs" [dependencies] arrayvec = { version = "0.7", default-features = false } -askama = { version = "0.11", default-features = false, features = ["config"] } +askama = { version = "0.12", default-features = false, features = ["config"] } itertools = "0.10.1" minifier = "0.2.2" once_cell = "1.10.0" diff --git a/src/librustdoc/askama.toml b/src/librustdoc/askama.toml index 0c984f637ba29..2732c4bc61ef6 100644 --- a/src/librustdoc/askama.toml +++ b/src/librustdoc/askama.toml @@ -1,2 +1,3 @@ [general] dirs = ["html/templates"] +whitespace = "suppress" diff --git a/src/librustdoc/html/templates/STYLE.md b/src/librustdoc/html/templates/STYLE.md index fff65e3b5ff24..72c516c93eb7f 100644 --- a/src/librustdoc/html/templates/STYLE.md +++ b/src/librustdoc/html/templates/STYLE.md @@ -10,28 +10,29 @@ similar to [Jinja2](jinjadoc) and [Django](djangodoc) templates, and also to [As We want our rendered output to have as little unnecessary whitespace as possible, so that pages load quickly. To achieve that we use Tera's -[whitespace control] features. At the end of most lines, we put an empty comment -tag with the whitespace control characters: `{#- -#}`. This causes all -whitespace between the end of the line and the beginning of the next, including -indentation, to be omitted on render. Sometimes we want to preserve a single -space. In those cases we put the space at the end of the line, followed by -`{# -#}`, which is a directive to remove following whitespace but not preceding. -We also use the whitespace control characters in most instances of tags with -control flow, for example `{%- if foo -%}`. +[whitespace control] features. By default, whitespace characters are removed +around jinja tags (`{% %}` for example). At the end of most lines, we put an +empty comment tag: `{# #}`. This causes all whitespace between the end of the +line and the beginning of the next, including indentation, to be omitted on +render. Sometimes we want to preserve a single space. In those cases we put the +space at the end of the line, followed by `{#+ #}`, which is a directive to +remove following whitespace but not preceding. We also use the whitespace +control characters in most instances of tags with control flow, for example +`{% if foo %}`. [whitespace control]: https://tera.netlify.app/docs/#whitespace-control We want our templates to be readable, so we use indentation and newlines -liberally. We indent by four spaces after opening an HTML tag _or_ a Tera +liberally. We indent by four spaces after opening an HTML tag _or_ a Jinja tag. In most cases an HTML tag should be followed by a newline, but if the tag has simple contents and fits with its close tag on a single line, the contents don't necessarily need a new line. -Tera templates support quite sophisticated control flow. To keep our templates +Askama templates support quite sophisticated control flow. To keep our templates simple and understandable, we use only a subset: `if` and `for`. In particular -we avoid [assignments in the template logic](assignments) and [Tera +we avoid [assignments in the template logic](assignments) and [Askama macros](macros). This also may make things easier if we switch to a different Jinja-style template system, like Askama, in the future. -[assignments]: https://tera.netlify.app/docs/#assignments -[macros]: https://tera.netlify.app/docs/#macros +[assignments]: https://djc.github.io/askama/template_syntax.html#assignments +[macros]: https://djc.github.io/askama/template_syntax.html#macros diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html index 7690d8f251f74..e896850fab6bd 100644 --- a/src/librustdoc/html/templates/page.html +++ b/src/librustdoc/html/templates/page.html @@ -1,148 +1,148 @@ - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {{page.title}} {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {#- -#} - {%- for theme in themes -%} - {#- -#} - {%- endfor -%} - {%- if !layout.default_settings.is_empty() -%} - {#- -#} - {%- endif -%} - {#- -#} - {%- if page.css_class.contains("crate") -%} - {#- -#} - {%- else if page.css_class == "source" -%} - {#- -#} - {#- -#} - {%- else if !page.css_class.contains("mod") -%} - {#- -#} - {%- endif -%} - {#- -#} - {%- if layout.scrape_examples_extension -%} - {#- -#} - {%- endif -%} - {#- -#} - {%- if layout.css_file_extension.is_some() -%} - {#- -#} - {%- endif -%} - {%- if !layout.favicon.is_empty() -%} - {#- -#} - {%- else -%} - {#- -#} - {#- -#} - {#- -#} - {%- endif -%} - {{- layout.external_html.in_header|safe -}} - {#- -#} - {#- -#} - {#- -#} - {{- layout.external_html.before_content|safe -}} - {%- if page.css_class != "source" -%} - {#- -#} - {%- endif -%} - {#- -#} -
{#- -#} - {%- if page.css_class != "source" -%}
{%- endif -%} - {#- -#} -
{{- content|safe -}}
{#- -#} - {%- if page.css_class != "source" -%}
{%- endif -%} -
{#- -#} - {{- layout.external_html.after_content|safe -}} -
{#- -#} -
{#- -#} - {#- -#} - {#- -#} + {% endfor %} + > {# #} + {% endif %} + {# #} + {% if page.css_class.contains("crate") %} + {# #} + {% else if page.css_class == "source" %} + {# #} + {# #} + {% else if !page.css_class.contains("mod") %} + {# #} + {% endif %} + {# #} + {% if layout.scrape_examples_extension %} + {# #} + {% endif %} + {# #} + {% if layout.css_file_extension.is_some() %} + {# #} + {% endif %} + {% if !layout.favicon.is_empty() %} + {# #} + {% else %} + {# #} + {# #} + {# #} + {% endif %} + {{ layout.external_html.in_header|safe }} + {# #} + {# #} + {# #} + {{ layout.external_html.before_content|safe }} + {% if page.css_class != "source" %} + {# #} + {% endif %} + {# #} +
{# #} + {% if page.css_class != "source" %}
{% endif %} + {# #} +
{{ content|safe }}
{# #} + {% if page.css_class != "source" %}
{% endif %} +
{# #} + {{ layout.external_html.after_content|safe }} +
{# #} +
{# #} + {# #} + {# #} diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index 3a1867b7feba3..edabac9a08231 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -1,28 +1,28 @@ -
{#- -#} -

{#- -#} - {{-typ-}} - {#- The breadcrumbs of the item path, like std::string -#} - {%- for component in path_components -%} - {{component.name}}:: - {%- endfor -%} - {{name}} {#- -#} - {#- -#} -

{#- -#} - {#- -#} +
{# #} +

{# #} + {{typ}} + {# The breadcrumbs of the item path, like std::string #} + {% for component in path_components %} + {{component.name}}:: + {% endfor %} + {{name}} {# #} + {# #} +

{# #} + {# #} {% if !stability_since_raw.is_empty() %} - {{- stability_since_raw|safe }} · {# -#} + {{ stability_since_raw|safe +}} · {#+ #} {% endif %} - {%- match src_href -%} - {%- when Some with (href) -%} - source · {# -#} - {%- else -%} - {%- endmatch -%} - {#- -#} - {#- -#} -
{#- -#} + {% match src_href %} + {% when Some with (href) %} + source · {#+ #} + {% else %} + {% endmatch %} + {# #} +
{# #} +
{# #} diff --git a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir new file mode 100644 index 0000000000000..d0b770783c1f1 --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `float_to_int` after built + +fn float_to_int(_1: f32) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:31 + + bb0: { + _0 = _1 as i32 (FloatToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir new file mode 100644 index 0000000000000..aaebff0d7673d --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `int_to_int` after built + +fn int_to_int(_1: u32) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:26: +0:29 + + bb0: { + _0 = _1 as i32 (IntToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir new file mode 100644 index 0000000000000..f040cf53df4a8 --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `int_to_ptr` after built + +fn int_to_ptr(_1: usize) -> *const i32 { + let mut _0: *const i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:38 + + bb0: { + _0 = _1 as *const i32 (PointerFromExposedAddress); // scope 0 at $DIR/as_cast.rs:+3:13: +3:34 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs new file mode 100644 index 0000000000000..b4b5ac6aa3b1e --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.rs @@ -0,0 +1,43 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR as_cast.int_to_int.built.after.mir +#[custom_mir(dialect = "built")] +fn int_to_int(x: u32) -> i32 { + mir!( + { + RET = x as i32; + Return() + } + ) +} + +// EMIT_MIR as_cast.float_to_int.built.after.mir +#[custom_mir(dialect = "built")] +fn float_to_int(x: f32) -> i32 { + mir!( + { + RET = x as i32; + Return() + } + ) +} + +// EMIT_MIR as_cast.int_to_ptr.built.after.mir +#[custom_mir(dialect = "built")] +fn int_to_ptr(x: usize) -> *const i32 { + mir!( + { + RET = x as *const i32; + Return() + } + ) +} + +fn main() { + assert_eq!(int_to_int(5), 5); + assert_eq!(float_to_int(5.), 5); + assert_eq!(int_to_ptr(0), std::ptr::null()); +} diff --git a/tests/run-make/translation/Makefile b/tests/run-make/translation/Makefile index 5b0b331ca468c..397fc542909ac 100644 --- a/tests/run-make/translation/Makefile +++ b/tests/run-make/translation/Makefile @@ -13,22 +13,22 @@ all: normal custom missing broken sysroot sysroot-invalid sysroot-missing # Check that the test works normally, using the built-in fallback bundle. normal: test.rs - $(RUSTC) $< 2>&1 | grep "struct literal body without path" + $(RUSTC) $< 2>&1 | $(CGREP) "struct literal body without path" # Check that a primary bundle can be loaded and will be preferentially used # where possible. custom: test.rs working.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/working.ftl 2>&1 | grep "this is a test message" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/working.ftl 2>&1 | $(CGREP) "this is a test message" # Check that a primary bundle with a broken message (e.g. a interpolated # variable is missing) will use the fallback bundle. missing: test.rs missing.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | grep "struct literal body without path" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | $(CGREP) "struct literal body without path" # Check that a primary bundle without the desired message will use the fallback # bundle. broken: test.rs broken.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/broken.ftl 2>&1 | grep "struct literal body without path" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/broken.ftl 2>&1 | $(CGREP) "struct literal body without path" # Check that a locale can be loaded from the sysroot given a language # identifier by making a local copy of the sysroot and adding the custom locale @@ -48,13 +48,13 @@ sysroot: test.rs working.ftl ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src mkdir -p $(FAKEROOT)/share/locale/zh-CN/ ln -s $(CURDIR)/working.ftl $(FAKEROOT)/share/locale/zh-CN/basic-translation.ftl - $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | grep "this is a test message" + $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | $(CGREP) "this is a test message" # Check that the compiler errors out when the sysroot requested cannot be # found. This test might start failing if there actually exists a Klingon # translation of rustc's error messages. -sysroot-missing: - $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 | grep "missing locale directory" +sysroot-missing: + $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 | $(CGREP) "missing locale directory" # Check that the compiler errors out when the directory for the locale in the # sysroot is actually a file. @@ -73,4 +73,4 @@ sysroot-invalid: test.rs working.ftl ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src mkdir -p $(FAKEROOT)/share/locale touch $(FAKEROOT)/share/locale/zh-CN - $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | grep "`\$sysroot/share/locales/\$locale` is not a directory" + $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | $(CGREP) "`\$sysroot/share/locales/\$locale` is not a directory" diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs new file mode 100644 index 0000000000000..efcb8b8ebab0a --- /dev/null +++ b/tests/ui/async-await/issue-108572.rs @@ -0,0 +1,12 @@ +// edition: 2021 + +use std::future::Future; +fn foo() -> impl Future { + async { } +} + +fn main() { + let fut = foo(); + fut.poll(); + //~^ ERROR no method named `poll` found for opaque type `impl Future` in the current scope [E0599] +} diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr new file mode 100644 index 0000000000000..0dbcf4d660a98 --- /dev/null +++ b/tests/ui/async-await/issue-108572.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `poll` found for opaque type `impl Future` in the current scope + --> $DIR/issue-108572.rs:10:9 + | +LL | fut.poll(); + | ^^^^ method not found in `impl Future` + | + = help: method `poll` found on `Pin<&mut impl Future>`, see documentation for `std::pin::Pin` + = help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`.