mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 20:28:33 +00:00
Auto merge of #113102 - matthiaskrgr:rollup-wpkbsw1, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #112518 (Detect actual span for getting unexpected token from parsing macros) - #112978 (Add suggestion for bad block fragment error) - #113068 (bootstrap: rename 'user' profile to 'dist') - #113079 (Use `CoverageKind::as_operand_id` instead of manually reimplementing it) - #113089 (Export AnalysisResults trait in rustc_mir_dataflow) - #113093 (`thir`: Add `Become` expression kind) - #113096 (Remove unused struct and tweak format macro uses) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
5ea6668646
@ -77,13 +77,6 @@ pub struct ForbiddenLifetimeBound {
|
|||||||
pub spans: Vec<Span>,
|
pub spans: Vec<Span>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
|
||||||
#[diag(ast_passes_forbidden_non_lifetime_param)]
|
|
||||||
pub struct ForbiddenNonLifetimeParam {
|
|
||||||
#[primary_span]
|
|
||||||
pub spans: Vec<Span>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(ast_passes_fn_param_too_many)]
|
#[diag(ast_passes_fn_param_too_many)]
|
||||||
pub struct FnParamTooMany {
|
pub struct FnParamTooMany {
|
||||||
|
@ -139,7 +139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
tcx,
|
tcx,
|
||||||
generics,
|
generics,
|
||||||
diag,
|
diag,
|
||||||
&format!("{}", proj.self_ty()),
|
&proj.self_ty().to_string(),
|
||||||
&path,
|
&path,
|
||||||
None,
|
None,
|
||||||
matching_span,
|
matching_span,
|
||||||
@ -153,7 +153,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||||||
tcx,
|
tcx,
|
||||||
generics,
|
generics,
|
||||||
diag,
|
diag,
|
||||||
&format!("{}", proj.self_ty()),
|
&proj.self_ty().to_string(),
|
||||||
&path,
|
&path,
|
||||||
None,
|
None,
|
||||||
matching_span,
|
matching_span,
|
||||||
|
@ -410,6 +410,10 @@ pub enum ExprKind<'tcx> {
|
|||||||
Return {
|
Return {
|
||||||
value: Option<ExprId>,
|
value: Option<ExprId>,
|
||||||
},
|
},
|
||||||
|
/// A `become` expression.
|
||||||
|
Become {
|
||||||
|
value: ExprId,
|
||||||
|
},
|
||||||
/// An inline `const` block, e.g. `const {}`.
|
/// An inline `const` block, e.g. `const {}`.
|
||||||
ConstBlock {
|
ConstBlock {
|
||||||
did: DefId,
|
did: DefId,
|
||||||
|
@ -100,6 +100,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
|
|||||||
visitor.visit_expr(&visitor.thir()[value])
|
visitor.visit_expr(&visitor.thir()[value])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Become { value } => visitor.visit_expr(&visitor.thir()[value]),
|
||||||
ConstBlock { did: _, substs: _ } => {}
|
ConstBlock { did: _, substs: _ } => {}
|
||||||
Repeat { value, count: _ } => {
|
Repeat { value, count: _ } => {
|
||||||
visitor.visit_expr(&visitor.thir()[value]);
|
visitor.visit_expr(&visitor.thir()[value]);
|
||||||
|
@ -549,6 +549,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
| ExprKind::Break { .. }
|
| ExprKind::Break { .. }
|
||||||
| ExprKind::Continue { .. }
|
| ExprKind::Continue { .. }
|
||||||
| ExprKind::Return { .. }
|
| ExprKind::Return { .. }
|
||||||
|
| ExprKind::Become { .. }
|
||||||
| ExprKind::Literal { .. }
|
| ExprKind::Literal { .. }
|
||||||
| ExprKind::NamedConst { .. }
|
| ExprKind::NamedConst { .. }
|
||||||
| ExprKind::NonHirLiteral { .. }
|
| ExprKind::NonHirLiteral { .. }
|
||||||
|
@ -532,6 +532,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
| ExprKind::Break { .. }
|
| ExprKind::Break { .. }
|
||||||
| ExprKind::Continue { .. }
|
| ExprKind::Continue { .. }
|
||||||
| ExprKind::Return { .. }
|
| ExprKind::Return { .. }
|
||||||
|
| ExprKind::Become { .. }
|
||||||
| ExprKind::InlineAsm { .. }
|
| ExprKind::InlineAsm { .. }
|
||||||
| ExprKind::PlaceTypeAscription { .. }
|
| ExprKind::PlaceTypeAscription { .. }
|
||||||
| ExprKind::ValueTypeAscription { .. } => {
|
| ExprKind::ValueTypeAscription { .. } => {
|
||||||
|
@ -82,7 +82,8 @@ impl Category {
|
|||||||
| ExprKind::Block { .. }
|
| ExprKind::Block { .. }
|
||||||
| ExprKind::Break { .. }
|
| ExprKind::Break { .. }
|
||||||
| ExprKind::Continue { .. }
|
| ExprKind::Continue { .. }
|
||||||
| ExprKind::Return { .. } =>
|
| ExprKind::Return { .. }
|
||||||
|
| ExprKind::Become { .. } =>
|
||||||
// FIXME(#27840) these probably want their own
|
// FIXME(#27840) these probably want their own
|
||||||
// category, like "nonterminating"
|
// category, like "nonterminating"
|
||||||
{
|
{
|
||||||
|
@ -493,7 +493,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
block.unit()
|
block.unit()
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprKind::Continue { .. } | ExprKind::Break { .. } | ExprKind::Return { .. } => {
|
ExprKind::Continue { .. }
|
||||||
|
| ExprKind::Break { .. }
|
||||||
|
| ExprKind::Return { .. }
|
||||||
|
| ExprKind::Become { .. } => {
|
||||||
unpack!(block = this.stmt_expr(block, expr, None));
|
unpack!(block = this.stmt_expr(block, expr, None));
|
||||||
// No assign, as these have type `!`.
|
// No assign, as these have type `!`.
|
||||||
block.unit()
|
block.unit()
|
||||||
|
@ -99,6 +99,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
BreakableTarget::Return,
|
BreakableTarget::Return,
|
||||||
source_info,
|
source_info,
|
||||||
),
|
),
|
||||||
|
// FIXME(explicit_tail_calls): properly lower tail calls here
|
||||||
|
ExprKind::Become { value } => this.break_scope(
|
||||||
|
block,
|
||||||
|
Some(&this.thir[value]),
|
||||||
|
BreakableTarget::Return,
|
||||||
|
source_info,
|
||||||
|
),
|
||||||
_ => {
|
_ => {
|
||||||
assert!(
|
assert!(
|
||||||
statement_scope.is_some(),
|
statement_scope.is_some(),
|
||||||
|
@ -316,6 +316,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||||||
| ExprKind::Closure { .. }
|
| ExprKind::Closure { .. }
|
||||||
| ExprKind::Continue { .. }
|
| ExprKind::Continue { .. }
|
||||||
| ExprKind::Return { .. }
|
| ExprKind::Return { .. }
|
||||||
|
| ExprKind::Become { .. }
|
||||||
| ExprKind::Yield { .. }
|
| ExprKind::Yield { .. }
|
||||||
| ExprKind::Loop { .. }
|
| ExprKind::Loop { .. }
|
||||||
| ExprKind::Let { .. }
|
| ExprKind::Let { .. }
|
||||||
|
@ -694,12 +694,8 @@ impl<'tcx> Cx<'tcx> {
|
|||||||
|
|
||||||
ExprKind::Repeat { value: self.mirror_expr(v), count: *count }
|
ExprKind::Repeat { value: self.mirror_expr(v), count: *count }
|
||||||
}
|
}
|
||||||
hir::ExprKind::Ret(ref v) => ExprKind::Return { value: v.map(|v| self.mirror_expr(v)) },
|
hir::ExprKind::Ret(v) => ExprKind::Return { value: v.map(|v| self.mirror_expr(v)) },
|
||||||
hir::ExprKind::Become(call) => {
|
hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
|
||||||
// FIXME(explicit_tail_calls): use `ExprKind::Become` once we implemented it
|
|
||||||
// Temporary transform `become` into a `return`, so we can write tests for code before this stage
|
|
||||||
ExprKind::Return { value: Some(self.mirror_expr(call)) }
|
|
||||||
}
|
|
||||||
hir::ExprKind::Break(dest, ref value) => match dest.target_id {
|
hir::ExprKind::Break(dest, ref value) => match dest.target_id {
|
||||||
Ok(target_id) => ExprKind::Break {
|
Ok(target_id) => ExprKind::Break {
|
||||||
label: region::Scope { id: target_id.local_id, data: region::ScopeData::Node },
|
label: region::Scope { id: target_id.local_id, data: region::ScopeData::Node },
|
||||||
|
@ -421,6 +421,12 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
|
|||||||
|
|
||||||
print_indented!(self, "}", depth_lvl);
|
print_indented!(self, "}", depth_lvl);
|
||||||
}
|
}
|
||||||
|
Become { value } => {
|
||||||
|
print_indented!(self, "Become {", depth_lvl);
|
||||||
|
print_indented!(self, "value:", depth_lvl + 1);
|
||||||
|
self.print_expr(*value, depth_lvl + 2);
|
||||||
|
print_indented!(self, "}", depth_lvl);
|
||||||
|
}
|
||||||
ConstBlock { did, substs } => {
|
ConstBlock { did, substs } => {
|
||||||
print_indented!(self, "ConstBlock {", depth_lvl);
|
print_indented!(self, "ConstBlock {", depth_lvl);
|
||||||
print_indented!(self, format!("did: {:?}", did), depth_lvl + 1);
|
print_indented!(self, format!("did: {:?}", did), depth_lvl + 1);
|
||||||
|
@ -45,7 +45,7 @@ pub mod graphviz;
|
|||||||
pub mod lattice;
|
pub mod lattice;
|
||||||
mod visitor;
|
mod visitor;
|
||||||
|
|
||||||
pub use self::cursor::{ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
|
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
|
||||||
pub use self::direction::{Backward, Direction, Forward};
|
pub use self::direction::{Backward, Direction, Forward};
|
||||||
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
|
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
|
||||||
pub use self::lattice::{JoinSemiLattice, MeetSemiLattice};
|
pub use self::lattice::{JoinSemiLattice, MeetSemiLattice};
|
||||||
|
@ -27,10 +27,10 @@ pub use self::drop_flag_effects::{
|
|||||||
on_lookup_result_bits,
|
on_lookup_result_bits,
|
||||||
};
|
};
|
||||||
pub use self::framework::{
|
pub use self::framework::{
|
||||||
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, CallReturnPlaces,
|
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, AnalysisResults, Backward,
|
||||||
CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
|
CallReturnPlaces, CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis,
|
||||||
ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor, ResultsVisitable,
|
JoinSemiLattice, Results, ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor,
|
||||||
ResultsVisitor, SwitchIntEdgeEffects,
|
ResultsVisitable, ResultsVisitor, SwitchIntEdgeEffects,
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::move_paths::MoveData;
|
use self::move_paths::MoveData;
|
||||||
|
@ -277,14 +277,7 @@ impl DebugCounters {
|
|||||||
|
|
||||||
pub fn add_counter(&mut self, counter_kind: &CoverageKind, some_block_label: Option<String>) {
|
pub fn add_counter(&mut self, counter_kind: &CoverageKind, some_block_label: Option<String>) {
|
||||||
if let Some(counters) = &mut self.some_counters {
|
if let Some(counters) = &mut self.some_counters {
|
||||||
let id: ExpressionOperandId = match *counter_kind {
|
let id = counter_kind.as_operand_id();
|
||||||
CoverageKind::Counter { id, .. } => id.into(),
|
|
||||||
CoverageKind::Expression { id, .. } => id.into(),
|
|
||||||
_ => bug!(
|
|
||||||
"the given `CoverageKind` is not an counter or expression: {:?}",
|
|
||||||
counter_kind
|
|
||||||
),
|
|
||||||
};
|
|
||||||
counters
|
counters
|
||||||
.try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
|
.try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
|
||||||
.expect("attempt to add the same counter_kind to DebugCounters more than once");
|
.expect("attempt to add the same counter_kind to DebugCounters more than once");
|
||||||
@ -330,13 +323,7 @@ impl DebugCounters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let id: ExpressionOperandId = match *counter_kind {
|
let id = counter_kind.as_operand_id();
|
||||||
CoverageKind::Counter { id, .. } => id.into(),
|
|
||||||
CoverageKind::Expression { id, .. } => id.into(),
|
|
||||||
_ => {
|
|
||||||
bug!("the given `CoverageKind` is not an counter or expression: {:?}", counter_kind)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
|
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
|
||||||
let counters = self.some_counters.as_ref().unwrap();
|
let counters = self.some_counters.as_ref().unwrap();
|
||||||
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
|
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
|
||||||
|
@ -353,6 +353,7 @@ parse_int_literal_too_large = integer literal is too large
|
|||||||
|
|
||||||
parse_invalid_block_macro_segment = cannot use a `block` macro fragment here
|
parse_invalid_block_macro_segment = cannot use a `block` macro fragment here
|
||||||
.label = the `block` fragment is within this context
|
.label = the `block` fragment is within this context
|
||||||
|
.suggestion = wrap this in another block
|
||||||
|
|
||||||
parse_invalid_char_in_escape = {parse_invalid_char_in_escape_msg}: `{$ch}`
|
parse_invalid_char_in_escape = {parse_invalid_char_in_escape_msg}: `{$ch}`
|
||||||
.label = {parse_invalid_char_in_escape_msg}
|
.label = {parse_invalid_char_in_escape_msg}
|
||||||
|
@ -333,6 +333,17 @@ pub(crate) struct InvalidBlockMacroSegment {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
#[label]
|
#[label]
|
||||||
pub context: Span,
|
pub context: Span,
|
||||||
|
#[subdiagnostic]
|
||||||
|
pub wrap: WrapInExplicitBlock,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Subdiagnostic)]
|
||||||
|
#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
|
||||||
|
pub(crate) struct WrapInExplicitBlock {
|
||||||
|
#[suggestion_part(code = "{{ ")]
|
||||||
|
pub lo: Span,
|
||||||
|
#[suggestion_part(code = " }}")]
|
||||||
|
pub hi: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -1013,9 +1013,15 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn error_unexpected_after_dot(&self) {
|
fn error_unexpected_after_dot(&self) {
|
||||||
// FIXME Could factor this out into non_fatal_unexpected or something.
|
|
||||||
let actual = pprust::token_to_string(&self.token);
|
let actual = pprust::token_to_string(&self.token);
|
||||||
self.sess.emit_err(errors::UnexpectedTokenAfterDot { span: self.token.span, actual });
|
let span = self.token.span;
|
||||||
|
let sm = self.sess.source_map();
|
||||||
|
let (span, actual) = match (&self.token.kind, self.subparser_name) {
|
||||||
|
(token::Eof, Some(_)) if let Ok(actual) = sm.span_to_snippet(sm.next_point(span)) =>
|
||||||
|
(span.shrink_to_hi(), actual.into()),
|
||||||
|
_ => (span, actual),
|
||||||
|
};
|
||||||
|
self.sess.emit_err(errors::UnexpectedTokenAfterDot { span, actual });
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need an identifier or integer, but the next token is a float.
|
// We need an identifier or integer, but the next token is a float.
|
||||||
@ -2186,6 +2192,10 @@ impl<'a> Parser<'a> {
|
|||||||
self.sess.emit_err(errors::InvalidBlockMacroSegment {
|
self.sess.emit_err(errors::InvalidBlockMacroSegment {
|
||||||
span: self.token.span,
|
span: self.token.span,
|
||||||
context: lo.to(self.token.span),
|
context: lo.to(self.token.span),
|
||||||
|
wrap: errors::WrapInExplicitBlock {
|
||||||
|
lo: self.token.span.shrink_to_lo(),
|
||||||
|
hi: self.token.span.shrink_to_hi(),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,8 @@ fn recurse_build<'tcx>(
|
|||||||
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
|
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
|
||||||
error(GenericConstantTooComplexSub::AssignNotSupported(node.span))?
|
error(GenericConstantTooComplexSub::AssignNotSupported(node.span))?
|
||||||
}
|
}
|
||||||
ExprKind::Closure { .. } | ExprKind::Return { .. } => {
|
// FIXME(explicit_tail_calls): maybe get `become` a new error
|
||||||
|
ExprKind::Closure { .. } | ExprKind::Return { .. } | ExprKind::Become { .. } => {
|
||||||
error(GenericConstantTooComplexSub::ClosureAndReturnNotSupported(node.span))?
|
error(GenericConstantTooComplexSub::ClosureAndReturnNotSupported(node.span))?
|
||||||
}
|
}
|
||||||
// let expressions imply control flow
|
// let expressions imply control flow
|
||||||
@ -337,6 +338,7 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
|
|||||||
| thir::ExprKind::Break { .. }
|
| thir::ExprKind::Break { .. }
|
||||||
| thir::ExprKind::Continue { .. }
|
| thir::ExprKind::Continue { .. }
|
||||||
| thir::ExprKind::Return { .. }
|
| thir::ExprKind::Return { .. }
|
||||||
|
| thir::ExprKind::Become { .. }
|
||||||
| thir::ExprKind::Array { .. }
|
| thir::ExprKind::Array { .. }
|
||||||
| thir::ExprKind::Tuple { .. }
|
| thir::ExprKind::Tuple { .. }
|
||||||
| thir::ExprKind::Adt(_)
|
| thir::ExprKind::Adt(_)
|
||||||
|
@ -1052,7 +1052,13 @@ def bootstrap(args):
|
|||||||
|
|
||||||
profile = RustBuild.get_toml_static(config_toml, 'profile')
|
profile = RustBuild.get_toml_static(config_toml, 'profile')
|
||||||
if profile is not None:
|
if profile is not None:
|
||||||
include_file = 'config.{}.toml'.format(profile)
|
# Allows creating alias for profile names, allowing
|
||||||
|
# profiles to be renamed while maintaining back compatibility
|
||||||
|
# Keep in sync with `profile_aliases` in config.rs
|
||||||
|
profile_aliases = {
|
||||||
|
"user": "dist"
|
||||||
|
}
|
||||||
|
include_file = 'config.{}.toml'.format(profile_aliases.get(profile) or profile)
|
||||||
include_dir = os.path.join(rust_root, 'src', 'bootstrap', 'defaults')
|
include_dir = os.path.join(rust_root, 'src', 'bootstrap', 'defaults')
|
||||||
include_path = os.path.join(include_dir, include_file)
|
include_path = os.path.join(include_dir, include_file)
|
||||||
# HACK: This works because `self.get_toml()` returns the first match it finds for a
|
# HACK: This works because `self.get_toml()` returns the first match it finds for a
|
||||||
|
@ -98,7 +98,7 @@ class GenerateAndParseConfig(unittest.TestCase):
|
|||||||
def test_no_args(self):
|
def test_no_args(self):
|
||||||
build = serialize_and_parse([])
|
build = serialize_and_parse([])
|
||||||
self.assertEqual(build.get_toml("changelog-seen"), '2')
|
self.assertEqual(build.get_toml("changelog-seen"), '2')
|
||||||
self.assertEqual(build.get_toml("profile"), 'user')
|
self.assertEqual(build.get_toml("profile"), 'dist')
|
||||||
self.assertIsNone(build.get_toml("llvm.download-ci-llvm"))
|
self.assertIsNone(build.get_toml("llvm.download-ci-llvm"))
|
||||||
|
|
||||||
def test_set_section(self):
|
def test_set_section(self):
|
||||||
|
@ -1129,6 +1129,14 @@ impl Config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(include) = &toml.profile {
|
if let Some(include) = &toml.profile {
|
||||||
|
// Allows creating alias for profile names, allowing
|
||||||
|
// profiles to be renamed while maintaining back compatibility
|
||||||
|
// Keep in sync with `profile_aliases` in bootstrap.py
|
||||||
|
let profile_aliases = HashMap::from([("user", "dist")]);
|
||||||
|
let include = match profile_aliases.get(include.as_str()) {
|
||||||
|
Some(alias) => alias,
|
||||||
|
None => include.as_str(),
|
||||||
|
};
|
||||||
let mut include_path = config.src.clone();
|
let mut include_path = config.src.clone();
|
||||||
include_path.push("src");
|
include_path.push("src");
|
||||||
include_path.push("bootstrap");
|
include_path.push("bootstrap");
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
use crate::config::TomlConfig;
|
||||||
|
|
||||||
use super::{Config, Flags};
|
use super::{Config, Flags};
|
||||||
use clap::CommandFactory;
|
use clap::CommandFactory;
|
||||||
|
use serde::Deserialize;
|
||||||
use std::{env, path::Path};
|
use std::{env, path::Path};
|
||||||
|
|
||||||
fn parse(config: &str) -> Config {
|
fn parse(config: &str) -> Config {
|
||||||
@ -159,3 +162,19 @@ fn override_toml_duplicate() {
|
|||||||
|&_| toml::from_str("changelog-seen = 0").unwrap(),
|
|&_| toml::from_str("changelog-seen = 0").unwrap(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn profile_user_dist() {
|
||||||
|
fn get_toml(file: &Path) -> TomlConfig {
|
||||||
|
let contents = if file.ends_with("config.toml") {
|
||||||
|
"profile = \"user\"".to_owned()
|
||||||
|
} else {
|
||||||
|
assert!(file.ends_with("config.dist.toml"));
|
||||||
|
std::fs::read_to_string(dbg!(file)).unwrap()
|
||||||
|
};
|
||||||
|
toml::from_str(&contents)
|
||||||
|
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
Config::parse_inner(&["check".to_owned()], get_toml);
|
||||||
|
}
|
||||||
|
@ -437,7 +437,7 @@ def parse_example_config(known_args, config):
|
|||||||
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)
|
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)
|
||||||
|
|
||||||
if 'profile' not in config:
|
if 'profile' not in config:
|
||||||
set('profile', 'user', config)
|
set('profile', 'dist', config)
|
||||||
configure_file(sections, top_level_keys, targets, config)
|
configure_file(sections, top_level_keys, targets, config)
|
||||||
return section_order, sections, targets
|
return section_order, sections, targets
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ pub enum Profile {
|
|||||||
Codegen,
|
Codegen,
|
||||||
Library,
|
Library,
|
||||||
Tools,
|
Tools,
|
||||||
User,
|
Dist,
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ impl Profile {
|
|||||||
pub fn all() -> impl Iterator<Item = Self> {
|
pub fn all() -> impl Iterator<Item = Self> {
|
||||||
use Profile::*;
|
use Profile::*;
|
||||||
// N.B. these are ordered by how they are displayed, not alphabetically
|
// N.B. these are ordered by how they are displayed, not alphabetically
|
||||||
[Library, Compiler, Codegen, Tools, User, None].iter().copied()
|
[Library, Compiler, Codegen, Tools, Dist, None].iter().copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn purpose(&self) -> String {
|
pub fn purpose(&self) -> String {
|
||||||
@ -53,7 +53,7 @@ impl Profile {
|
|||||||
Compiler => "Contribute to the compiler itself",
|
Compiler => "Contribute to the compiler itself",
|
||||||
Codegen => "Contribute to the compiler, and also modify LLVM or codegen",
|
Codegen => "Contribute to the compiler, and also modify LLVM or codegen",
|
||||||
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
|
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
|
||||||
User => "Install Rust from source",
|
Dist => "Install Rust from source",
|
||||||
None => "Do not modify `config.toml`"
|
None => "Do not modify `config.toml`"
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
@ -73,7 +73,7 @@ impl Profile {
|
|||||||
Profile::Codegen => "codegen",
|
Profile::Codegen => "codegen",
|
||||||
Profile::Library => "library",
|
Profile::Library => "library",
|
||||||
Profile::Tools => "tools",
|
Profile::Tools => "tools",
|
||||||
Profile::User => "user",
|
Profile::Dist => "dist",
|
||||||
Profile::None => "none",
|
Profile::None => "none",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ impl FromStr for Profile {
|
|||||||
"lib" | "library" => Ok(Profile::Library),
|
"lib" | "library" => Ok(Profile::Library),
|
||||||
"compiler" => Ok(Profile::Compiler),
|
"compiler" => Ok(Profile::Compiler),
|
||||||
"llvm" | "codegen" => Ok(Profile::Codegen),
|
"llvm" | "codegen" => Ok(Profile::Codegen),
|
||||||
"maintainer" | "user" => Ok(Profile::User),
|
"maintainer" | "dist" | "user" => Ok(Profile::Dist),
|
||||||
"tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => {
|
"tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => {
|
||||||
Ok(Profile::Tools)
|
Ok(Profile::Tools)
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ pub fn setup(config: &Config, profile: Profile) {
|
|||||||
"test src/tools/rustfmt",
|
"test src/tools/rustfmt",
|
||||||
],
|
],
|
||||||
Profile::Library => &["check", "build", "test library/std", "doc"],
|
Profile::Library => &["check", "build", "test library/std", "doc"],
|
||||||
Profile::User => &["dist", "build"],
|
Profile::Dist => &["dist", "build"],
|
||||||
};
|
};
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
@ -170,7 +170,7 @@ pub fn setup(config: &Config, profile: Profile) {
|
|||||||
println!("- `x.py {}`", cmd);
|
println!("- `x.py {}`", cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if profile != Profile::User {
|
if profile != Profile::Dist {
|
||||||
println!(
|
println!(
|
||||||
"For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html"
|
"For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html"
|
||||||
);
|
);
|
||||||
|
@ -10,6 +10,10 @@ LL | m!({});
|
|||||||
| ------ in this macro invocation
|
| ------ in this macro invocation
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: wrap this in another block
|
||||||
|
|
|
||||||
|
LL | 'lab: { $b };
|
||||||
|
| + +
|
||||||
|
|
||||||
error: cannot use a `block` macro fragment here
|
error: cannot use a `block` macro fragment here
|
||||||
--> $DIR/bad-interpolated-block.rs:6:16
|
--> $DIR/bad-interpolated-block.rs:6:16
|
||||||
@ -23,6 +27,10 @@ LL | m!({});
|
|||||||
| ------ in this macro invocation
|
| ------ in this macro invocation
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: wrap this in another block
|
||||||
|
|
|
||||||
|
LL | unsafe { $b };
|
||||||
|
| + +
|
||||||
|
|
||||||
error: cannot use a `block` macro fragment here
|
error: cannot use a `block` macro fragment here
|
||||||
--> $DIR/bad-interpolated-block.rs:7:23
|
--> $DIR/bad-interpolated-block.rs:7:23
|
||||||
@ -34,6 +42,10 @@ LL | m!({});
|
|||||||
| ------ in this macro invocation
|
| ------ in this macro invocation
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: wrap this in another block
|
||||||
|
|
|
||||||
|
LL | |x: u8| -> () { $b };
|
||||||
|
| + +
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
4
tests/ui/parser/issues/issue-112458.rs
Normal file
4
tests/ui/parser/issues/issue-112458.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("{}", x.); //~ ERROR unexpected token: `)`
|
||||||
|
//~^ ERROR cannot find value `x` in this scope
|
||||||
|
}
|
15
tests/ui/parser/issues/issue-112458.stderr
Normal file
15
tests/ui/parser/issues/issue-112458.stderr
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
error: unexpected token: `)`
|
||||||
|
--> $DIR/issue-112458.rs:2:22
|
||||||
|
|
|
||||||
|
LL | println!("{}", x.);
|
||||||
|
| ^
|
||||||
|
|
||||||
|
error[E0425]: cannot find value `x` in this scope
|
||||||
|
--> $DIR/issue-112458.rs:2:20
|
||||||
|
|
|
||||||
|
LL | println!("{}", x.);
|
||||||
|
| ^ not found in this scope
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0425`.
|
@ -77,6 +77,10 @@ LL | m!({});
|
|||||||
| ------ in this macro invocation
|
| ------ in this macro invocation
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: wrap this in another block
|
||||||
|
|
|
||||||
|
LL | 'l5 { $b };
|
||||||
|
| + +
|
||||||
|
|
||||||
error: labeled expression must be followed by `:`
|
error: labeled expression must be followed by `:`
|
||||||
--> $DIR/labeled-no-colon-expr.rs:14:8
|
--> $DIR/labeled-no-colon-expr.rs:14:8
|
||||||
|
Loading…
Reference in New Issue
Block a user