Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1a521db

Browse files
committed
Auto merge of #108863 - JohnTitor:rollup-haydnsw, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #108619 (Remove the option to disable `llvm-version-check`) - #108728 (infer: fix and improve comments) - #108731 (feat: impl better help for `.poll()` not found on `impl Future`) - #108774 (Greatly improve the error messages when `run-make/translation` fails) - #108805 (Update askama to 0.12 and improve whitespace control) - #108823 (Add tracking issue for cf-protection to unstable book) - #108855 (Custom MIR: Support `as` casts) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 160c2eb + fddd861 commit 1a521db

File tree

22 files changed

+386
-262
lines changed

22 files changed

+386
-262
lines changed

‎Cargo.lock‎

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -132,47 +132,36 @@ checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7"
132132

133133
[[package]]
134134
name = "askama"
135-
version = "0.11.0"
135+
version = "0.12.0"
136136
source = "registry+https://github.com/rust-lang/crates.io-index"
137-
checksum = "4d8f355701c672c2ba3d718acbd213f740beea577cc4eae66accdffe15be1882"
137+
checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e"
138138
dependencies = [
139139
"askama_derive",
140140
"askama_escape",
141-
"askama_shared",
142141
]
143142

144143
[[package]]
145144
name = "askama_derive"
146-
version = "0.11.0"
147-
source = "registry+https://github.com/rust-lang/crates.io-index"
148-
checksum = "84704cab5b7ae0fd3a9f78ee5eb7b27f3749df445f04623db6633459ae283267"
149-
dependencies = [
150-
"askama_shared",
151-
"proc-macro2",
152-
"syn",
153-
]
154-
155-
[[package]]
156-
name = "askama_escape"
157-
version = "0.10.2"
158-
source = "registry+https://github.com/rust-lang/crates.io-index"
159-
checksum = "9a1bb320f97e6edf9f756bf015900038e43c7700e059688e5724a928c8f3b8d5"
160-
161-
[[package]]
162-
name = "askama_shared"
163145
version = "0.12.0"
164146
source = "registry+https://github.com/rust-lang/crates.io-index"
165-
checksum = "dae03eebba55a2697a376e58b573a29fe36893157173ac8df312ad85f3c0e012"
147+
checksum = "e80b5ad1afe82872b7aa3e9de9b206ecb85584aa324f0f60fa4c903ce935936b"
166148
dependencies = [
167-
"askama_escape",
149+
"basic-toml",
150+
"mime",
151+
"mime_guess",
168152
"nom",
169153
"proc-macro2",
170154
"quote",
171155
"serde",
172156
"syn",
173-
"toml 0.5.7",
174157
]
175158

159+
[[package]]
160+
name = "askama_escape"
161+
version = "0.10.3"
162+
source = "registry+https://github.com/rust-lang/crates.io-index"
163+
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
164+
176165
[[package]]
177166
name = "atty"
178167
version = "0.2.14"
@@ -223,6 +212,15 @@ version = "1.5.3"
223212
source = "registry+https://github.com/rust-lang/crates.io-index"
224213
checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf"
225214

215+
[[package]]
216+
name = "basic-toml"
217+
version = "0.1.2"
218+
source = "registry+https://github.com/rust-lang/crates.io-index"
219+
checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1"
220+
dependencies = [
221+
"serde",
222+
]
223+
226224
[[package]]
227225
name = "bitflags"
228226
version = "1.3.2"
@@ -2614,6 +2612,22 @@ dependencies = [
26142612
"autocfg",
26152613
]
26162614

2615+
[[package]]
2616+
name = "mime"
2617+
version = "0.3.16"
2618+
source = "registry+https://github.com/rust-lang/crates.io-index"
2619+
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
2620+
2621+
[[package]]
2622+
name = "mime_guess"
2623+
version = "2.0.4"
2624+
source = "registry+https://github.com/rust-lang/crates.io-index"
2625+
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
2626+
dependencies = [
2627+
"mime",
2628+
"unicase",
2629+
]
2630+
26172631
[[package]]
26182632
name = "minifier"
26192633
version = "0.2.2"

‎compiler/rustc_hir_typeck/src/method/suggest.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
348348
err.downgrade_to_delayed_bug();
349349
}
350350

351+
if tcx.ty_is_opaque_future(rcvr_ty) && item_name.name == sym::poll {
352+
err.help(&format!(
353+
"method `poll` found on `Pin<&mut {ty_str}>`, \
354+
see documentation for `std::pin::Pin`"
355+
));
356+
err.help("self type must be pinned to call `Future::poll`, \
357+
see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice"
358+
);
359+
}
360+
351361
if let Mode::MethodCall = mode && let SelfSource::MethodCall(cal) = source {
352362
self.suggest_await_before_method(
353363
&mut err, item_name, rcvr_ty, cal, span, expected.only_has_type(self),

‎compiler/rustc_infer/src/infer/mod.rs‎

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,26 @@ pub struct InferCtxtInner<'tcx> {
114114
float_unification_storage: ut::UnificationTableStorage<ty::FloatVid>,
115115

116116
/// Tracks the set of region variables and the constraints between them.
117+
///
117118
/// This is initially `Some(_)` but when
118119
/// `resolve_regions_and_report_errors` is invoked, this gets set to `None`
119120
/// -- further attempts to perform unification, etc., may fail if new
120121
/// region constraints would've been added.
121122
region_constraint_storage: Option<RegionConstraintStorage<'tcx>>,
122123

123-
/// A set of constraints that regionck must validate. Each
124-
/// constraint has the form `T:'a`, meaning "some type `T` must
124+
/// A set of constraints that regionck must validate.
125+
///
126+
/// Each constraint has the form `T:'a`, meaning "some type `T` must
125127
/// outlive the lifetime 'a". These constraints derive from
126128
/// instantiated type parameters. So if you had a struct defined
127-
/// like
129+
/// like the following:
128130
/// ```ignore (illustrative)
129-
/// struct Foo<T:'static> { ... }
131+
/// struct Foo<T:'static> { ... }
130132
/// ```
131-
/// then in some expression `let x = Foo { ... }` it will
133+
/// In some expression `let x = Foo { ... }`, it will
132134
/// instantiate the type parameter `T` with a fresh type `0ドル`. At
133135
/// the same time, it will record a region obligation of
134-
/// `0ドル:'static`. This will get checked later by regionck. (We
136+
/// `0ドル:'static`. This will get checked later by regionck. (We
135137
/// can't generally check these things right away because we have
136138
/// to wait until types are resolved.)
137139
///
@@ -268,7 +270,7 @@ pub struct InferCtxt<'tcx> {
268270
/// Caches the results of trait evaluation.
269271
pub evaluation_cache: select::EvaluationCache<'tcx>,
270272

271-
/// the set of predicates on which errors have been reported, to
273+
/// The set of predicates on which errors have been reported, to
272274
/// avoid reporting the same error twice.
273275
pub reported_trait_errors: RefCell<FxIndexMap<Span, Vec<ty::Predicate<'tcx>>>>,
274276

@@ -291,7 +293,7 @@ pub struct InferCtxt<'tcx> {
291293
tainted_by_errors: Cell<Option<ErrorGuaranteed>>,
292294

293295
/// Track how many errors were reported when this infcx is created.
294-
/// If the number of errors increases, that's also a sign (line
296+
/// If the number of errors increases, that's also a sign (like
295297
/// `tainted_by_errors`) to avoid reporting certain kinds of errors.
296298
// FIXME(matthewjasper) Merge into `tainted_by_errors`
297299
err_count_on_creation: usize,
@@ -313,7 +315,7 @@ pub struct InferCtxt<'tcx> {
313315
/// During coherence we have to assume that other crates may add
314316
/// additional impls which we currently don't know about.
315317
///
316-
/// To deal with this evaluation should be conservative
318+
/// To deal with this evaluation, we should be conservative
317319
/// and consider the possibility of impls from outside this crate.
318320
/// This comes up primarily when resolving ambiguity. Imagine
319321
/// there is some trait reference `0ドル: Bar` where `0ドル` is an
@@ -323,7 +325,7 @@ pub struct InferCtxt<'tcx> {
323325
/// bound to some type that in a downstream crate that implements
324326
/// `Bar`.
325327
///
326-
/// Outside of coherence we set this to false because we are only
328+
/// Outside of coherence, we set this to false because we are only
327329
/// interested in types that the user could actually have written.
328330
/// In other words, we consider `0ドル: Bar` to be unimplemented if
329331
/// there is no type that the user could *actually name* that
@@ -373,7 +375,7 @@ pub enum SubregionOrigin<'tcx> {
373375
Subtype(Box<TypeTrace<'tcx>>),
374376

375377
/// When casting `&'a T` to an `&'b Trait` object,
376-
/// relating `'a` to `'b`
378+
/// relating `'a` to `'b`.
377379
RelateObjectBound(Span),
378380

379381
/// Some type parameter was instantiated with the given type,
@@ -384,7 +386,7 @@ pub enum SubregionOrigin<'tcx> {
384386
/// that must outlive some other region.
385387
RelateRegionParamBound(Span),
386388

387-
/// Creating a pointer `b` to contents of another reference
389+
/// Creating a pointer `b` to contents of another reference.
388390
Reborrow(Span),
389391

390392
/// (&'a &'b T) where a >= b
@@ -398,7 +400,7 @@ pub enum SubregionOrigin<'tcx> {
398400
trait_item_def_id: DefId,
399401
},
400402

401-
/// Checking that the bounds of a trait's associated type hold for a given impl
403+
/// Checking that the bounds of a trait's associated type hold for a given impl.
402404
CheckAssociatedTypeBounds {
403405
parent: Box<SubregionOrigin<'tcx>>,
404406
impl_item_def_id: LocalDefId,
@@ -435,32 +437,33 @@ pub enum LateBoundRegionConversionTime {
435437
AssocTypeProjection(DefId),
436438
}
437439

438-
/// Reasons to create a region inference variable
440+
/// Reasons to create a region inference variable.
439441
///
440-
/// See `error_reporting` module for more details
442+
/// See `error_reporting` module for more details.
441443
#[derive(Copy, Clone, Debug)]
442444
pub enum RegionVariableOrigin {
443-
/// Region variables created for ill-categorized reasons,
444-
/// mostly indicates places in need of refactoring
445+
/// Region variables created for ill-categorized reasons.
446+
///
447+
/// They mostly indicate places in need of refactoring.
445448
MiscVariable(Span),
446449

447-
/// Regions created by a `&P` or `[...]` pattern
450+
/// Regions created by a `&P` or `[...]` pattern.
448451
PatternRegion(Span),
449452

450-
/// Regions created by `&` operator
453+
/// Regions created by `&` operator.
454+
///
451455
AddrOfRegion(Span),
452-
453-
/// Regions created as part of an autoref of a method receiver
456+
/// Regions created as part of an autoref of a method receiver.
454457
Autoref(Span),
455458

456-
/// Regions created as part of an automatic coercion
459+
/// Regions created as part of an automatic coercion.
457460
Coercion(Span),
458461

459-
/// Region variables created as the values for early-bound regions
462+
/// Region variables created as the values for early-bound regions.
460463
EarlyBoundRegion(Span, Symbol),
461464

462465
/// Region variables created for bound regions
463-
/// in a function or method that is called
466+
/// in a function or method that is called.
464467
LateBoundRegion(Span, ty::BoundRegionKind, LateBoundRegionConversionTime),
465468

466469
UpvarRegion(ty::UpvarId, Span),
@@ -534,7 +537,7 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
534537
}
535538
}
536539

537-
/// Used to configure inference contexts before their creation
540+
/// Used to configure inference contexts before their creation.
538541
pub struct InferCtxtBuilder<'tcx> {
539542
tcx: TyCtxt<'tcx>,
540543
defining_use_anchor: DefiningAnchor,
@@ -835,9 +838,9 @@ impl<'tcx> InferCtxt<'tcx> {
835838

836839
/// Scan the constraints produced since `snapshot` began and returns:
837840
///
838-
/// - `None` -- if none of them involve "region outlives" constraints
839-
/// - `Some(true)` -- if there are `'a: 'b` constraints where `'a` or `'b` is a placeholder
840-
/// - `Some(false)` -- if there are `'a: 'b` constraints but none involve placeholders
841+
/// - `None` -- if none of them involves "region outlives" constraints.
842+
/// - `Some(true)` -- if there are `'a: 'b` constraints where `'a` or `'b` is a placeholder.
843+
/// - `Some(false)` -- if there are `'a: 'b` constraints but none involve placeholders.
841844
pub fn region_constraints_added_in_snapshot(
842845
&self,
843846
snapshot: &CombinedSnapshot<'tcx>,
@@ -1770,7 +1773,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
17701773
}
17711774
}
17721775

1773-
/// Helper for `ty_or_const_infer_var_changed` (see comment on that), currently
1776+
/// Helper for [InferCtxt::ty_or_const_infer_var_changed] (see comment on that), currently
17741777
/// used only for `traits::fulfill`'s list of `stalled_on` inference variables.
17751778
#[derive(Copy, Clone, Debug)]
17761779
pub enum TyOrConstInferVar<'tcx> {

‎compiler/rustc_mir_build/src/build/custom/parse/instruction.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_middle::mir::interpret::{ConstValue, Scalar};
22
use rustc_middle::mir::tcx::PlaceTy;
3+
use rustc_middle::ty::cast::mir_cast_kind;
34
use rustc_middle::{mir::*, thir::*, ty};
45
use rustc_span::Span;
56
use rustc_target::abi::VariantIdx;
@@ -142,7 +143,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
142143
}
143144

144145
fn parse_rvalue(&self, expr_id: ExprId) -> PResult<Rvalue<'tcx>> {
145-
parse_by_kind!(self, expr_id, _, "rvalue",
146+
parse_by_kind!(self, expr_id, expr, "rvalue",
146147
@call("mir_discriminant", args) => self.parse_place(args[0]).map(Rvalue::Discriminant),
147148
@call("mir_checked", args) => {
148149
parse_by_kind!(self, args[0], _, "binary op",
@@ -167,6 +168,12 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
167168
ExprKind::Repeat { value, count } => Ok(
168169
Rvalue::Repeat(self.parse_operand(*value)?, *count)
169170
),
171+
ExprKind::Cast { source } => {
172+
let source = self.parse_operand(*source)?;
173+
let source_ty = source.ty(self.body.local_decls(), self.tcx);
174+
let cast_kind = mir_cast_kind(source_ty, expr.ty);
175+
Ok(Rvalue::Cast(cast_kind, source, expr.ty))
176+
},
170177
_ => self.parse_operand(expr_id).map(Rvalue::Use),
171178
)
172179
}

‎config.toml.example‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ changelog-seen = 2
7575
# or alternatively ...
7676
#ccache = "/path/to/ccache"
7777

78-
# If an external LLVM root is specified, we automatically check the version by
79-
# default to make sure it's within the range that we're expecting, but setting
80-
# this flag will indicate that this version check should not be done.
81-
#version-check = true
82-
8378
# When true, link libstdc++ statically into the rustc_llvm.
8479
# This is useful if you don't want to use the dynamic version of that
8580
# library provided by LLVM.

‎src/bootstrap/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1616
- `remote-test-server`'s `verbose` argument has been removed in favor of the `--verbose` flag
1717
- `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.
1818
- `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)
19+
- 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)
1920

2021
### Non-breaking changes
2122

‎src/bootstrap/config.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ pub struct Config {
118118
pub llvm_optimize: bool,
119119
pub llvm_thin_lto: bool,
120120
pub llvm_release_debuginfo: bool,
121-
pub llvm_version_check: bool,
122121
pub llvm_static_stdcpp: bool,
123122
/// `None` if `llvm_from_ci` is true and we haven't yet downloaded llvm.
124123
#[cfg(not(test))]
@@ -672,7 +671,6 @@ define_config! {
672671
tests: Option<bool> = "tests",
673672
plugins: Option<bool> = "plugins",
674673
ccache: Option<StringOrBool> = "ccache",
675-
version_check: Option<bool> = "version-check",
676674
static_libstdcpp: Option<bool> = "static-libstdcpp",
677675
ninja: Option<bool> = "ninja",
678676
targets: Option<String> = "targets",
@@ -804,7 +802,6 @@ impl Config {
804802
let mut config = Config::default();
805803
config.llvm_optimize = true;
806804
config.ninja_in_file = true;
807-
config.llvm_version_check = true;
808805
config.llvm_static_stdcpp = false;
809806
config.backtrace = true;
810807
config.rust_optimize = true;
@@ -1166,7 +1163,6 @@ impl Config {
11661163
set(&mut config.llvm_optimize, llvm.optimize);
11671164
set(&mut config.llvm_thin_lto, llvm.thin_lto);
11681165
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
1169-
set(&mut config.llvm_version_check, llvm.version_check);
11701166
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
11711167
if let Some(v) = llvm.link_shared {
11721168
config.llvm_link_shared.set(Some(v));

‎src/bootstrap/configure.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def v(*args):
4444
o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ for LLVM")
4545
o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)")
4646
o("rpath", "rust.rpath", "build rpaths into rustc itself")
47-
o("llvm-version-check", "llvm.version-check", "check if the LLVM version is supported, build anyway")
4847
o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests")
4948
o("option-checking", None, "complain about unrecognized options in this configure script")
5049
o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)")

‎src/bootstrap/native.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,6 @@ impl Step for Llvm {
520520
}
521521

522522
fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
523-
if !builder.config.llvm_version_check {
524-
return;
525-
}
526-
527523
if builder.config.dry_run() {
528524
return;
529525
}

‎src/doc/unstable-book/src/compiler-flags/cf-protection.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# `cf-protection`
22

3+
The tracking issue for this feature is: [#93754](https://github.com/rust-lang/rust/issues/93754).
4+
5+
------------------------
6+
37
This option enables control-flow enforcement technology (CET) on x86; a more detailed description of
48
CET is available [here]. Similar to `clang`, this flag takes one of the following values:
59

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /